فهرست منبع

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

Min 11 ماه پیش
والد
کامیت
880c2a43f5

+ 35 - 28
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -1894,15 +1894,16 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                                     item.put("key","审核人");
                                     item.put("value",wxCorpInfo.getSaasSyncContact() == 1?("$userName="+user.getName()+"$"): user.getName());
                                     dataJson.add(item);
-                                    if(timeType.getNeedEvaluate()==1){
-                                        JSONObject item1=new JSONObject();
-                                        item1.put("key","评价");
-                                        item1.put("value",StringUtils.isEmpty(report.getEvaluate())?"":report.getEvaluate());
-                                        dataJson.add(item1);
-                                        json.put("template_id","tty9TkCAAAWoUyhGnXRCZuhkgCqw_Uow");
-                                    }else {
-                                        json.put("template_id","tty9TkCAAANpvEtLrkPUGeOEd1-U7W2w");
-                                    }
+//                                    if(timeType.getNeedEvaluate()==1){
+//                                        JSONObject item1=new JSONObject();
+//                                        item1.put("key","评价");
+//                                        item1.put("value",StringUtils.isEmpty(report.getEvaluate())?"":report.getEvaluate());
+//                                        dataJson.add(item1);
+//                                        json.put("template_id","tty9TkCAAAWoUyhGnXRCZuhkgCqw_Uow");
+//                                    }else {
+//                                        json.put("template_id","tty9TkCAAANpvEtLrkPUGeOEd1-U7W2w");
+//                                    }
+                                    json.put("template_id","tty9TkCAAANpvEtLrkPUGeOEd1-U7W2w");
                                     JSONObject item2=new JSONObject();
                                     item2.put("key","日期");
                                     item2.put("value",report.getCreateDate());
@@ -2447,15 +2448,16 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                                     item.put("key","审核人");
                                     item.put("value",user.getName());
                                     dataJson.add(item);
-                                    if(timeType.getNeedEvaluate()==1){
-                                        JSONObject item1=new JSONObject();
-                                        item1.put("key","评价");
-                                        item1.put("value",StringUtils.isEmpty(report.getEvaluate())?"":report.getEvaluate());
-                                        dataJson.add(item1);
-                                        json.put("template_id","tty9TkCAAAWoUyhGnXRCZuhkgCqw_Uow");
-                                    }else {
-                                        json.put("template_id","tty9TkCAAANpvEtLrkPUGeOEd1-U7W2w");
-                                    }
+//                                    if(timeType.getNeedEvaluate()==1){
+//                                        JSONObject item1=new JSONObject();
+//                                        item1.put("key","评价");
+//                                        item1.put("value",StringUtils.isEmpty(report.getEvaluate())?"":report.getEvaluate());
+//                                        dataJson.add(item1);
+//                                        json.put("template_id","tty9TkCAAAWoUyhGnXRCZuhkgCqw_Uow");
+//                                    }else {
+//                                        json.put("template_id","tty9TkCAAANpvEtLrkPUGeOEd1-U7W2w");
+//                                    }
+                                    json.put("template_id","tty9TkCAAANpvEtLrkPUGeOEd1-U7W2w");
                                     JSONObject item2=new JSONObject();
                                     item2.put("key","日期");
                                     item2.put("value",report.getCreateDate());
@@ -3777,15 +3779,16 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                                     item.put("key","审核人");
                                     item.put("value",user.getName());
                                     dataJson.add(item);
-                                    if(timeType.getNeedEvaluate()==1){
-                                        JSONObject item1=new JSONObject();
-                                        item1.put("key","评价");
-                                        item1.put("value",StringUtils.isEmpty(report.getEvaluate())?"":report.getEvaluate());
-                                        dataJson.add(item1);
-                                        json.put("template_id","tty9TkCAAAWoUyhGnXRCZuhkgCqw_Uow");
-                                    }else {
-                                        json.put("template_id","tty9TkCAAANpvEtLrkPUGeOEd1-U7W2w");
-                                    }
+//                                    if(timeType.getNeedEvaluate()==1){
+//                                        JSONObject item1=new JSONObject();
+//                                        item1.put("key","评价");
+//                                        item1.put("value",StringUtils.isEmpty(report.getEvaluate())?"":report.getEvaluate());
+//                                        dataJson.add(item1);
+//                                        json.put("template_id","tty9TkCAAAWoUyhGnXRCZuhkgCqw_Uow");
+//                                    }else {
+//
+//                                    }
+                                    json.put("template_id","tty9TkCAAANpvEtLrkPUGeOEd1-U7W2w");
                                     JSONObject item2=new JSONObject();
                                     item2.put("key","日期");
                                     item2.put("value",report.getCreateDate());
@@ -5298,7 +5301,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                             report.setWorkingTime(time);
                             report.setContent(workContent);
                             report.setMultiWorktime(timeType.getMultiWorktime());
-                            report.setFillUserid(user.getId());
+//                            report.setFillUserid(user.getId());  导入时,处理为自己填写的
                             if (timeType.getImportReportAuditNormal() == 0) {
                                 //老的导入日报审核模式
                                 if (timeType.getNeedDeptAudit() == 0) {
@@ -5380,7 +5383,11 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                     msg.setError(MessageUtils.message("finance.importErrorByAllAdopt"));
                     return msg;
                 } else {
+                    //如果开启了审批流的显示,需要插入日报提交记录表
                     reportService.saveBatch(reportList);
+                    if (timeType.getShowFillauditTime() == 1) {
+                        saveFillReportLog(reportList);
+                    }
                     msg.data = dataCount;
                     String originName = fileName;
                     //定义一个独立的文件夹

+ 104 - 72
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/task/TimingTask.java

@@ -954,39 +954,48 @@ public class TimingTask {
             //判断日报审核类型
             timeTypeList.stream().filter(timeType -> timeType.getCompanyId().equals(companyId)).findFirst().ifPresent(timeType -> {
                 if (timeType.getReportAuditType() == 7) {//并行审核模式
-                    List<User> userList = userMapper.selectList(new QueryWrapper<User>().select("id,dingding_userid", "corpwx_userid").eq("company_id", companyId));
-                    List<Report> reportList = reportMapper.selectList(new QueryWrapper<Report>().select("id, project_auditor_id, audit_dept_managerid,project_audit_state,department_audit_state").eq("company_id", companyId).eq("state", 0));
-                    HashMap<String, Long> auditorMap = new HashMap();
-                    for (Report report : reportList) {
-                        //按审核人汇总统计
-                        String pAuditorId = null;
-                        if (report.getProjectAuditState() == 0) {
-                            pAuditorId = report.getProjectAuditorId();
-                            if (auditorMap.get(pAuditorId) == null) {
-                                auditorMap.put(pAuditorId, 1L);
-                            } else {
-                                auditorMap.put(pAuditorId, auditorMap.get(pAuditorId) + 1);
-                            }
+                    boolean shouldAlert = true;
+                    if (timeType.getAlertType() == 4) {
+                        //每周提醒一次,校验日期是否正确
+                        if (LocalDate.now().getDayOfWeek().getValue() != timeType.getAlertCheckDay()) {
+                            shouldAlert = false;
                         }
-                        String deptAuditorId = null;
-                        if (report.getDepartmentAuditState() == 0) {
-                            deptAuditorId = report.getAuditDeptManagerid();
-                            if (deptAuditorId != null &&!deptAuditorId.equals(pAuditorId)) {
-                                //不是同一个人,需要单独统计
-                                if (auditorMap.get(deptAuditorId) == null) {
-                                    auditorMap.put(deptAuditorId, 1L);
+                    }
+                    if (shouldAlert) {
+                        List<User> userList = userMapper.selectList(new QueryWrapper<User>().select("id,dingding_userid", "corpwx_userid").eq("company_id", companyId));
+                        List<Report> reportList = reportMapper.selectList(new QueryWrapper<Report>().select("id, project_auditor_id, audit_dept_managerid,project_audit_state,department_audit_state").eq("company_id", companyId).eq("state", 0));
+                        HashMap<String, Long> auditorMap = new HashMap();
+                        for (Report report : reportList) {
+                            //按审核人汇总统计
+                            String pAuditorId = null;
+                            if (report.getProjectAuditState() == 0) {
+                                pAuditorId = report.getProjectAuditorId();
+                                if (auditorMap.get(pAuditorId) == null) {
+                                    auditorMap.put(pAuditorId, 1L);
                                 } else {
-                                    auditorMap.put(deptAuditorId, auditorMap.get(deptAuditorId) + 1);
+                                    auditorMap.put(pAuditorId, auditorMap.get(pAuditorId) + 1);
+                                }
+                            }
+                            String deptAuditorId = null;
+                            if (report.getDepartmentAuditState() == 0) {
+                                deptAuditorId = report.getAuditDeptManagerid();
+                                if (deptAuditorId != null &&!deptAuditorId.equals(pAuditorId)) {
+                                    //不是同一个人,需要单独统计
+                                    if (auditorMap.get(deptAuditorId) == null) {
+                                        auditorMap.put(deptAuditorId, 1L);
+                                    } else {
+                                        auditorMap.put(deptAuditorId, auditorMap.get(deptAuditorId) + 1);
+                                    }
                                 }
                             }
                         }
-                    }
-                    for (Map.Entry<String, Long> entry : auditorMap.entrySet()) {
-                        String auditorId = entry.getKey();
-                        Long num = entry.getValue();
-                        Optional<User> first = userList.stream().filter(ul -> ul.getId().equals(auditorId)).findFirst();
-                        if (first.isPresent()) {
-                            companyDingdingService.sendReportWaitingApplyMsg(companyId, companyDingding.getAgentId(), num, first.get().getDingdingUserid());
+                        for (Map.Entry<String, Long> entry : auditorMap.entrySet()) {
+                            String auditorId = entry.getKey();
+                            Long num = entry.getValue();
+                            Optional<User> first = userList.stream().filter(ul -> ul.getId().equals(auditorId)).findFirst();
+                            if (first.isPresent()) {
+                                companyDingdingService.sendReportWaitingApplyMsg(companyId, companyDingding.getAgentId(), num, first.get().getDingdingUserid());
+                            }
                         }
                     }
                 } else {
@@ -1026,60 +1035,83 @@ public class TimingTask {
                 }
                 //判断日报审核类型
                 timeTypeList.stream().filter(timeType -> timeType.getCompanyId().equals(companyId)).findFirst().ifPresent(timeType -> {
+                    //校验审核的日期,是否是每周提醒;目前仅景昱采用了这个模式审核,他们需要设置每周几审核
                     if (timeType.getReportAuditType() == 7) {//并行审核模式
-                        List<User> userList = userMapper.selectList(new QueryWrapper<User>().select("id,dingding_userid", "corpwx_userid").eq("company_id", companyId));
-                        List<Report> reportList = reportMapper.selectList(new QueryWrapper<Report>().select("id, project_auditor_id, audit_dept_managerid,project_audit_state,department_audit_state").eq("company_id", companyId).eq("state", 0));
-                        HashMap<String, Long> auditorMap = new HashMap();
-                        for (Report report : reportList) {
-                            //按审核人汇总统计
-                            String pAuditorId = null;
-                            if (report.getProjectAuditState() == 0) {
-                                pAuditorId = report.getProjectAuditorId();
-                                if (auditorMap.get(pAuditorId) == null) {
-                                    auditorMap.put(pAuditorId, 1L);
-                                } else {
-                                    auditorMap.put(pAuditorId, auditorMap.get(pAuditorId) + 1);
-                                }
+                        boolean shouldAlert = true;
+                        if (timeType.getAlertType() == 4) {
+                            //每周提醒一次,校验日期是否正确
+                            if (LocalDate.now().getDayOfWeek().getValue() != timeType.getAlertCheckDay()) {
+                                shouldAlert = false;
                             }
-                            String deptAuditorId = null;
-                            if (report.getDepartmentAuditState() == 0) {
-                                deptAuditorId = report.getAuditDeptManagerid();
-                                if (!deptAuditorId.equals(pAuditorId)) {
-                                    //不是同一个人,需要单独统计
-                                    if (auditorMap.get(deptAuditorId) == null) {
-                                        auditorMap.put(deptAuditorId, 1L);
+                        }
+                        if (shouldAlert) {
+                            List<User> userList = userMapper.selectList(new QueryWrapper<User>().select("id,dingding_userid", "corpwx_userid").eq("company_id", companyId));
+                            List<Report> reportList = reportMapper.selectList(new QueryWrapper<Report>().select("id, project_auditor_id, audit_dept_managerid,project_audit_state,department_audit_state").eq("company_id", companyId).eq("state", 0));
+                            HashMap<String, Long> auditorMap = new HashMap();
+                            for (Report report : reportList) {
+                                //按审核人汇总统计
+                                String pAuditorId = null;
+                                if (report.getProjectAuditState() == 0) {
+                                    pAuditorId = report.getProjectAuditorId();
+                                    if (auditorMap.get(pAuditorId) == null) {
+                                        auditorMap.put(pAuditorId, 1L);
                                     } else {
-                                        auditorMap.put(deptAuditorId, auditorMap.get(deptAuditorId) + 1);
+                                        auditorMap.put(pAuditorId, auditorMap.get(pAuditorId) + 1);
                                     }
                                 }
-                            }
-                        }
-                        for (Map.Entry<String, Long> entry : auditorMap.entrySet()) {
-                            String auditorId = entry.getKey();
-                            Long num = entry.getValue();
-                            Optional<User> first = userList.stream().filter(ul -> ul.getId().equals(auditorId)).findFirst();
-                            if (first.isPresent()) {
-                                if (first.get().getCorpwxUserid() != null) {
-                                    String corpwxUserid = first.get().getCorpwxUserid();
-                                    //推送到企业微信
-                                    JSONObject json=new JSONObject();
-                                    JSONArray dataJson=new JSONArray();
-                                    JSONObject jsonObj=new JSONObject();
-                                    jsonObj.put("key", "待审核数量");
-                                    jsonObj.put("value",num+"");
-                                    dataJson.add(jsonObj);
-                                    if(isPrivateDeploy){
-                                        json.put("content","待审核数量: "+num+"\\n<a href=\\\"https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww4e237fd6abb635af&redirect_uri="+pcUrl+"/api/corpWXAuth&response_type=code&scope=snsapi_base&state=0#wechat_redirect\\\">去审核</a>");
-                                    }else {
-                                        json.put("template_id","tty9TkCAAAuPvPjabDdQXGocnG0K24EQ");
-                                        json.put("url","https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww4e237fd6abb635af&redirect_uri=http://worktime.ttkuaiban.com/api/corpWXAuth&response_type=code&scope=snsapi_base&state=review#wechat_redirect");
-                                        json.put("content_item",dataJson);
+                                String deptAuditorId = null;
+                                if (report.getDepartmentAuditState() == 0) {
+                                    deptAuditorId = report.getAuditDeptManagerid();
+                                    if (!deptAuditorId.equals(pAuditorId)) {
+                                        //不是同一个人,需要单独统计
+                                        if (auditorMap.get(deptAuditorId) == null) {
+                                            auditorMap.put(deptAuditorId, 1L);
+                                        } else {
+                                            auditorMap.put(deptAuditorId, auditorMap.get(deptAuditorId) + 1);
+                                        }
                                     }
+                                }
+                            }
+                            for (Map.Entry<String, Long> entry : auditorMap.entrySet()) {
+                                String auditorId = entry.getKey();
+                                Long num = entry.getValue();
+                                Optional<User> first = userList.stream().filter(ul -> ul.getId().equals(auditorId)).findFirst();
+                                if (first.isPresent()) {
+                                    if (first.get().getCorpwxUserid() != null) {
+                                        String corpwxUserid = first.get().getCorpwxUserid();
+                                        //推送到企业微信
+                                        JSONObject json=new JSONObject();
+                                        JSONArray dataJson=new JSONArray();
+                                        JSONObject jsonObj=new JSONObject();
+                                        if (timeType.getAlertType() == 4) {
+                                            jsonObj.put("key", "提示");
+                                            String msgContent = timeType.getAlertCheckMsg();
+                                            if (StringUtils.isEmpty(msgContent)) {
+                                                msgContent = "待审核数量:"+num;
+                                            } else {
+                                                msgContent = msgContent.replace("{0}", ""+num);
+                                            }
+                                            jsonObj.put("value",msgContent);
+                                        } else {
+                                            jsonObj.put("key", "待审核数量");
+                                            jsonObj.put("value",num+"");
+                                        }
+                                        dataJson.add(jsonObj);
+                                        if(isPrivateDeploy){
+                                            json.put("content","待审核数量: "+num+"\\n<a href=\\\"https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww4e237fd6abb635af&redirect_uri="+pcUrl+"/api/corpWXAuth&response_type=code&scope=snsapi_base&state=0#wechat_redirect\\\">去审核</a>");
+                                        }else {
+                                            String templateId = timeType.getAlertType() == 4 ? "tty9TkCAAAtDDCqY796mGulF9c5Jmwng":"tty9TkCAAAuPvPjabDdQXGocnG0K24EQ";
+                                            json.put("template_id",templateId);
+                                            json.put("url","https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww4e237fd6abb635af&redirect_uri=http://worktime.ttkuaiban.com/api/corpWXAuth&response_type=code&scope=snsapi_base&state=review#wechat_redirect");
+                                            json.put("content_item",dataJson);
+                                        }
 //                                    System.out.println("发送企业微信消息==用户:"+first.get().getId()+", name="+first.get().getName()+", "+json.toJSONString());
-                                    wxCorpInfoService.sendWXCorpTemplateMsg(wxCorpInfo, corpwxUserid, json);
+                                        wxCorpInfoService.sendWXCorpTemplateMsg(wxCorpInfo, corpwxUserid, json);
+                                    }
                                 }
                             }
                         }
+
                     } else {
                         List<Map<String, Object>> result = reportMapper.getProWaitingApproveCnt(wxCorpInfo.getCompanyId());
                         List<Map<String, Object>> result1 = reportMapper.getDeptWaitingApproveCnt(wxCorpInfo.getCompanyId());