Min 1 year ago
parent
commit
2b86be5b6a

+ 37 - 11
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/UserServiceImpl.java

@@ -3,6 +3,7 @@ package com.management.platform.service.impl;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -1980,7 +1981,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
         try {
             String userId = request.getHeader("Token");
             User user = userMapper.selectById(userId);
+            TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
             WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
+            List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>().select(User::getId, User::getName, User::getCorpwxUserid).eq(User::getCompanyId, user.getCompanyId()));
             List<UserCustom> userCustomList = userCustomMapper.selectList(new QueryWrapper<UserCustom>().eq("company_id", user.getCompanyId()));
             //查看当前用户是否有人员成本的查看权限
             boolean canViewCost = sysFunctionService.hasPriviledge(user.getRoleId(), "人员成本管理");
@@ -2029,30 +2032,36 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
             //headCell.setCellValue("部门");
             headCell.setCellValue(MessageUtils.message("excel.department"));
             headCell.setCellStyle(headStyle);
+            if(timeType.getReportAuditType() == 5 || timeType.getReportAuditType() == 6){
+                headCell = headRow.createCell(5);
+                //headCell.setCellValue("部门");
+                headCell.setCellValue("直属审核人");
+                headCell.setCellStyle(headStyle);
+            }
 
             int minusIndex = -2;
             if (canViewCost) {
-                headCell = headRow.createCell(5);
+                headCell = headRow.createCell(6);
                 //headCell.setCellValue("月薪");
                 headCell.setCellValue(MessageUtils.message("excel.MonSalary"));
                 headCell.setCellStyle(headStyle);
-                headCell = headRow.createCell(6);
+                headCell = headRow.createCell(7);
                 //headCell.setCellValue("时薪");
                 headCell.setCellValue(MessageUtils.message("excel.hourlyWage"));
                 headCell.setCellStyle(headStyle);
                 minusIndex = 0;
             }
 
-            headCell = headRow.createCell(7+minusIndex);
+            headCell = headRow.createCell(8+minusIndex);
             //headCell.setCellValue("证书");
             headCell.setCellValue(MessageUtils.message("excel.certificate"));
             headCell.setCellStyle(headStyle);
             for (int i = 0; i < userCustomList.size(); i++) {
-                headCell = headRow.createCell(minusIndex+8+i);
+                headCell = headRow.createCell(minusIndex+9+i);
                 headCell.setCellValue(userCustomList.get(i).getName());
                 headCell.setCellStyle(headStyle);
             }
-            headCell = headRow.createCell(minusIndex+8+userCustomList.size());
+            headCell = headRow.createCell(minusIndex+9+userCustomList.size());
             //headCell.setCellValue("状态");
             headCell.setCellValue(MessageUtils.message("leave.status"));
             headCell.setCellStyle(headStyle);
@@ -2096,9 +2105,26 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
                 }else {
                     row.createCell(4).setCellValue(item.getDepartmentName());
                 }
+                if(timeType.getReportAuditType()==5||timeType.getReportAuditType()==6){
+                    if(item.getSuperiorId()!=null){
+                        Optional<User> first = userList.stream().filter(u ->u.getId().equals(item.getSuperiorId())).findFirst();
+                        if(first.isPresent()){
+                            if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                                row.createCell(5).setCellValue("$userName="+(first.get().getCorpwxUserid()==null?" ":first.get().getCorpwxUserid())+"$");
+                            }else {
+                                row.createCell(5).setCellValue(first.get().getName());
+                            }
+                        }else {
+                            row.createCell(5).setCellValue("");
+                        }
+                    }else {
+                        row.createCell(5).setCellValue("");
+                    }
+
+                }
                 if (canViewCost) {
-                    row.createCell(5).setCellValue(item.getMonthCost()==null? 0 : item.getMonthCost().intValue());
-                    row.createCell(6).setCellValue(item.getCost() == null?0.0 : item.getCost().doubleValue());
+                    row.createCell(6).setCellValue(item.getMonthCost()==null? 0 : item.getMonthCost().intValue());
+                    row.createCell(7).setCellValue(item.getCost() == null?0.0 : item.getCost().doubleValue());
                 }
                 List<UserCert> certList = userCertList.stream().distinct().filter(uc -> uc.getUserId().equals(item.getId())).collect(Collectors.toList());
                 if(certList.size()>0){
@@ -2110,9 +2136,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
                             s+=certList.get(i).getCertName()+" "+certList.get(i).getCertDate();
                         }
                     }
-                    row.createCell(7+minusIndex).setCellValue(s);
+                    row.createCell(8+minusIndex).setCellValue(s);
                 }else {
-                    row.createCell(7+minusIndex).setCellValue("");
+                    row.createCell(8+minusIndex).setCellValue("");
                 }
                 for (int i = 0; i < userCustomList.size(); i++) {
                     String value="";
@@ -2128,9 +2154,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
                         case 4:value=item.getPlate5()==null?"":item.getPlate5();
                             break;
                     }
-                    row.createCell(8+i+minusIndex).setCellValue(value);
+                    row.createCell(9+i+minusIndex).setCellValue(value);
                 }
-                row.createCell(8+userCustomList.size()+minusIndex).setCellValue(item.getIsActive()==1?MessageUtils.message("excel.normal"):MessageUtils.message("access.deactivated"));
+                row.createCell(9+userCustomList.size()+minusIndex).setCellValue(item.getIsActive()==1?MessageUtils.message("excel.normal"):MessageUtils.message("access.deactivated"));
                 rowNum++;
             }
             //生成Excel文件