|
@@ -5,6 +5,7 @@ import cn.com.crbank.ommo.bean.ResultMessage;
|
|
|
import cn.com.crbank.ommo.esUtil.BeanUtils;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -44,7 +45,6 @@ import java.net.URL;
|
|
|
import java.net.URLConnection;
|
|
|
import java.nio.file.Files;
|
|
|
import java.nio.file.Paths;
|
|
|
-import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.LocalTime;
|
|
@@ -100,11 +100,9 @@ public class TEquipmentController {
|
|
|
@Autowired
|
|
|
TLabelService labelService;
|
|
|
|
|
|
-// TokenManager tokenManager;
|
|
|
-
|
|
|
-// private int j;
|
|
|
-
|
|
|
- // 超时时间为30秒
|
|
|
+ /**
|
|
|
+ * 超时时间为30秒
|
|
|
+ */
|
|
|
private static final int TIMEOUT = 30000;
|
|
|
|
|
|
@ApiOperation(value = "根据经纬度获取区域内设备信息")
|
|
@@ -248,13 +246,13 @@ public class TEquipmentController {
|
|
|
}).collect(Collectors.toList());
|
|
|
for (TEquipmentDTO equipmentDTO : equipmentDTOList) {
|
|
|
// Date date = new Date();
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- Date date = null;
|
|
|
- try {
|
|
|
- date = sdf.parse(todayDate);
|
|
|
- } catch (ParseException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
+// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+// Date date = null;
|
|
|
+// try {
|
|
|
+// date = sdf.parse(todayDate);
|
|
|
+// } catch (ParseException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
LocalDateTime dateTime = LocalDateTime.parse(todayDate + "T00:00:00");
|
|
|
// 获取前一天的0点时间
|
|
|
LocalDateTime startDateTime = dateTime.minusDays(1).with(LocalTime.MIN);
|
|
@@ -326,7 +324,6 @@ public class TEquipmentController {
|
|
|
public ResponseModel<?> findById(@RequestParam Long id) {
|
|
|
TEquipment equipment = tEquipmentService.getById(id);
|
|
|
TEquipmentDTO equipmentDTO = new TEquipmentDTO();
|
|
|
-// BeanUtils.copyProperties(equipment, equipmentDTO);
|
|
|
BeanUtils.copyPropertiesIgnoreNull(equipment, equipmentDTO, true);
|
|
|
TEquipmentDesc equipmentDesc = equipmentDescService.getById(id);
|
|
|
if (equipmentDesc != null) {
|
|
@@ -355,9 +352,6 @@ public class TEquipmentController {
|
|
|
if (i > 2) {
|
|
|
equipmentDTO.setMessageReceiver3(message[2]);
|
|
|
}
|
|
|
-// equipmentDTO.setMessageReceiver1(message[0]);
|
|
|
-// equipmentDTO.setMessageReceiver2(message[1]);
|
|
|
-// equipmentDTO.setMessageReceiver3(message[2]);
|
|
|
}
|
|
|
return R.ok(equipmentDTO);
|
|
|
}
|
|
@@ -444,21 +438,11 @@ public class TEquipmentController {
|
|
|
} else {
|
|
|
String equipmentIds = adminEquipment.getEquipmentIds();
|
|
|
String[] strings = equipmentIds.split(",");
|
|
|
-// List<String> equipmentIdList = JSON.parseArray(equipmentIds, String.class);
|
|
|
query.in(TEquipment::getId, strings);
|
|
|
}
|
|
|
}
|
|
|
-// query.eq(TEquipment::getAdminId,adminId);
|
|
|
List<TEquipment> list = tEquipmentService.list(query);
|
|
|
List<EquipmentVO> equipmentVOs = new ArrayList<>();
|
|
|
-// for (TEquipment equipment : list) {
|
|
|
-// EquipmentVO equipmentVO = new EquipmentVO();
|
|
|
-// equipmentVO.setId(equipment.getId());
|
|
|
-// String name = StringUtils.isEmpty(equipment.getName()) ? equipment.getClientId() : equipment.getName();
|
|
|
-// equipmentVO.setName(name);
|
|
|
-// equipmentVO.setClientId(equipment.getClientId());
|
|
|
-// equipmentVOS.add(equipmentVO);
|
|
|
-// }
|
|
|
Map<String, String> duplicateNames = new HashMap<>();
|
|
|
|
|
|
for (TEquipment equipment : list) {
|
|
@@ -594,9 +578,6 @@ public class TEquipmentController {
|
|
|
oldEquipment.setMessageReceiver(message[0] + "," + message[1] + "," + message[2]);
|
|
|
}
|
|
|
tEquipmentService.updateById(oldEquipment);
|
|
|
-// String channel = oldEquipment.getChannel();
|
|
|
-// String equimentType = oldEquipment.getEquimentType();
|
|
|
-// String clientId = oldEquipment.getClientId();
|
|
|
if (equipment.getPayType() != null) {
|
|
|
tEquipmentService.sentMessage(oldEquipment.getClientId(), PushUtils.buildJson("payType", oldEquipment.getPayType().toString() + ":" + oldEquipment.getTimeRuleId()).toString());
|
|
|
}
|
|
@@ -738,8 +719,15 @@ public class TEquipmentController {
|
|
|
}
|
|
|
String machineType = equipment.getMachineType();
|
|
|
if (StringUtils.isNotEmpty(machineType) && machineType.equals("2")) {
|
|
|
- tAlarmRecord.setIsEliminate(1);
|
|
|
- tAlarmRecordService.updateById(tAlarmRecord);
|
|
|
+// tAlarmRecord.setIsEliminate(1);
|
|
|
+// tAlarmRecordService.updateById(tAlarmRecord);
|
|
|
+ // 消除过往的报警
|
|
|
+ LambdaUpdateWrapper<TAlarmRecord> wrapper = Wrappers.lambdaUpdate();
|
|
|
+ wrapper.eq(TAlarmRecord::getClientId, tAlarmRecord.getClientId());
|
|
|
+ wrapper.eq(TAlarmRecord::getIsEliminate, 0);
|
|
|
+ wrapper.le(TAlarmRecord::getCreateDate, new Date());
|
|
|
+ wrapper.set(TAlarmRecord::getIsEliminate, 1);
|
|
|
+ tAlarmRecordService.update(wrapper);
|
|
|
} else {
|
|
|
JSONObject kindData = new JSONObject();
|
|
|
kindData.put("id", param.getId());
|
|
@@ -756,7 +744,6 @@ public class TEquipmentController {
|
|
|
if (!StringUtils.isEmpty(equipment.getVolume())) {
|
|
|
TEquipment tEquipment = tEquipmentService.getById(equipment.getId());
|
|
|
tEquipmentService.sentMessage(tEquipment.getClientId(), PushUtils.buildJson("volume", equipment.getVolume()).toString());
|
|
|
-// PushUtils.push(tEquipment.getGtClientId(), "", "", PushUtils.buildJson("volume", equipment.getVolume()).toString());
|
|
|
}
|
|
|
return ResponseEntity.status(HttpStatus.OK)
|
|
|
.body(new ResultMessage().setCode(true).setData(true).setMessage("修改成功"));
|