Преглед на файлове

1、设备录入操作人显示

lmstack преди 3 години
родител
ревизия
2390d3469c

+ 1 - 2
src/main/java/cn/fastfun/controller/api/ApiAppDeviceController.java

@@ -133,7 +133,7 @@ public class ApiAppDeviceController {
     public ApiPageDTO batchNumPageQuery(@RequestBody DeviceBatchQueryParam param) {
 
         StringBuffer sql = new StringBuffer();
-        sql.append("select t1.batch_num,t1.sn,t1.imei,t1.operate_id, t1.deliver_time,count(0) as total,count(if(status = 1,true,null)) as in_storage,count(if(status = 2,true,null)) as transfer,");
+        sql.append("select t1.batch_num,t1.sn,t1.imei,t1.operate_id, t1.operator, t1.deliver_time,count(0) as total,count(if(status = 1,true,null)) as in_storage,count(if(status = 2,true,null)) as transfer,");
         sql.append("count(if(status = 3,true,null)) as out_storage,count(if(status = 4,true,null)) as handle,");
         sql.append("t1.add_time,t1.received_place from app_device t1");
 
@@ -176,7 +176,6 @@ public class ApiAppDeviceController {
                 p.put("pack_title", device.getPackTitle());
                 p.put("deliver_time", DateUtils.toString(ObjectUtil.obj2Date(p.get("deliver_time")), DateUtils.YMD));
                 p.put("add_time", DateUtils.toString(ObjectUtil.obj2Date(p.get("add_time")), DateUtils.YMDHMS));
-                p.put("operator", device.getOperator());
             }
             page.setData(list);
         }

+ 18 - 2
src/main/java/cn/fastfun/controller/api/ApiAppDeviceLogController.java

@@ -171,12 +171,21 @@ public class ApiAppDeviceLogController {
 
     @ApiOperation(value = "设备自检 结果查看")
     @RequestMapping(value = "selfcheck", method = RequestMethod.POST)
-    public ApiDTO selfCheck(@RequestBody @ApiParam(name = "入库参数", value = "指定sn", required = true) BenchQueryDetailParam param) {
+    public ApiDTO selfCheckQuery(@RequestBody @ApiParam(name = "入库参数", value = "指定sn", required = true) BenchQueryDetailParam param) {
         AppDevice device = appDeviceService.getOne(QueryParamExp.eq("sn", param.getSn()));
         device.setCheckStatus(1);
         appDeviceService.save(device);
         return ApiDTO.ok();
     }
+    @ApiOperation(value = "设备自检 详情查看")
+    @RequestMapping(value = "selfcheck/detail", method = RequestMethod.POST)
+    public ApiDTO selfCheckDetailQuery(@RequestBody @ApiParam(name = "入库参数", value = "指定sn", required = true) BenchQueryDetailParam param) {
+        AppDevice device = appDeviceService.getOne(QueryParamExp.eq("sn", param.getSn()));
+        device.setCheckStatus(1);
+        appDeviceService.save(device);
+        return ApiDTO.ok();
+    }
+
     @ApiOperation(value = "根据sn或batch调拨 ")
     @RequestMapping(value = "transfer", method = RequestMethod.POST)
     public ApiDTO transfer(@RequestBody @ApiParam(name = "划拨参数", value = "传入json格式", required = true) TransferFormParam param) {
@@ -493,7 +502,7 @@ public class ApiAppDeviceLogController {
 
     @ApiOperation(value = "处置 搜索 & 重置")
     @RequestMapping(value = "handle/pageQuery", method = RequestMethod.POST)
-    public ApiPageDTO deviceLogPageQuery(@RequestBody HandelQueryParam param) {
+    public ApiPageDTO handlePageQuery(@RequestBody HandelQueryParam param) {
         param.addParam(QueryParamExp.eq("type", 4));
 
         Page<AppDeviceLog> devicePage = deviceLogService.findByParam(param);
@@ -504,5 +513,12 @@ public class ApiAppDeviceLogController {
         return new ApiPageDTO(null,devicePage);
     }
 
+    @ApiOperation(value = "处置 查看")
+    @RequestMapping(value = "handle/pageQuery/Detail", method = RequestMethod.POST)
+    public ApiPageDTO handlePageQueryDetail(@RequestBody BenchQueryDetailParam param) {
+        AppDevice device = appDeviceService.getOne(QueryParamExp.eq("sn",param.getSn()));
 
+        List<AppDevice> devicePage = appDeviceService.findAll(QueryParamExp.eq("imei",device.getImei()));
+        return new ApiPageDTO(null,devicePage);
+    }
 }

+ 3 - 3
src/main/java/cn/fastfun/service/AppDeviceLogService.java

@@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 
+import java.util.Map;
+
 /**
  * 设备操作日志
  */
@@ -29,9 +31,7 @@ public interface AppDeviceLogService extends JpaService<AppDeviceLog, String> {
 
      */
 
-    boolean selfCheck(String sn);
-
-
+    public Map<String, Boolean> selfCheck(String sn);
 
     /**
      * 设备划拨

+ 24 - 0
src/main/java/cn/fastfun/service/entity/AppDevice.java

@@ -118,6 +118,30 @@ public class AppDevice extends DateEntity {
     @Column(name = "check_status")
     private Integer checkStatus = 0;
 
+    @ApiModelProperty(value = "自检数据连接", name = "checkStatusDataConnect", required = true)
+    @Column(name = "self_check_data_connect")
+    private Integer checkStatusDataConnect = 0;
+
+    @ApiModelProperty(value = "自检定位", name = "checkStatusLocation", required = true)
+    @Column(name = "self_check_location")
+    private Integer checkStatusLocation = 0;
+
+
+    @ApiModelProperty(value = "自检上锁", name = "checkStatusLock", required = true)
+    @Column(name = "self_check_lock")
+    private Integer checkStatusLock = 0;
+
+
+    @ApiModelProperty(value = "自检故障", name = "checkStatusFault", required = true)
+    @Column(name = "self_check_fault")
+    private Integer checkStatusFault = 0;
+
+
+    @ApiModelProperty(value = "自检电压", name = "checkStatusVoltage", required = true)
+    @Column(name = "self_check_voltage")
+    private Integer checkStatusVoltage = 0;
+
+
     // 关联
     @JsonIgnore
     @ManyToOne(targetEntity = SysDict.class)

+ 24 - 5
src/main/java/cn/fastfun/service/impl/AppDeviceLogServiceImpl.java

@@ -75,7 +75,13 @@ public class AppDeviceLogServiceImpl extends JpaServiceImp<AppDeviceLog, String>
                 batchNum = appDevice.getBatchNum();
                 if (appDevice.getStatus() < 1) {
                     appDevice.setStatus(1); // 已入库
-                    appDevice.setCheckStatus(BooleanUtils.toInteger(appDeviceLogService.selfCheck(p))); //自检
+                    appDevice.setCheckStatus(BooleanUtils.toInteger(appDeviceLogService.selfCheck(p).get("checkResult"))); //自检
+                    appDevice.setCheckStatusDataConnect(BooleanUtils.toInteger(appDeviceLogService.selfCheck(p).get("checkDataConnectResult"))); //自检
+                    appDevice.setCheckStatusLocation(BooleanUtils.toInteger(appDeviceLogService.selfCheck(p).get("checkLocationResult"))); //自检
+                    appDevice.setCheckStatusLock(BooleanUtils.toInteger(appDeviceLogService.selfCheck(p).get("checkLockResult"))); //自检
+                    appDevice.setCheckStatusFault(BooleanUtils.toInteger(appDeviceLogService.selfCheck(p).get("checkFaultResult"))); //自检
+                    appDevice.setCheckStatusVoltage(BooleanUtils.toInteger(appDeviceLogService.selfCheck(p).get("checkVoltageResult"))); //自检
+                    //TODO 发送解锁指令
                     appDevice.setInstorageTime(time);
                     appDeviceService.save(appDevice);
 
@@ -89,12 +95,25 @@ public class AppDeviceLogServiceImpl extends JpaServiceImp<AppDeviceLog, String>
 
     @Override
     @Transactional
-    public boolean selfCheck(String sn) {
-        boolean checkResult = false;
+    public Map<String, Boolean> selfCheck(String sn) {
+        //TODO 添加自检
+        Map<String, Boolean> res = new HashMap<>();
+        Boolean checkResult = false;
+        Boolean checkDataConnectResult = false;
+        Boolean checkLocationResult = false;
+        Boolean checkLockResult = false;
+        Boolean checkFaultResult = false;
+        Boolean checkVoltageResult = false;
         if (true){
             checkResult = true;
         }
-        return checkResult;
+        res.put("checkResult", checkResult);
+        res.put("checkDataConnectResult", checkDataConnectResult);
+        res.put("checkLocationResult", checkLocationResult);
+        res.put("checkLockResult", checkLockResult);
+        res.put("checkFaultResult", checkFaultResult);
+        res.put("checkVoltageResult", checkVoltageResult);
+        return res;
     }
 
     @Override
@@ -257,7 +276,7 @@ public class AppDeviceLogServiceImpl extends JpaServiceImp<AppDeviceLog, String>
             appDevice.setHandleTime(time);
             appDevice.setStatus(4); // 处置
             appDeviceService.save(appDevice);
-
+            //TODO 发送上锁指令
             AppDeviceLog appDeviceLog = new AppDeviceLog(p, appDevice.getImei()).toHandle(param, time, batchNum, finalOperateID);
             appDeviceLog.setOperator(utilService.getUserName());
             save(appDeviceLog); // 记录处置日志