Przeglądaj źródła

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

Lijy 1 rok temu
rodzic
commit
cb52f31dd5

+ 18 - 1
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ProductController.java

@@ -57,6 +57,8 @@ public class ProductController {
     private SysDictService sysDictService;
     @Resource
     private StageService stageService;
+    @Resource
+    private ContactsService contactsService;
 
 
     /**
@@ -268,6 +270,7 @@ public class ProductController {
         List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>().eq(User::getCompanyId, companyId));
 //        List<SysDict> businessStageList = sysDictService.list(new LambdaQueryWrapper<SysDict>().eq(SysDict::getCode, "BusinessStage"));
         List<Stage> businessStageList = stageService.list(new LambdaQueryWrapper<Stage>().eq(Stage::getCompanyId, companyId));
+        List<Contacts> contactsList = contactsService.list(new LambdaQueryWrapper<Contacts>().eq(Contacts::getCompanyId, companyId));
         opportunityList.forEach(c->{
             Optional<Custom> custom = customList.stream().filter(ct -> ct.getId().equals(c.getCustomerId())).findFirst();
             if(custom.isPresent()){
@@ -277,7 +280,7 @@ public class ProductController {
             if(user.isPresent()){
                 c.setCreatorName(user.get().getName());
             }
-            Optional<User> contacts = userList.stream().filter(u -> u.getId().equals(c.getContactsId())).findFirst();
+            Optional<Contacts> contacts = contactsList.stream().filter(u -> u.getId().equals(c.getContactsId())).findFirst();
             if(contacts.isPresent()){
                 c.setContactsName(contacts.get().getName());
             }
@@ -312,6 +315,8 @@ public class ProductController {
         orderIds.add(-1);
         List<SalesOrder> orderList = salesOrderService.list(new LambdaQueryWrapper<SalesOrder>().in(SalesOrder::getId, orderIds));
         List<SysDict> orderTypeList = sysDictService.list(new LambdaQueryWrapper<SysDict>().eq(SysDict::getCode, "OrderType"));
+        List<Integer> businessOpportunityIds = orderList.stream().map(SalesOrder::getBusinessOpportunityId).distinct().collect(Collectors.toList());
+        List<BusinessOpportunity> businessOpportunityList = businessOpportunityService.list(new LambdaQueryWrapper<BusinessOpportunity>().in(BusinessOpportunity::getId, businessOpportunityIds));
         orderList.forEach(o->{
             Optional<Custom> custom = customList.stream().filter(ct -> ct.getId().equals(o.getCustomId())).findFirst();
             if(custom.isPresent()){
@@ -321,10 +326,22 @@ public class ProductController {
             if(user.isPresent()){
                 o.setCreatorName(user.get().getName());
             }
+            Optional<User> customSigner = userList.stream().filter(u -> u.getId().equals(o.getCustomSigner())).findFirst();
+            if(customSigner.isPresent()){
+                o.setCustomSignerName(customSigner.get().getName());
+            }
+            Optional<User> companySigner = userList.stream().filter(u -> u.getId().equals(o.getCompanySigner())).findFirst();
+            if(companySigner.isPresent()){
+                o.setCompanySigner(companySigner.get().getName());
+            }
             Optional<User> incharger = userList.stream().filter(u -> u.getId().equals(o.getInchargerId())).findFirst();
             if(incharger.isPresent()){
                 o.setInchargerName(incharger.get().getName());
             }
+            Optional<BusinessOpportunity> businessOpportunity = businessOpportunityList.stream().filter(b -> o.getBusinessOpportunityId() != null && b.getId().equals(o.getBusinessOpportunityId())).findFirst();
+            if(businessOpportunity.isPresent()){
+                o.setBusinessOpportunityName(businessOpportunity.get().getName());
+            }
             Optional<SysDict> orderType = orderTypeList.stream().filter(ot -> ot.getId().equals(o.getType())).findFirst();
             if(orderType.isPresent()){
                 o.setTypeName(orderType.get().getName());

+ 2 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportLogController.java

@@ -309,6 +309,8 @@ public class ReportLogController {
                             msg.setError("第"+row+"行填报时间格式错误,请检查审核时间数据");
                             return msg;
                         }
+                        reportLog.setOperateDate(createTimeTime);
+                        needUpdateReportLogList.add(reportLog);
                         LocalDateTime finalCreateTimeTime = createTimeTime;
                         reports.forEach(r->{
                             r.setCreateTime(finalCreateTimeTime);

+ 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());