提交 b2b8647d authored 作者: 林业通's avatar 林业通

记录、温控修改

上级 3a01765e
...@@ -32,9 +32,7 @@ public class ShDeviceRecordController { ...@@ -32,9 +32,7 @@ public class ShDeviceRecordController {
if (StringUtils.isBlank(params.get("deviceId"))) { if (StringUtils.isBlank(params.get("deviceId"))) {
return R.error("缺少参数"); return R.error("缺少参数");
} }
PageUtils page = otherShDeviceRecordService.queryPage(params); return otherShDeviceRecordService.switchOutletRecord(params);
return R.ok().put("page", page);
} }
......
...@@ -104,10 +104,72 @@ public class ShDeviceTempController { ...@@ -104,10 +104,72 @@ public class ShDeviceTempController {
@Login @Login
@GetMapping("info/{id}") @GetMapping("info/{id}")
@ApiOperation("定时详情(智能插座、开关、窗帘)") @ApiOperation("温控详情")
@ApiLog("定时详情") @ApiLog("温控详情")
public R info(@PathVariable("id") Integer id) { public R info(@PathVariable("id") Integer id) {
return R.ok().put("temp", otherShDeviceTempService.getOne(new QueryWrapper<ShDeviceTempEntity>().eq("device_id", id))); return R.ok().put("temp", otherShDeviceTempService.getOne(new QueryWrapper<ShDeviceTempEntity>().eq("device_id", id)));
} }
@Login
@PostMapping("delete")
@ApiOperation("智能插座删除温控")
@ApiLog("智能插座删除温控")
public R delete(@RequestBody Map<String, Object> params) {
Integer id = (Integer) params.get("id");
Integer deviceId = (Integer) params.get("deviceId");
if (StringUtils.isBlank(id, deviceId)) {
return R.error("缺少参数");
}
otherShDeviceTempService.removeById(id);
ShDeviceEntity entity = otherShDeviceService.getById(deviceId);
String content;
String tempH = ByteUtils.signInt2HexString("99", 2);
String tempL = ByteUtils.signInt2HexString("-99", 2);
content = tempH + ByteUtils.int2Hex(1) + tempL + ByteUtils.int2Hex(1) +
"00000000";
ProtocolContent protocol = new ProtocolContent();
protocol.setReceiveId(entity.getNumbering());
protocol.setDeviceType("03");
protocol.setCmd("1A");
protocol.setContent(content);
String json = JSON.toJSONString(protocol);
redisUtils.set("device:sendtemp:" + entity.getNumbering(), json);
return R.ok().put("temp", otherShDeviceTempService.getOne(new QueryWrapper<ShDeviceTempEntity>().eq("device_id", id)));
}
@Login
@PostMapping("delete1")
@ApiOperation("智能开关删除温控")
@ApiLog("智能开关删除温控")
public R delete1(@RequestBody Map<String, Object> params) {
Integer id = (Integer) params.get("id");
Integer deviceId = (Integer) params.get("deviceId");
if (StringUtils.isBlank(id, deviceId)) {
return R.error("缺少参数");
}
otherShDeviceTempService.removeById(id);
ShDeviceEntity entity = otherShDeviceService.getById(deviceId);
String content;
String tempH = ByteUtils.signInt2HexString("99", 2);
String tempL = ByteUtils.signInt2HexString("-99", 2);
String tempHT = ByteUtils.signInt2HexString("99", 2);
String tempLT = ByteUtils.signInt2HexString("-99", 2);
content = tempH + ByteUtils.int2Hex(1) + tempL + ByteUtils.int2Hex(1) +
tempHT + ByteUtils.int2Hex(1) + tempLT + ByteUtils.int2Hex(1);
ProtocolContent protocol = new ProtocolContent();
protocol.setReceiveId(entity.getNumbering());
protocol.setDeviceType("02");
protocol.setCmd("1A");
protocol.setContent(content);
String json = JSON.toJSONString(protocol);
redisUtils.set("device:sendtemp:" + entity.getNumbering(), json);
return R.ok();
}
} }
\ No newline at end of file
...@@ -30,6 +30,15 @@ public interface OtherShDeviceRecordDao extends BaseMapper<ShDeviceRecordEntity> ...@@ -30,6 +30,15 @@ public interface OtherShDeviceRecordDao extends BaseMapper<ShDeviceRecordEntity>
" </script>") " </script>")
List<Map<String, Object>> list(Page<Map<String, Object>> page, Map<String, Object> params); List<Map<String, Object>> list(Page<Map<String, Object>> page, Map<String, Object> params);
@Select("<script>" +
"SELECT a.create_time createTime, a.action FROM sh_device_record a WHERE a.device_id = ${deviceId}" +
" <if test='start != null and start != \"\" and end != null and end != \"\"' > "
+ " and <![CDATA[ a.create_time >= #{start} and a.create_time <= #{end} ]]> "
+ " </if>"
+ "ORDER BY a.id DESC" +
" </script>")
List<Map<String, Object>> list1(Map<String, Object> params);
@Update("update sh_device_record set remark = '' WHERE device_id = ${deviceId}") @Update("update sh_device_record set remark = '' WHERE device_id = ${deviceId}")
void clearRemark(Integer deviceId); void clearRemark(Integer deviceId);
} }
...@@ -43,26 +43,25 @@ public class ShDeviceTempForm { ...@@ -43,26 +43,25 @@ public class ShDeviceTempForm {
private Integer statusL; private Integer statusL;
/** /**
* 高温 * 高温
*/
@ApiModelProperty(value = "高温") @ApiModelProperty(value = "高温")
@NotNull(message="高温不能为空") @NotNull(message="高温不能为空")*/
private Integer tempHT; private Integer tempHT;
/** /**
* 状态 1开 2关 * 状态 1开 2关
*/
@ApiModelProperty(value = "状态") @ApiModelProperty(value = "状态")
@NotNull(message="状态不能为空") @NotNull(message="状态不能为空")*/
private Integer statusHT; private Integer statusHT;
/** /**
* 高温 * 高温
*/
@ApiModelProperty(value = "高温") @ApiModelProperty(value = "高温")
@NotNull(message="高温不能为空") @NotNull(message="高温不能为空")*/
private Integer tempLT; private Integer tempLT;
/** /**
* 状态 1开 2关 * 状态 1开 2关
*/
@ApiModelProperty(value = "状态") @ApiModelProperty(value = "状态")
@NotNull(message="状态不能为空") @NotNull(message="状态不能为空")*/
private Integer statusLT; private Integer statusLT;
} }
...@@ -18,6 +18,8 @@ public interface OtherShDeviceRecordService extends IService<ShDeviceRecordEntit ...@@ -18,6 +18,8 @@ public interface OtherShDeviceRecordService extends IService<ShDeviceRecordEntit
PageUtils queryPage(Map<String, Object> params); PageUtils queryPage(Map<String, Object> params);
R switchOutletRecord(Map<String, Object> params);
R clearRemark(Integer deviceId); R clearRemark(Integer deviceId);
} }
...@@ -28,6 +28,12 @@ public class OtherShDeviceRecordServiceImpl extends ServiceImpl<OtherShDeviceRec ...@@ -28,6 +28,12 @@ public class OtherShDeviceRecordServiceImpl extends ServiceImpl<OtherShDeviceRec
return new PageUtils(page); return new PageUtils(page);
} }
@Override
public R switchOutletRecord(Map<String, Object> params) {
List<Map<String, Object>> list = this.baseMapper.list1(params);
return R.ok().put("list", list);
}
@Override @Override
public R clearRemark(Integer deviceId) { public R clearRemark(Integer deviceId) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论