Bladeren bron

修复财务核算成本,费用报销上传的相关bug

seyason 2 jaren geleden
bovenliggende
commit
0fc6904433

+ 8 - 5
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ExpenseSheetServiceImpl.java

@@ -396,23 +396,26 @@ public class ExpenseSheetServiceImpl extends ServiceImpl<ExpenseSheetMapper, Exp
                 if (expenseTypeCell == null) {
                     throw new Exception("费用类型不能为空");
                 }
-                if (reportDateCell == null  || StringUtils.isEmpty(reportDateCell.getStringCellValue())) {
+                if (reportDateCell == null  || reportDateCell.getDateCellValue() == null) {
                     throw new Exception("填报日期不能为空");
                 }
                 //做完非空校验后,进行姓名处理
-                List<String> userNameList=new ArrayList<>();
+
                 String reimburserName = reimburserCell.getStringCellValue();
-                userNameList.add(reimburserName);
+
                 HttpRespMsg respMsg= null;
+                List<User> targetUserList= new ArrayList<>();
                 if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                    List<String> userNameList=new ArrayList<>();
+                    userNameList.add(reimburserName);
                     System.out.println("参与搜素的人员列表"+userNameList);
                     respMsg = wxCorpInfoService.getBatchSearchUserInfo(wxCorpInfo, userNameList,null);
                     if(respMsg.code.equals("0")){
                         msg.setError("姓名为["+String.valueOf(respMsg.data)+"]的人员存在重复,请使用工号!");
                         return msg;
                     }
+                    targetUserList = (List<User>) respMsg.data;
                 }
-                List<User> targetUserList= (List<User>) respMsg.data;
                 ExpenseSheet expenseSheet = new ExpenseSheet();
                 if(functionList.size()>0){
                     expenseSheet.setStatus(0);
@@ -446,7 +449,7 @@ public class ExpenseSheetServiceImpl extends ServiceImpl<ExpenseSheetMapper, Exp
                 }else {
                     first = userList.stream().filter(us -> us.getName().equals(reimburserName)).findFirst();
                 }
-                if (first.isPresent()) {
+                if (first != null && first.isPresent()) {
                     expenseSheet.setOwnerId(first.get().getId());
                     expenseSheet.setOwnerName(first.get().getName());
                 } else {

+ 19 - 12
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/FinanceServiceImpl.java

@@ -220,8 +220,14 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
                     nameStartIndex = 1;
                 }
                 Cell nameCell = row.getCell(nameStartIndex + 0);
-                String name = nameCell.getStringCellValue().trim().replaceAll("\\u00a0", "");
-                if(name.equals("姓名")){
+                String name = null;
+                if (nameCell == null) {
+                    msg.setError("姓名不能为空");
+                    return msg;
+                } else {
+                    name = nameCell.getStringCellValue().trim().replaceAll("\\u00a0", "");
+                }
+                if("姓名".equals(name)){
                     continue;
                 }
                 //判断工号是否填写
@@ -319,16 +325,17 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
                 if (field3 != null)field3.setCellType(CellType.STRING);
 
                 finance.setCompanyId(companyId);
-                Optional<User> userOp;
-                if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
-                    Optional<User> optional = targetUserList.stream().filter(tl -> tl.getName().equals(name)).findFirst();
-                    userOp= userList.stream().filter(u ->((optional.isPresent()&&u.getCorpwxUserid()!=null&&u.getCorpwxUserid().equals(optional.get().getCorpwxUserid())))).findFirst();
-                }else {
-                    userOp= userList.stream().filter(u -> u.getName().equals(name)).findFirst();
-                }
-                if(userOp.isPresent()){
-                    finance.setName(userOp.get().getName());
-                }
+//                Optional<User> userOp;
+//                if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+//                    Optional<User> optional = targetUserList.stream().filter(tl -> tl.getName().equals(name)).findFirst();
+//                    userOp= userList.stream().filter(u ->((optional.isPresent()&&u.getCorpwxUserid()!=null&&u.getCorpwxUserid().equals(optional.get().getCorpwxUserid())))).findFirst();
+//                }else {
+//                    userOp= userList.stream().filter(u -> u.getName().equals(name)).findFirst();
+//                }
+//                if(userOp.isPresent()){
+//
+//                }
+                finance.setName(name);
                 //工号模式下,工号也不是必填,有工号优先按工号匹配
                 if (includeJobNumber) {
                     finance.setJobNumber(jobNumberCell!=null?jobNumberCell.getStringCellValue():null);

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

@@ -352,9 +352,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
             }
             //建筑工程版项目总进度计算
             Company company = companyMapper.selectById(companyId);
-            List<PpMembs> ppMembList = null;
-            List<ProjectProfession> ppList = null;
-            if (company.getPackageEngineering() == 1) {
+            List<PpMembs> ppMembList = new ArrayList<>();
+            List<ProjectProfession> ppList = new ArrayList<>();
+            if (company.getPackageEngineering() == 1 && projectIds.size() > 0) {
                 ppMembList = ppMembsMapper.selectList(new QueryWrapper<PpMembs>().in("project_id", projectIds));
                 ppList = projectProfessionMapper.selectList(new QueryWrapper<ProjectProfession>().in("project_id", projectIds));
             }

+ 26 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/UserServiceImpl.java

@@ -333,8 +333,32 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
                 }
                 if (first == null || !first.isPresent()) {
                     //按照姓名匹配
-                    first = userList.stream().filter(u ->
-                            u.getName().equals(name)).findFirst();
+                    WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
+                    if (wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1) {
+                        //需要转译的情况;TODO: 验收通过后抽取出去,改成批量一次性搜索全部姓名
+                        List<String> userNameList = new ArrayList<>();
+                        userNameList.add(name);
+                        HttpRespMsg respMsg = null;
+                        try {
+                            respMsg = wxCorpInfoService.getBatchSearchUserInfo(wxCorpInfo, userNameList,null);
+                            if(respMsg.code.equals("0")){
+                                msg.setError("["+String.valueOf(respMsg.data)+"]在系统中为重名人员,请完善工号信息!");
+                                return msg;
+                            }
+                            List<User> targetUserList= (List<User>) respMsg.data;
+                            if (targetUserList.size() > 0) {
+                                User targetU = targetUserList.get(0);
+                                first = userList.stream().filter(u->u.getCorpwxUserid() != null && u.getCorpwxUserid().equals(targetU.getCorpwxUserid())).findFirst();
+                            }
+                        } catch (Exception exception) {
+                            exception.printStackTrace();
+                            msg.setError(exception.getMessage());
+                            return msg;
+                        }
+                    } else {
+                        first = userList.stream().filter(u ->
+                                u.getName().equals(name)).findFirst();
+                    }
                 }
                 if (first != null && first.isPresent()) {
                     if (salaryCell != null) {

+ 1 - 0
fhKeeper/formulahousekeeper/timesheet/src/views/project/finance.vue

@@ -1340,6 +1340,7 @@ import { error } from 'dingtalk-jsapi';
                 }
                 if (index === 2 && this.user.timeType.financeJobnumEnabled == 1) {
                     sums[index] = '';
+                    return;
                 }
                 const values = data.map(item => Number(item[column.property]));
                 if (!values.every(value => isNaN(value))) {