|
@@ -29,10 +29,7 @@ import com.szwl.model.bo.R;
|
|
|
import com.szwl.model.bo.ResponseModel;
|
|
|
import com.szwl.model.bo.UserDetailBO;
|
|
|
import com.szwl.model.entity.*;
|
|
|
-import com.szwl.model.param.DoSugarParam;
|
|
|
-import com.szwl.model.param.EquipmentParam;
|
|
|
-import com.szwl.model.param.PasswordParam;
|
|
|
-import com.szwl.model.param.SmokeJamParm;
|
|
|
+import com.szwl.model.param.*;
|
|
|
import com.szwl.model.query.StatisticsParam;
|
|
|
import com.szwl.model.utils.DateUtils;
|
|
|
import com.szwl.model.utils.PushUtils;
|
|
@@ -337,7 +334,7 @@ public class TEquipmentController {
|
|
|
String adminName = param.getAdminName();
|
|
|
String equipmentName = param.getEquipmentName();
|
|
|
String areaName = param.getAreaName();
|
|
|
- String eqeStatus = param.getEqeStatus();
|
|
|
+ Integer eqeStatus = param.getEqeStatus();
|
|
|
String machineType = param.getMachineType();
|
|
|
String equimentType = param.getEquimentType();
|
|
|
String labelId = param.getLabelId();
|
|
@@ -390,7 +387,7 @@ public class TEquipmentController {
|
|
|
if (StringUtils.isNotEmpty(areaName)) {
|
|
|
query.like(TEquipment::getFullName, areaName);
|
|
|
}
|
|
|
- if (StringUtils.isNotEmpty(eqeStatus)) {
|
|
|
+ if (eqeStatus != null) {
|
|
|
query.eq(TEquipment::getEqeStatus, eqeStatus);
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(machineType)) {
|
|
@@ -2194,14 +2191,6 @@ public class TEquipmentController {
|
|
|
return R.fail(ResponseCodesEnum.A0001);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- /**
|
|
|
- * 上传日志
|
|
|
- *
|
|
|
- * @param equipmentId 设备ID,用于标识上传日志的设备
|
|
|
- * @param day 日期,指定要上传日志的日期
|
|
|
- * @return 返回操作结果,成功则返回成功信息,失败则返回失败原因
|
|
|
- */
|
|
|
@ApiOperation(value = "上传日志")
|
|
|
@GetMapping("/newUploadLog")
|
|
|
public ResponseModel<?> newUploadLog(String equipmentId, String day) {
|
|
@@ -2232,7 +2221,130 @@ public class TEquipmentController {
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "修改音量")
|
|
|
+ @PostMapping("/changeVolume")
|
|
|
+ public ResponseModel<?> changeVolume(@RequestBody TEquipment param) {
|
|
|
+ UserDetailBO userDetailBO = Optional.ofNullable(tokenManager.getLoginUserDetails())
|
|
|
+ .orElseThrow(() -> new BizException(ResponseCodesEnum.L0001));
|
|
|
+ Long adminId = userDetailBO.getId();
|
|
|
+ TEquipment equipment = tEquipmentService.getById(param.getId());
|
|
|
+ if (equipment != null) {
|
|
|
+ String volume = param.getVolume();
|
|
|
+ String message = PushUtils.buildJson(OperationType.VOLUME.getCode(), volume).toString();
|
|
|
+ tEquipmentService.sendRemoteMessage(equipment.getClientId(), OperationType.VOLUME, message, adminId);
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+ return R.fail(ResponseCodesEnum.A0001);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "修改机器密码")
|
|
|
+ @PostMapping("/changePassword")
|
|
|
+ public ResponseModel<?> changePassword(@RequestBody EquipmentParam param) {
|
|
|
+ UserDetailBO userDetailBO = Optional.ofNullable(tokenManager.getLoginUserDetails())
|
|
|
+ .orElseThrow(() -> new BizException(ResponseCodesEnum.L0001));
|
|
|
+ Long adminId = userDetailBO.getId();
|
|
|
+
|
|
|
+ Long id = param.getId();
|
|
|
+ TEquipment equipment = tEquipmentService.getById(id);
|
|
|
+ if (equipment != null) {
|
|
|
+ String adminPwd = param.getAdminPwd();
|
|
|
+ String guestPwd = param.getGuestPwd();
|
|
|
+ JSONObject kindData = new JSONObject();
|
|
|
+ if (StringUtils.isNotEmpty(guestPwd)) {
|
|
|
+ kindData.put("type", "0");
|
|
|
+ kindData.put("password", guestPwd);
|
|
|
+ String message = PushUtils.buildJson(OperationType.PASSWORD.getCode(), kindData.toString()).toString();
|
|
|
+ tEquipmentService.sendRemoteMessage(equipment.getClientId(), OperationType.PASSWORD, message, adminId);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(adminPwd)) {
|
|
|
+ kindData.put("type", "1");
|
|
|
+ kindData.put("password", adminPwd);
|
|
|
+ String message = PushUtils.buildJson(OperationType.PASSWORD.getCode(), kindData.toString()).toString();
|
|
|
+ tEquipmentService.sendRemoteMessage(equipment.getClientId(), OperationType.PASSWORD, message, adminId);
|
|
|
+ }
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+ return R.fail(ResponseCodesEnum.A0001, "找不到设备");
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("操作开门")
|
|
|
+ @PostMapping("/newOpenDoor")
|
|
|
+ public ResponseModel<?> newOpenDoor(@RequestBody EquipmentDescParam param) {
|
|
|
+ UserDetailBO userDetailBO = Optional.ofNullable(tokenManager.getLoginUserDetails())
|
|
|
+ .orElseThrow(() -> new BizException(ResponseCodesEnum.L0001));
|
|
|
+ Long adminId = userDetailBO.getId();
|
|
|
+
|
|
|
+ Long equipmentId = param.getId();
|
|
|
+ TEquipment equipment = tEquipmentService.getById(equipmentId);
|
|
|
+ if (equipment != null) {
|
|
|
+ String type = param.getType();
|
|
|
+ String status = param.getStatus();
|
|
|
+ JSONObject kindData = new JSONObject();
|
|
|
+ kindData.put("type", type);
|
|
|
+ kindData.put("status", status);
|
|
|
+ String message = PushUtils.buildJson(OperationType.OPEN_DOOR.getCode(), kindData.toString()).toString();
|
|
|
+ tEquipmentService.sendRemoteMessage(equipment.getClientId(), OperationType.OPEN_DOOR, message, adminId);
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+ return R.fail(ResponseCodesEnum.A0001);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "重启触摸屏")
|
|
|
+ @GetMapping("/restartScreen")
|
|
|
+ public ResponseModel<?> restartScreen(String equipmentId) {
|
|
|
+ UserDetailBO userDetailBO = Optional.ofNullable(tokenManager.getLoginUserDetails())
|
|
|
+ .orElseThrow(() -> new BizException(ResponseCodesEnum.L0001));
|
|
|
+ Long adminId = userDetailBO.getId();
|
|
|
+
|
|
|
+ TEquipment equipment = tEquipmentService.getById(equipmentId);
|
|
|
+ if (equipment != null) {
|
|
|
+ String clientId = equipment.getClientId();
|
|
|
+ String message = PushUtils.buildJson(OperationType.RESTART_ANDROID.getCode(), OperationType.RESTART_ANDROID.getCode()).toString();
|
|
|
+ tEquipmentService.sendRemoteMessage(equipment.getClientId(), OperationType.RESTART_ANDROID, message, adminId);
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+ return R.fail(ResponseCodesEnum.A0001);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "机器睡眠")
|
|
|
+ @PostMapping("/switchSleep")
|
|
|
+ public ResponseModel<?> switchSleep(@RequestBody EquipmentParam param) {
|
|
|
+ UserDetailBO userDetailBO = Optional.ofNullable(tokenManager.getLoginUserDetails())
|
|
|
+ .orElseThrow(() -> new BizException(ResponseCodesEnum.L0001));
|
|
|
+ Long adminId = userDetailBO.getId();
|
|
|
|
|
|
+ TEquipment equipment = tEquipmentService.getById(param.getId());
|
|
|
+ if (equipment != null) {
|
|
|
+ String clientId = equipment.getClientId();
|
|
|
+ String isSleep = param.getIsSleep();
|
|
|
+ String message = PushUtils.buildJson(OperationType.SLEEP.getCode(), isSleep).toString();
|
|
|
+ tEquipmentService.sendRemoteMessage(equipment.getClientId(), OperationType.SLEEP, message, adminId);
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+ return R.fail(ResponseCodesEnum.A0001);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "机器开关机")
|
|
|
+ @PostMapping("/powerOnOff")
|
|
|
+ public ResponseModel<?> powerOnOff(@RequestBody EquipmentParam param) {
|
|
|
+ UserDetailBO userDetailBO = Optional.ofNullable(tokenManager.getLoginUserDetails())
|
|
|
+ .orElseThrow(() -> new BizException(ResponseCodesEnum.L0001));
|
|
|
+ Long adminId = userDetailBO.getId();
|
|
|
+
|
|
|
+ TEquipment equipment = tEquipmentService.getById(param.getId());
|
|
|
+ if (equipment != null) {
|
|
|
+ String clientId = equipment.getClientId();
|
|
|
+ Integer eqeStatus = param.getEqeStatus();
|
|
|
+ Long time = getNetworkTime();
|
|
|
+ if (time == null) {
|
|
|
+ time = System.currentTimeMillis();
|
|
|
+ }
|
|
|
+ String message = PushUtils.buildJson(OperationType.EQE_STATUS.getCode(), String.valueOf(eqeStatus), String.valueOf(time), "http://time.tianqi.com").toString();
|
|
|
+ tEquipmentService.sendRemoteMessage(equipment.getClientId(), OperationType.EQE_STATUS, message, adminId);
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+ return R.fail(ResponseCodesEnum.A0001);
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|