lmstack преди 3 години
родител
ревизия
31c12d0689

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

@@ -51,14 +51,6 @@ public class ApiAppDeviceLogController {
         return ApiDTO.ok();
     }
 
-    @ApiOperation(value = "设备自检")
-    @RequestMapping(value = "selfcheck", method = RequestMethod.POST)
-    public ApiDTO selfCheck(@RequestBody @ApiParam(name = "入库参数", value = "指定sn", required = true) LibraryInFormParam param) {
-        AppDevice device = appDeviceService.getOne(QueryParamExp.eq("sn", param.getSn()));
-        device.setCheckStatus(1);
-        appDeviceService.save(device);
-        return ApiDTO.ok();
-    }
 
     @ApiOperation(value = "批次入库 搜索 & 重置")
     @RequestMapping(value = "instorage/batch/Query", method = RequestMethod.POST)
@@ -177,6 +169,14 @@ public class ApiAppDeviceLogController {
         return page;
     }
 
+    @ApiOperation(value = "设备自检 结果查看")
+    @RequestMapping(value = "selfcheck", method = RequestMethod.POST)
+    public ApiDTO selfCheck(@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) {

+ 27 - 7
src/main/java/cn/fastfun/controller/api/IndexController.java

@@ -128,12 +128,32 @@ public class IndexController {
         res.put("sn", devicePage.getSn());
         res.put("imei", devicePage.getImei());
         res.put("status", devicePage.getStatus());
-        res.put("deliverTime", devicePage.getDeliverTime());
-        res.put("instorageTime", devicePage.getInstorageTime());
-        res.put("transferTime", devicePage.getTransferTime());
-        res.put("transferBackTime", devicePage.getTransferBackTime());
-        res.put("outstorageTime", devicePage.getOutstorageTime());
-        res.put("handleTime", devicePage.getHandleTime());
+        List<Map<String,String>> timeStream = new ArrayList<>();
+        Map<String , String > map = new HashMap<>();
+        map.put("deliverTime", DateUtils.toString(ObjectUtil.obj2Date(devicePage.getDeliverTime()), DateUtils.YMDHMS));
+        timeStream.add(map);
+
+        map = new HashMap<>();
+        map.put("instorageTime", DateUtils.toString(ObjectUtil.obj2Date(devicePage.getInstorageTime()), DateUtils.YMDHMS));
+        timeStream.add(map);
+
+        map = new HashMap<>();
+        map.put("transferTime", DateUtils.toString(ObjectUtil.obj2Date(devicePage.getTransferTime()), DateUtils.YMDHMS));
+        timeStream.add(map);
+
+        map = new HashMap<>();
+        map.put("transferBackTime", DateUtils.toString(ObjectUtil.obj2Date(devicePage.getTransferBackTime()), DateUtils.YMDHMS));
+        timeStream.add(map);
+
+        map = new HashMap<>();
+        map.put("outstorageTime", DateUtils.toString(ObjectUtil.obj2Date(devicePage.getOutstorageTime()), DateUtils.YMDHMS));
+        timeStream.add(map);
+
+        map = new HashMap<>();
+        map.put("handleTime", DateUtils.toString(ObjectUtil.obj2Date(devicePage.getHandleTime()), DateUtils.YMDHMS));
+        timeStream.add(map);
+
+        res.put("timeStream", timeStream);
 
 
         if (devicePage.getStatus() == 2 || devicePage.getStatus() == 3){
@@ -166,7 +186,7 @@ public class IndexController {
 
         StringBuffer sql = new StringBuffer();
         sql.append("select * from ");
-        res.put("lastOnLineTime", 0);
+        res.put("lastOnLineTime", "");
         res.put("lat", 0);
         res.put("long", 0);
         res.put("typeTitle", devicePage.getTypeTitle());

+ 18 - 3
src/main/java/cn/fastfun/controller/api/SysController.java

@@ -150,9 +150,9 @@ public class SysController {
         return new ApiDtDTO("", options);
     }
 
-    @ApiOperation(value = "权限菜单树")
-    @RequestMapping(value = "role/tree", method = RequestMethod.POST)
-    public ApiDTO menuTree(@RequestBody IdParam param) {
+    @ApiOperation(value = "登陆用户权限")
+    @RequestMapping(value = "logInrole/tree", method = RequestMethod.POST)
+    public ApiDTO logInRoleTree(@RequestBody IdParam param) {
         if (StringUtils.isEmpty(param.getId())) throw new ApiRuntimeException("没有角色编码");
         SysUserRole sysUserRole = sysUserRoleService.getOne(QueryParamExp.eq("userId", param.getId()));
         SysRole sysRole = sysRoleService.getOne(QueryParamExp.eq("code", sysUserRole.getRoleCode()));
@@ -169,6 +169,21 @@ public class SysController {
         return ApiDTO.ok(null, objectMap);
     }
 
+    @ApiOperation(value = "权限菜单树")
+    @RequestMapping(value = "role/tree", method = RequestMethod.POST)
+    public ApiDTO menuTree(@RequestBody IdParam param) {
+
+        Map<String, Object> objectMap = new HashMap<>();
+
+        List<SysRoleComponent> sysRoleComponentList = sysRoleComponentService.findAll(QueryParamExp.eq("roleCode", param.getId()));
+        List<String> checked = new ArrayList<>();
+        sysRoleComponentList.forEach(p -> {
+            checked.add(p.getComponentId());
+        });
+        objectMap.put("checked", checked);
+        return ApiDTO.ok(null, objectMap);
+    }
+
     /**
      * 数据保存
      */

+ 6 - 6
src/main/java/cn/fastfun/controller/param/BenchQueryParam.java

@@ -24,13 +24,13 @@ public class BenchQueryParam extends QueryParam{
             addParam(QueryParamExp.like("sn", "%".concat(sn).concat("%")));
     }
 
-    @ApiModelProperty(value = "设备类型", name = "checkStatus", example = "0, 0:未通过 ; 1:已通过;  空:全部")
-    private Integer checkStatus;
+    @ApiModelProperty(value = "设备类型", name = "type", example = "1, 1:电池 ; 2:电动车; 3:配件;  空:全部")
+    private Integer type;
 
-    @ApiModelProperty(value = "设备状态", name = "status", example = "[], 0:未入库,1:已入库,2:已调拨,3:已出库,4:已处置")
-    public void setStatus(List<Integer> status) {
-        if (!CollectionUtils.isEmpty(status)) {
-            addParam(QueryParamExp.in("status", status.toArray(new Integer[]{})));
+    @ApiModelProperty(value = "设备状态", name = "status", example = "0, 0:未入库,1:已入库,2:已调拨,3:已出库,4:已处置")
+    public void setStatus(Integer status) {
+        if (!StringUtils.isEmpty(status)) {
+            addParam(QueryParamExp.eq("status", status));
         }
     }
 

+ 16 - 0
src/main/java/cn/fastfun/service/AppDeviceLogService.java

@@ -1,8 +1,16 @@
 package cn.fastfun.service;
 
 import cn.fastfun.controller.param.*;
+import cn.fastfun.service.entity.AppDevice;
 import cn.fastfun.service.entity.AppDeviceLog;
+import com.bridge.dto.ApiDTO;
+import com.bridge.dto.QueryParamExp;
 import com.bridge.service.JpaService;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
 
 /**
  * 设备操作日志
@@ -16,6 +24,14 @@ public interface AppDeviceLogService extends JpaService<AppDeviceLog, String> {
      */
     void putInStorage(LibraryInFormParam param);
 
+    /**
+     * 设备自检
+
+     */
+
+    boolean selfCheck(String sn);
+
+
 
     /**
      * 设备划拨

+ 17 - 0
src/main/java/cn/fastfun/service/impl/AppDeviceLogServiceImpl.java

@@ -14,11 +14,17 @@ import com.bridge.dto.QueryParamExp;
 import com.bridge.exception.ApiRuntimeException;
 import com.bridge.service.JpaService;
 import com.bridge.service.impl.JpaServiceImp;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
 import io.swagger.models.auth.In;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.BooleanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
 
 import javax.annotation.Resource;
 import javax.persistence.Query;
@@ -69,6 +75,7 @@ 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.setInstorageTime(time);
                     appDeviceService.save(appDevice);
 
@@ -80,6 +87,16 @@ public class AppDeviceLogServiceImpl extends JpaServiceImp<AppDeviceLog, String>
         }
     }
 
+    @Override
+    @Transactional
+    public boolean selfCheck(String sn) {
+        boolean checkResult = false;
+        if (true){
+            checkResult = true;
+        }
+        return checkResult;
+    }
+
     @Override
     @Transactional
     public void transfer(TransferFormParam param) {