Przeglądaj źródła

添加调拨客户信息

zyg 1 rok temu
rodzic
commit
9212615130

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

@@ -1,6 +1,5 @@
 package cn.fastfun.controller.api;
 
-import cn.fastfun.controller.dto.DevicePageStatDTO;
 import cn.fastfun.controller.param.*;
 import cn.fastfun.service.AppDeviceLogService;
 import cn.fastfun.service.AppDeviceService;
@@ -22,7 +21,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
-import java.math.BigInteger;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -238,7 +236,9 @@ public class ApiAppDeviceLogController {
     @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 ");
+        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 ");
 
         // sn搜索
         if (!StringUtils.isEmpty(param.getSn())) {
@@ -274,12 +274,22 @@ public class ApiAppDeviceLogController {
         log.info("SQL: {}", sql.toString());
 
         ApiPageDTO page = appDeviceService.getListBySQL(sql.toString(), new HashMap<>(), param);
+
+        List<Map<String,Object>> customerList = appDeviceService.getListBySQL("select id,title from app_custom", new HashMap<>());
         // 组装数据
         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));
-                p.put("customTitle", "骑享科技");
+                if(p.get("out_custom_id")!=null) {
+                    if (customerList.size() > 0) {
+                        customerList.forEach(o -> {
+                            if (o.get("id").toString().equals(p.get("out_custom_id").toString())) {
+                                p.put("customTitle", o.get("title").toString());
+                            }
+                        });
+                    }
+                }
             }
             page.setData(list);
         }

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

@@ -170,6 +170,9 @@ public class AppDevice extends DateEntity {
     @Column(name = "owner_id")
     private String ownerId;
 
+    @ApiModelProperty(value = "客户", name = "customer", required = true)
+    @Column(name = "customer")
+    private String customer;
 
     public AppDevice(Map<String, Object> param) {
         setBatchNum(ObjectUtil.obj2String(param.get("pathId")));

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

@@ -216,12 +216,14 @@ public class AppDeviceLogServiceImpl extends JpaServiceImp<AppDeviceLog, String>
                     appDevice.setStatus(2); // 已划拨
                     appDevice.setTransferTime(time);
                     appDevice.setOwnerId(param.getCustomId()); // 设置归属
+                    appDevice.setCustomer(param.getCustomId()); // 设置归属
                     appDevice.setTfDescribe(param.getDescribe());
                     appDevice.setTfUsed(param.getUsed());
                     appDeviceService.save(appDevice);
 
                     AppDeviceLog appDeviceLog = new AppDeviceLog(p, appDevice.getImei()).toTransfer(param, time, batchNum, finalOperateID);
                     appDeviceLog.setOperator(utilService.getUserName());
+                    appDeviceLog.setOutCustomId(param.getCustomId());
                     save(appDeviceLog); // 记录划拨日志
                 }
                 else{