|
@@ -0,0 +1,941 @@
|
|
|
+package com.jeeplus.modules.ruralprojectrecords.service;
|
|
|
+
|
|
|
+import com.google.common.collect.Maps;
|
|
|
+import com.google.gson.Gson;
|
|
|
+import com.jeeplus.common.service.CrudService;
|
|
|
+import com.jeeplus.common.utils.MyBeanUtils;
|
|
|
+import com.jeeplus.modules.act.entity.Act;
|
|
|
+import com.jeeplus.modules.act.service.ActTaskService;
|
|
|
+import com.jeeplus.modules.historical.service.HistoricalService;
|
|
|
+import com.jeeplus.modules.isignature.service.ISignatureDocumentService;
|
|
|
+import com.jeeplus.modules.projectAccessory.entity.ProjectAccessoryRelationInfo;
|
|
|
+import com.jeeplus.modules.projectAccessory.entity.ProjectTemplateInfo;
|
|
|
+import com.jeeplus.modules.projectAccessory.service.ProjectTemplateService;
|
|
|
+import com.jeeplus.modules.projectFilingBatch.dao.ProjectFilingBatchDao;
|
|
|
+import com.jeeplus.modules.projectFilingBatch.dao.ProjectFilingbatchRelationDao;
|
|
|
+import com.jeeplus.modules.projectcontentinfo.dao.ProjectReportDataDao;
|
|
|
+import com.jeeplus.modules.projectcontentinfo.dao.ProjectReportDataTwoDao;
|
|
|
+import com.jeeplus.modules.projectcontentinfo.dao.ProjectcontentinfoDao;
|
|
|
+import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportData;
|
|
|
+import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportDataTwo;
|
|
|
+import com.jeeplus.modules.projectcontentinfo.entity.Projectcontentinfo;
|
|
|
+import com.jeeplus.modules.projectcontentinfo.service.ProjectReportDataService;
|
|
|
+import com.jeeplus.modules.projectcontentinfo.service.ProjectReportDataTwoService;
|
|
|
+import com.jeeplus.modules.projectcontentinfo.service.ProjectcontentinfoService;
|
|
|
+import com.jeeplus.modules.projectrecord.entity.ProjectRecords;
|
|
|
+import com.jeeplus.modules.projectrecord.service.ProjectRecordsService;
|
|
|
+import com.jeeplus.modules.projectreportnum.service.ProjectReportNumService;
|
|
|
+import com.jeeplus.modules.ruralprojectrecords.dao.RuralProjectMessageDao;
|
|
|
+import com.jeeplus.modules.ruralprojectrecords.dao.RuralProjectRecordsReportedDao;
|
|
|
+import com.jeeplus.modules.ruralprojectrecords.dao.RuralWorkProjectUserDao;
|
|
|
+import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecords;
|
|
|
+import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectcontentinfo;
|
|
|
+import com.jeeplus.modules.ruralprojectrecords.entity.RuralReportConsultant;
|
|
|
+import com.jeeplus.modules.sys.dao.WorkattachmentDao;
|
|
|
+import com.jeeplus.modules.sys.entity.MainDictDetail;
|
|
|
+import com.jeeplus.modules.sys.entity.Office;
|
|
|
+import com.jeeplus.modules.sys.entity.User;
|
|
|
+import com.jeeplus.modules.sys.entity.Workattachment;
|
|
|
+import com.jeeplus.modules.sys.service.OfficeService;
|
|
|
+import com.jeeplus.modules.sys.service.WorkattachmentService;
|
|
|
+import com.jeeplus.modules.sys.utils.UserUtils;
|
|
|
+import com.jeeplus.modules.workactivity.dao.WorkActivityProcessDao;
|
|
|
+import com.jeeplus.modules.workactivity.entity.Activity;
|
|
|
+import com.jeeplus.modules.workactivity.entity.WorkActivityProcess;
|
|
|
+import com.jeeplus.modules.workactivity.service.ActivityService;
|
|
|
+import com.jeeplus.modules.workactivity.service.WorkActivityProcessService;
|
|
|
+import com.jeeplus.modules.workactivitymenu.entity.WorkActivityMenu;
|
|
|
+import com.jeeplus.modules.workactivitymenu.service.WorkActivityMenuService;
|
|
|
+import com.jeeplus.modules.workclientinfo.dao.WorkClientAttachmentDao;
|
|
|
+import com.jeeplus.modules.workclientinfo.dao.WorkClientLinkmanDao;
|
|
|
+import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
|
|
|
+import com.jeeplus.modules.workclientinfo.entity.WorkClientInfo;
|
|
|
+import com.jeeplus.modules.workclientinfo.service.WorkClientInfoService;
|
|
|
+import com.jeeplus.modules.workcontent.web.WorkContentTypeController;
|
|
|
+import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfo;
|
|
|
+import com.jeeplus.modules.workcontractinfo.service.WorkContractInfoService;
|
|
|
+import com.jeeplus.modules.workprojectnotify.entity.WorkProjectNotify;
|
|
|
+import com.jeeplus.modules.workprojectnotify.service.WorkProjectNotifyService;
|
|
|
+import com.jeeplus.modules.workprojectnotify.util.UtilNotify;
|
|
|
+import com.jeeplus.modules.workreview.dao.WorkReviewAuditDao;
|
|
|
+import com.jeeplus.modules.workstaff.entity.WorkStaffCertificate;
|
|
|
+import org.activiti.engine.ActivitiObjectNotFoundException;
|
|
|
+import org.activiti.engine.HistoryService;
|
|
|
+import org.activiti.engine.IdentityService;
|
|
|
+import org.activiti.engine.RuntimeService;
|
|
|
+import org.activiti.engine.runtime.ProcessInstance;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+@Service
|
|
|
+@Transactional(readOnly = true)
|
|
|
+public class RuralProjectMessageNewTwoService extends CrudService<RuralProjectMessageDao, RuralProjectRecords> {
|
|
|
+ @Autowired
|
|
|
+ private RuralWorkProjectUserDao workProjectUserDao;
|
|
|
+ @Autowired
|
|
|
+ private WorkClientLinkmanDao workClientLinkmanDao;
|
|
|
+ @Autowired
|
|
|
+ protected HistoryService historyService;
|
|
|
+ @Autowired
|
|
|
+ private WorkContractInfoService contractInfoService;
|
|
|
+ @Autowired
|
|
|
+ private WorkClientAttachmentDao workClientAttachmentDao;
|
|
|
+ @Autowired
|
|
|
+ private WorkattachmentService workattachmentService;
|
|
|
+ @Autowired
|
|
|
+ private WorkClientInfoService workClientInfoService;
|
|
|
+ @Autowired
|
|
|
+ private ProjectcontentinfoDao projectcontentinfoDao;
|
|
|
+ @Autowired
|
|
|
+ private ProjectReportDataTwoDao projectReportDataDao;
|
|
|
+ @Autowired
|
|
|
+ private ProjectReportNumService projectReportNumService;
|
|
|
+ @Autowired
|
|
|
+ private ProjectReportDataTwoService projectReportDataService;
|
|
|
+ @Autowired
|
|
|
+ private WorkattachmentDao workattachmentDao;
|
|
|
+ @Autowired
|
|
|
+ private ISignatureDocumentService signatureDocumentService;
|
|
|
+ @Autowired
|
|
|
+ private OfficeService officeService;
|
|
|
+ @Autowired
|
|
|
+ private IdentityService identityService;
|
|
|
+ @Autowired
|
|
|
+ private WorkActivityMenuService workActivityMenuService;
|
|
|
+ @Autowired
|
|
|
+ private WorkProjectNotifyService workProjectNotifyService;
|
|
|
+ @Autowired
|
|
|
+ private RuntimeService runtimeService;
|
|
|
+ @Autowired
|
|
|
+ private WorkActivityProcessService workActivityProcessService;
|
|
|
+ @Autowired
|
|
|
+ private WorkReviewAuditDao workReviewAuditDao;
|
|
|
+ @Autowired
|
|
|
+ private ActTaskService actTaskService;
|
|
|
+ @Autowired
|
|
|
+ private ProjectRecordsService projectRecordsService;
|
|
|
+ @Autowired
|
|
|
+ private ActivityService activityService;
|
|
|
+ @Autowired
|
|
|
+ private WorkActivityProcessDao workActivityProcessDao;
|
|
|
+ @Autowired
|
|
|
+ private WorkContractInfoService workContractInfoService;
|
|
|
+ @Autowired
|
|
|
+ private RuralProjectRecordsReportedDao ruralProjectRecordsReportedDao;
|
|
|
+ @Autowired
|
|
|
+ private RuralProjectRecordsService ruralProjectRecordsService;
|
|
|
+ @Autowired
|
|
|
+ private HistoricalService historicalService;
|
|
|
+ @Autowired
|
|
|
+ private ProjectcontentinfoService projectcontentinfoService;
|
|
|
+ @Autowired
|
|
|
+ private ProjectTemplateService projectTemplateService;
|
|
|
+ @Autowired
|
|
|
+ private SubProjectInfoService subProjectInfoService;
|
|
|
+ @Autowired
|
|
|
+ private ProjectFilingbatchRelationDao filingbatchRelationDao;
|
|
|
+ @Autowired
|
|
|
+ private ProjectFilingBatchDao projectFilingBatchDao;
|
|
|
+
|
|
|
+ private static byte[] SYN_BYTE = new byte[0];
|
|
|
+
|
|
|
+ public RuralProjectRecords get(String id) {
|
|
|
+ return super.get(id);
|
|
|
+ }
|
|
|
+ public RuralProjectRecords getInfo(String id) {
|
|
|
+ RuralProjectRecords projectRecords = super.get(id);
|
|
|
+ if(projectRecords!=null){
|
|
|
+ String cid = projectRecords.getWorkContractInfo().getId();
|
|
|
+ WorkContractInfo workContractInfo = contractInfoService.get(cid);
|
|
|
+ if(null != workContractInfo) {
|
|
|
+ WorkClientInfo workClientInfo = workClientInfoService.get(workContractInfo.getClient().getId());
|
|
|
+ workContractInfo.setClient(workClientInfo);
|
|
|
+ }
|
|
|
+ projectRecords.setWorkContractInfo(workContractInfo);
|
|
|
+ }
|
|
|
+ return projectRecords;
|
|
|
+ }
|
|
|
+ public ProjectRecords getMasters(String id) {
|
|
|
+ ProjectRecords projectRecords = dao.getRuralProjectRecords(id);
|
|
|
+ List<User> users = workProjectUserDao.queryProjectUsers(projectRecords.getId(), "1");
|
|
|
+ projectRecords.setProjectLeaders(users);
|
|
|
+ return projectRecords;
|
|
|
+ }
|
|
|
+ @Transactional(readOnly = false)
|
|
|
+ public String saveData(Projectcontentinfo projectcontentinfo, int type) {
|
|
|
+ RuralProjectRecords ruralProjectRecords = projectcontentinfo.getProjectOnRural();
|
|
|
+ String count = "0";
|
|
|
+ String infoId = "";
|
|
|
+ Projectcontentinfo s = new Projectcontentinfo();
|
|
|
+ s.setParentIds("0,");
|
|
|
+ if (null==projectcontentinfo.getProjectReportDataTwo().getProject()){
|
|
|
+ projectcontentinfo.getProjectReportDataTwo().setProject(projectcontentinfo.getProject());
|
|
|
+ }
|
|
|
+ s.setProject(projectcontentinfo.getProjectReportDataTwo().getProject());
|
|
|
+ //根据项目id查询相关工作内容信息的数据 并将其存为父级数据
|
|
|
+ Projectcontentinfo contentinfo = projectcontentinfoDao.findListByProject(s).get(0);
|
|
|
+ projectcontentinfo.setProjectOnRural(this.getInfo(projectcontentinfo.getProject().getId()));
|
|
|
+ List<Workattachment> attachmentList = projectcontentinfo.getWorkAttachments();
|
|
|
+ if (projectcontentinfo.getProjectReportDataTwo()!=null){
|
|
|
+ //保存工作报告相关数据
|
|
|
+ ProjectReportDataTwo projectReportData = projectcontentinfo.getProjectReportDataTwo();
|
|
|
+ RuralProjectRecords projectRecords=ruralProjectRecordsService.get(projectcontentinfo.getProjectReportDataTwo().getProject().getId());
|
|
|
+ projectReportData.setCompanyId(contentinfo.getCompanyId());
|
|
|
+ projectReportData.setOfficeId(contentinfo.getOfficeId());
|
|
|
+ projectReportData.setProject(contentinfo.getProject());
|
|
|
+ if (com.jeeplus.common.utils.StringUtils.isBlank(projectReportData.getId())){
|
|
|
+ projectReportData.setFileStatus("1");
|
|
|
+ }
|
|
|
+ if (type==1){
|
|
|
+ //暂存
|
|
|
+ projectReportData.setStatus("1");
|
|
|
+ String num = projectReportData.getNumber();
|
|
|
+ if(com.jeeplus.common.utils.StringUtils.isNotBlank(num)){
|
|
|
+ projectReportNumService.updateNum(num);
|
|
|
+ }
|
|
|
+ projectReportDataService.save(projectReportData);
|
|
|
+ }else {
|
|
|
+ //送审
|
|
|
+ Map<String, Object> variables = Maps.newHashMap();
|
|
|
+ projectReportData.setStatus("2");
|
|
|
+ String processInstanceId = "";
|
|
|
+ //判断是否存在撤回
|
|
|
+ if (com.jeeplus.common.utils.StringUtils.isNotBlank(projectReportData.getId())){
|
|
|
+ ProjectReportDataTwo old = projectReportDataService.get(projectReportData.getId());
|
|
|
+ if (com.jeeplus.common.utils.StringUtils.isNotBlank(old.getProcessInstanceId())){
|
|
|
+ processInstanceId = old.getProcessInstanceId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ projectReportData.setConsultantDate(new Date());
|
|
|
+ projectReportData.setPrincipalDate(new Date());
|
|
|
+ //获取项目信息
|
|
|
+ ProjectRecords projectRecord = this.getMasters(projectcontentinfo.getProjectReportDataTwo().getProject().getId());
|
|
|
+ projectcontentinfo.setProject(projectRecord);
|
|
|
+ if (type == 2) {
|
|
|
+ //启动流程
|
|
|
+ String str = this.saveRuralProject(projectReportData, variables, processInstanceId, projectcontentinfo.getProject().getProjectLeaders());
|
|
|
+ if (!str.equals("true")){
|
|
|
+ return str;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //修改项目开始时间和结束时间
|
|
|
+ System.out.println(ruralProjectRecords.getStartDate());
|
|
|
+ System.out.println(ruralProjectRecords.getEndingDate());
|
|
|
+ if(null != ruralProjectRecords.getStartDate() && null != ruralProjectRecords.getEndingDate()){
|
|
|
+ ruralProjectRecordsService.updateDate(ruralProjectRecords);
|
|
|
+ }
|
|
|
+
|
|
|
+ count="8";
|
|
|
+ infoId = projectReportData.getId();
|
|
|
+ contentinfo.setDictType(projectReportData.getType());
|
|
|
+// contentinfo.setInfoId(projectReportData.getId());
|
|
|
+// projectcontentinfoDao.updateInfoId(contentinfo);
|
|
|
+ }
|
|
|
+ //保存附件+tree
|
|
|
+ if (attachmentList!=null && attachmentList.size()!=0) {
|
|
|
+ //附件信息
|
|
|
+ for (Workattachment workattachment : attachmentList) {
|
|
|
+ if ("86".equals(workattachment.getAttachmentFlag())){
|
|
|
+ workattachment.setDivIdType("_attachment");
|
|
|
+ } else if ("152".equals(workattachment.getAttachmentFlag())){
|
|
|
+ workattachment.setDivIdType("_gistdata");
|
|
|
+ }else if ("153".equals(workattachment.getAttachmentFlag())){
|
|
|
+ workattachment.setDivIdType("_other");
|
|
|
+ }
|
|
|
+ if (workattachment.getId() == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (workattachment.DEL_FLAG_NORMAL.equals(workattachment.getDelFlag())) {
|
|
|
+ workattachment.setAttachmentId(infoId);
|
|
|
+ workattachment.setAttachmentUser(UserUtils.getUser().getId());
|
|
|
+ if (com.jeeplus.common.utils.StringUtils.isBlank(workattachment.getId()) || "null".equals(workattachment.getId())) {
|
|
|
+ workattachment.preInsert();
|
|
|
+ if (null == workattachment.getDivIdType()){
|
|
|
+ workattachment.setDivIdType("");
|
|
|
+ }
|
|
|
+
|
|
|
+ workattachmentDao.insert(workattachment);
|
|
|
+ if (projectcontentinfo.getProjectReportDataTwo()!=null && com.jeeplus.common.utils.StringUtils.isNotBlank(projectcontentinfo.getProjectReportDataTwo().getId())) {
|
|
|
+ try {
|
|
|
+ signatureDocumentService.createIsignature(workattachment.getUrl(), workattachment.getAttachmentName(), workattachment.getId(), projectcontentinfo.getProjectReportDataTwo().getName());
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.info("PDF转换失败:" + e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ workattachment.preUpdate();
|
|
|
+ workattachmentDao.update(workattachment);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ workattachmentDao.delete(workattachment);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return "true";
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getReportToJson(Projectcontentinfo projectcontentinfo){
|
|
|
+ RuralProjectcontentinfo info = new RuralProjectcontentinfo();
|
|
|
+ try {
|
|
|
+ MyBeanUtils.copyBeanNotNull2Bean(projectcontentinfo,info);//将编辑表单中的非NULL值覆盖数据库记录中的值
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ logger.error("Exception e:"+e);
|
|
|
+ }
|
|
|
+ Projectcontentinfo projectcontentinfo1 = projectcontentinfoService.getByProjectId(projectcontentinfo.getProject().getId());
|
|
|
+ String dictType = projectcontentinfo.getDictType();
|
|
|
+ RuralProjectRecords records = ruralProjectRecordsService.getQueryProjectUsers(projectcontentinfo1.getProject().getId());
|
|
|
+ info.setProject(records);
|
|
|
+ ProjectReportDataTwo projectReportData = new ProjectReportDataTwo();
|
|
|
+ projectReportData.setType(dictType);
|
|
|
+ if (com.jeeplus.common.utils.StringUtils.isNotBlank(projectcontentinfo1.getInfoId())){
|
|
|
+ projectReportData = projectReportDataService.get(projectcontentinfo1.getInfoId());
|
|
|
+ }else if (info.getProjectReportDataTwo()!=null && com.jeeplus.common.utils.StringUtils.isNotBlank(info.getProjectReportDataTwo().getId())) {
|
|
|
+ projectReportData = projectReportDataService.get(info.getProjectReportDataTwo().getId());
|
|
|
+ }else {
|
|
|
+ projectReportData.setNumber("");
|
|
|
+ }
|
|
|
+ if (projectReportData.getMaster()==null || com.jeeplus.common.utils.StringUtils.isBlank(projectReportData.getMaster().getId())){
|
|
|
+ projectReportData.setMaster(UserUtils.getUser());
|
|
|
+ }
|
|
|
+ if (com.jeeplus.common.utils.StringUtils.isBlank(projectReportData.getStatus())){
|
|
|
+ projectReportData.setFileStatus("1");
|
|
|
+ }
|
|
|
+ info.setProjectReportDataTwo(projectReportData);
|
|
|
+ //查询报告文件、依据性文件、其他文件必填列表以及数据
|
|
|
+ List<MainDictDetail> mainDictDetails = projectTemplateService.attachmentTemplateList();
|
|
|
+ for (MainDictDetail mainDict:mainDictDetails) {
|
|
|
+ ProjectAccessoryRelationInfo relateInfo = new ProjectAccessoryRelationInfo();
|
|
|
+ //添加项目类型
|
|
|
+ relateInfo.setProjectType("1");
|
|
|
+ //添加报告类型
|
|
|
+ relateInfo.setRequiredStage(1);
|
|
|
+ relateInfo.setId(records.getId());
|
|
|
+ relateInfo.setAttachType(mainDict.getValue());
|
|
|
+ switch(mainDict.getValue()){
|
|
|
+ case "11" :
|
|
|
+ info.setFileAttachmentList(projectTemplateService.getProjectTemplateList(relateInfo));
|
|
|
+ break;
|
|
|
+ case "12" :
|
|
|
+ info.setFileGistdataList(projectTemplateService.getProjectTemplateList(relateInfo));
|
|
|
+ break;
|
|
|
+ case "13" :
|
|
|
+ info.setFileOtherList(projectTemplateService.getProjectTemplateList(relateInfo));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Gson gson = new Gson();
|
|
|
+ String toJson = gson.toJson(info);
|
|
|
+ return toJson;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 提交存储
|
|
|
+ * @param projectReportData
|
|
|
+ * @param variables
|
|
|
+ */
|
|
|
+ @Transactional(readOnly = false)
|
|
|
+ public String saveRuralProject(ProjectReportDataTwo projectReportData, Map<String, Object> variables, String processInstanceId, List<User> masters) {
|
|
|
+ User user = UserUtils.getUser();
|
|
|
+ Boolean insert = false;
|
|
|
+ if (StringUtils.isBlank(projectReportData.getId())){
|
|
|
+ projectReportData.preInsert();
|
|
|
+ insert = true;
|
|
|
+ }
|
|
|
+// String num = projectReportData.getNumber();
|
|
|
+// if(com.jeeplus.common.utils.StringUtils.isNotBlank(num)){
|
|
|
+// projectReportNumService.updateNum(num);
|
|
|
+// }
|
|
|
+ ProjectRecords projectRecords = dao.getRuralProjectRecords(projectReportData.getProject().getId());
|
|
|
+ Office recordsOffice =officeService.get(projectRecords.getOffice());
|
|
|
+ String title = "项目【"+projectRecords.getProjectName()+"】报告签发待审批";
|
|
|
+ String str = "项目【"+projectRecords.getProjectName()+"】报告签发待审批";
|
|
|
+ // 用来设置启动流程的人员ID,引擎会自动把用户ID保存到activiti:initiator中
|
|
|
+ identityService.setAuthenticatedUserId(user.getId());
|
|
|
+ // 启动流程
|
|
|
+ String businessKey = projectReportData.getId().toString();
|
|
|
+ WorkActivityMenu workActivityMenu = workActivityMenuService.findByParentAndOffice("9764872f45b84acd893010e66a3db2c8", recordsOffice);
|
|
|
+ // 启动流程
|
|
|
+ String processType = workActivityMenu.getProcessType();
|
|
|
+ StringBuffer buffer = new StringBuffer();
|
|
|
+ Activity activity = new Activity();
|
|
|
+ WorkProjectNotify workProjectNotify = UtilNotify
|
|
|
+ .saveNotify(projectReportData.getId(),
|
|
|
+ null,
|
|
|
+ projectReportData.getCompanyId(),
|
|
|
+ title,
|
|
|
+ str,
|
|
|
+ "97",
|
|
|
+ "0",
|
|
|
+ "待审批",
|
|
|
+ ""
|
|
|
+ );
|
|
|
+ List<User> users = new ArrayList<>();
|
|
|
+
|
|
|
+ //总工
|
|
|
+ List<User> bzshbs = new ArrayList<>();
|
|
|
+ User bzshbsUser = UserUtils.get(projectReportData.getBzshbUserId());
|
|
|
+ if(null != bzshbsUser){
|
|
|
+ bzshbs.add(bzshbsUser);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (insert) {
|
|
|
+ projectReportDataService.insert(projectReportData);
|
|
|
+ }else {
|
|
|
+ projectReportDataService.save(projectReportData);
|
|
|
+ }
|
|
|
+ if (com.jeeplus.common.utils.StringUtils.isNotBlank(workActivityMenu.getId())) {
|
|
|
+ workProjectNotify.setNotifyRole("");
|
|
|
+ workActivityMenu = workActivityMenuService.get(workActivityMenu.getId());
|
|
|
+ List<Activity> activities = workActivityMenu.getActivities();
|
|
|
+ for (Activity a : activities) {
|
|
|
+ String encount = a.getEncount();
|
|
|
+ String enlist = a.getEnlist();
|
|
|
+ if (a.getRole()!=null && com.jeeplus.common.utils.StringUtils.isNotBlank(a.getRole().getEnname())){
|
|
|
+ List enusers = UserUtils.getByRoleActivityEnnames(a.getRole().getEnname(),recordsOffice.getId(),"8",projectReportData.getCreateBy());
|
|
|
+ if (enusers.size()==0){
|
|
|
+ projectReportData.setStatus("1");
|
|
|
+ projectReportDataService.save(projectReportData);
|
|
|
+ return "流程审批人不能为空,角色"+a.getRole().getName()+"下无用户,请联系管理员!";
|
|
|
+ }
|
|
|
+ variables.put(encount, enusers.size());
|
|
|
+ variables.put(enlist, enusers);
|
|
|
+ }
|
|
|
+ if (a.getDelFlag().equals("0") && a.getCount() == 1) {
|
|
|
+ activity = a;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ buffer.append(activity.getRole().getEnname());
|
|
|
+ if (activity != null && com.jeeplus.common.utils.StringUtils.isNotBlank(activity.getId())) {
|
|
|
+ //人员审批
|
|
|
+ if (com.jeeplus.common.utils.StringUtils.isNotBlank(activity.getUser().getId())) {
|
|
|
+ users.add(activity.getUser());
|
|
|
+ }
|
|
|
+ //角色审批
|
|
|
+ if (com.jeeplus.common.utils.StringUtils.isNotBlank(activity.getRole().getEnname())) {
|
|
|
+ users = UserUtils.getByRoleActivityEnnames(activity.getRole().getEnname(),recordsOffice.getId(),"8",projectReportData.getCreateBy());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ workProjectNotify.setId("");
|
|
|
+ } else {
|
|
|
+ if (bzshbs.size()==0 ){
|
|
|
+ projectReportData.setStatus("1");
|
|
|
+ projectReportDataService.save(projectReportData);
|
|
|
+ }
|
|
|
+ if (bzshbs.size()==0){
|
|
|
+ return "流程审批人不能为空,总工下无用户,请联系管理员!";
|
|
|
+ }
|
|
|
+ processType = "newReportAuditTwo";
|
|
|
+ users.addAll(bzshbs);
|
|
|
+ variables.put("bzshbList", bzshbs);
|
|
|
+ variables.put("bzshbcount", bzshbs.size());
|
|
|
+ }
|
|
|
+ for (User u : users){
|
|
|
+ workProjectNotify.setUser(u);
|
|
|
+ workProjectNotify.setNotifyRole("部门主任审批");
|
|
|
+ workProjectNotify.setId("");
|
|
|
+ workProjectNotifyService
|
|
|
+ .save(workProjectNotify);
|
|
|
+ Map<String,Object> extras = new HashMap<>();
|
|
|
+ extras.put("type","7001");
|
|
|
+ extras.put("id",workProjectNotify.getId());
|
|
|
+ extras.put("procDefKey","97");
|
|
|
+ UserUtils.pushInfoToApp(title,str,extras,u.getId());
|
|
|
+ UserUtils.pushIm(u.getId(),str);
|
|
|
+ }
|
|
|
+ variables.put("type", processType);
|
|
|
+ variables.put("busId", businessKey);
|
|
|
+ variables.put("title", "审批单:" + projectReportData.getNumber());//设置标题;
|
|
|
+
|
|
|
+ ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processType, businessKey, variables);
|
|
|
+ projectReportData.setProcessInstance(processInstance);
|
|
|
+ if (com.jeeplus.common.utils.StringUtils.isNotBlank(processInstanceId)) {
|
|
|
+ workActivityProcessService.updateProcessInstanceId(processInstance.getId(),processInstanceId);
|
|
|
+ workActivityProcessService.deleteProcessInstanceId(processInstanceId);
|
|
|
+ workActivityProcessService.deleteProcessIdAuditUsers(processInstanceId);
|
|
|
+ }
|
|
|
+ // 更新流程实例ID
|
|
|
+ projectReportData.setProcessInstanceId(processInstance.getId());
|
|
|
+ projectReportDataDao.updateProcessInstanceId(projectReportData);
|
|
|
+ //通知添加流程实例ID
|
|
|
+ workProjectNotify.setProcessInstanceId(processInstance.getId());
|
|
|
+ workProjectNotifyService.save(workProjectNotify);
|
|
|
+ List<Activity> list = workActivityMenu.getActivities();
|
|
|
+ if (list != null && list.size() != 0) {
|
|
|
+ workActivityProcessService.saveList(list, processInstance.getId());
|
|
|
+ } else {
|
|
|
+ WorkActivityProcess workActivityProcess = new WorkActivityProcess();
|
|
|
+ workActivityProcess.setProcessKey(processType);
|
|
|
+ workActivityProcess.setCount(1);
|
|
|
+ workActivityProcess.setProcessInstanceId(processInstance.getId());
|
|
|
+ workActivityProcess.setIsApproval("0");
|
|
|
+ workActivityProcessService.insert(workActivityProcess);
|
|
|
+ workActivityProcessService.insertAuditsByType(bzshbs,processInstance.getId(),1,1);
|
|
|
+ }
|
|
|
+ return "true";
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 根据项目id 查询报告咨询员列表
|
|
|
+ * @param projectId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<RuralReportConsultant> getConsultantsList(String projectId){
|
|
|
+ List<RuralReportConsultant> list=projectcontentinfoDao.findByProjectId(projectId);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 根据用户查询技能信息
|
|
|
+ * @param projectId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<WorkStaffCertificate> getCertificateByUser(String userId){
|
|
|
+ List<WorkStaffCertificate> list=projectcontentinfoDao.getCertificateByUser(userId);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 审核流程
|
|
|
+ * @param reportData
|
|
|
+ */
|
|
|
+ @Transactional(readOnly = false)
|
|
|
+ public String auditSave(ProjectReportDataTwo reportData,List<User> auditUsers) {
|
|
|
+
|
|
|
+ if(StringUtils.isNotBlank(reportData.getConsultantRemarks())){
|
|
|
+ while (reportData.getConsultantRemarks().endsWith(",")){
|
|
|
+ reportData.setConsultantRemarks(reportData.getConsultantRemarks().substring(0,reportData.getConsultantRemarks().length()-1));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(reportData.getPrincipalRemarks())){
|
|
|
+ while(reportData.getPrincipalRemarks().endsWith(",")){
|
|
|
+ reportData.setPrincipalRemarks(reportData.getPrincipalRemarks().substring(0,reportData.getPrincipalRemarks().length()-1));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(reportData.getTechnicistRemarks())){
|
|
|
+ while(reportData.getTechnicistRemarks().endsWith(",")){
|
|
|
+ reportData.setTechnicistRemarks(reportData.getTechnicistRemarks().substring(0,reportData.getTechnicistRemarks().length()-1));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String flag = reportData.getAct().getFlag();
|
|
|
+ // 对不同环节的业务逻辑进行操作
|
|
|
+ Act act = reportData.getAct();
|
|
|
+ String taskDefKey = act.getTaskDefKey();
|
|
|
+ ProjectReportDataTwo projectReportData = null;
|
|
|
+ if (!"modifyApply".equals(taskDefKey) && !taskDefKey.contains("audit") ) {
|
|
|
+ actTaskService.claim(act.getTaskId(), UserUtils.getUser().getId());
|
|
|
+ projectReportData = projectReportDataDao.get(reportData.getId());
|
|
|
+ }else {
|
|
|
+ projectReportData = reportData;
|
|
|
+ flag = "yes";
|
|
|
+ }
|
|
|
+ User user= UserUtils.get(projectReportData.getCreateBy().getId());
|
|
|
+ ProjectRecords projectRecords = projectRecordsService.getRuralMasters(projectReportData.getProject().getId());
|
|
|
+ Office recordsOffice =officeService.get(projectRecords.getOffice());
|
|
|
+ String title = "报告名称:"+projectReportData.getName();
|
|
|
+ String str = "报告名称:"+projectReportData.getName()+",工作内容类型:"+ WorkContentTypeController.getContentTypeName(projectReportData.getType(),"")+",项目所属部门:"+recordsOffice.getName()+",负责人:"+user.getName();
|
|
|
+
|
|
|
+ if (com.jeeplus.common.utils.StringUtils.isBlank(act.getComment())){
|
|
|
+ act.setComment(flag.equals("yes")?"同意":"驳回");
|
|
|
+ }
|
|
|
+ String comment = "";
|
|
|
+ if (projectReportData.getStatus().equals("4")){
|
|
|
+ comment = ("yes".equals(flag)?"[重新申请] ":"[已撤销] ");
|
|
|
+ }else {
|
|
|
+ comment = ("yes".equals(flag)?"[同意] ":"[驳回] ")+act.getComment();
|
|
|
+ }
|
|
|
+ //yes 的时候状态为审核通过 否则为未通过
|
|
|
+ //1 审核中 2 未通过
|
|
|
+ projectReportData.setStatus(("yes".equals(flag) ? "2" : "4"));
|
|
|
+ Map<String, Object> vars = Maps.newHashMap();
|
|
|
+ //业务逻辑对应的条件表达式
|
|
|
+ String exp = "";
|
|
|
+ String taskCount = "";
|
|
|
+ String notifyRole = "";
|
|
|
+ int key = 0;
|
|
|
+ String enname = "";
|
|
|
+ List<Activity> activitieList = activityService.getByProcessInstanceId(projectReportData.getProcessInstanceId());
|
|
|
+ WorkActivityMenu workActivityMenu = new WorkActivityMenu();
|
|
|
+ if (activitieList != null && activitieList.size() != 0) {
|
|
|
+ //判断上面act流程的流程图key是不是空 不是空则使用该流程图key信息
|
|
|
+ if(StringUtils.isNotBlank(act.getProcDefKey())){
|
|
|
+ workActivityMenu.setProcessType(act.getProcDefKey());
|
|
|
+ }else{
|
|
|
+ workActivityMenu.setProcessType(activitieList.get(0).getProcessKey());
|
|
|
+ }
|
|
|
+ workActivityMenu.setActivities(activitieList);
|
|
|
+ }
|
|
|
+
|
|
|
+ WorkActivityProcess workActivityProcess = new WorkActivityProcess();
|
|
|
+ WorkActivityProcess selectProcess = new WorkActivityProcess();
|
|
|
+ selectProcess.setProcessInstanceId(projectReportData.getProcessInstanceId());
|
|
|
+ List<WorkActivityProcess> workActivityProcesses = workActivityProcessService.findList(selectProcess);
|
|
|
+ List<Activity> activities = workActivityMenu.getActivities();
|
|
|
+ if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("newReportAuditTwo")) {
|
|
|
+ key = 1;
|
|
|
+ for (int i = 0; i < workActivityProcesses.size(); i++) {
|
|
|
+ WorkActivityProcess activityProcess = workActivityProcesses.get(i);
|
|
|
+ if (taskDefKey.equals(activityProcess.getActivityTask()) && !taskDefKey.equals("modifyApply")) {
|
|
|
+ taskCount = activityProcess.getCount()+"";
|
|
|
+ workActivityProcess = activityProcess;
|
|
|
+ if (!workActivityProcess.getIsApproval().equals("0")) {
|
|
|
+ workActivityProcess.setId("");
|
|
|
+ }
|
|
|
+ exp = "pass";
|
|
|
+ if (!"yes".equals(flag)) {
|
|
|
+ workActivityProcess.setIsApproval("2");
|
|
|
+ projectReportData.setStatus("4");
|
|
|
+ String returnBack = "-1";
|
|
|
+ for (Activity activity : activities) {
|
|
|
+ if (activity.getCount() == activityProcess.getCount()) {
|
|
|
+ returnBack = activity.getReturnBack();
|
|
|
+ notifyRole = activity.getName();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (returnBack.equals("0")) {
|
|
|
+ workActivityProcess.setId("");
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ workActivityProcess.setIsApproval("1");
|
|
|
+ }
|
|
|
+ }else if(taskDefKey.equals("modifyApply")){
|
|
|
+ notifyRole = "调整报告";
|
|
|
+ taskCount = "0";
|
|
|
+ exp = "pass";
|
|
|
+ workActivityProcess.setId("");
|
|
|
+ workActivityProcess.setCount(0);
|
|
|
+ if (!"yes".equals(flag)) {
|
|
|
+ projectReportData.setStatus("3");
|
|
|
+ workActivityProcess.setIsApproval("2");
|
|
|
+ } else {
|
|
|
+ workActivityProcess.setIsApproval("1");
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ workActivityMenu.setProcessType("newReportAuditTwo");
|
|
|
+ for (int i = 0; i < workActivityProcesses.size(); i++) {
|
|
|
+ WorkActivityProcess activityProcess = workActivityProcesses.get(i);
|
|
|
+ String count = activityProcess.getCount() + "";
|
|
|
+ workActivityProcess = activityProcess;
|
|
|
+ if (!workActivityProcess.getIsApproval().equals("0")) {
|
|
|
+ workActivityProcess.setId("");
|
|
|
+ }
|
|
|
+ // 审核环节
|
|
|
+ if ("bzshb".equals(taskDefKey) && count.contains("1")) {
|
|
|
+ taskCount = "1";
|
|
|
+ exp = "pass";
|
|
|
+ if ("yes".equals(flag)) {
|
|
|
+ projectReportData.setTechnicistDate(new Date());
|
|
|
+ notifyRole = "审批通过";
|
|
|
+ synchronized (SYN_BYTE) {
|
|
|
+ //添加审核通过日期
|
|
|
+ projectReportData.setAuditPassDate(new Date());
|
|
|
+ }
|
|
|
+ workActivityProcess.setIsApproval("1");
|
|
|
+ } else {
|
|
|
+ notifyRole = "调整报告";
|
|
|
+ workActivityProcess.setIsApproval("2");
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ } else if ("modifyApply".equals(taskDefKey)&& count.contains("0")) {
|
|
|
+ notifyRole = "总工审批";
|
|
|
+ taskCount = "0";
|
|
|
+ exp = "pass";
|
|
|
+ workActivityProcess.setCount(0);
|
|
|
+ enname = "master";
|
|
|
+ if (!"yes".equals(flag)) {
|
|
|
+ projectReportData.setStatus("3");
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 设置意见
|
|
|
+ act.setComment(("yes".equals(flag) ? "[同意] " : "[驳回] ") + act.getComment());
|
|
|
+ projectReportData.preUpdate();
|
|
|
+ // 提交流程任务
|
|
|
+ vars.put(exp, "yes".equals(flag) ? true : false);
|
|
|
+ vars.put("passs", true);
|
|
|
+ workActivityProcessService.updateProcess(workActivityProcess,workActivityMenu,key,taskCount,projectReportData.getProcessInstanceId(),taskDefKey,"modifyApply",flag,comment, activities);
|
|
|
+ // 提交流程任务
|
|
|
+ actTaskService.complete(act.getTaskId(), act.getProcInsId(), act.getComment(), vars);
|
|
|
+ boolean state = actTaskService.isProcessEnd(act.getProcInsId());
|
|
|
+ List<User> users = new ArrayList<>();
|
|
|
+ List<User> userList = new ArrayList<>();
|
|
|
+ if (!state) {
|
|
|
+ users.add(projectReportData.getCreateBy());
|
|
|
+ if ("yes".equals(flag)) {
|
|
|
+ String titleStr = "项目【"+projectRecords.getProjectName()+"】报告签发审批通过";
|
|
|
+ String content = "项目【"+projectRecords.getProjectName()+"】报告签发审批通过,报告号:" + projectReportData.getNumber();
|
|
|
+ str = "报告名称:"+projectReportData.getName()+",工作内容类型:"+ WorkContentTypeController.getContentTypeName(projectReportData.getType(),"")+",项目所属部门:"+recordsOffice.getName();
|
|
|
+ projectReportData.setStatus("5");
|
|
|
+ WorkProjectNotify notify = new WorkProjectNotify();
|
|
|
+ notify.setNotifyId(projectReportData.getId());
|
|
|
+ userList = workProjectNotifyService.readByNotifyId(notify);
|
|
|
+ workProjectNotifyService
|
|
|
+ .save(UtilNotify
|
|
|
+ .saveNotify(projectReportData.getId(),
|
|
|
+ projectReportData.getCreateBy(),
|
|
|
+ projectReportData.getCompanyId(),
|
|
|
+ titleStr,
|
|
|
+ content,
|
|
|
+ "97",
|
|
|
+ "0",
|
|
|
+ "待通知",
|
|
|
+ notifyRole));
|
|
|
+
|
|
|
+ } else {
|
|
|
+ WorkProjectNotify notify = new WorkProjectNotify();
|
|
|
+ notify.setNotifyId(projectReportData.getId());
|
|
|
+ userList = workProjectNotifyService.readByNotifyId(notify);
|
|
|
+ if (com.jeeplus.common.utils.StringUtils.isNotBlank(projectReportData.getStatus()) && !projectReportData.getStatus().equals("3")){
|
|
|
+ projectReportData.setStatus("4");
|
|
|
+ workProjectNotifyService
|
|
|
+ .save(UtilNotify
|
|
|
+ .saveNotify(projectReportData.getId(),
|
|
|
+ projectReportData.getCreateBy(),
|
|
|
+ projectReportData.getCompanyId(),
|
|
|
+ title,
|
|
|
+ str,
|
|
|
+ "97",
|
|
|
+ "0",
|
|
|
+ "待通知",
|
|
|
+ notifyRole));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ workActivityProcessService.deleteProcessIdAuditUsers(projectReportData.getProcessInstanceId());
|
|
|
+ } else {
|
|
|
+ if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("newReportAuditTwo")) {
|
|
|
+ WorkProjectNotify notify = new WorkProjectNotify();
|
|
|
+ notify.setNotifyId(projectReportData.getId());
|
|
|
+ userList = workProjectNotifyService.readByNotifyId(notify);
|
|
|
+ WorkProjectNotify workProjectNotify = UtilNotify
|
|
|
+ .saveNotify(projectReportData.getId(),
|
|
|
+ new User(),
|
|
|
+ projectReportData.getCompanyId(),
|
|
|
+ title,
|
|
|
+ str,
|
|
|
+ "97",
|
|
|
+ "0",
|
|
|
+ "待审批",
|
|
|
+ notifyRole);
|
|
|
+ List<WorkProjectNotify> workProjectNotifys = activityService.getByFlagAndTaskDefKeyList(
|
|
|
+ activities,
|
|
|
+ workProjectNotify,
|
|
|
+ taskDefKey,
|
|
|
+ flag,
|
|
|
+ taskCount,
|
|
|
+ projectReportData.getCreateBy(),
|
|
|
+ user.getOffice().getId(),
|
|
|
+ "8");
|
|
|
+ for (WorkProjectNotify workProjectNotify1:workProjectNotifys){
|
|
|
+ users.add(workProjectNotify1.getUser());
|
|
|
+ workProjectNotify1.setId("");
|
|
|
+ workProjectNotify1.setIsNewRecord(false);
|
|
|
+ workProjectNotifyService
|
|
|
+ .save(workProjectNotify1);
|
|
|
+ if (!"modifyApply".equals(taskDefKey)){
|
|
|
+ Map<String,Object> extras = new HashMap<>();
|
|
|
+ if ("glyda".equals(taskDefKey)){
|
|
|
+ extras.put("type","7003");
|
|
|
+ }else if("zlfgld".equals(taskDefKey) ){
|
|
|
+ extras.put("type","7002");
|
|
|
+ }else {
|
|
|
+ extras.put("type","7001");
|
|
|
+ }
|
|
|
+ extras.put("id",workProjectNotify.getId());
|
|
|
+ extras.put("procDefKey","97");
|
|
|
+ UserUtils.pushInfoToApp(title,str,extras,workProjectNotify1.getUser().getId());
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ if (!"yes".equals(flag)) {//报告驳回待办提醒
|
|
|
+ title = "项目【"+ projectRecords.getProjectName()+"】报告签发被驳回";
|
|
|
+ str = "项目【"+ projectRecords.getProjectName()+"】报告签发被驳回,请选择重新申请或删除报告";
|
|
|
+ WorkProjectNotify notify = new WorkProjectNotify();
|
|
|
+ notify.setNotifyId(projectReportData.getId());
|
|
|
+ userList = workProjectNotifyService.readByNotifyId(notify);
|
|
|
+ workProjectNotifyService
|
|
|
+ .save(UtilNotify
|
|
|
+ .saveNotify(projectReportData.getId(),
|
|
|
+ projectReportData.getCreateBy(),
|
|
|
+ projectReportData.getCompanyId(),
|
|
|
+ title,
|
|
|
+ str,
|
|
|
+ "97",
|
|
|
+ "0",
|
|
|
+ "重新申请",
|
|
|
+ notifyRole));
|
|
|
+ users.add( projectReportData.getCreateBy());
|
|
|
+ } else {
|
|
|
+ if (com.jeeplus.common.utils.StringUtils.isNotBlank(enname)) {//驳回重新申请待办信息
|
|
|
+ str = "项目【"+ projectRecords.getProjectName()+"】报告签发待审批";
|
|
|
+ title = "项目【"+ projectRecords.getProjectName()+"】报告签发待审批";
|
|
|
+ WorkProjectNotify notify = new WorkProjectNotify();
|
|
|
+ notify.setNotifyId(projectReportData.getId());
|
|
|
+ userList = workProjectNotifyService.readByNotifyId(notify);
|
|
|
+ WorkProjectNotify workProjectNotify = UtilNotify
|
|
|
+ .saveNotify(projectReportData.getId(),
|
|
|
+ new User(),
|
|
|
+ projectReportData.getCompanyId(),
|
|
|
+ title,
|
|
|
+ str,
|
|
|
+ "97",
|
|
|
+ "0",
|
|
|
+ "待审批",
|
|
|
+ notifyRole);
|
|
|
+ users.addAll(auditUsers);
|
|
|
+ for (User user1 : users) {
|
|
|
+ workProjectNotify.setUser(user1);
|
|
|
+ workProjectNotify.setId("");
|
|
|
+ workProjectNotify.setIsNewRecord(false);
|
|
|
+ workProjectNotifyService
|
|
|
+ .save(workProjectNotify);
|
|
|
+ if (!"modifyApply".equals(taskDefKey)){
|
|
|
+ Map<String,Object> extras = new HashMap<>();
|
|
|
+ if ("glyda".equals(taskDefKey)){
|
|
|
+ extras.put("type","7003");
|
|
|
+ }else if("zlfgld".equals(taskDefKey) ){
|
|
|
+ extras.put("type","7002");
|
|
|
+ }else {
|
|
|
+ extras.put("type","7001");
|
|
|
+ }
|
|
|
+ extras.put("id",workProjectNotify.getId());
|
|
|
+ extras.put("procDefKey","97");
|
|
|
+ UserUtils.pushInfoToApp(title,str,extras,user1.getId());
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ WorkProjectNotify notify = new WorkProjectNotify();
|
|
|
+ notify.setNotifyId(projectReportData.getId());
|
|
|
+ userList = workProjectNotifyService.readByNotifyId(notify);
|
|
|
+ users.add(projectReportData.getCreateBy());
|
|
|
+ workProjectNotifyService
|
|
|
+ .save(UtilNotify
|
|
|
+ .saveNotify(projectReportData.getId(),
|
|
|
+ projectReportData.getCreateBy(),
|
|
|
+ projectReportData.getCompanyId(),
|
|
|
+ title,
|
|
|
+ str,
|
|
|
+ "97",
|
|
|
+ "0",
|
|
|
+ "重新申请",
|
|
|
+ notifyRole));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (users!=null && users.size()!=0) {
|
|
|
+ for (User u : users) {
|
|
|
+ UserUtils.pushIm(u.getId(),title);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (users!=null && userList.size()!=0) {
|
|
|
+ for (User u : userList) {
|
|
|
+ UserUtils.pushMeIm(u.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!"yes".equals(flag)){
|
|
|
+ workReviewAuditDao.delReviewAudit(projectReportData.getId());
|
|
|
+ }
|
|
|
+ projectReportData.setTechnicist(reportData.getTechnicist());
|
|
|
+ projectReportData.setTechnicistRemarks(reportData.getTechnicistRemarks());
|
|
|
+ projectReportData.setConsultantRemarks(reportData.getConsultantRemarks());
|
|
|
+ projectReportData.setPrincipalRemarks(reportData.getPrincipalRemarks());
|
|
|
+ projectReportDataDao.update(projectReportData);
|
|
|
+
|
|
|
+ return "保存审核意见成功!";
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 报告:强制撤销
|
|
|
+ * @param projectReportData
|
|
|
+ */
|
|
|
+ @Transactional(readOnly = false)
|
|
|
+ public void cancelInvalidate(ProjectReportDataTwo projectReportData) {
|
|
|
+ try {
|
|
|
+ String invalidateProcessInstanceId = projectReportData.getProcessInstanceId();
|
|
|
+ //将流程图中尚未走到的task的流程追踪信息逻辑删除,添加一条"撤销"流程追踪信息
|
|
|
+ WorkActivityProcess process = new WorkActivityProcess();
|
|
|
+ process.setProcessInstanceId(projectReportData.getProcessInstanceId());
|
|
|
+ process.setIsApproval("0");
|
|
|
+ WorkActivityProcess workActivityProcess = new WorkActivityProcess();
|
|
|
+ workActivityProcess.setProcessInstanceId(projectReportData.getProcessInstanceId());
|
|
|
+ List<WorkActivityProcess> processList = workActivityProcessService.findList(workActivityProcess);
|
|
|
+ WorkProjectNotify notify = new WorkProjectNotify();
|
|
|
+ notify.setNotifyId(projectReportData.getId());
|
|
|
+ List<User> userList = workProjectNotifyService.readByNotifyId(notify);
|
|
|
+ if (userList!=null && userList.size()!=0) {
|
|
|
+ for (User u : userList) {
|
|
|
+ User user = UserUtils.get(u.getId());
|
|
|
+ UserUtils.pushMeIm(user.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(processList!=null && processList.size()>0){
|
|
|
+ for (int i =0;i<processList.size();i++) {
|
|
|
+ WorkActivityProcess p = processList.get(i);
|
|
|
+ if(com.jeeplus.common.utils.StringUtils.isNotBlank(p.getIsApproval()) && "0".equals(p.getIsApproval())){
|
|
|
+ p.setDelFlag("1");
|
|
|
+ p.setIsApproval("-1");
|
|
|
+ workActivityProcessDao.updateDelFlagAndIsApproval(p);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ WorkActivityProcess pro = new WorkActivityProcess();
|
|
|
+ pro.setId("");
|
|
|
+ pro.preInsert();
|
|
|
+ pro.setDelFlag("0");
|
|
|
+ pro.setRemarks("[强制撤销]");
|
|
|
+ pro.setProcessKey(processList.get(0).getProcessKey());
|
|
|
+ pro.setIsApproval("1");
|
|
|
+ pro.setProcessInstanceId(processList.get(0).getProcessInstanceId());
|
|
|
+ pro.setCount(0);
|
|
|
+ workActivityProcessDao.insert(pro);
|
|
|
+ }
|
|
|
+
|
|
|
+ //结束该流程,设为"撤销"状态
|
|
|
+ actTaskService.endProcessInstance(invalidateProcessInstanceId,"报告-强制撤销");
|
|
|
+ projectReportData.setStatus("3");
|
|
|
+ update(projectReportData);
|
|
|
+
|
|
|
+ }catch (ActivitiObjectNotFoundException e){
|
|
|
+ System.err.println("报告撤销异常,因为这个流程已不存在!");
|
|
|
+ e.printStackTrace();
|
|
|
+ logger.error("Exception e:"+e);
|
|
|
+ }
|
|
|
+ catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ logger.error("Exception e:"+e);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ @Transactional(readOnly = false)
|
|
|
+ public void update(ProjectReportDataTwo projectReportData) {
|
|
|
+ projectReportData.preUpdate();
|
|
|
+ dao.updateRuralProjectReportDataTwo(projectReportData);
|
|
|
+ if (com.jeeplus.common.utils.StringUtils.isBlank(projectReportData.getFileStatus())) {
|
|
|
+ projectReportData.setFileStatus("1");
|
|
|
+ }
|
|
|
+// dao.updateFileStatusTwo(projectReportData);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 删除报告信息
|
|
|
+ * @param projectReportData
|
|
|
+ */
|
|
|
+ @Transactional(readOnly = false)
|
|
|
+ public void deleteReport(ProjectReportDataTwo projectReportData, List<ProjectTemplateInfo> attachmentList){
|
|
|
+ dao.deleteReportTwo(projectReportData);
|
|
|
+ //删除流程表信息
|
|
|
+ workProjectNotifyService.deleteActivityProcess(projectReportData.getProcessInstanceId());
|
|
|
+ //删除流程人员表信息
|
|
|
+ workProjectNotifyService.deleteActivityProcessUser(projectReportData.getProcessInstanceId());
|
|
|
+ }
|
|
|
+}
|