|
@@ -1019,7 +1019,6 @@ public class TEquipmentController {
|
|
TEquipment equipment = tEquipmentService.getById(id);
|
|
TEquipment equipment = tEquipmentService.getById(id);
|
|
String network = equipment.getNetwork();
|
|
String network = equipment.getNetwork();
|
|
Long nowTime2 = getNetworkTime();
|
|
Long nowTime2 = getNetworkTime();
|
|
-// Long nowTime2 = new Date().getTime();
|
|
|
|
if (network != null) {
|
|
if (network != null) {
|
|
Long old = Long.valueOf(network);
|
|
Long old = Long.valueOf(network);
|
|
if (nowTime2 == null) {
|
|
if (nowTime2 == null) {
|
|
@@ -1036,13 +1035,6 @@ public class TEquipmentController {
|
|
.setData("SUCCESS")
|
|
.setData("SUCCESS")
|
|
.setMessage("网络良好"));
|
|
.setMessage("网络良好"));
|
|
} else {
|
|
} else {
|
|
-// if(equipment.getEqeStatus()==0){
|
|
|
|
-// equipment.setEqeStatus(1);
|
|
|
|
-// tEquipmentService.updateById(equipment);
|
|
|
|
-// }else {
|
|
|
|
-// equipment.setEqeStatus(0);
|
|
|
|
-// tEquipmentService.updateById(equipment);
|
|
|
|
-// }
|
|
|
|
return ResponseEntity
|
|
return ResponseEntity
|
|
.status(HttpStatus.OK)
|
|
.status(HttpStatus.OK)
|
|
.body(new ResultMessage()
|
|
.body(new ResultMessage()
|
|
@@ -1084,9 +1076,6 @@ public class TEquipmentController {
|
|
String equipmentId = param.getEquipmentId();
|
|
String equipmentId = param.getEquipmentId();
|
|
Long id = Long.valueOf(equipmentId);
|
|
Long id = Long.valueOf(equipmentId);
|
|
TEquipment equipment = tEquipmentService.getById(id);
|
|
TEquipment equipment = tEquipmentService.getById(id);
|
|
-// if (equipment == null) {
|
|
|
|
-// return ERROR_MESSAGE;
|
|
|
|
-// }
|
|
|
|
String eqeStatus = "0";
|
|
String eqeStatus = "0";
|
|
String code = param.getEqeStatus();
|
|
String code = param.getEqeStatus();
|
|
if (code.equals("1")) {
|
|
if (code.equals("1")) {
|
|
@@ -1099,7 +1088,6 @@ public class TEquipmentController {
|
|
|
|
|
|
tEquipmentService.updateById(equipment);
|
|
tEquipmentService.updateById(equipment);
|
|
tEquipmentService.sentMessage(equipment.getClientId(), PushUtils.buildJson("is_sleep", eqeStatus).toString());
|
|
tEquipmentService.sentMessage(equipment.getClientId(), PushUtils.buildJson("is_sleep", eqeStatus).toString());
|
|
-// PushUtils.push(equipment.getGtClientId(), "", "", PushUtils.buildJson("is_sleep", eqeStatus).toString());
|
|
|
|
return ResponseEntity
|
|
return ResponseEntity
|
|
.status(HttpStatus.OK)
|
|
.status(HttpStatus.OK)
|
|
.body(new ResultMessage()
|
|
.body(new ResultMessage()
|
|
@@ -1132,7 +1120,6 @@ public class TEquipmentController {
|
|
if (equipmentList.size() > 0) {
|
|
if (equipmentList.size() > 0) {
|
|
for (TEquipment equipment : equipmentList) {
|
|
for (TEquipment equipment : equipmentList) {
|
|
tEquipmentService.sentMessage(equipment.getClientId(), PushUtils.buildJson("onoffstatus", "0").toString());
|
|
tEquipmentService.sentMessage(equipment.getClientId(), PushUtils.buildJson("onoffstatus", "0").toString());
|
|
-// PushUtils.push(equipment.getGtClientId(), "", "", PushUtils.buildJson("onoffstatus", "0").toString());
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return R.ok();
|
|
return R.ok();
|
|
@@ -1499,23 +1486,22 @@ public class TEquipmentController {
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
|
|
|
|
|
|
Calendar cal = Calendar.getInstance();
|
|
Calendar cal = Calendar.getInstance();
|
|
- cal.setFirstDayOfWeek(Calendar.MONDAY);// 设置一个星期的第一天,按中国的习惯一个星期的第一天是星期一
|
|
|
|
- int dayWeek = cal.get(Calendar.DAY_OF_WEEK);// 获得当前日期是一个星期的第几天
|
|
|
|
|
|
+ // 设置一个星期的第一天,按中国的习惯一个星期的第一天是星期一
|
|
|
|
+ cal.setFirstDayOfWeek(Calendar.MONDAY);
|
|
|
|
+ // 获得当前日期是一个星期的第几天
|
|
|
|
+ int dayWeek = cal.get(Calendar.DAY_OF_WEEK);
|
|
if (dayWeek == 1) {
|
|
if (dayWeek == 1) {
|
|
dayWeek = 8;
|
|
dayWeek = 8;
|
|
}
|
|
}
|
|
-// System.out.println("要计算日期为:" + sdf.format(cal.getTime())); // 输出要计算日期
|
|
|
|
-
|
|
|
|
- cal.add(Calendar.DATE, cal.getFirstDayOfWeek() - dayWeek);// 根据日历的规则,给当前日期减去星期几与一个星期第一天的差值
|
|
|
|
|
|
+ // 根据日历的规则,给当前日期减去星期几与一个星期第一天的差值
|
|
|
|
+ cal.add(Calendar.DATE, cal.getFirstDayOfWeek() - dayWeek);
|
|
Date mondayDate = cal.getTime();
|
|
Date mondayDate = cal.getTime();
|
|
String weekBegin = sdf.format(mondayDate);
|
|
String weekBegin = sdf.format(mondayDate);
|
|
-// System.out.println("所在周星期一的日期:" + weekBegin);
|
|
|
|
|
|
|
|
|
|
|
|
cal.add(Calendar.DATE, 4 + cal.getFirstDayOfWeek());
|
|
cal.add(Calendar.DATE, 4 + cal.getFirstDayOfWeek());
|
|
Date sundayDate = cal.getTime();
|
|
Date sundayDate = cal.getTime();
|
|
String weekEnd = sdf.format(sundayDate);
|
|
String weekEnd = sdf.format(sundayDate);
|
|
-// System.out.println("所在周星期日的日期:" + weekEnd);
|
|
|
|
|
|
|
|
map.put("mondayDate", weekBegin);
|
|
map.put("mondayDate", weekBegin);
|
|
map.put("sundayDate", weekEnd);
|
|
map.put("sundayDate", weekEnd);
|
|
@@ -1530,18 +1516,11 @@ public class TEquipmentController {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@PostMapping("/updateParameters")
|
|
@PostMapping("/updateParameters")
|
|
- public ResponseEntity<?> updateCommonParam(@RequestBody CommonParamVo commonParamVo) {
|
|
|
|
|
|
+ public ResponseModel<?> updateCommonParam(@RequestBody CommonParamVo commonParamVo) {
|
|
String equipmentId = commonParamVo.getId();
|
|
String equipmentId = commonParamVo.getId();
|
|
TEquipment equipment = tEquipmentService.getById(Long.valueOf(equipmentId));
|
|
TEquipment equipment = tEquipmentService.getById(Long.valueOf(equipmentId));
|
|
tEquipmentService.sentMessage(equipment.getClientId(), PushUtils.buildJson("Param", commonParamVo.getName() + ":" + commonParamVo.getVal()).toString());
|
|
tEquipmentService.sentMessage(equipment.getClientId(), PushUtils.buildJson("Param", commonParamVo.getName() + ":" + commonParamVo.getVal()).toString());
|
|
-// PushUtils.push(equipment.getGtClientId(), "", "", PushUtils.buildJson("Param", commonParamVo.getName() + ":" + commonParamVo.getVal()).toString());
|
|
|
|
-
|
|
|
|
- return ResponseEntity
|
|
|
|
- .status(HttpStatus.OK)
|
|
|
|
- .body(new ResultMessage()
|
|
|
|
- .setCode(true)
|
|
|
|
- .setData("SUCCESS")
|
|
|
|
- .setMessage("SUCCESS"));
|
|
|
|
|
|
+ return R.ok();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1551,18 +1530,11 @@ public class TEquipmentController {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@PostMapping("/humidityParameters")
|
|
@PostMapping("/humidityParameters")
|
|
- public ResponseEntity<?> humidityParameters(@RequestBody CommonParamVo commonParamVo) {
|
|
|
|
|
|
+ public ResponseModel<?> humidityParameters(@RequestBody CommonParamVo commonParamVo) {
|
|
String equipmentId = commonParamVo.getId();
|
|
String equipmentId = commonParamVo.getId();
|
|
TEquipment equipment = tEquipmentService.getById(equipmentId);
|
|
TEquipment equipment = tEquipmentService.getById(equipmentId);
|
|
tEquipmentService.sentMessage(equipment.getClientId(), PushUtils.buildJson("humidityParameters", commonParamVo.getName() + ":" + commonParamVo.getVal()).toString());
|
|
tEquipmentService.sentMessage(equipment.getClientId(), PushUtils.buildJson("humidityParameters", commonParamVo.getName() + ":" + commonParamVo.getVal()).toString());
|
|
-// PushUtils.push(equipment.getGtClientId(), "", "", PushUtils.buildJson("Param", commonParamVo.getName() + ":" + commonParamVo.getVal()).toString());
|
|
|
|
-
|
|
|
|
- return ResponseEntity
|
|
|
|
- .status(HttpStatus.OK)
|
|
|
|
- .body(new ResultMessage()
|
|
|
|
- .setCode(true)
|
|
|
|
- .setData("SUCCESS")
|
|
|
|
- .setMessage("SUCCESS"));
|
|
|
|
|
|
+ return R.ok();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1576,9 +1548,6 @@ public class TEquipmentController {
|
|
@GetMapping("/downloadLog")
|
|
@GetMapping("/downloadLog")
|
|
public ResponseModel<?> downloadLog(String equipmentId, String day, HttpServletResponse response) throws IOException, InterruptedException {
|
|
public ResponseModel<?> downloadLog(String equipmentId, String day, HttpServletResponse response) throws IOException, InterruptedException {
|
|
// 1、发送MQ到安卓端上传日志
|
|
// 1、发送MQ到安卓端上传日志
|
|
-/* if(day.length()!=8){
|
|
|
|
- return R.fail(A0001,"日期格式有误");
|
|
|
|
- }*/
|
|
|
|
if (StringUtils.isEmpty(equipmentId)) {
|
|
if (StringUtils.isEmpty(equipmentId)) {
|
|
return R.fail(A0001);
|
|
return R.fail(A0001);
|
|
}
|
|
}
|
|
@@ -1591,8 +1560,6 @@ public class TEquipmentController {
|
|
String filepath = "/home/hboxs/log/" + kind + ".txt";
|
|
String filepath = "/home/hboxs/log/" + kind + ".txt";
|
|
// 1.1 如果文件已存在,直接下载
|
|
// 1.1 如果文件已存在,直接下载
|
|
if (Files.exists(Paths.get(filepath))) {
|
|
if (Files.exists(Paths.get(filepath))) {
|
|
-// DownloadUtils.downloadFile(filepath, response);
|
|
|
|
-// return R.ok();
|
|
|
|
try {
|
|
try {
|
|
Files.delete(Paths.get(filepath));
|
|
Files.delete(Paths.get(filepath));
|
|
return R.ok();
|
|
return R.ok();
|
|
@@ -1642,25 +1609,6 @@ public class TEquipmentController {
|
|
return R.ok();
|
|
return R.ok();
|
|
}
|
|
}
|
|
|
|
|
|
- // 从服务器下载文件
|
|
|
|
-// public void downloadFile(String filepath, HttpServletResponse response) throws IOException {
|
|
|
|
-// File logFile = new File(filepath);
|
|
|
|
-// response.setHeader("Content-Disposition", "attachment; filename=\"" + logFile.getName() + "\"");
|
|
|
|
-//
|
|
|
|
-// FileInputStream fis = new FileInputStream(logFile);
|
|
|
|
-// OutputStream os = response.getOutputStream();
|
|
|
|
-//
|
|
|
|
-// byte[] buffer = new byte[4096];
|
|
|
|
-// int length;
|
|
|
|
-// while ((length = fis.read(buffer)) > 0) {
|
|
|
|
-// os.write(buffer, 0, length);
|
|
|
|
-// os.flush();
|
|
|
|
-// }
|
|
|
|
-// os.close();
|
|
|
|
-// fis.close();
|
|
|
|
-// response.flushBuffer();
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
//查找设备
|
|
//查找设备
|
|
@ApiOperation(value = "获取对应的机器编号")
|
|
@ApiOperation(value = "获取对应的机器编号")
|
|
@GetMapping("/findEquipmentByClientIds")
|
|
@GetMapping("/findEquipmentByClientIds")
|
|
@@ -1719,7 +1667,6 @@ public class TEquipmentController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
tEquipmentService.sentMessage(equipment.getClientId(), PushUtils.buildJson("updateDIYProductShow", JSON.toJSONString(list)).toString());
|
|
tEquipmentService.sentMessage(equipment.getClientId(), PushUtils.buildJson("updateDIYProductShow", JSON.toJSONString(list)).toString());
|
|
-// tDiyFlowerService.updateBatchById(products);
|
|
|
|
return R.ok(null, "修改请求发送成功");
|
|
return R.ok(null, "修改请求发送成功");
|
|
}
|
|
}
|
|
|
|
|