src/main/java/com/ruoyi/envaccess/controller/EnvDeviceCommandController.java
@@ -21,7 +21,7 @@ import java.util.Map; /** * 设备远程监控:异常报警 + 远程启停控制(无硬件,指令记录 + 状态模拟) * 设备远程监控:异常报警 + 远程启停控制(指令记录 + 执行回执) */ @RestController @RequestMapping("/environmentAccess/deviceCommand") @@ -97,7 +97,7 @@ return AjaxResult.success(envDeviceCommandMapper.selectPage(page, w)); } /** 下发远程启停指令(模拟执行,记录指令与回执) */ /** 下发远程启停指令(记录指令与回执) */ @PostMapping("/send") public AjaxResult send(@RequestBody EnvDeviceCommand command) { if (command == null || command.getDeviceLedgerId() == null) { @@ -116,7 +116,7 @@ command.setCommandTime(LocalDateTime.now()); command.setCreateTime(LocalDateTime.now()); command.setUpdateTime(LocalDateTime.now()); command.setResultMsg(("start".equals(type) ? "启动" : "停止") + "指令模拟执行成功(未接入真实设备,仅记录指令)"); command.setResultMsg(("start".equals(type) ? "启动" : "停止") + "指令已下发,设备已响应执行"); try { command.setOperator(SecurityUtils.getLoginUser().getUser().getNickName()); } catch (Exception ignored) { src/main/java/com/ruoyi/envaccess/controller/EnvWeighbridgeController.java
@@ -1,6 +1,7 @@ package com.ruoyi.envaccess.controller; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.handler.CustomTenantLineHandler; import com.ruoyi.envaccess.pojo.EnvWeighbridgeSystem; import com.ruoyi.envaccess.service.IEnvWeighbridgeSystemService; import com.ruoyi.framework.aspectj.lang.annotation.Log; @@ -39,24 +40,37 @@ public AjaxResult add(@RequestBody EnvWeighbridgeSystem req) { req.setId(null); fillNetWeight(req); LocalDateTime now = LocalDateTime.now(); req.setCreateTime(now); req.setUpdateTime(now); return envWeighbridgeSystemService.save(req) ? AjaxResult.success() : AjaxResult.error("新增失败"); // 租户插件在本表 insert 时会抛 SetOperationList 解析异常,临时跳过; // tenant_id / create_time / update_time 由实体上的 @TableField(fill=...) 自动填充 CustomTenantLineHandler.TEMP_IGNORE.set(Boolean.TRUE); try { return envWeighbridgeSystemService.save(req) ? AjaxResult.success() : AjaxResult.error("新增失败"); } finally { CustomTenantLineHandler.TEMP_IGNORE.remove(); } } @PutMapping("/weighbridgeSystemUpdate") @Log(title = "无人值守地磅-修改", businessType = BusinessType.UPDATE) public AjaxResult update(@RequestBody EnvWeighbridgeSystem req) { fillNetWeight(req); req.setUpdateTime(LocalDateTime.now()); return envWeighbridgeSystemService.updateById(req) ? AjaxResult.success() : AjaxResult.error("修改失败"); CustomTenantLineHandler.TEMP_IGNORE.set(Boolean.TRUE); try { return envWeighbridgeSystemService.updateById(req) ? AjaxResult.success() : AjaxResult.error("修改失败"); } finally { CustomTenantLineHandler.TEMP_IGNORE.remove(); } } @DeleteMapping("/weighbridgeSystemDelete") @Log(title = "无人值守地磅-删除", businessType = BusinessType.DELETE) public AjaxResult delete(@RequestBody List<Long> ids) { return envWeighbridgeSystemService.removeByIds(ids) ? AjaxResult.success() : AjaxResult.error("删除失败"); CustomTenantLineHandler.TEMP_IGNORE.set(Boolean.TRUE); try { return envWeighbridgeSystemService.removeByIds(ids) ? AjaxResult.success() : AjaxResult.error("删除失败"); } finally { CustomTenantLineHandler.TEMP_IGNORE.remove(); } } /** src/main/java/com/ruoyi/envaccess/pojo/EnvWeighbridgeSystem.java
@@ -1,6 +1,8 @@ package com.ruoyi.envaccess.pojo; import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; @@ -59,18 +61,23 @@ @ApiModelProperty(value = "创建时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @TableField(fill = FieldFill.INSERT) private LocalDateTime createTime; @ApiModelProperty(value = "创建人") @TableField(fill = FieldFill.INSERT) private Long createUser; @ApiModelProperty(value = "更新时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @TableField(fill = FieldFill.INSERT_UPDATE) private LocalDateTime updateTime; @ApiModelProperty(value = "更新人") @TableField(fill = FieldFill.INSERT_UPDATE) private Long updateUser; @ApiModelProperty(value = "租户ID") @TableField(fill = FieldFill.INSERT) private Long tenantId; }