|
@@ -56,6 +56,8 @@ import java.util.concurrent.Executor;
|
|
|
import java.util.concurrent.Executors;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import static org.springframework.boot.system.SystemProperties.get;
|
|
|
+
|
|
|
/**
|
|
|
* <p>
|
|
|
* 服务实现类
|
|
@@ -594,7 +596,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
r.setGroupName(optinal.get().getName());
|
|
|
}
|
|
|
}
|
|
|
- } else {
|
|
|
+ } else if (reportAuditType == 1 || reportAuditType == 2){
|
|
|
List<GroupParticipator> groupParticipatorList = groupParticipatorMapper.selectList(new QueryWrapper<GroupParticipator>());
|
|
|
if (groupParticipatorList.size() > 0) {
|
|
|
List<Integer> groupIds = groupParticipatorList.stream().map(GroupParticipator::getGroupId).collect(Collectors.toList());
|
|
@@ -1387,41 +1389,53 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
for (Integer rid : ids) {
|
|
|
Report r = new Report();
|
|
|
r.setId(rid);
|
|
|
- ReportAuditorSetting auditorItem = auditorSettingList.stream().filter(a -> a.getReportId().equals(rid)).findFirst().get();
|
|
|
- switch (auditorItem.getCurAuditLevel()) {
|
|
|
- case 1:
|
|
|
- if (auditorItem.getAuditorSec() != null) {
|
|
|
- //进入到第二审批人
|
|
|
- r.setProjectAuditorId(auditorItem.getAuditorSec());
|
|
|
- auditorItem.setCurAuditLevel(2);
|
|
|
- updateReportAuditorSettingList.add(auditorItem);
|
|
|
- } else {
|
|
|
- r.setProjectAuditState(1);
|
|
|
- r.setProjectAuditTime(LocalDateTime.now());
|
|
|
- r.setState(1);
|
|
|
- }
|
|
|
- updateReportList.add(r);
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- if (auditorItem.getAuditorThird() != null) {
|
|
|
- //进入到第三审批人
|
|
|
- r.setProjectAuditorId(auditorItem.getAuditorThird());
|
|
|
- auditorItem.setCurAuditLevel(3);
|
|
|
- updateReportAuditorSettingList.add(auditorItem);
|
|
|
- } else {
|
|
|
+ Optional<ReportAuditorSetting> first = auditorSettingList.stream().filter(a -> a.getReportId().equals(rid)).findFirst();
|
|
|
+ if (first.isPresent()) {
|
|
|
+ //存在员工提交的审批流记录
|
|
|
+ ReportAuditorSetting auditorItem = first.get();
|
|
|
+ switch (auditorItem.getCurAuditLevel()) {
|
|
|
+ case 1:
|
|
|
+ //第二审批人存在,并且和第一审批人不一样
|
|
|
+ if (auditorItem.getAuditorSec() != null && !auditorItem.getAuditorSec().equals(auditorItem.getAuditorFirst())) {
|
|
|
+ //进入到第二审批人
|
|
|
+ r.setProjectAuditorId(auditorItem.getAuditorSec());
|
|
|
+ auditorItem.setCurAuditLevel(2);
|
|
|
+ updateReportAuditorSettingList.add(auditorItem);
|
|
|
+ } else {
|
|
|
+ r.setProjectAuditState(1);
|
|
|
+ r.setProjectAuditTime(LocalDateTime.now());
|
|
|
+ r.setState(1);
|
|
|
+ }
|
|
|
+ updateReportList.add(r);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ //第三审批人存在,并且和第二审批人不一样
|
|
|
+ if (auditorItem.getAuditorThird() != null && !auditorItem.getAuditorThird().equals(auditorItem.getAuditorSec())) {
|
|
|
+ //进入到第三审批人
|
|
|
+ r.setProjectAuditorId(auditorItem.getAuditorThird());
|
|
|
+ auditorItem.setCurAuditLevel(3);
|
|
|
+ updateReportAuditorSettingList.add(auditorItem);
|
|
|
+ } else {
|
|
|
+ r.setProjectAuditState(1);
|
|
|
+ r.setProjectAuditTime(LocalDateTime.now());
|
|
|
+ r.setState(1);
|
|
|
+ }
|
|
|
+ updateReportList.add(r);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ //目前最多三层,第三个审批人审批后结束
|
|
|
r.setProjectAuditState(1);
|
|
|
r.setProjectAuditTime(LocalDateTime.now());
|
|
|
r.setState(1);
|
|
|
- }
|
|
|
- updateReportList.add(r);
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- //目前最多三层,第三个审批人审批后结束
|
|
|
- r.setProjectAuditState(1);
|
|
|
- r.setProjectAuditTime(LocalDateTime.now());
|
|
|
- r.setState(1);
|
|
|
- updateReportList.add(r);
|
|
|
- break;
|
|
|
+ updateReportList.add(r);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //是之前项目审核人直接审核的情况,还没切换到员工自行选择审核人的情况
|
|
|
+ r.setProjectAuditState(1);
|
|
|
+ r.setProjectAuditTime(LocalDateTime.now());
|
|
|
+ r.setState(1);
|
|
|
+ updateReportList.add(r);
|
|
|
}
|
|
|
}
|
|
|
if (updateReportList.size() > 0) {
|
|
@@ -1616,7 +1630,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
for (Report report : reportList) {
|
|
|
if(report.getState()==1){
|
|
|
ReportAuditorSetting reportAuditorSetting = reportAuditorSettingMapper.selectById(report.getId());
|
|
|
- if(reportAuditorSetting.getCcUserid() != null){
|
|
|
+ if(reportAuditorSetting != null && reportAuditorSetting.getCcUserid() != null){
|
|
|
Optional<User> first = userList.stream().filter(ul -> ul.getId().equals(reportAuditorSetting.getCcUserid())).findFirst();
|
|
|
//取到抄送人
|
|
|
User u = first.get();
|
|
@@ -2269,35 +2283,58 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
updateBatchById(reportList);
|
|
|
} else if (timeType.getReportAuditType() == 3) {
|
|
|
//员工自由选择的审批人
|
|
|
+ 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, project_id, project_audit_state, creator_id, create_date, company_id").in("id", ids));
|
|
|
+ allReports = reportList;
|
|
|
String auditorId = user.getId();
|
|
|
List<ReportAuditorSetting> auditorSettingList = reportAuditorSettingMapper.selectList(new QueryWrapper<ReportAuditorSetting>().in("report_id", ids));
|
|
|
List<Report> updateReportList = new ArrayList<>();
|
|
|
+ List<ReportAuditorSetting> updateReportAuditorSettingList = new ArrayList<>();
|
|
|
for (Integer rid : ids) {
|
|
|
Report r = new Report();
|
|
|
r.setId(rid);
|
|
|
- ReportAuditorSetting auditorItem = auditorSettingList.stream().filter(a -> a.getReportId().equals(rid)).findFirst().get();
|
|
|
- if (auditorId.equals(auditorItem.getAuditorFirst())) {
|
|
|
- if (auditorItem.getAuditorSec() != null) {
|
|
|
- //进入到第二审批人
|
|
|
- r.setProjectAuditorId(auditorItem.getAuditorSec());
|
|
|
- } else {
|
|
|
- r.setProjectAuditState(1);
|
|
|
- r.setProjectAuditTime(LocalDateTime.now());
|
|
|
- r.setState(1);
|
|
|
- }
|
|
|
- updateReportList.add(r);
|
|
|
- } else if (auditorId.equals(auditorItem.getAuditorSec())) {
|
|
|
- if (auditorItem.getAuditorThird() != null) {
|
|
|
- //进入到第三审批人
|
|
|
- r.setProjectAuditorId(auditorItem.getAuditorThird());
|
|
|
- } else {
|
|
|
- r.setProjectAuditState(1);
|
|
|
- r.setProjectAuditTime(LocalDateTime.now());
|
|
|
- r.setState(1);
|
|
|
+ Optional<ReportAuditorSetting> first = auditorSettingList.stream().filter(a -> a.getReportId().equals(rid)).findFirst();
|
|
|
+ if (first.isPresent()) {
|
|
|
+ ReportAuditorSetting auditorItem = first.get();
|
|
|
+ switch (auditorItem.getCurAuditLevel()) {
|
|
|
+ case 1:
|
|
|
+ //第二审批人存在,并且和第一审批人不一样
|
|
|
+ if (auditorItem.getAuditorSec() != null && !auditorItem.getAuditorSec().equals(auditorItem.getAuditorFirst())) {
|
|
|
+ //进入到第二审批人
|
|
|
+ r.setProjectAuditorId(auditorItem.getAuditorSec());
|
|
|
+ auditorItem.setCurAuditLevel(2);
|
|
|
+ updateReportAuditorSettingList.add(auditorItem);
|
|
|
+ } else {
|
|
|
+ r.setProjectAuditState(1);
|
|
|
+ r.setProjectAuditTime(LocalDateTime.now());
|
|
|
+ r.setState(1);
|
|
|
+ }
|
|
|
+ updateReportList.add(r);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ //第三审批人存在,并且和第二审批人不一样
|
|
|
+ if (auditorItem.getAuditorThird() != null && !auditorItem.getAuditorThird().equals(auditorItem.getAuditorSec())) {
|
|
|
+ //进入到第三审批人
|
|
|
+ r.setProjectAuditorId(auditorItem.getAuditorThird());
|
|
|
+ auditorItem.setCurAuditLevel(3);
|
|
|
+ updateReportAuditorSettingList.add(auditorItem);
|
|
|
+ } else {
|
|
|
+ r.setProjectAuditState(1);
|
|
|
+ r.setProjectAuditTime(LocalDateTime.now());
|
|
|
+ r.setState(1);
|
|
|
+ }
|
|
|
+ updateReportList.add(r);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ //目前最多三层,第三个审批人审批后结束
|
|
|
+ r.setProjectAuditState(1);
|
|
|
+ r.setProjectAuditTime(LocalDateTime.now());
|
|
|
+ r.setState(1);
|
|
|
+ updateReportList.add(r);
|
|
|
+ break;
|
|
|
}
|
|
|
- updateReportList.add(r);
|
|
|
- } else if (auditorId.equals(auditorItem.getAuditorThird())) {
|
|
|
- //目前最多三层,第三个审批人审批后结束
|
|
|
+ } else {
|
|
|
+ //老版本的数据,直接审核通过
|
|
|
r.setProjectAuditState(1);
|
|
|
r.setProjectAuditTime(LocalDateTime.now());
|
|
|
r.setState(1);
|
|
@@ -2306,6 +2343,10 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}
|
|
|
if (updateReportList.size() > 0) {
|
|
|
updateBatchById(updateReportList);
|
|
|
+ //更新审核人的审批流程
|
|
|
+ if (updateReportAuditorSettingList.size() > 0) {
|
|
|
+ reportAuditorSettingService.updateBatchById(updateReportAuditorSettingList);
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
List<AuditWorkflowTimeSetting> settings = auditWorkflowTimeSettingMapper.selectList(
|
|
@@ -2555,6 +2596,48 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if (timeType.getReportAuditType() == 3) {
|
|
|
+ //审核通过的话,给抄送人发送审核通过提醒
|
|
|
+ List<Report> reportList = reportMapper.selectList(new QueryWrapper<Report>().in("id", ids));
|
|
|
+ for (Report report : reportList) {
|
|
|
+ if(report.getState()==1){
|
|
|
+ ReportAuditorSetting reportAuditorSetting = reportAuditorSettingMapper.selectById(report.getId());
|
|
|
+ if(reportAuditorSetting != null && reportAuditorSetting.getCcUserid() != null){
|
|
|
+ Optional<User> first = userList.stream().filter(ul -> ul.getId().equals(reportAuditorSetting.getCcUserid())).findFirst();
|
|
|
+ //取到抄送人
|
|
|
+ User u = first.get();
|
|
|
+ if(u.getCorpwxUserid()!=null){
|
|
|
+ if(wxCorpInfoList.size()>0){
|
|
|
+ JSONObject json=new JSONObject();
|
|
|
+ JSONArray dataJson=new JSONArray();
|
|
|
+ JSONObject item=new JSONObject();
|
|
|
+ item.put("key","审核结果");
|
|
|
+ item.put("value","通过");
|
|
|
+ dataJson.add(item);
|
|
|
+ JSONObject item1=new JSONObject();
|
|
|
+ item1.put("key","项目名称");
|
|
|
+ item1.put("value",projectList.stream().filter(pro->pro.getId().equals(report.getProjectId())).findFirst().get().getProjectName());
|
|
|
+ dataJson.add(item1);
|
|
|
+ JSONObject item2=new JSONObject();
|
|
|
+ item2.put("key","填报人员");
|
|
|
+ item2.put("value",userList.stream().filter(curU->curU.getId().equals(report.getCreatorId())).findFirst().get().getName());
|
|
|
+ dataJson.add(item2);
|
|
|
+ JSONObject item3=new JSONObject();
|
|
|
+ item3.put("key","工作日期");
|
|
|
+ item3.put("value",report.getCreateDate());
|
|
|
+ dataJson.add(item3);
|
|
|
+ json.put("template_id","tty9TkCAAAwOgmzwS2uFogWgOmPDdIRQ");
|
|
|
+ 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=0#wechat_redirect");
|
|
|
+ json.put("content_item",dataJson);
|
|
|
+ wxCorpInfoService.sendWXCorpTemplateMsg(wxCorpInfoList.get(0),u.getCorpwxUserid(),json);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//需要进行审核记录保存
|
|
|
ReportAuditLog log = new ReportAuditLog();
|
|
|
log.setAuditChannel(channel);
|
|
@@ -4756,7 +4839,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
array.add(object);
|
|
|
});
|
|
|
String username = "WPG_GS";
|
|
|
- String password = "Sys_GS@12345";
|
|
|
+ String password = "Sap_GS@12345";
|
|
|
String authorization =username + ":" + password;
|
|
|
JSONObject header=new JSONObject();
|
|
|
String s = "Basic "+Base64.getEncoder().encodeToString(authorization.getBytes());
|