Sfoglia il codice sorgente

修复reportAuditType !=3时编辑日报的bug.
同步企业微信部门和人员的新增,变动

seyason 2 anni fa
parent
commit
4f7c440fa0

+ 3 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/AuthRedirectController.java

@@ -72,8 +72,9 @@ public class AuthRedirectController {
         JSONObject obj = JSONObject.parseObject(forObject);
         System.out.println("企微身份:"+obj.toString());
         String wxUserId = obj.getString("UserId");
-
-        List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("corpwx_userid", wxUserId));
+        String openUserId = obj.getString("open_userid");
+        System.out.println("wxUserId="+wxUserId+", openUserId="+openUserId);
+        List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("corpwx_userid", openUserId));
         if (userList.size() > 0) {
             //该用户已存在
             User curUser = userList.get(0);

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

@@ -323,8 +323,13 @@ public class ReportController {
                 msg.setError("请设置审批人");
                 return msg;
             } else {
+                auditorSettingList = new ArrayList<>();
                 for (int i=0;i<auditorSettingArray.length; i++) {
                     String str = auditorSettingArray[i];
+                    System.out.println(str);
+                    if (str.contains("@")) {
+                        str = str.replaceAll("@", ",");
+                    }
                     ReportAuditorSetting reportAuditorSetting = JSONObject.parseObject(str, ReportAuditorSetting.class);
                     auditorSettingList.add(reportAuditorSetting);
                     //检查审核人层级是否设置满

+ 146 - 54
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/WeiXinCorpController.java

@@ -423,12 +423,14 @@ public class WeiXinCorpController {
                 // "SuiteId":"ww4e237fd6abb635af","InfoType":"change_contact","AuthCorpId":"wwf11426cf618e1703",
                 // "TimeStamp":1655908762,"OpenUserID":"woy9TkCAAApdqSxsfJbmK4cBJhbzI5Ug"}}
                 String changeType = jsonObject.getString("ChangeType");
+                String corpId = jsonObject.getString("AuthCorpId");
+                WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectById(corpId);
+                if (wxCorpInfo == null) return "success";
+                Integer companyId = wxCorpInfo.getCompanyId();
                 if ("delete_user".equals(changeType)) {
                     //监听到员工离职
-                    String corpId = jsonObject.getString("AuthCorpId");
-                    String corpWxUserId = jsonObject.getString("UserID");
-                    Integer companyId = wxCorpInfoMapper.selectById(corpId).getCompanyId();
-                    User user = userMapper.selectOne(new QueryWrapper<User>().eq("corpwx_userid", corpWxUserId).eq("company_id", companyId));
+                    String openUserId = jsonObject.getString("OpenUserID");
+                    User user = userMapper.selectOne(new QueryWrapper<User>().eq("corpwx_userid", openUserId).eq("company_id", companyId));
                     if (user != null && user.getIsActive() == 1) {
                         user.setIsActive(0);
                         user.setInactiveDate(LocalDate.now());
@@ -436,12 +438,36 @@ public class WeiXinCorpController {
                     }
                 } else if ("create_user".equals(changeType)) {
                     //新增员工
-                    String corpId = jsonObject.getString("AuthCorpId");
+                    SysRole defaultRole = sysRoleMapper.selectOne(new QueryWrapper<SysRole>().eq("company_id", companyId).eq("is_default", 1));
                     String corpWxUserId = jsonObject.getString("UserID");
-                    WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectById(corpId);
-                    if (!StringUtils.isEmpty(wxCorpInfo.getContactSecret()) && !StringUtils.isEmpty(wxCorpInfo.getContactSecret())) {
-                        Integer companyId = wxCorpInfo.getCompanyId();
-                        SysRole defaultRole = sysRoleMapper.selectOne(new QueryWrapper<SysRole>().eq("company_id", companyId).eq("is_default", 1));
+                    String openUserId = jsonObject.getString("OpenUserID");
+                    if (wxCorpInfo.getSaasSyncContact() == 1) {
+                        //直接通过企业微信通讯录同步
+                        JSONObject userObj = getUserInfo(getCorpAccessToken(wxCorpInfo), corpWxUserId);
+                        //成功获取到通讯录的个人详情
+                        Long id = SnowFlake.nextId();
+                        JSONArray department = userObj.getJSONArray("department");
+                        Integer curUserWXDeptid = getMaxDeptIdFromArray(department);
+                        Department sysDept = departmentMapper.selectOne(new QueryWrapper<Department>().eq("company_id", companyId).eq("corpwx_deptid", curUserWXDeptid));
+
+                        User user = new User()
+                                .setId(id.toString())
+                                .setRoleId(defaultRole.getId())
+                                .setRoleName(defaultRole.getRolename())
+                                .setName(userObj.getString("name"))
+                                .setPhone(userObj.getString("mobile"))
+                                .setPassword(MD5Util.getPassword("000000"))
+                                .setCorpwxUserid(openUserId)
+                                .setJobNumber(userObj.getString("userid"))
+                                .setColor(ColorUtil.randomColor())
+                                .setCompanyId(companyId);
+                        if (sysDept != null) {
+                            user.setDepartmentId(sysDept.getDepartmentId());
+                            List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
+                            user.setDepartmentCascade(convertDepartmentIdToCascade(user.getDepartmentId(), allDeptList));
+                            userMapper.insert(user);
+                        }
+                    } else if (!StringUtils.isEmpty(wxCorpInfo.getContactSecret()) && !StringUtils.isEmpty(wxCorpInfo.getContactServer())) {
                         //通过通讯录secret获取到员工姓名
                         String remoteCorpConcactAccessToken = getRemoteCorpConcactAccessToken(wxCorpInfo);
                         String curCorpAccessToken = getCorpAccessToken(wxCorpInfo);
@@ -462,30 +488,60 @@ public class WeiXinCorpController {
                                     .setName(userObj.getString("name"))
                                     .setPhone(userObj.getString("mobile"))
                                     .setPassword(MD5Util.getPassword("000000"))
-                                    .setCorpwxUserid(corpWxUserId)
+                                    .setCorpwxUserid(openUserId)
                                     .setJobNumber(userObj.getString("userid"))
                                     .setColor(ColorUtil.randomColor())
                                     .setCompanyId(companyId);
                             if (sysDept != null) {
                                 user.setDepartmentId(sysDept.getDepartmentId());
                             }
-                            if (userObj.containsKey("direct_leader") && userObj.getJSONArray("direct_leader").size() > 0) {
-                                String directLeader = userObj.getJSONArray("direct_leader").getString(0);
-                                User leader = userMapper.selectOne(new QueryWrapper<User>().eq("company_id", companyId).eq("corpwx_userid", directLeader));
-                                if (leader != null) {
-                                    user.setSuperiorId(leader.getId());
-                                }
-                            }
+//                            if (userObj.containsKey("direct_leader") && userObj.getJSONArray("direct_leader").size() > 0) {
+//                                String directLeader = userObj.getJSONArray("direct_leader").getString(0);
+//                                User leader = userMapper.selectOne(new QueryWrapper<User>().eq("company_id", companyId).eq("corpwx_userid", directLeader));
+//                                if (leader != null) {
+//                                    user.setSuperiorId(leader.getId());
+//                                }
+//                            }
                             userMapper.insert(user);
                         }
                     }
                 } else if ("update_user".equals(changeType)) {
-                    String corpId = jsonObject.getString("AuthCorpId");
                     String corpWxUserId = jsonObject.getString("UserID");
-                    WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectById(corpId);
-                    Integer companyId = wxCorpInfo.getCompanyId();
+                    String openUserId = jsonObject.getString("OpenUserID");
+                    if (wxCorpInfo.getSaasSyncContact() == 1) {
+                        Integer curUserWXDeptid = 0;
+                        if (jsonObject.has("Department")) {
+                            String department = jsonObject.getString("Department");
+                            if (department.contains(",")) {
+                                String[] split = department.split(",");
+                                curUserWXDeptid = getMaxDeptIdFromArray(split);
+                            } else {
+                                curUserWXDeptid = Integer.valueOf(department);
+                            }
+                        } else if (jsonObject.has("MainDepartment")) {
+                            //取主部门
+                            curUserWXDeptid = jsonObject.getInt("MainDepartment");
+                        } else {
+                            System.out.println("部门未变更,不处理");
+                        }
+                        if (curUserWXDeptid != 0) {
+                            User user = userMapper.selectOne(new QueryWrapper<User>().eq("company_id", companyId).eq("corpwx_userid", openUserId));
+                            User changeUser = new User();
+                            changeUser.setId(user.getId());
+                            if (!curUserWXDeptid.equals(user.getCorpwxDeptid())) {
+                                changeUser.setCorpwxDeptid(curUserWXDeptid);
+                                Department department = departmentMapper.selectOne(new QueryWrapper<Department>().eq("company_id", companyId).eq("corpwx_deptid", curUserWXDeptid));
+                                if (department != null) {
+                                    changeUser.setDepartmentId(department.getDepartmentId());
+                                    List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
+                                    changeUser.setDepartmentCascade(convertDepartmentIdToCascade(changeUser.getDepartmentId(), allDeptList));
+                                    userMapper.updateById(changeUser);
+                                }
+                            }
+                        }
+                    }
                     //只有授权通讯录同步的,才有机会更新部门或者上级
-                    if (!StringUtils.isEmpty(wxCorpInfo.getContactSecret()) && !StringUtils.isEmpty(wxCorpInfo.getContactSecret())) {
+                    else if (!StringUtils.isEmpty(wxCorpInfo.getContactSecret()) && !StringUtils.isEmpty(wxCorpInfo.getContactServer())) {
                         String remoteCorpConcactAccessToken = getRemoteCorpConcactAccessToken(wxCorpInfo);
                         String curCorpAccessToken = getCorpAccessToken(wxCorpInfo);
                         Integer curUserWXDeptid = 0;
@@ -540,14 +596,24 @@ public class WeiXinCorpController {
                         }
                     }
                 } else if ("create_party".equals(changeType)) {
-                    //创建部门,调用中转服务接口获取部门详情
-                    String corpId = jsonObject.getString("AuthCorpId");
                     Integer deptId = jsonObject.getInt("Id");
                     Integer parentDeptId = jsonObject.getInt("ParentId");
-                    WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectById(corpId);
-                    if (wxCorpInfo != null && !StringUtils.isEmpty(wxCorpInfo.getContactSecret()) && !StringUtils.isEmpty(wxCorpInfo.getContactSecret())) {
+                    if (wxCorpInfo.getSaasSyncContact() == 1) {
+                        Department department = new Department();
+                        department.setCompanyId(companyId);
+                        department.setCorpwxDeptid(deptId);
+                        department.setCorpwxDeptpid(parentDeptId);
+                        department.setDepartmentName(jsonObject.getString("Name"));
+                        if (parentDeptId != 1) {
+                            Department parentDept = department.selectOne(new QueryWrapper<Department>().eq("company_id", companyId).eq("corpwx_deptid", parentDeptId));
+                            if (parentDept != null) {
+                                department.setSuperiorId(parentDept.getDepartmentId());
+                            }
+                        }
+                        departmentMapper.insert(department);
+                    } else if (wxCorpInfo != null && !StringUtils.isEmpty(wxCorpInfo.getContactSecret()) && !StringUtils.isEmpty(wxCorpInfo.getContactSecret())) {
+                        //创建部门,调用中转服务接口获取部门详情
                         String remoteCorpConcactAccessToken = getRemoteCorpConcactAccessToken(wxCorpInfo);
-                        Integer companyId = wxCorpInfo.getCompanyId();
                         Department department = new Department();
                         department.setCompanyId(companyId);
                         department.setCorpwxDeptid(deptId);
@@ -566,11 +632,21 @@ public class WeiXinCorpController {
                     }
                 } else if ("update_party".equals(changeType)) {
                     //变更部门,父部门变化
-                    String corpId = jsonObject.getString("AuthCorpId");
                     Integer deptId = jsonObject.getInt("Id");
                     Integer parentDeptId = jsonObject.getInt("ParentId");
-                    WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectById(corpId);
-                    if (wxCorpInfo != null && !StringUtils.isEmpty(wxCorpInfo.getContactSecret()) && !StringUtils.isEmpty(wxCorpInfo.getContactSecret())) {
+                    if (wxCorpInfo.getSaasSyncContact() == 1) {
+                        if (parentDeptId != null) {
+                            //发生父部门的结构变化了
+                            Department department = departmentMapper.selectOne(new QueryWrapper<Department>().eq("company_id", wxCorpInfo.getCompanyId()).eq("corpwx_deptid", deptId));
+                            if (department != null) {
+                                Department parentDept = departmentMapper.selectOne(new QueryWrapper<Department>().eq("company_id", wxCorpInfo.getCompanyId()).eq("corpwx_deptid", parentDeptId));
+                                if (parentDept != null) {
+                                    department.setSuperiorId(parentDept.getDepartmentId());
+                                    departmentMapper.updateById(department);
+                                }
+                            }
+                        }
+                    } else if (wxCorpInfo != null && !StringUtils.isEmpty(wxCorpInfo.getContactSecret()) && !StringUtils.isEmpty(wxCorpInfo.getContactServer())) {
                         if (parentDeptId != null) {
                             //发生父部门的结构变化了
                             Department department = departmentMapper.selectOne(new QueryWrapper<Department>().eq("company_id", wxCorpInfo.getCompanyId()).eq("corpwx_deptid", deptId));
@@ -1424,6 +1500,7 @@ public class WeiXinCorpController {
             JSONObject userJson = usersUnderRootArray.getJSONObject(m);
             System.out.println(userJson.toString());
             String curUserid = userJson.getString("userid");
+            String openUserid = userJson.getString("open_userid");
             //跳过非激活状态的员工
             if (userJson.getInteger("status") != 1) continue;
             //不存在的人员, 进行插入
@@ -1441,7 +1518,7 @@ public class WeiXinCorpController {
                     .setCompanyId(companyId)
                     .setName(userJson.getString("name"))
                     .setPhone(userJson.getString("mobile"))
-                    .setCorpwxUserid(curUserid)
+                    .setCorpwxUserid(openUserid)
                     .setColor(ColorUtil.randomColor())
                     .setJobNumber(curUserid)
                     .setCorpwxDeptid(maxDeptId);
@@ -1481,10 +1558,11 @@ public class WeiXinCorpController {
                 for (int m=0;m<userList.size(); m++) {
                     JSONObject userJson = userList.getJSONObject(m);
                     String curUserid = userJson.getString("userid");
+                    String openUserid = userJson.getString("open_userid");
                     System.out.println("人员信息:"+userJson.toString());
                     //不存在的人员, 进行插入
                     User user = new User();
-                    Optional<User> first = allCorpWxUserList.stream().filter(all -> all.getCorpwxUserid().equals(curUserid)).findFirst();
+                    Optional<User> first = allCorpWxUserList.stream().filter(all -> all.getCorpwxUserid().equals(openUserid)).findFirst();
                     if (first.isPresent()) {
                         user = first.get();
                         user.setCorpwxDeptid(deptId);
@@ -1495,9 +1573,10 @@ public class WeiXinCorpController {
                                 .setRoleName(defaultRole.getRolename())
                                 .setCompanyId(companyId)
                                 .setName(userJson.getString("name"))
-                                .setCorpwxUserid(curUserid)
+                                .setCorpwxUserid(openUserid)
                                 .setColor(ColorUtil.randomColor())
-                                .setJobNumber(curUserid);
+                                .setJobNumber(curUserid)
+                                .setCorpwxDeptid(curDept.getCorpwxDeptid());
                         allCorpWxUserList.add(user);
                     }
                 }
@@ -1512,7 +1591,7 @@ public class WeiXinCorpController {
         List<User> newUserList = allCorpWxUserList.stream().filter(newItem -> !existingUsers.stream().anyMatch(existingItem -> newItem.getCorpwxUserid().equals(existingItem.getCorpwxUserid()))).collect(Collectors.toList());
         newUserList.forEach(newItem->{
             if (newItem.getCorpwxDeptid() != 1) {
-                int deptId = allDeptList.stream().filter(all->all.getCorpwxDeptid().equals(newItem.getCorpwxDeptid())).findFirst().get().getDepartmentId();
+                Integer deptId = allDeptList.stream().filter(all->all.getCorpwxDeptid() != null && all.getCorpwxDeptid().equals(newItem.getCorpwxDeptid())).findFirst().get().getDepartmentId();
                 newItem.setDepartmentId(deptId);
                 newItem.setDepartmentCascade(convertDepartmentIdToCascade(deptId, allDeptList));
             }
@@ -1520,28 +1599,41 @@ public class WeiXinCorpController {
         if (newUserList.size() > 0) {
             userService.saveBatch(newUserList);
         }
-        List<User> updateUserList = allCorpWxUserList.stream().filter(newItem->existingUsers.stream().anyMatch(existingItem->newItem.getCorpwxUserid().equals(existingItem.getCorpwxUserid())
-                                            && (!newItem.getName().equals(existingItem.getName()) || (newItem.getCorpwxDeptid() != null && !newItem.getCorpwxDeptid().equals(existingItem.getCorpwxDeptid()))))).collect(Collectors.toList());
-        List<Integer> corpWxDeptIds = updateUserList.stream().map(User::getCorpwxDeptid).collect(Collectors.toList());
-        List<Department> departmentList = null;
-        if (corpWxDeptIds.size() > 0) {
-            departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId).in("corpwx_deptid", corpWxDeptIds));
-        }
-        final  List<Department> fDeptList = departmentList;
-        updateUserList.forEach(u->{
-            if (u.getCorpwxDeptid() != 1) {
-                if (fDeptList != null) {
-                    u.setDepartmentId(fDeptList.stream().filter(d->d.getCorpwxDeptid().equals(u.getCorpwxDeptid())).findFirst().get().getDepartmentId());
+        //姓名,部门,账号的同步更新
+        List<User> finalUpdateUserList = new ArrayList<>();
+        for (User userItem : allCorpWxUserList) {
+            Optional<User> first = existingUsers.stream().filter(ex -> userItem.getCorpwxUserid().equals(ex.getCorpwxUserid())).findFirst();
+            if (first.isPresent()) {
+                User oldUser = first.get();
+                User changeUser = new User();
+                if (!userItem.getJobNumber().equals(oldUser.getJobNumber())) {
+                    changeUser.setId(oldUser.getId());
+                    changeUser.setJobNumber(userItem.getJobNumber());
+                }
+                if (!userItem.getName().equals(oldUser.getName())) {
+                    changeUser.setId(oldUser.getId());
+                    changeUser.setName(oldUser.getName());
+                }
+                if (!userItem.getCorpwxDeptid().equals(oldUser.getCorpwxDeptid())) {
+                    changeUser.setId(oldUser.getId());
+                    if (userItem.getCorpwxDeptid() != 1) {
+                        changeUser.setDepartmentId(allDeptList.stream().filter(d->d.getCorpwxDeptid().equals(userItem.getCorpwxDeptid())).findFirst().get().getDepartmentId());
+                        //设置层级部门
+                        changeUser.setDepartmentCascade(convertDepartmentIdToCascade(changeUser.getDepartmentId(), allDeptList));
+                    } else {
+                        changeUser.setDepartmentId(0);
+                        changeUser.setDepartmentCascade("0");
+                    }
+                }
+                if (changeUser.getId() != null) {
+                    //有变动
+                    finalUpdateUserList.add(changeUser);
                 }
-                //设置层级部门
-                u.setDepartmentCascade(convertDepartmentIdToCascade(u.getDepartmentId(), allDeptList));
-            } else {
-                u.setDepartmentId(0);
-                u.setDepartmentCascade("0");
             }
-        });
-        if (updateUserList.size() > 0) {
-            userService.updateBatchById(updateUserList);
+        }
+
+        if (finalUpdateUserList.size() > 0) {
+            userService.updateBatchById(finalUpdateUserList);
         }
         return new HttpRespMsg();
     }

+ 4 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/ReportAuditorSetting.java

@@ -1,9 +1,12 @@
 package com.management.platform.entity;
 
+import com.baomidou.mybatisplus.annotation.FieldStrategy;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableField;
 import java.io.Serializable;
+
+import jdk.nashorn.internal.ir.annotations.Ignore;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
@@ -50,10 +53,9 @@ public class ReportAuditorSetting extends Model<ReportAuditorSetting> {
     /**
      * 抄送人
      */
-    @TableField("cc_userid")
+    @TableField(value = "cc_userid",updateStrategy = FieldStrategy.IGNORED)
     private String ccUserid;
 
-
     @Override
     protected Serializable pkVal() {
         return this.reportId;

+ 7 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/TimeType.java

@@ -17,7 +17,7 @@ import lombok.experimental.Accessors;
  * </p>
  *
  * @author Seyason
- * @since 2022-09-27
+ * @since 2022-09-30
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -371,6 +371,12 @@ public class TimeType extends Model<TimeType> {
     @TableField("audit_level")
     private Integer auditLevel;
 
+    /**
+     * 任务列表是否有预估工时功能
+     */
+    @TableField("stage_has_evtime")
+    private Integer stageHasEvtime;
+
 
     @Override
     protected Serializable pkVal() {

+ 42 - 5
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -155,6 +155,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
     @Resource
     private UserSalaryService userSalaryService;
     @Resource
+    LocaleInformationMapper localeInformationMapper;
+    @Resource
     private AuditWorkflowTimeSettingMapper auditWorkflowTimeSettingMapper;
     @Resource
     private ReportAlogMembdateService reportAlogMembdateService;
@@ -1830,13 +1832,24 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         String pNames = projectList.stream().map(Project::getProjectName).collect(Collectors.joining(", ", "[", "]"));
         String str = null;
         String fillUserId = null;
+        WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", company.getId()));
         if (oneReport.getState() == -1) {//待部门直属领导审核
             //str = "您"+date+"导入的日报中"+pNames+"项目被["+user.getName()+"]驳回。原因:" + reason+",请重新导入。";
-            str = MessageUtils.message("profession.impProReject",date,pNames,user.getName(),reason);
+            String sendToUser = user.getName();
+            if (wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1) {
+                //需要转译
+                sendToUser = "$userName="+user.getCorpwxUserid()+"$";
+            }
+            str = MessageUtils.message("profession.impProReject",date,pNames,sendToUser,reason);
             fillUserId = oneReport.getFillUserid();
         } else {
             //str = "您"+date+"填写的日报中"+pNames+"项目被["+user.getName()+"]驳回。原因:" + reason;
-            str = MessageUtils.message("profession.fillProReject",date,pNames,user.getName(),reason);
+            String sendToUser = user.getName();
+            if (wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1) {
+                //需要转译
+                sendToUser = "$userName="+user.getCorpwxUserid()+"$";
+            }
+            str = MessageUtils.message("profession.fillProReject",date,pNames,sendToUser,reason);
             fillUserId = oneReport.getCreatorId();
         }
 
@@ -2173,7 +2186,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             if (timeType.getReportAuditType() == 2) {
                 allUsers = userMapper.selectList(new QueryWrapper<User>().select("id, name, department_id").eq("company_id", company.getId()));
                 //先分组负责人审核,再项目负责人审核
-                List<Report> reportList = reportMapper.selectList(new QueryWrapper<Report>().select("id, state, group_audit_state, project_id, project_audit_state, creator_id, create_date").in("id", ids));
+                List<Report> reportList = reportMapper.selectList(new QueryWrapper<Report>().select("id, state, group_audit_state, project_id, project_audit_state, creator_id, create_date, company_id").in("id", ids));
                 allReports = reportList;
                 List<Integer> assProjectIds = reportList.stream().map(Report::getProjectId).collect(Collectors.toList());
                 List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().select("id, incharger_id").in("id", assProjectIds));
@@ -3461,7 +3474,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             //检查模式,是否是一个项目多个工作事项的情况
             TimeType timeType = timeTypeMapper.selectOne(new QueryWrapper<TimeType>().eq("company_id", user.getCompanyId()));
             Company company = companyMapper.selectById(user.getCompanyId());
-
+            Integer companyId = company.getId();
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
             //准备导出
             HSSFWorkbook workbook = new HSSFWorkbook();
@@ -3684,6 +3697,26 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             }
             DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
             DecimalFormat df = new DecimalFormat("#0.0");
+            int offsetSeconds = 0;
+            if (company.getIsInternational() == 1) {
+                //国际化版本
+                LocaleInformation locale = localeInformationMapper.selectById(companyId);
+                TimeZone curZone = TimeZone.getTimeZone(locale.getTimezone());
+                offsetSeconds = (curZone.getRawOffset() - TimeZone.getTimeZone("GMT+8").getRawOffset())/1000;
+                //时区转换,默认数据库存的是GMT+8
+                for (Map<String, Object> map : allReportByDate) {
+                    String createTime = sdf.format((Date)map.get("time"));
+                    LocalDateTime time = LocalDateTime.parse(createTime, dtf);
+                    time = time.plusSeconds(offsetSeconds);
+                    map.put("time", DateTimeUtil.localDateTimeToDate(time));
+
+                    //审核时间
+                    String projectAuditTime = sdf.format((Date)map.get("projectAuditTime"));
+                    LocalDateTime auditTime = LocalDateTime.parse(projectAuditTime, dtf);
+                    auditTime = auditTime.plusSeconds(offsetSeconds);
+                    map.put("projectAuditTime", DateTimeUtil.localDateTimeToDate(auditTime));
+                }
+            }
             for (Map<String, Object> map : allReportByDate) {
                 HSSFRow row = sheet.createRow(rowNum);
                 row.createCell(0).setCellValue(rowNum);
@@ -3766,7 +3799,11 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                         StringBuilder sb = new StringBuilder();
                         boolean isFirst = true;
                         for (ReportLogDetail audit:detailList) {
-                            String time = dtf.format(audit.getOperateDate());
+                            LocalDateTime operateDate = audit.getOperateDate();
+                            if (company.getIsInternational() == 1) {
+                                operateDate = operateDate.plusSeconds(offsetSeconds);
+                            }
+                            String time = dtf.format(operateDate);
                             String msg = time+" " + audit.getMsg();
                             if (!isFirst) {
                                 sb.append("->");

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

@@ -198,7 +198,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
     @Override
     public void sendWXCorpMsg(WxCorpInfo corpInfo, String corpUserid, String msg) {
         try {
-            if (isDev) return;
+//            if (isDev) return;
             log.info("发送企业微信消息===" + corpUserid);
             System.out.println("发送企业微信消息===" + corpUserid);
             String accessToken = getCorpAccessToken(corpInfo);

+ 11 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/util/DateTimeUtil.java

@@ -3,13 +3,11 @@ package com.management.platform.util;
 import org.apache.tomcat.jni.Local;
 
 import java.math.BigDecimal;
-import java.time.Instant;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.ZoneId;
+import java.time.*;
 import java.time.format.DateTimeFormatter;
 import java.time.temporal.TemporalAccessor;
 import java.util.Arrays;
+import java.util.Date;
 
 public class DateTimeUtil {
     public static final String[] WEEK_DAYS = {"周一","周二","周三","周四","周五","周六", "周日"};
@@ -56,6 +54,15 @@ public class DateTimeUtil {
         return WEEK_DAYS[day-1];
     }
 
+    public static Date localDateTimeToDate(final LocalDateTime localDateTime) {
+        if (null == localDateTime) {
+            return null;
+        }
+        final ZoneId zoneId = ZoneId.systemDefault();
+        final ZonedDateTime zdt = localDateTime.atZone(zoneId);
+        final Date date = Date.from(zdt.toInstant());
+        return date;
+    }
 
     public static void main(String[] args) {
 

File diff suppressed because it is too large
+ 2 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TimeTypeMapper.xml


+ 4 - 4
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -4120,10 +4120,10 @@
                                     customText: list.report[i].customText,
                                     basecostId: list.report[i].basecostId,
 
-                                        auditorFirst: list.report[i].auditorSetting.auditorFirst ? list.report[i].auditorSetting.auditorFirst : '',
-                                        auditorSec: list.report[i].auditorSetting.auditorSec ? list.report[i].auditorSetting.auditorSec : '',
-                                        auditorThird: list.report[i].auditorSetting.auditorThird ? list.report[i].auditorSetting.auditorThird : '',
-                                        ccUserid: list.report[i].auditorSetting.ccUserid ? list.report[i].auditorSetting.ccUserid : '',
+                                        auditorFirst: list.report[i].auditorSetting && list.report[i].auditorSetting.auditorFirst ? list.report[i].auditorSetting.auditorFirst : '',
+                                        auditorSec: list.report[i].auditorSetting && list.report[i].auditorSetting.auditorSec ? list.report[i].auditorSetting.auditorSec : '',
+                                        auditorThird: list.report[i].auditorSetting && list.report[i].auditorSetting.auditorThird ? list.report[i].auditorSetting.auditorThird : '',
+                                        ccUserid: list.report[i].auditorSetting && list.report[i].auditorSetting.ccUserid ? list.report[i].auditorSetting.ccUserid : '',
 
                                     canEdit: list.report[i].state >= 2 ? true : false
                                 })