Преглед изворни кода

动态显示自定义字段以及相关bug

cs пре 2 година
родитељ
комит
d38618a5b4

+ 23 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserController.java

@@ -4,6 +4,8 @@ package com.management.platform.controller;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.management.platform.entity.FeishuInfo;
 import com.management.platform.entity.User;
+import com.management.platform.entity.UserCustom;
+import com.management.platform.mapper.UserCustomMapper;
 import com.management.platform.service.FeishuInfoService;
 import com.management.platform.service.UserService;
 import com.management.platform.util.HttpRespMsg;
@@ -40,6 +42,9 @@ public class UserController {
     @Resource
     private FeishuInfoService feishuInfoService;
 
+    @Resource
+    private UserCustomMapper userCustomMapper;
+
     /**
      * 登录网页端
      * username 用户名
@@ -278,5 +283,23 @@ public class UserController {
         return userService.areaData(token);
     }
 
+    /**
+     * 返回用户自定义的地区名称
+     * @return
+     */
+    @RequestMapping("/areaName")
+    public HttpRespMsg areaName(HttpServletRequest request){
+        HttpRespMsg httpRespMsg=new HttpRespMsg();
+        String token = request.getHeader("token");
+        User user = userService.getById(token);
+        List<UserCustom> userCustoms = userCustomMapper.selectList(new QueryWrapper<UserCustom>().eq("company_id", user.getCompanyId()).orderByAsc("id"));
+        String customName = "";
+        if (userCustoms.size() != 0){
+            customName = userCustoms.get(0).getName();
+        }
+        httpRespMsg.data = customName;
+        return httpRespMsg;
+    }
+
 }
 

+ 15 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.util.StringUtil;
 import com.management.platform.entity.*;
 import com.management.platform.entity.vo.*;
 import com.management.platform.mapper.*;
@@ -9772,6 +9773,11 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         User user = userMapper.selectById(request.getHeader("token"));
         WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
+        List<UserCustom> userCustoms = userCustomMapper.selectList(new QueryWrapper<UserCustom>().eq("company_id", user.getCompanyId()).orderByAsc("id"));
+        String customName = "";
+        if (userCustoms.size() != 0){
+            customName = userCustoms.get(0).getName();
+        }
         HttpRespMsg fteData = getFTEData(null, null, month, area, request);
         Map<String, Object> data = (Map<String, Object>) (Map<String, Object>) fteData.data;
         List<Map<String, Object>> resultList = (List<Map<String, Object>>) data.get("resultList");
@@ -9780,7 +9786,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         List<String> titleList=new ArrayList<>();
         List<String> subtitle=new ArrayList<>();
         Integer no = 0;
-        titleList.add("地区");
+        titleList.add(customName);
         titleList.add("序号");
         titleList.add("CRC姓名");
         titleList.add("项目号");
@@ -9802,10 +9808,15 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         Float aTimeSum = 0.0F;
         Float aFteSum = 0.0F;
         for (int i = 0; i < resultList.size(); i++) {
+            if (!resultList.get(i).containsKey("area")){
+                resultList.get(i).put("area","无");
+            }else if(org.apache.commons.lang3.StringUtils.isBlank(resultList.get(i).get("area").toString())){
+                resultList.get(i).put("area","无");
+            }
             ArrayList<String> row = new ArrayList<>();
             if (i == 0){
                 no += 1;
-                row.add(resultList.get(i).get("area")==null?"无":resultList.get(i).get("area").toString());
+                row.add(resultList.get(i).get("area").toString());
                 row.add(no + "");
                 if (wxCorpInfo != null && wxCorpInfo.getSaasSyncContact().equals(1)){
                     row.add(resultList.get(i).get("corpwx_userid") + "");
@@ -9907,7 +9918,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 ArrayList<String> sum = new ArrayList<>();
                 sum.add("");
                 sum.add("");
-                sum.add("地区合计");
+                sum.add(customName + "合计");
                 sum.add("");
                 sum.add("");
                 sum.add(aTimeSum.toString());
@@ -9965,7 +9976,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 ArrayList<String> sum = new ArrayList<>();
                 sum.add("");
                 sum.add("");
-                sum.add("地区合计");
+                sum.add(customName + "合计");
                 sum.add("");
                 sum.add("");
                 sum.add(aTimeSum.toString());