Browse Source

bug修复

lmstack 3 years ago
parent
commit
511456d22a

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

@@ -168,6 +168,8 @@ public class ApiAppDeviceController {
         query.addParam(QueryParamExp.eq("sn", param.getSn()));
         Page<AppDeviceLog> deviceLogPage = appDeviceLogService.findByParam(query);
         AppDeviceLog lastDeviceLogPage = deviceLogPage.getContent().get(0);
+//        if ()
+//                deviceLogPage.getContent().get(0);
 
 
         AppDevice device = appDeviceService.getOne(new QueryParamExp("sn", param.getSn()));

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

@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -87,6 +88,7 @@ public class ApiAppDeviceLogController {
         }
         return page;
     }
+
     @ApiOperation(value = "批次入库 --> 入库 搜索 & 重置")
     @RequestMapping(value = "instorage/batch/inStorageQuery", method = RequestMethod.POST)
     public ApiPageDTO inStorageBatchInStorageQuery(@RequestBody DeviceBatchQueryParam param) {
@@ -107,12 +109,11 @@ public class ApiAppDeviceLogController {
     public ApiPageDTO inStoragePageQuery(@RequestBody LibraryInQueryParam param) {
 
         StringBuffer sql = new StringBuffer();
-        if(CollectionUtils.isEmpty(param.getCheckStatus())){
+        if (CollectionUtils.isEmpty(param.getCheckStatus())) {
             sql.append("SELECT * FROM app_device_log WHERE type=1");
-        }
-        else{
-            sql.append("SELECT * FROM app_device_log WHERE type=1 AND sn IN(SELECT sn FROM app_device WHERE check_status="+
-                    param.getCheckStatus().get(0).toString()+")");
+        } else {
+            sql.append("SELECT * FROM app_device_log WHERE type=1 AND sn IN(SELECT sn FROM app_device WHERE check_status=" +
+                    param.getCheckStatus().get(0).toString() + ")");
         }
 
         log.info("SQL: {}", sql.toString());
@@ -153,9 +154,10 @@ public class ApiAppDeviceLogController {
         deviceLogService.transfer(param);
         return ApiDTO.ok();
     }
+
     @ApiOperation(value = "调回平台 ")
     @RequestMapping(value = "transferBack", method = RequestMethod.POST)
-    public ApiDTO transferBack(@RequestBody @ApiParam(name = "回调参数", value = "输入sn", required = true) TransferFormParam  param) {
+    public ApiDTO transferBack(@RequestBody @ApiParam(name = "回调参数", value = "输入sn", required = true) TransferFormParam param) {
         deviceLogService.transferBack(param);
         return ApiDTO.ok();
     }
@@ -164,7 +166,6 @@ public class ApiAppDeviceLogController {
     @RequestMapping(value = "transfer/detialQuery", method = RequestMethod.POST)
     public ApiPageDTO transferDetialQuery(@RequestBody detialQueryParam param) {
         QueryParam query = new QueryParam();
-
         query.addParam(QueryParamExp.eq("operateID", param.getOperateID()));
         query.addParam(QueryParamExp.eq("type", 2));
         Page<AppDeviceLog> deviceLogPage = deviceLogService.findByParam(query);
@@ -173,13 +174,17 @@ public class ApiAppDeviceLogController {
             AppDevice device = new AppDevice();
             device.setImei(p.getImei());
             appDeviceService.addImeiTitle(device);
+            device.setImei(p.getImei());
+            appDeviceService.addImeiTitle(device);
             p.appendFormDevice(device);
+            p.appendInTime(device);
         });
+
         return new ApiPageDTO(null, deviceLogPage);
 
     }
 
-        @ApiOperation(value = "设备调拨 搜索 & 重置")
+    @ApiOperation(value = "设备调拨 搜索 & 重置")
     @RequestMapping(value = "transfer/pageQuery", method = RequestMethod.POST)
     public ApiPageDTO transferPageQuery(@RequestBody LogTransferQueryParam param) {
         StringBuffer sql = new StringBuffer("select t.batch_num,t.operate_id, t.add_time,count(0) as total,t.tf_event,t.tf_device_type,t.tf_used,t.tf_describe,t.out_custom_id,t.operator,t.remarks from app_device_log t where t.type = 2");
@@ -202,7 +207,7 @@ public class ApiAppDeviceLogController {
 
         ApiPageDTO page = appDeviceService.getListBySQL(sql.toString(), new HashMap<>(), param);
         // 组装数据
-        if(null !=  page.getData()) {
+        if (null != page.getData()) {
             List<Map<String, Object>> list = (List<Map<String, Object>>) page.getData();
             for (Map<String, Object> p : list) {
                 p.put("add_time", DateUtils.toString(ObjectUtil.obj2Date(p.get("add_time")), DateUtils.YMDHMS));
@@ -249,7 +254,7 @@ public class ApiAppDeviceLogController {
         log.info("SQL: {}", sql.toString());
 
         ApiPageDTO page = appDeviceService.getListBySQL(sql.toString(), new HashMap<>(), param);
-        if(null != page.getData()) {
+        if (null != page.getData()) {
             // 组装数据
             List<Map<String, Object>> list = (List<Map<String, Object>>) page.getData();
             for (Map<String, Object> p : list) {
@@ -307,18 +312,20 @@ public class ApiAppDeviceLogController {
     @RequestMapping(value = "outstorage/detialQuery", method = RequestMethod.POST)
     public ApiPageDTO outDetialQuery(@RequestBody detialQueryParam param) {
         QueryParam query = new QueryParam();
-
         query.addParam(QueryParamExp.eq("operateID", param.getOperateID()));
         query.addParam(QueryParamExp.eq("type", 3));
-
         Page<AppDeviceLog> deviceLogPage = deviceLogService.findByParam(query);
 
         deviceLogPage.getContent().forEach(p -> {
             AppDevice device = new AppDevice();
             device.setImei(p.getImei());
             appDeviceService.addImeiTitle(device);
+            device.setImei(p.getImei());
+            appDeviceService.addImeiTitle(device);
             p.appendFormDevice(device);
+            p.appendInTime(device);
         });
+
         return new ApiPageDTO(null, deviceLogPage);
 
     }
@@ -326,7 +333,7 @@ public class ApiAppDeviceLogController {
     @ApiOperation(value = "设备出库 搜索 & 重置")
     @RequestMapping(value = "outstorage/pageQuery", method = RequestMethod.POST)
     public ApiPageDTO outPageQuery(@RequestBody OutQueryParam param) {
-        StringBuffer sql = new StringBuffer("select t.batch_num,t1.operate_id,t.add_time,count(0) as total,t.out_type,t.receiver_name,t.receiver_phone,t.remarks,t.out_custom_id,t.operator,t.update_time from app_device_log t where t.type = 3");
+        StringBuffer sql = new StringBuffer("select t.batch_num,t.operate_id,t.add_time,count(0) as total,t.out_type,t.receiver_name,t.receiver_phone,t.remarks,t.out_custom_id,t.operator,t.update_time from app_device_log t where t.type = 3");
 
         // sn搜索
         if (!StringUtils.isEmpty(param.getSn())) {
@@ -338,7 +345,7 @@ public class ApiAppDeviceLogController {
             sql.append(StringUtils.isEmpty(param.getSn()) ? "where" : "and");
             sql.append(" t.out_type = '").append(param.getOutType()).append("'");
         }
-        sql.append(" group by t1.operate_id");
+        sql.append(" group by t.operate_id");
         if (!StringUtils.isEmpty(param.getOrderBy())) {
             sql.append(param.getOrderBy());
         }
@@ -352,7 +359,7 @@ public class ApiAppDeviceLogController {
                 p.put("add_time", DateUtils.toString(ObjectUtil.obj2Date(p.get("add_time")), DateUtils.YMDHMS));
                 p.put("update_time", DateUtils.toString(ObjectUtil.obj2Date(p.get("update_time")), DateUtils.YMDHMS));
                 p.put("operator", "admin");
-                p.put("out_type",String.valueOf(p.get("out_type")));
+                p.put("out_type", String.valueOf(p.get("out_type")));
             }
             page.setData(list);
         }
@@ -393,7 +400,7 @@ public class ApiAppDeviceLogController {
         log.info("SQL: {}", sql.toString());
 
         ApiPageDTO page = appDeviceService.getListBySQL(sql.toString(), new HashMap<>(), param);
-        if(null != page.getData()) {
+        if (null != page.getData()) {
             // 组装数据
             List<Map<String, Object>> list = (List<Map<String, Object>>) page.getData();
             for (Map<String, Object> p : list) {
@@ -427,8 +434,4 @@ public class ApiAppDeviceLogController {
     }
 
 
-
-
-
-
 }

+ 3 - 3
src/main/java/cn/fastfun/controller/param/TransferFormParam.java

@@ -16,12 +16,12 @@ public class TransferFormParam {
     @ApiModelProperty(value = "设备编号", name = "sn")
     private List<String> sn;
 
-    @ApiModelProperty(value = "拨设备类型", name = "deviceType", required = true)
-    private String deviceType;
+    @ApiModelProperty(value = "拨设备类型", name = "deviceType", required = true)
+    private Integer deviceType;
 
 
     @ApiModelProperty(value = "用途", name = "used", required = true)
-    private String used;
+    private Integer used;
 
 
     @ApiModelProperty(value = "描述", name = "describe", required = true)

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

@@ -83,6 +83,12 @@ public class AppDevice extends DateEntity {
     @Column(name = "deliver_time")
     private Date deliverTime;
 
+    @ApiModelProperty(value = "入库时间", name = "transferTime", required = true)
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @Column(name = "instorage_time")
+    private Date instorageTime;
+
     @ApiModelProperty(value = "最新调拨时间", name = "transferTime", required = true)
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")

+ 15 - 2
src/main/java/cn/fastfun/service/entity/AppDeviceLog.java

@@ -6,12 +6,15 @@ import cn.fastfun.controller.param.LibraryOutFormParam;
 import cn.fastfun.controller.param.TransferBySnQueryParam;
 import cn.fastfun.controller.param.TransferFormParam;
 import com.bridge.entity.DateEntity;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import io.swagger.annotations.ApiModelProperty;
+import io.swagger.models.auth.In;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import javax.persistence.Column;
 import javax.persistence.Entity;
@@ -77,12 +80,12 @@ public class AppDeviceLog extends DateEntity {
 
     @ApiModelProperty(value = "划拨设备类型", name = "tfDeviceType", required = true)
     @Column(name = "tf_device_type")
-    private String tfDeviceType;
+    private Integer tfDeviceType;
 
 
     @ApiModelProperty(value = "用途", name = "tfUsed", required = true)
     @Column(name = "tf_used")
-    private String tfUsed;
+    private Integer tfUsed;
 
 
     @ApiModelProperty(value = "描述", name = "tfDescribe", required = true)
@@ -200,4 +203,14 @@ public class AppDeviceLog extends DateEntity {
         setSpecTitle(device.getSpecTitle());
         setExpandTitle(device.getExpandTitle());
     }
+
+    @ApiModelProperty(value = "入库时间", name = "handleTime", required = true)
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @Column(name = "instorage_time")
+    private Date instorageTime;
+
+    public void appendInTime(AppDevice device) {
+        setInstorageTime(device.getInstorageTime());
+    }
 }

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

@@ -145,6 +145,7 @@ public class AppDeviceLogServiceImpl extends JpaServiceImp<AppDeviceLog, String>
         if (null == appDevice) throw new ApiRuntimeException("设备信息不存在!");
         if (3 != appDevice.getStatus()) throw new ApiRuntimeException("设备不是出库状态!");
         batchNum = appDevice.getBatchNum();
+        appDevice.setInstorageTime(time);
         appDevice.setStatus(1); // 已入库
         appDevice.setTransferBackTime(time);
         appDeviceService.save(appDevice);