老设备入库删除重复数据

This commit is contained in:
gongjiale 2024-12-04 10:57:08 +08:00
parent 9edb776849
commit c21fc355a6
4 changed files with 14 additions and 2 deletions

View File

@ -36,7 +36,7 @@ public class EquTask {
/**
* 港口原有设备对接
*/
@Scheduled(fixedRate = 3600)
@Scheduled(fixedRate = 3600000)
public void equ(){
String hash = "16EA8A305FB58BE0730DD67F04F022F4";
@ -56,7 +56,7 @@ public class EquTask {
map.put("sensorUId",e.getSn());
map.put("label",e.getName());
HttpResult result = OkHttps.sync("http://10.201.35.30:8090/enviSensor/select?" +
"page=1&pageSize=20&valid=0&type=5&sensorUId={sensorUId}&label={label}")
"page=1&pageSize=40&valid=0&type=5&sensorUId={sensorUId}&label={label}")
.addPathPara(map)
.addHeader("token", token)
.get();

View File

@ -26,4 +26,11 @@ public interface OutSideMapper {
* @param list
*/
void insertMonth(@Param("sensorMonthList") List<SensorMonth> list);
/**
* 删除相同数据
* @param sn
* @param reportTime
*/
void deleteSampleDevice(@Param("sn")String sn,@Param("reportTime") String reportTime);
}

View File

@ -86,6 +86,7 @@ public class OutSideServiceImpl implements OutSideService {
for (JsonNode node : rootNode) {
if (node.get("type").asInt()==5) {
SensorData sd = insertOldData(node);
outSideMapper.deleteSampleDevice(sd.getSn(),sd.getReportTime());
outSideMapper.insertDevice(sd);
}
}

View File

@ -64,4 +64,8 @@
</foreach>
SELECT * FROM dual
</insert>
<delete id="deleteSampleDevice">
delete from th_device_report where sn=#{sn} and report_time= TO_DATE(#{reportTime}, 'yyyy-mm-dd hh24:mi:ss')
</delete>
</mapper>