Explorar el Código

Merge branch 'master' of http://47.100.37.243:10080/wutt/manHourHousekeeper

cs hace 2 años
padre
commit
f17d58510d

+ 14 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ExpenseSheetServiceImpl.java

@@ -63,6 +63,8 @@ public class ExpenseSheetServiceImpl extends ServiceImpl<ExpenseSheetMapper, Exp
     private SysFunctionMapper sysFunctionMapper;
     @Resource
     private ExpenseTypeMapper expenseTypeMapper;
+    @Resource
+    private WxCorpInfoMapper wxCorpInfoMapper;
     @Override
     public HttpRespMsg add(ExpenseSheet sheet, String items, String userId) {
         HttpRespMsg msg = new HttpRespMsg();
@@ -217,6 +219,7 @@ public class ExpenseSheetServiceImpl extends ServiceImpl<ExpenseSheetMapper, Exp
     public HttpRespMsg importData(HttpServletRequest request,MultipartFile[] files) {
         HttpRespMsg msg = new HttpRespMsg();
         User user = userMapper.selectById(request.getHeader("token"));
+        WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
         //然后处理文件
         for (MultipartFile multipartFile : files) {
             String fileName = multipartFile.getOriginalFilename();
@@ -294,12 +297,21 @@ public class ExpenseSheetServiceImpl extends ServiceImpl<ExpenseSheetMapper, Exp
                 LocalDate localDate = Instant.ofEpochMilli(reportDateCell.getDateCellValue().getTime())
                         .atZone(ZoneId.systemDefault()).toLocalDate();
                 expenseSheet.setCreateDate(localDate);
-                Optional<User> first = userList.stream().filter(us -> us.getName().equals(reimburserCell.getStringCellValue())).findFirst();
+                Optional<User> first;
+                if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                    first = userList.stream().filter(us -> us.getName().equals(reimburserCell.getStringCellValue())).findFirst();
+                }else {
+                    first = userList.stream().filter(us -> us.getName().equals(reimburserCell.getStringCellValue())||(us.getJobNumber()!=null&&us.getJobNumber().equals(reimburserCell.getStringCellValue()))).findFirst();
+                }
                 if (first.isPresent()) {
                     expenseSheet.setOwnerId(first.get().getId());
                     expenseSheet.setOwnerName(first.get().getName());
                 } else {
-                    throw new Exception("报销人[" +reimburserCell+"]不存在");
+                    if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                        throw new Exception("报销人[" +reimburserCell+"]不存在");
+                    }else {
+                        throw new Exception("报销人/工号[" +reimburserCell+"]不存在");
+                    }
                 }
                 expenseSheet.setOperatorId(user.getId());
                 expenseSheet.setRemark(remarksCell.getStringCellValue());

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

@@ -3228,12 +3228,12 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                             Optional<User> first;
                             Integer exception=null;
                             if(split.length==1){
-                                if(wxCorpInfo.getSaasSyncContact()!=1){
+                                if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()!=1){
                                     first= userList.stream().filter(u -> u.getName().equals(split[0])||(u.getJobNumber()!=null&&u.getJobNumber().equals(split[0]))).findFirst();
                                 }else {first= userList.stream().filter(u ->(u.getJobNumber()!=null&&u.getJobNumber().equals(split[0]))).findFirst();}
                                 exception=0;
                             }else {
-                                if(wxCorpInfo.getSaasSyncContact()!=1){
+                                if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()!=1){
                                     first= userList.stream().filter(u -> u.getName().equals(split[0])&&(u.getJobNumber()!=null&&u.getJobNumber().equals(split[1]))).findFirst();
                                     exception=1;
                                 }else first= userList.stream().filter(u ->(u.getJobNumber()!=null&&u.getJobNumber().equals(split[1]))).findFirst();
@@ -3243,7 +3243,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                 project.setInchargerName(first.get().getName());
                             } else {
                                 switch (exception){
-                                    case 0:throw new Exception(wxCorpInfo.getSaasSyncContact()==1?"项目负责人工号为["+split[0]+"]的人员不存在":"项目负责人姓名/工号为["+split[0]+"]的人员不存在");
+                                    case 0:throw new Exception(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1?"项目负责人工号为["+split[0]+"]的人员不存在":"项目负责人姓名/工号为["+split[0]+"]的人员不存在");
                                     case 1:throw new Exception("项目负责人["+split[0]+"]姓名与工号不匹配");
                                 }
                             }
@@ -3324,12 +3324,12 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                         Optional<User> first;
                         Integer exception=null;
                         if(split.length==1){
-                            if(wxCorpInfo.getSaasSyncContact()!=1){
+                            if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()!=1){
                                 first= userList.stream().filter(u -> u.getName().equals(split[0])||(u.getJobNumber()!=null&&u.getJobNumber().equals(split[0]))).findFirst();
                             }else {first= userList.stream().filter(u ->(u.getJobNumber()!=null&&u.getJobNumber().equals(split[0]))).findFirst();}
                             exception=0;
                         }else {
-                            if(wxCorpInfo.getSaasSyncContact()!=1){
+                            if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()!=1){
                                 first= userList.stream().filter(u -> u.getName().equals(split[0])&&(u.getJobNumber()!=null&&u.getJobNumber().equals(split[1]))).findFirst();
                                 exception=1;
                             }else first= userList.stream().filter(u ->(u.getJobNumber()!=null&&u.getJobNumber().equals(split[1]))).findFirst();
@@ -3341,7 +3341,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                             participationList.add(p);
                         } else {
                             switch (exception){
-                                case 0:throw new Exception(wxCorpInfo.getSaasSyncContact()==1?"参与人工号为["+split[0]+"]的人员不存在":"参与人姓名/工号为["+split[0]+"]的人员不存在");
+                                case 0:throw new Exception(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1?"参与人工号为["+split[0]+"]的人员不存在":"参与人姓名/工号为["+split[0]+"]的人员不存在");
                                 case 1:throw new Exception("参与人["+split[0]+"]姓名与工号不匹配");
                             }
                         }
@@ -3364,12 +3364,12 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                 Optional<User> first;
                                 Integer exception=null;
                                 if(split.length==1){
-                                    if(wxCorpInfo.getSaasSyncContact()!=1){
+                                    if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()!=1){
                                         first= userList.stream().filter(u -> u.getName().equals(split[0])||(u.getJobNumber()!=null&&u.getJobNumber().equals(split[0]))).findFirst();
                                     }else {first= userList.stream().filter(u ->(u.getJobNumber()!=null&&u.getJobNumber().equals(split[0]))).findFirst();}
                                     exception=0;
                                 }else {
-                                    if(wxCorpInfo.getSaasSyncContact()!=1){
+                                    if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()!=1){
                                         first= userList.stream().filter(u -> u.getName().equals(split[0])&&(u.getJobNumber()!=null&&u.getJobNumber().equals(split[1]))).findFirst();
                                         exception=1;
                                     }else first= userList.stream().filter(u ->(u.getJobNumber()!=null&&u.getJobNumber().equals(split[1]))).findFirst();
@@ -3384,7 +3384,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                     }
                                 } else {
                                     switch (exception){
-                                        case 0:throw new Exception(wxCorpInfo.getSaasSyncContact()==1?"参与人工号为["+split[0]+"]的人员不存在":"参与人姓名/工号为["+split[0]+"]的人员不存在");
+                                        case 0:throw new Exception(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1?"参与人工号为["+split[0]+"]的人员不存在":"参与人姓名/工号为["+split[0]+"]的人员不存在");
                                         case 1:throw new Exception("参与人["+split[0]+"]姓名与工号不匹配");
                                     }
                                 }
@@ -3739,12 +3739,12 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                             Optional<User> first;
                             Integer exception=null;
                             if(split.length==1){
-                                if(wxCorpInfo.getSaasSyncContact()!=1){
+                                if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()!=1){
                                     first= userList.stream().filter(u -> u.getName().equals(split[0])||(u.getJobNumber()!=null&&u.getJobNumber().equals(split[0]))).findFirst();
                                 }else {first= userList.stream().filter(u ->(u.getJobNumber()!=null&&u.getJobNumber().equals(split[0]))).findFirst();}
                                 exception=0;
                             }else {
-                                if(wxCorpInfo.getSaasSyncContact()!=1){
+                                if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()!=1){
                                     first= userList.stream().filter(u -> u.getName().equals(split[0])&&(u.getJobNumber()!=null&&u.getJobNumber().equals(split[1]))).findFirst();
                                     exception=1;
                                 }else first= userList.stream().filter(u ->(u.getJobNumber()!=null&&u.getJobNumber().equals(split[1]))).findFirst();
@@ -3754,7 +3754,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                 project.setInchargerName(first.get().getName());
                             } else {
                                 switch (exception){
-                                    case 0:throw new Exception(wxCorpInfo.getSaasSyncContact()==1?"项目负责人工号为["+split[0]+"]的人员不存在":"项目负责人姓名/工号为["+split[0]+"]的人员不存在");
+                                    case 0:throw new Exception(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1?"项目负责人工号为["+split[0]+"]的人员不存在":"项目负责人姓名/工号为["+split[0]+"]的人员不存在");
                                     case 1:throw new Exception("项目负责人["+split[0]+"]姓名与工号不匹配");
                                 }
                             }
@@ -4315,12 +4315,12 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                         Optional<User> first;
                         Integer exception=null;
                         if(split.length==1){
-                            if(wxCorpInfo.getSaasSyncContact()!=1){
+                            if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()!=1){
                                 first= userList.stream().filter(u -> u.getName().equals(split[0])||(u.getJobNumber()!=null&&u.getJobNumber().equals(split[0]))).findFirst();
                             }else {first= userList.stream().filter(u ->(u.getJobNumber()!=null&&u.getJobNumber().equals(split[0]))).findFirst();}
                             exception=0;
                         }else {
-                            if(wxCorpInfo.getSaasSyncContact()!=1){
+                            if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()!=1){
                                 first= userList.stream().filter(u -> u.getName().equals(split[0])&&(u.getJobNumber()!=null&&u.getJobNumber().equals(split[1]))).findFirst();
                                 exception=1;
                             }else first= userList.stream().filter(u ->(u.getJobNumber()!=null&&u.getJobNumber().equals(split[1]))).findFirst();
@@ -4332,7 +4332,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                             participationList.add(p);
                         } else {
                             switch (exception){
-                                case 0:throw new Exception(wxCorpInfo.getSaasSyncContact()==1?"参与人工号为["+split[0]+"]的人员不存在":"参与人姓名/工号为["+split[0]+"]的人员不存在");
+                                case 0:throw new Exception(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1?"参与人工号为["+split[0]+"]的人员不存在":"参与人姓名/工号为["+split[0]+"]的人员不存在");
                                 case 1:throw new Exception("参与人["+split[0]+"]姓名与工号不匹配");
                             }
                         }
@@ -4354,12 +4354,12 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                 Optional<User> first;
                                 Integer exception=null;
                                 if(split.length==1){
-                                    if(wxCorpInfo.getSaasSyncContact()!=1){
+                                    if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()!=1){
                                         first= userList.stream().filter(u -> u.getName().equals(split[0])||(u.getJobNumber()!=null&&u.getJobNumber().equals(split[0]))).findFirst();
                                     }else {first= userList.stream().filter(u ->(u.getJobNumber()!=null&&u.getJobNumber().equals(split[0]))).findFirst();}
                                     exception=0;
                                 }else {
-                                    if(wxCorpInfo.getSaasSyncContact()!=1){
+                                    if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()!=1){
                                         first= userList.stream().filter(u -> u.getName().equals(split[0])&&(u.getJobNumber()!=null&&u.getJobNumber().equals(split[1]))).findFirst();
                                         exception=1;
                                     }else first= userList.stream().filter(u ->(u.getJobNumber()!=null&&u.getJobNumber().equals(split[1]))).findFirst();
@@ -4375,7 +4375,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                     }
                                 } else {
                                     switch (exception){
-                                        case 0:throw new Exception(wxCorpInfo.getSaasSyncContact()==1?"参与人工号为["+split[0]+"]的人员不存在":"参与人姓名/工号为["+split[0]+"]的人员不存在");
+                                        case 0:throw new Exception(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1?"参与人工号为["+split[0]+"]的人员不存在":"参与人姓名/工号为["+split[0]+"]的人员不存在");
                                         case 1:throw new Exception("参与人["+split[0]+"]姓名与工号不匹配");
                                     }
                                 }

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

@@ -3402,6 +3402,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         HttpRespMsg msg = new HttpRespMsg();
         String token = request.getHeader("TOKEN");
         User user = userMapper.selectById(token);
+        WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
         TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
         //对于存在预算成本的公司,暂不支持导入工时
         Company company = companyMapper.selectById(companyId);
@@ -3522,10 +3523,19 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                     }
                     String username = withCheckIn==null?row.getCell(1).getStringCellValue().trim():row.getCell(2).getStringCellValue().trim();
                     //检查人员是否存在
-                    Optional<User> any = allUserList.stream().filter(u -> u.getName().equals(username)).findAny();
+                    Optional<User> any;
+                    if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                        any = allUserList.stream().filter(u -> u.getName().equals(username)).findAny();
+                    }else {
+                        any = allUserList.stream().filter(u -> u.getName().equals(username)||(u.getJobNumber()!=null&&u.getJobNumber().equals(username))).findAny();
+                    }
                     if (!any.isPresent()) {
                         //msg.setError("人员["+username+"]不存在,请先在组织结构中添加或者通过钉钉同步导入");
-                        msg.setError(MessageUtils.message("staff.peopleNullAndAdd",username));
+                        if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                            msg.setError(MessageUtils.message("staff.peopleNullAndAdd",username));
+                        }else {
+                            msg.setError(MessageUtils.message("staff.peopleNullAndAddPlus",username));
+                        }
                         return msg;
                     }
                     User reportCreator = any.get();

+ 106 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/application-sgai.yml

@@ -0,0 +1,106 @@
+server:
+  port: 10010
+  tomcat:
+    uri-encoding: utf-8
+    max-http-form-post-size: -1
+    connection-timeout: 18000000s
+spring:
+  servlet:
+    multipart:
+      # 配置上传文件的大小设�?
+      # Single file max size  即单个文件大�?
+      max-file-size: 100MB
+      max-request-size: 100MB
+  datasource:
+    driver-class-name: com.mysql.cj.jdbc.Driver
+    url: jdbc:mysql://10.168.54.5:3306/man_sgai?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&rewriteBatchedStatements=true
+    username: sgaigs
+    password: gs5IP5qfsia#oq5P
+    hikari:
+      maximum-pool-size: 60
+      minimum-idle: 10
+      max-lifetime: 180000
+      # 数据库连接超时时�?默认30秒,�?0000
+      connection-timeout: 60000
+      connection-test-query: SELECT 1
+    #######redis配置######
+    # redis
+    redis:
+      host: 127.0.0.1
+      port: 6379
+      timeout: 3
+      # password:
+      pool:
+        minIdle: 1
+        maxIdle: 10
+        maxWait: 3
+        maxActive: 8
+    ####全局配置时间返回格式#####
+  jackson:
+    #参数意义�?
+    #JsonInclude.Include.ALWAYS       默认
+    #JsonInclude.Include.NON_DEFAULT   属性为默认值不序列�?
+    #JsonInclude.Include.NON_EMPTY     属性为 空(””) 或者为 NULL 都不序列�?
+    #JsonInclude.Include.NON_NULL      属性为NULL  不序列化
+    default-property-inclusion: ALWAYS
+    time-zone: GMT+8
+    date-format: yyyy-MM-dd HH:mm:ss
+
+##########日志配置
+logging:
+  level:
+    root: info
+    org.mybatis: error
+    java.sql: error
+    org.springframework.web: error
+    #打印sql语句
+    com.management.platform.mapper: error
+  path: /log/
+  file: worktime.log
+##########
+mybatis-plus:
+  #  mapper-locations: classpath:mapper/*/*.xml
+  #  #实体扫描,多个package用逗号或者分号分�?
+  #  typeAliasesPackage: com.hssx.cloudmodel
+  global-config:
+    #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+    id-type: 0
+    #字段策略 0:"忽略判断",1:"�?NULL 判断"),2:"非空判断"
+    field-strategy: 2
+    db-column-underline: true
+    refresh-mapper:
+    #################插入和更新非null判断
+    db-config:
+      insert-strategy: not_null
+      update-strategy: not_null
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+######mybstis配置#######
+mybatis:
+  type-aliases-package: com.management.platform.entity
+  mapper-locations: mappers/*Mapper.xml
+#####配置图片上传路径####
+upload:
+  path: /www/staticproject/timesheet/upload/
+
+
+
+##actuator健康检查配�?
+management:
+  security:
+    enabled:false:
+  server:
+    port: 10011
+  #  endpoints:
+  #    web:
+  #      exposure:
+  #        include: "*"
+
+  health:
+    redis:
+      enabled: false
+
+configEnv:
+  isDev: true
+  isPrivateDeploy: true

+ 1 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/i18n/messages.properties

@@ -350,6 +350,7 @@ role.deleteErrorByHavePeople=该角色存在相关人员,请将他们修改为
 #员工相关
 staff.nameNullByRow=第"{0}"行缺少员工姓名
 staff.peopleNullAndAdd=人员["{0}"]不存在,请先在组织结构中添加或者通过钉钉同步导入
+staff.peopleNullAndAddPlus=人员/工号["{0}"]不存在,请先在组织结构中添加或者通过钉钉同步导入
 staff.proportionError=人员["{0}"]"+"分摊比例不满足100%,当前比例["{1}"%],请检查
 staff.workingHoursNull=工号为"{0}"的员工在工时系统中不存在
 staff.deleteErrorByDaily=该员工存在填写的日报,无法删除。

+ 1 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/i18n/messages_en_US.properties

@@ -350,6 +350,7 @@ role.deleteErrorByHavePeople=There are related persons in this role. Please modi
 #员工相关
 staff.nameNullByRow=Employee name is missing in row "{0}".
 staff.peopleNullAndAdd=The person ["{0}"] does not exist. Please add it in the organization structure first or import it synchronously through Ding Talk.
+staff.peopleNullAndAddPlus=The person/jobNumber ["{0}"] does not exist. Please add it in the organization structure first or import it synchronously through Ding Talk.
 staff.proportionError=The personnel ["{0}"] "+" allocation proportion does not meet 100%. The current proportion ["{1}"%], please check.
 staff.workingHoursNull=The employee with job number "{0}" does not exist in the work hour system.
 staff.deleteErrorByDaily=The employee has daily reports filled in and cannot be deleted.