Parcourir la source

自定义项中第一个下拉类型的属性,在日报导出的页面中增加该筛选条件

yusm il y a 2 semaines
Parent
commit
cdf1200eb8

+ 5 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java

@@ -241,7 +241,9 @@ public class ReportController {
      * date 日期 格式yyyy-mm-dd
      */
     @RequestMapping("/exportReport")
-    public HttpRespMsg exportReport(String startDate, String endDate,@RequestParam(required = false) Integer exportType, Integer projectId,@RequestParam(defaultValue = "0") Integer stateKey,String departmentIds) {
+    public HttpRespMsg exportReport(String startDate, String endDate,@RequestParam(required = false) Integer exportType,
+                                    Integer projectId,@RequestParam(defaultValue = "0") Integer stateKey,String departmentIds,
+                                    String plate) {
         //startDate和endDate间隔不得超过1年
         DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
         LocalDate start = LocalDate.parse(startDate, dateTimeFormatter);
@@ -252,9 +254,9 @@ public class ReportController {
             return httpRespMsg;
         }
         if (exportType==null){
-            return reportService.exportReport(startDate, endDate,0, projectId,stateKey,departmentIds, request);
+            return reportService.exportReport(startDate, endDate,0, projectId,stateKey,departmentIds,plate, request);
         }else {
-            return reportService.exportReport(startDate, endDate,exportType, projectId,stateKey,departmentIds, request);
+            return reportService.exportReport(startDate, endDate,exportType, projectId,stateKey,departmentIds,plate, request);
         }
 
     }

+ 33 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserCustomController.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.management.platform.entity.SubUserCustom;
 import com.management.platform.entity.User;
 import com.management.platform.entity.UserCustom;
+import com.management.platform.mapper.SubUserCustomMapper;
 import com.management.platform.mapper.UserCustomMapper;
 import com.management.platform.mapper.UserMapper;
 import com.management.platform.service.SubUserCustomService;
@@ -21,6 +22,7 @@ import javax.servlet.http.HttpServletRequest;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Optional;
 import java.util.stream.Collectors;
 
 /**
@@ -42,6 +44,9 @@ public class UserCustomController {
     private SubUserCustomService subUserCustomService;
     @Resource
     private UserMapper userMapper;
+    @Resource
+    private SubUserCustomMapper subUserCustomMapper;
+
     @RequestMapping("/addOrMod")
     public HttpRespMsg addOrMod(String json, HttpServletRequest request){
         List<UserCustom> userCustomList = JSONArray.parseArray(json, UserCustom.class);
@@ -127,5 +132,33 @@ public class UserCustomController {
         httpRespMsg.data=map;
         return httpRespMsg;
     }
+
+    @RequestMapping("/getUserCustomFirstPullDown")
+    public HttpRespMsg getUserCustomFirstPullDown(HttpServletRequest request){
+        HttpRespMsg httpRespMsg=new HttpRespMsg();
+        User user = userMapper.selectById(request.getHeader("token"));
+        List<UserCustom> customList = userCustomService.list(new QueryWrapper<UserCustom>()
+                .eq("company_id", user.getCompanyId()).orderByAsc("id"));
+        Optional<UserCustom> first = customList.stream().filter(c -> c.getType() == 0).findFirst();
+        if (first.isPresent()) {
+            UserCustom custom = first.get();
+            HashMap<String, Object> map = new HashMap<>();
+            map.put("companyId",custom.getCompanyId());
+            map.put("name",custom.getName());
+            map.put("type",custom.getType());
+            for (int i = 0; i < customList.size(); i++) {
+                if(customList.get(i).getId().equals(custom.getId())){
+                    map.put("plate","plate"+(i+1));
+                    break;
+                }
+            }
+            List<SubUserCustom> subUserCustomList = subUserCustomMapper.selectList(new QueryWrapper<SubUserCustom>().eq("user_custom_id", custom.getId()));
+            map.put("subUserCustomList",subUserCustomList);
+            httpRespMsg.data=map;
+        }else {
+            httpRespMsg.data=null;
+        }
+        return httpRespMsg;
+    }
 }
 

+ 8 - 5
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/ReportMapper.java

@@ -32,7 +32,7 @@ public interface ReportMapper extends BaseMapper<Report> {
                                                      @Param("endDate") String endDate,
                                                      @Param("projectId") Integer projectId,
                                                      @Param("stateKey") Integer stateKey,
-                                                     @Param("branchDepartment")List<Integer> branchDepartment
+                                                     @Param("branchDepartment")List<Integer> branchDepartment,@Param("field")String field,@Param("fieldValue")String fieldValue
                                                  );
     List<HashMap<String, Object>> getAllReportByDateWithReportLog(@Param("startDate") String startDate,
                                                      @Param("companyId") Integer companyId,
@@ -40,7 +40,7 @@ public interface ReportMapper extends BaseMapper<Report> {
                                                      @Param("endDate") String endDate,
                                                      @Param("projectId") Integer projectId,
                                                      @Param("stateKey") Integer stateKey,
-                                                     @Param("branchDepartment")List<Integer> branchDepartment
+                                                     @Param("branchDepartment")List<Integer> branchDepartment,@Param("field")String field,@Param("fieldValue")String fieldValue
     );
 
     List<HashMap<String, Object>> getAllReportByDateNew(@Param("startDate") String startDate,
@@ -68,7 +68,7 @@ public interface ReportMapper extends BaseMapper<Report> {
                                                      @Param("projectId") Integer projectId,
                                                      @Param("stateKey") Integer stateKey,
                                                      @Param("branchDepartment")List<Integer> branchDepartment,
-                                                             @Param("ccProjectIds")List<Integer> ccProjectIds);
+                                                             @Param("ccProjectIds")List<Integer> ccProjectIds,@Param("field")String field,@Param("fieldValue")String fieldValue);
     List<HashMap<String, Object>> getProjectMembReportByDateWithReportLog(@Param("startDate") String startDate,
                                                              @Param("companyId") Integer companyId,
                                                              @Param("leaderId") String leaderId,
@@ -76,12 +76,15 @@ public interface ReportMapper extends BaseMapper<Report> {
                                                              @Param("projectId") Integer projectId,
                                                              @Param("stateKey") Integer stateKey,
                                                              @Param("branchDepartment")List<Integer> branchDepartment,
-                                                                          @Param("ccProjectIds")List<Integer> ccProjectIds);
+                                                                          @Param("ccProjectIds")List<Integer> ccProjectIds
+            ,@Param("field")String field,@Param("fieldValue")String fieldValue
+                                                                          );
     //获取部门下的人员的日报
     List<HashMap<String, Object>> getDeptMembReportByDate(@Param("startDate") String startDate,
                                                              @Param("companyId") Integer companyId,
                                                              @Param("deptIds") List<Integer> deptIds,
-                                                             @Param("endDate") String endDate, @Param("projectId") Integer projectId,@Param("stateKey")Integer stateKey,@Param("branchDepartment")List<Integer> branchDepartment, @Param("viewUserId")String viewUserId);
+                                                             @Param("endDate") String endDate, @Param("projectId") Integer projectId,@Param("stateKey")Integer stateKey,@Param("branchDepartment")List<Integer> branchDepartment,
+                                                          @Param("viewUserId")String viewUserId,@Param("field")String field,@Param("fieldValue")String fieldValue);
 
 
     //获取项目经理所管理的人员的报告

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ReportService.java

@@ -26,7 +26,7 @@ import java.util.Map;
 public interface ReportService extends IService<Report> {
     HttpRespMsg getReportList(String date, Integer deptId, String userId, Integer pageIndex, Integer pageSize, HttpServletRequest request);
 
-    HttpRespMsg exportReport(@RequestParam String startDate, @RequestParam String endDate,Integer exportType, Integer projectId,Integer stateKey,String departmentIds, HttpServletRequest request);
+    HttpRespMsg exportReport(@RequestParam String startDate, @RequestParam String endDate,Integer exportType, Integer projectId,Integer stateKey,String departmentIds,String plate, HttpServletRequest request);
 
     HttpRespMsg getReport(String date, HttpServletRequest request);
 

+ 16 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/DepartmentServiceImpl.java

@@ -10,6 +10,7 @@ import com.management.platform.entity.vo.SysRichFunction;
 import com.management.platform.mapper.*;
 import com.management.platform.service.DepartmentService;
 import com.management.platform.service.ExcelExportService;
+import com.management.platform.service.SysRoleFunctionService;
 import com.management.platform.service.WxCorpInfoService;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.ListUtil;
@@ -75,6 +76,8 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
     private WxCorpInfoService wxCorpInfoService;
     @Resource
     private CompanyDingdingMapper companyDingdingMapper;
+    @Resource
+    private SysRoleFunctionService sysRoleFunctionService;
 
     @Value("${corpId}")
     private String corpId;
@@ -1424,7 +1427,9 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
     public HttpRespMsg exportDeptStatistic(String startDate, String endDate, HttpServletRequest request) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         try {
-            Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
+            User user = userMapper.selectById(request.getHeader("token"));
+            Integer companyId = user.getCompanyId();
+            Integer hideTimeCount= sysRoleFunctionService.selectHideTimeCount(user.getRoleId());
             WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
             CompanyDingding dingding = companyDingdingMapper.selectOne(new QueryWrapper<CompanyDingding>().eq("company_id", companyId));
             HttpRespMsg msg = getDepartmentStatistics(null, startDate, endDate, request);
@@ -1455,7 +1460,11 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
                     item.add(departmentMasterVO.getDepartmentName());
                 }
                 if(!costList.stream().anyMatch(ct->ct.getCostTime()==null)){
-                    item.add(String.valueOf(departmentMasterVO.getCostTime()));
+                    if (hideTimeCount>0){
+                        item.add("*");
+                    }else {
+                        item.add(String.valueOf(departmentMasterVO.getCostTime()));
+                    }
                     bigDecimal=bigDecimal.add(BigDecimal.valueOf(departmentMasterVO.getCostTime()));
                 }
                 if(!costList.stream().anyMatch(ct->ct.getCostMoney()==null)){
@@ -1467,7 +1476,11 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
             //rowData.add("合计");
             rowData.add(MessageUtils.message("entry.total"));
             if(!costList.stream().anyMatch(ct->ct.getCostTime()==null)){
-                rowData.add(String.valueOf(bigDecimal.doubleValue()));
+                if (hideTimeCount>0){
+                    rowData.add("*");
+                }else {
+                    rowData.add(String.valueOf(bigDecimal.doubleValue()));
+                }
             }
             if(!costList.stream().anyMatch(ct->ct.getCostMoney()==null)){
                 rowData.add(totalCostMoney.toString());

+ 33 - 12
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -6402,10 +6402,18 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
 
     //导出报告
     @Override
-    public HttpRespMsg exportReport(@RequestParam String startDate, @RequestParam String endDate,Integer exportType, Integer projectId,Integer stateKey,String departmentIds, HttpServletRequest request) {
+    public HttpRespMsg exportReport(@RequestParam String startDate, @RequestParam String endDate,Integer exportType, Integer projectId,Integer stateKey,String departmentIds,String plate, HttpServletRequest request) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         DateFormat timeDf = new SimpleDateFormat("yyyy-MM-dd");
         try {
+            String field="";
+            String fieldValue="";
+            if (!StringUtils.isEmpty(plate)){
+                String[] strings = plate.split("-");
+                field=strings[0];
+                fieldValue=strings[1];
+
+            }
             String userId = request.getHeader("Token");
             User user = userMapper.selectById(userId);
             Integer hideTimeCount= sysRoleFunctionService.selectHideTimeCount(user.getRoleId());
@@ -6570,7 +6578,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                 //检查是否是部门负责人
                 List<Integer> allVisibleDeptIdList = getAllVisibleDeptIdList(user, null);
                 if (allVisibleDeptIdList.size() > 0) {
-                    allReportByDate = reportMapper.getDeptMembReportByDate(startDate, null, allVisibleDeptIdList, endDate, projectId,stateKey,branchDepartment, user.getId());
+                    allReportByDate = reportMapper.getDeptMembReportByDate(startDate, null, allVisibleDeptIdList, endDate, projectId,stateKey,branchDepartment, user.getId(),field,fieldValue);
                 }
 
                 List<HashMap<String, Object>> reportsFromProjects = null;
@@ -6586,16 +6594,16 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                 }
                 if (cnt > 0 || auditorPids != null) {
                     if (exportType == 0 && timeType.getShowFillauditTime() == 1) {
-                        reportsFromProjects = reportMapper.getProjectMembReportByDateWithReportLog(startDate, null, user.getId(), endDate, projectId,stateKey,branchDepartment, auditorPids);
+                        reportsFromProjects = reportMapper.getProjectMembReportByDateWithReportLog(startDate, null, user.getId(), endDate, projectId,stateKey,branchDepartment, auditorPids,field,fieldValue);
                     } else{
-                        reportsFromProjects = reportMapper.getProjectMembReportByDate(startDate, null, user.getId(), endDate, projectId,stateKey,branchDepartment, auditorPids);
+                        reportsFromProjects = reportMapper.getProjectMembReportByDate(startDate, null, user.getId(), endDate, projectId,stateKey,branchDepartment, auditorPids,field,fieldValue);
                     }
                 } else {
                     //普通员工只能看自己的
                     if (exportType == 0 && timeType.getShowFillauditTime() == 1) {
-                        reportsFromProjects = reportMapper.getAllReportByDateWithReportLog(startDate, null, user.getId(), endDate, projectId,stateKey,branchDepartment);
+                        reportsFromProjects = reportMapper.getAllReportByDateWithReportLog(startDate, null, user.getId(), endDate, projectId,stateKey,branchDepartment,field,fieldValue);
                     } else {
-                        reportsFromProjects = reportMapper.getAllReportByDate(startDate, null, user.getId(), endDate, projectId,stateKey,branchDepartment);
+                        reportsFromProjects = reportMapper.getAllReportByDate(startDate, null, user.getId(), endDate, projectId,stateKey,branchDepartment,field,fieldValue);
                     }
 
                 }
@@ -6615,9 +6623,9 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             else {
                 //看公司所有人的
                 if (exportType == 0 && timeType.getShowFillauditTime() == 1) {
-                    allReportByDate = reportMapper.getAllReportByDateWithReportLog(startDate, user.getCompanyId(), null, endDate, projectId,stateKey,branchDepartment);
+                    allReportByDate = reportMapper.getAllReportByDateWithReportLog(startDate, user.getCompanyId(), null, endDate, projectId,stateKey,branchDepartment,field,fieldValue);
                 } else {
-                    allReportByDate = reportMapper.getAllReportByDate(startDate, user.getCompanyId(), null, endDate, projectId,stateKey,branchDepartment);
+                    allReportByDate = reportMapper.getAllReportByDate(startDate, user.getCompanyId(), null, endDate, projectId,stateKey,branchDepartment,field,fieldValue);
                 }
             }
             //获取企业微信考勤数据
@@ -7818,7 +7826,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             return msg;
         }
         if(token.equals(thirdPartyInterface.getToken())){
-            List<HashMap<String, Object>> allReportByDate = reportMapper.getAllReportByDate(startDate,thirdPartyInterface.getCompanyId(), null, endDate, null, 1, null);
+            List<HashMap<String, Object>> allReportByDate = reportMapper.getAllReportByDate(startDate,thirdPartyInterface.getCompanyId(), null, endDate, null, 1, null,null,null);
             final CountDownLatch latch=new CountDownLatch(allReportByDate.size());
             for (HashMap<String, Object> map : allReportByDate) {
                 java.sql.Date sqlCreateDate= (java.sql.Date) map.get("createDate");
@@ -8950,6 +8958,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             userId = targetUserId;
         }
         User user = userMapper.selectById(userId);
+        Integer hideTimeCount= sysRoleFunctionService.selectHideTimeCount(user.getRoleId());
         Company company = companyMapper.selectById(user.getCompanyId());
         //根据targetDate获取本周的日期
         DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
@@ -9106,9 +9115,21 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
 
             //放入当天对应的日报
             List<Report> dateReportList = reportList.stream().filter(r -> r.getCreateDate().isEqual(itemDate)).collect(Collectors.toList());
-            item.put("reportList", dateReportList);
-            double sum = dateReportList.stream().mapToDouble(Report::getWorkingTime).sum();
-            item.put("filledTime", sum);
+            if(hideTimeCount>0){
+                for (Report report : dateReportList) {
+                    if (report.getWorkingTime()!=null){
+                        report.setWorkingTime(null);
+                        report.setEndTime("");
+                        report.setStartTime("");
+                    }
+                }
+                item.put("reportList", dateReportList);
+                item.put("filledTime", "*");
+            }else {
+                item.put("reportList", dateReportList);
+                double sum = dateReportList.stream().mapToDouble(Report::getWorkingTime).sum();
+                item.put("filledTime", sum);
+            }
             dateList.add(item);
         }
         reportMap.put("dateList", dateList);

+ 15 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ReportMapper.xml

@@ -117,6 +117,9 @@
                 #{deptId}
             </foreach>
         </if>
+        <if test="field !=null and field !='' and fieldValue !=null and fieldValue !='' ">
+            and  c.${field} = #{fieldValue}
+        </if>
 
         ORDER BY a.creator_id, a.create_date desc
     </select>
@@ -232,6 +235,9 @@
                 #{deptId}
             </foreach>
         </if>
+        <if test="field !=null and field !='' and fieldValue !=null and fieldValue !='' ">
+            and  c.${field} = #{fieldValue}
+        </if>
         group by a.id
         ORDER BY a.creator_id, a.create_date desc
     </select>
@@ -379,6 +385,9 @@
                 #{deptId}
             </foreach>
         </if>
+        <if test="field !=null and field !='' and fieldValue !=null and fieldValue !='' ">
+            and  c.${field} = #{fieldValue}
+        </if>
         ORDER BY a.creator_id, a.create_date desc
     </select>
 
@@ -448,6 +457,9 @@
                 #{deptId}
             </foreach>
         </if>
+        <if test="field !=null and field !='' and fieldValue !=null and fieldValue !='' ">
+            and  c.${field} = #{fieldValue}
+        </if>
         group by a.id
         ORDER BY a.creator_id, a.create_date desc
     </select>
@@ -509,6 +521,9 @@
             </foreach>
             or a.creator_id=#{viewUserId})
         </if>
+        <if test="field !=null and field !='' and fieldValue !=null and fieldValue !='' ">
+            and  c.${field} = #{fieldValue}
+        </if>
         ORDER BY a.creator_id, a.create_date desc
     </select>
     <!-- 批量获取员工某天的报告 -->