|
@@ -797,6 +797,208 @@ public class WorkContractInfoService extends CrudService<WorkContractInfoDao, Wo
|
|
|
logger.info("合同送审任务结束,共耗时:[" + (end-begin) / 1000 + "]秒,流程启动时间:"+(s2-s1)+"ms");
|
|
|
return "";
|
|
|
}
|
|
|
+
|
|
|
+ @Transactional(readOnly = false)
|
|
|
+ public synchronized String newSave(WorkContractInfo workContractInfo,Map<String, Object> variables, String contextPath,String urls) {
|
|
|
+ long begin = System.currentTimeMillis();
|
|
|
+ String processInstanceId = workContractInfo.getProcessInstanceId();
|
|
|
+ String contractTypeCode = workContractInfo.getContractTypeDoc();
|
|
|
+ String contractType = "";
|
|
|
+ String contractTypeId = "";
|
|
|
+ List<MainDictDetail> list1 = DictUtils.getMainDictList("contract_info_type");
|
|
|
+ for(MainDictDetail mainDictDetail:list1){
|
|
|
+ if(mainDictDetail.getValue().equals(contractTypeCode)){
|
|
|
+ contractType = mainDictDetail.getLabel();
|
|
|
+ contractTypeId = mainDictDetail.getValue();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(workContractInfo.getContractNum())) {
|
|
|
+ //根据合同类型生成合同编号
|
|
|
+ String type = null;
|
|
|
+ if("100".equals(contractTypeId)){
|
|
|
+ type = WorkContractInfo.SERIAL_CONSULT;
|
|
|
+ }else if("101".equals(contractTypeId)){
|
|
|
+ type = WorkContractInfo.SERIAL_CHECK;
|
|
|
+ }else if("102".equals(contractTypeId)){
|
|
|
+ type = WorkContractInfo.SERIAL_AGENCY;
|
|
|
+ }else if("103".equals(contractTypeId)){
|
|
|
+ type = WorkContractInfo.SERIAL_AUDIT;
|
|
|
+ }else {
|
|
|
+ type = WorkContractInfo.SERIAL_ELST;
|
|
|
+ }
|
|
|
+ synchronized (SYN_BYTE){
|
|
|
+ workContractInfo.setContractNum(serialNumTplService.genSerialNum(UserUtils.get(workContractInfo.getCreateBy().getId()).getCompany(), type).replace("TYPE",contractType));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /*//生成合同编号
|
|
|
+ workContractInfo.setContractNum(serialNumTplService.genSerialNumNotNum(UserUtils.get(workContractInfo.getCreateBy().getId()).getCompany(), WorkContractInfo.SERIAL_CONSULT).replace("TYPE",contractType));
|
|
|
+ //根据当前合同编号查询对应最后一条合同编号
|
|
|
+ String contractLastNumStr = dao.getContractLastNum(workContractInfo.getContractNum());
|
|
|
+ if(StringUtils.isNotBlank(contractLastNumStr)) {
|
|
|
+ //获取最新的后缀编号
|
|
|
+ Integer num = Integer.parseInt(contractLastNumStr.substring(workContractInfo.getContractNum().length(), contractLastNumStr.length())) + 1;
|
|
|
+ //更新合同编号
|
|
|
+ workContractInfo.setContractNum(workContractInfo.getContractNum() + String.format("%04d", num));
|
|
|
+ }else {
|
|
|
+ //更新合同编号
|
|
|
+ workContractInfo.setContractNum(workContractInfo.getContractNum() + String.format("%04d", 1));
|
|
|
+ }*/
|
|
|
+ long end2 = System.currentTimeMillis();
|
|
|
+ logger.info("合同送审-项目编码设置任务结束,共耗时:[" + (end2-begin) / 1000 + "]秒");
|
|
|
+ }
|
|
|
+ long begin2 = System.currentTimeMillis();
|
|
|
+ if (StringUtils.isBlank(workContractInfo.getContractNumPath())) {
|
|
|
+ String num=workContractInfo.getContractNum();
|
|
|
+ long time = System.currentTimeMillis();
|
|
|
+ String picNamePhoto = time + ".png";
|
|
|
+ ByteArrayOutputStream byteArrayOutputStream=new ByteArrayOutputStream();
|
|
|
+ WordToPic.TextToAliyunPic(num, 500, 80, 25,new Color(0,188,212), byteArrayOutputStream);
|
|
|
+
|
|
|
+ byte[] buf = byteArrayOutputStream.toByteArray();
|
|
|
+ ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(buf);
|
|
|
+ OSSClientUtil ossUtil = new OSSClientUtil();
|
|
|
+ ossUtil.uploadFile2OSS(byteArrayInputStream, Global.getContractNumPath(), picNamePhoto);
|
|
|
+ workContractInfo.setContractNumPath(Global.getAliyunUrl()+"/"+Global.getContractNumPath()+picNamePhoto);
|
|
|
+ }
|
|
|
+ workContractInfo.setContractState("2");
|
|
|
+ this.save(workContractInfo);
|
|
|
+ Office office = UserUtils.getUser().getOffice();
|
|
|
+ String title = "合同【"+workContractInfo.getName() +"】登记待审批";
|
|
|
+ String str = "合同【"+workContractInfo.getName() +"】登记待审批,合同编号:"+workContractInfo.getContractNum();
|
|
|
+ identityService.setAuthenticatedUserId(workContractInfo.getCreateBy().getId());
|
|
|
+ String businessKey = workContractInfo.getId().toString();
|
|
|
+ WorkActivityMenu workActivityMenu = workActivityMenuService.findByParentAndOffice("zth3125f1f194c82bdea93555c750905", office);
|
|
|
+ // 启动流程
|
|
|
+ String processType = workActivityMenu.getProcessType();
|
|
|
+ StringBuffer buffer = new StringBuffer();
|
|
|
+ Activity activity = new Activity();
|
|
|
+ WorkProjectNotify workProjectNotify = UtilNotify
|
|
|
+ .saveNotify(workContractInfo.getId(),
|
|
|
+ null,
|
|
|
+ workContractInfo.getCompanyId(),
|
|
|
+ title,
|
|
|
+ str,
|
|
|
+ "143",
|
|
|
+ "0",
|
|
|
+ "待审批",
|
|
|
+ ""
|
|
|
+ );
|
|
|
+ List<User> users = new ArrayList<>();
|
|
|
+ String officeId = UserUtils.getSelectOffice().getId();
|
|
|
+ List<User> bmzrs = UserUtils.getByRoleActivityEnname("bmzr",2,office.getId(),"2",workContractInfo.getCreateBy());
|
|
|
+// List<User> scyfglbzrs = UserUtils.getByRoleActivityEnname("scyfglbzr",1,office.getId(),"2",workContractInfo.getCreateBy());
|
|
|
+ //获取总经理人员信息
|
|
|
+ List<User> zjls = UserUtils.getByRoleActivityEnname("zjl",3,office.getId(),"2",workContractInfo.getCreateBy());
|
|
|
+ long end3 = System.currentTimeMillis();
|
|
|
+ logger.info("合同送审-查找人员审核任务结束,共耗时:[" + (end3-begin2) / 1000 + "]秒");
|
|
|
+ long begin3 = System.currentTimeMillis();
|
|
|
+ if (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 && StringUtils.isNotBlank(a.getRole().getEnname())) {
|
|
|
+ List enusers = UserUtils.getByRoleActivityEnnames(a.getRole().getEnname(), office.getId(), "2", workContractInfo.getCreateBy());
|
|
|
+ if (enusers.size() == 0) {
|
|
|
+ workContractInfo.setContractState("1");
|
|
|
+ this.save(workContractInfo);
|
|
|
+ return "流程审批人不能为空,角色部门负责人下无用户,请联系管理员!";
|
|
|
+ }
|
|
|
+ variables.put(enlist, enusers);
|
|
|
+ variables.put(encount, enusers.size());
|
|
|
+ }
|
|
|
+ if (a.getDelFlag().equals("0") && a.getCount() == 1) {
|
|
|
+ activity = a;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ buffer.append(activity.getRole().getEnname());
|
|
|
+ if (activity != null && StringUtils.isNotBlank(activity.getId())) {
|
|
|
+ //角色审批
|
|
|
+ if (StringUtils.isNotBlank(activity.getRole().getEnname())) {
|
|
|
+ users = UserUtils.getByRoleActivityEnnames(activity.getRole().getEnname(), office.getId(), "2", workContractInfo.getCreateBy());
|
|
|
+ }
|
|
|
+ //人员审批
|
|
|
+ if (StringUtils.isNotBlank(activity.getUser().getId())) {
|
|
|
+ users.add(activity.getUser());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ workProjectNotify.setId("");
|
|
|
+ } else {
|
|
|
+ processType = "newContractAudit";
|
|
|
+ if(bmzrs==null||bmzrs.size()==0){
|
|
|
+ workContractInfo.setContractState("1");
|
|
|
+ this.save(workContractInfo);
|
|
|
+ return "流程审批人不能为空,角色部门负责人下无用户,请联系管理员!";
|
|
|
+ }
|
|
|
+ if(zjls==null||zjls.size()==0){
|
|
|
+ workContractInfo.setContractState("1");
|
|
|
+ this.save(workContractInfo);
|
|
|
+ return "流程总经理审批人不能为空,总经理审批人下无用户,请联系管理员!";
|
|
|
+ }
|
|
|
+ variables.put("bmzrList", bmzrs);
|
|
|
+ variables.put("bmzrCount",bmzrs.size());
|
|
|
+ users.addAll(bmzrs);
|
|
|
+ }
|
|
|
+
|
|
|
+ for (User u : users) {
|
|
|
+ workProjectNotify.setUser(u);
|
|
|
+ workProjectNotify.setId("");
|
|
|
+ workProjectNotify.setNotifyRole("部门主任审批");
|
|
|
+ workProjectNotifyService
|
|
|
+ .save(workProjectNotify);
|
|
|
+ Map<String,Object> extras = new HashMap<>();
|
|
|
+ extras.put("type","7002");
|
|
|
+ extras.put("id",workProjectNotify.getId());
|
|
|
+ extras.put("procDefKey","143");
|
|
|
+ UserUtils.pushInfoToApp(title,str,extras,u.getId());
|
|
|
+ UserUtils.pushIm(u.getId(),str);
|
|
|
+ }
|
|
|
+ variables.put("type", processType);
|
|
|
+ variables.put("busId", businessKey);
|
|
|
+// variables.put("count",users.size());
|
|
|
+// variables.put("assigneeList",users);
|
|
|
+ variables.put("title", "合同名称:" + workContractInfo.getName());//设置标题;
|
|
|
+ long s1 = System.currentTimeMillis();
|
|
|
+ ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processType, businessKey, variables);
|
|
|
+ long s2 = System.currentTimeMillis();
|
|
|
+ workContractInfo.setProcessInstance(processInstance);
|
|
|
+ if (StringUtils.isNotBlank(processInstanceId)) {
|
|
|
+ workActivityProcessService.updateProcessInstanceId(processInstance.getId(),processInstanceId);
|
|
|
+ workActivityProcessService.deleteProcessInstanceId(processInstanceId);
|
|
|
+ workActivityProcessService.deleteProcessIdAuditUsers(processInstanceId);
|
|
|
+ }
|
|
|
+ // 更新流程实例ID
|
|
|
+ workContractInfo.setProcessInstanceId(processInstance.getId());
|
|
|
+ workContractInfoDao.updateProcessInstanceId(workContractInfo);
|
|
|
+ //通知添加流程实例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("newContractAudit");
|
|
|
+ workActivityProcess.setCount(1);
|
|
|
+ workActivityProcess.setProcessInstanceId(processInstance.getId());
|
|
|
+ workActivityProcess.setIsApproval("0");
|
|
|
+ workActivityProcessService.save(workActivityProcess);
|
|
|
+ workActivityProcess.setCount(2);
|
|
|
+ workActivityProcess.setId("");
|
|
|
+ workActivityProcessService.save(workActivityProcess);
|
|
|
+ workActivityProcessService.insertAuditsByType(bmzrs,processInstance.getId(),1,1);
|
|
|
+ workActivityProcessService.insertAuditsByType(zjls,processInstance.getId(),2,0);
|
|
|
+// workActivityProcessService.insertAuditsByType(fglds,processInstance.getId(),3,0);
|
|
|
+ }
|
|
|
+ long end = System.currentTimeMillis();
|
|
|
+ logger.info("合同送审任务结束,共耗时:[" + (end-begin) / 1000 + "]秒,流程启动时间:"+(s2-s1)+"ms");
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 合同变更启动流程
|
|
|
* @param
|
|
@@ -1275,6 +1477,392 @@ public class WorkContractInfoService extends CrudService<WorkContractInfoDao, Wo
|
|
|
workContractInfoDao.update(workContractInfo);
|
|
|
return "保存审核意见成功!";
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 工单执行(完成任务)
|
|
|
+ * @param workContractInfo
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Transactional(readOnly = false)
|
|
|
+ public String newAuditSave(WorkContractInfo workContractInfo,String [] status,List<User> auditUsers){
|
|
|
+ //判断收费标准是否存在
|
|
|
+ if(null!= workContractInfo.getChargeCriterionList() && workContractInfo.getChargeCriterionList().size()>0){
|
|
|
+ String chargeCriterion = String.join(",", workContractInfo.getChargeCriterionList());
|
|
|
+ workContractInfo.setChargeCriterion(chargeCriterion);
|
|
|
+ }
|
|
|
+
|
|
|
+ //Office office = officeService.get(workContractInfo.getChargeCompany());
|
|
|
+ Office office = UserUtils.getUser().getOffice();
|
|
|
+ String str = "合同申请人:" + UserUtils.get(workContractInfo.getCreateBy().getId()).getName() + ",主委托方:" + workContractInfo.getClient().getName() + ",合同所属部门:"+office.getName();
|
|
|
+ String title = "合同名称:"+workContractInfo.getName();
|
|
|
+ // 对不同环节的业务逻辑进行操作
|
|
|
+ String taskDefKey = workContractInfo.getAct().getTaskDefKey();
|
|
|
+ if (!"modifyApply".equals(taskDefKey)) {
|
|
|
+ actTaskService.claim(workContractInfo.getAct().getTaskId(), UserUtils.getUser().getId());
|
|
|
+ }else {
|
|
|
+ workContractInfo.getAct().setFlag("yes");
|
|
|
+ updateWorkContractInfo(workContractInfo);
|
|
|
+ }
|
|
|
+ String comment = "";
|
|
|
+ if (workContractInfo.getContractState().equals("3")){
|
|
|
+ comment = ("yes".equals(workContractInfo.getAct().getFlag())?"[重新申请] ":"[已撤销] ");
|
|
|
+ }else {
|
|
|
+ if(StringUtils.isNotBlank(workContractInfo.getAct().getComment())){
|
|
|
+ comment = ("yes".equals(workContractInfo.getAct().getFlag())?"[同意] ":"[驳回] ")+workContractInfo.getAct().getComment();
|
|
|
+ }else{
|
|
|
+ comment = ("yes".equals(workContractInfo.getAct().getFlag())?"[同意] ":"[驳回] ");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //yes 的时候状态为审核通过 否则为未通过
|
|
|
+ workContractInfo.setContractState(("yes".equals(workContractInfo.getAct().getFlag())?"2":"4"));
|
|
|
+ //String buffer = UserUtils.getRoleActivityEnname(workContractInfo.getCompanyId(),workContractInfo.getCreateBy());
|
|
|
+ Map<String, Object> vars = Maps.newHashMap();
|
|
|
+ //业务逻辑对应的条件表达式
|
|
|
+ String exp = "";
|
|
|
+ String taskCount = "";
|
|
|
+ String notifyRole = "";
|
|
|
+ int key = 0;
|
|
|
+ String enname = "";
|
|
|
+ List<Activity> activitieList = activityService.getByProcessInstanceId(workContractInfo.getProcessInstanceId());
|
|
|
+ WorkActivityMenu workActivityMenu = new WorkActivityMenu();
|
|
|
+ if (activitieList != null && activitieList.size() != 0) {
|
|
|
+ Iterator<Activity> iterator = activitieList.iterator();
|
|
|
+ while (iterator.hasNext()){
|
|
|
+ Activity activityInfo = iterator.next();
|
|
|
+ if (!"newContractAudit".equals(activityInfo.getProcessKey())){
|
|
|
+ iterator.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ workActivityMenu.setProcessType(activitieList.get(0).getProcessKey());
|
|
|
+ workActivityMenu.setActivities(activitieList);
|
|
|
+ }
|
|
|
+ /*if (activitieList!=null && activitieList.size()!=0){
|
|
|
+ workActivityMenu.setProcessType(activitieList.get(0).getProcessKey());
|
|
|
+ workActivityMenu.setActivities(activitieList);
|
|
|
+ }*/
|
|
|
+
|
|
|
+ WorkActivityProcess workActivityProcess = new WorkActivityProcess();
|
|
|
+ WorkActivityProcess selectProcess = new WorkActivityProcess();
|
|
|
+ selectProcess.setProcessInstanceId(workContractInfo.getProcessInstanceId());
|
|
|
+ List<WorkActivityProcess> workActivityProcesses = workActivityProcessService.findList(selectProcess);
|
|
|
+ List<Activity> activities = workActivityMenu.getActivities();
|
|
|
+ if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("newContractAudit")) {
|
|
|
+ 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(workContractInfo.getAct().getFlag())) {
|
|
|
+ workContractInfo.setContractState("4");
|
|
|
+ workActivityProcess.setIsApproval("2");
|
|
|
+ String returnBack = "-1";
|
|
|
+ for (Activity activity : activities) {
|
|
|
+ if (activity.getCount() == activityProcess.getCount()) {
|
|
|
+ notifyRole = activity.getName();
|
|
|
+ returnBack = activity.getReturnBack();
|
|
|
+ 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(workContractInfo.getAct().getFlag())) {
|
|
|
+ workContractInfo.setContractState("3");
|
|
|
+ workActivityProcess.setIsApproval("2");
|
|
|
+ } else {
|
|
|
+ workActivityProcess.setIsApproval("1");
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ workActivityMenu.setProcessType("newContractAudit");
|
|
|
+ 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 ("bmzr".equals(taskDefKey) && count.contains("1")) {
|
|
|
+ taskCount = "1";
|
|
|
+ exp = "pass";
|
|
|
+ if ("yes".equals(workContractInfo.getAct().getFlag())) {
|
|
|
+ workActivityProcessService.insertAuditsByType(auditUsers,workContractInfo.getProcessInstanceId(),2,1);
|
|
|
+
|
|
|
+ notifyRole = "总经理审批";
|
|
|
+ workActivityProcess.setIsApproval("1");
|
|
|
+ enname = "zjl";
|
|
|
+ vars.put("zjlList", auditUsers);
|
|
|
+ vars.put("zjlCount",auditUsers.size());
|
|
|
+ } else {
|
|
|
+ notifyRole = "调整报告";
|
|
|
+ workActivityProcess.setIsApproval("2");
|
|
|
+ }
|
|
|
+ } else if ("zjl".equals(taskDefKey) && count.contains("2")) {
|
|
|
+ taskCount = "2";
|
|
|
+ exp = "pass";
|
|
|
+ if ("yes".equals(workContractInfo.getAct().getFlag())) {
|
|
|
+ notifyRole = "审批通过";
|
|
|
+ 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 = "bmzr";
|
|
|
+ if (!"yes".equals(workContractInfo.getAct().getFlag())) {
|
|
|
+ workContractInfo.setContractState("3");
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //workActivityProcessService.updateProcess(workActivityProcess,workActivityMenu,key,taskCount,workContractInfo.getProcessInstanceId(),taskDefKey,"modifyApply",workContractInfo.getAct().getFlag(),comment, activities);
|
|
|
+ // 设置意见
|
|
|
+ workContractInfo.getAct().setComment(("yes".equals(workContractInfo.getAct().getFlag()) ? "[同意] " : "[驳回] ") + workContractInfo.getAct().getComment());
|
|
|
+ workContractInfo.preUpdate();
|
|
|
+ // 提交流程任务
|
|
|
+ vars.put(exp, "yes".equals(workContractInfo.getAct().getFlag())? true : false);
|
|
|
+ vars.put("passs", true);
|
|
|
+ workActivityProcessService.updateProcess(workActivityProcess,workActivityMenu,key,taskCount,workContractInfo.getProcessInstanceId(),taskDefKey,"modifyApply",workContractInfo.getAct().getFlag(),comment, activities);
|
|
|
+ // 提交流程任务
|
|
|
+ actTaskService.complete(workContractInfo.getAct().getTaskId(), workContractInfo.getAct().getProcInsId(), workContractInfo.getAct().getComment(), vars);
|
|
|
+ boolean state = actTaskService.isProcessEnd(workContractInfo.getAct().getProcInsId());
|
|
|
+ List<User> users = new ArrayList<>();
|
|
|
+ List<User> userList = new ArrayList<>();
|
|
|
+ List<User> zjlList = dao.getUserByRole("总经理");
|
|
|
+ if(!state) {
|
|
|
+ str = "合同编号:" + workContractInfo.getContractNum() + ",主委托方:" + workContractInfo.getClient().getName() + ",合同所属部门:"+office.getName();
|
|
|
+ title = "合同名称:"+workContractInfo.getName();
|
|
|
+ users.add(workContractInfo.getCreateBy());
|
|
|
+ if ("yes".equals(workContractInfo.getAct().getFlag())) {
|
|
|
+ String titleStr = "合同【"+workContractInfo.getName() +"】登记完成";
|
|
|
+ String content = "合同【"+workContractInfo.getName() +"】登记完成,合同编号:" + workContractInfo.getContractNum();
|
|
|
+
|
|
|
+ workContractInfo.setContractState("5");
|
|
|
+ WorkProjectNotify notify = new WorkProjectNotify();
|
|
|
+ notify.setNotifyId(workContractInfo.getId());
|
|
|
+ userList = workProjectNotifyService.readByNotifyId(notify);
|
|
|
+ workProjectNotifyService
|
|
|
+ .save(UtilNotify
|
|
|
+ .saveNotify(workContractInfo.getId(),
|
|
|
+ workContractInfo.getCreateBy(),
|
|
|
+ workContractInfo.getCompanyId(),
|
|
|
+ titleStr,
|
|
|
+ content,
|
|
|
+ "143",
|
|
|
+ "0",
|
|
|
+ "待通知",
|
|
|
+ notifyRole));
|
|
|
+ for (User user : zjlList) {
|
|
|
+ workProjectNotifyService
|
|
|
+ .save(UtilNotify
|
|
|
+ .saveNotify(workContractInfo.getId(),
|
|
|
+ user,
|
|
|
+ workContractInfo.getCompanyId(),
|
|
|
+ titleStr,
|
|
|
+ content,
|
|
|
+ "143",
|
|
|
+ "0",
|
|
|
+ "待通知",
|
|
|
+ notifyRole));
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ WorkProjectNotify notify = new WorkProjectNotify();
|
|
|
+ notify.setNotifyId(workContractInfo.getId());
|
|
|
+ userList = workProjectNotifyService.readByNotifyId(notify);
|
|
|
+ if (StringUtils.isNotBlank(workContractInfo.getContractState()) && !("3").equals(workContractInfo.getContractState())){
|
|
|
+ workContractInfo.setContractState("4");
|
|
|
+ workProjectNotifyService
|
|
|
+ .save(UtilNotify
|
|
|
+ .saveNotify(workContractInfo.getId(),
|
|
|
+ workContractInfo.getCreateBy(),
|
|
|
+ workContractInfo.getCompanyId(),
|
|
|
+ title,
|
|
|
+ str,
|
|
|
+ "143",
|
|
|
+ "0",
|
|
|
+ "待通知",
|
|
|
+ notifyRole));
|
|
|
+ for (User user : zjlList) {
|
|
|
+ workProjectNotifyService
|
|
|
+ .save(UtilNotify
|
|
|
+ .saveNotify(workContractInfo.getId(),
|
|
|
+ user,
|
|
|
+ workContractInfo.getCompanyId(),
|
|
|
+ title,
|
|
|
+ str,
|
|
|
+ "143",
|
|
|
+ "0",
|
|
|
+ "待通知",
|
|
|
+ notifyRole));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ workActivityProcessService.deleteProcessIdAuditUsers(workContractInfo.getProcessInstanceId());
|
|
|
+ }else{
|
|
|
+ if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("newContractAudit")) {
|
|
|
+ WorkProjectNotify notify = new WorkProjectNotify();
|
|
|
+ notify.setNotifyId(workContractInfo.getId());
|
|
|
+ userList = workProjectNotifyService.readByNotifyId(notify);
|
|
|
+ //users.addAll(userList);
|
|
|
+ WorkProjectNotify workProjectNotify = UtilNotify
|
|
|
+ .saveNotify(workContractInfo.getId(),
|
|
|
+ new User(),
|
|
|
+ workContractInfo.getCompanyId(),
|
|
|
+ title,
|
|
|
+ str,
|
|
|
+ "143",
|
|
|
+ "0",
|
|
|
+ "待审批",
|
|
|
+ notifyRole);
|
|
|
+ List<WorkProjectNotify> workProjectNotifys = activityService.getByFlagAndTaskDefKeyList(
|
|
|
+ activities,
|
|
|
+ workProjectNotify,
|
|
|
+ taskDefKey,
|
|
|
+ workContractInfo.getAct().getFlag(),
|
|
|
+ taskCount,
|
|
|
+ workContractInfo.getCreateBy(),
|
|
|
+ workContractInfo.getChargeCompany(),
|
|
|
+ "2");
|
|
|
+ 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 ("gzr".equals(taskDefKey)){
|
|
|
+ extras.put("type","7001");
|
|
|
+ }else {
|
|
|
+ extras.put("type","7002");
|
|
|
+ }
|
|
|
+ extras.put("id",workProjectNotify.getId());
|
|
|
+ extras.put("procDefKey","143");
|
|
|
+ UserUtils.pushInfoToApp(title,str,extras,workProjectNotify1.getUser().getId());
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ if (!"yes".equals(workContractInfo.getAct().getFlag())) {//驳回待办展示
|
|
|
+ title = "合同【"+workContractInfo.getName() +"】登记被驳回";
|
|
|
+ str = "合同【"+workContractInfo.getName() +"】登记被驳回,请选择重新申请或作废";
|
|
|
+ WorkProjectNotify notify = new WorkProjectNotify();
|
|
|
+ notify.setNotifyId(workContractInfo.getId());
|
|
|
+ userList = workProjectNotifyService.readByNotifyId(notify);
|
|
|
+ //users.addAll(userList);
|
|
|
+ workProjectNotifyService
|
|
|
+ .save(UtilNotify
|
|
|
+ .saveNotify(workContractInfo.getId(),
|
|
|
+ workContractInfo.getCreateBy(),
|
|
|
+ workContractInfo.getCompanyId(),
|
|
|
+ title,
|
|
|
+ str,
|
|
|
+ "143",
|
|
|
+ "0",
|
|
|
+ "重新申请",
|
|
|
+ notifyRole));
|
|
|
+ users.add( workContractInfo.getCreateBy());
|
|
|
+ } else {
|
|
|
+ if (StringUtils.isNotBlank(enname)) {//驳回重新申请待办展示
|
|
|
+ title = "合同【"+workContractInfo.getName() +"】登记,待审批";
|
|
|
+ str = "合同【"+workContractInfo.getName() +"】登记,待审批";
|
|
|
+ WorkProjectNotify notify = new WorkProjectNotify();
|
|
|
+ notify.setNotifyId(workContractInfo.getId());
|
|
|
+ userList = workProjectNotifyService.readByNotifyId(notify);
|
|
|
+ //users.addAll(userList1);
|
|
|
+ WorkProjectNotify workProjectNotify = UtilNotify
|
|
|
+ .saveNotify(workContractInfo.getId(),
|
|
|
+ new User(),
|
|
|
+ workContractInfo.getCompanyId(),
|
|
|
+ title,
|
|
|
+ str,
|
|
|
+ "143",
|
|
|
+ "0",
|
|
|
+ "待审批",
|
|
|
+ notifyRole);
|
|
|
+ users.addAll(auditUsers);
|
|
|
+ for (User user1:auditUsers){
|
|
|
+ workProjectNotify.setUser(user1);
|
|
|
+ workProjectNotify.setId("");
|
|
|
+ workProjectNotify.setIsNewRecord(false);
|
|
|
+ workProjectNotifyService
|
|
|
+ .save(workProjectNotify);
|
|
|
+ if (!"modifyApply".equals(taskDefKey)){
|
|
|
+ Map<String,Object> extras = new HashMap<>();
|
|
|
+ if ("gzr".equals(taskDefKey)){
|
|
|
+ extras.put("type","7001");
|
|
|
+ }else {
|
|
|
+ extras.put("type","7002");
|
|
|
+ }
|
|
|
+ extras.put("id",workProjectNotify.getId());
|
|
|
+ extras.put("procDefKey","143");
|
|
|
+ UserUtils.pushInfoToApp(title,str,extras,user1.getId());
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ WorkProjectNotify notify = new WorkProjectNotify();
|
|
|
+ notify.setNotifyId(workContractInfo.getId());
|
|
|
+ userList = workProjectNotifyService.readByNotifyId(notify);
|
|
|
+ users.addAll(userList);
|
|
|
+ users.add(workContractInfo.getCreateBy());
|
|
|
+ workProjectNotifyService
|
|
|
+ .save(UtilNotify
|
|
|
+ .saveNotify(workContractInfo.getId(),
|
|
|
+ workContractInfo.getCreateBy(),
|
|
|
+ workContractInfo.getCompanyId(),
|
|
|
+ title,
|
|
|
+ str,
|
|
|
+ "143",
|
|
|
+ "0",
|
|
|
+ "重新申请",
|
|
|
+ notifyRole));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (users!=null && users.size()!=0) {
|
|
|
+ for (User u : users) {
|
|
|
+ UserUtils.pushIm(u.getId(),str);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (userList!=null && userList.size()!=0) {
|
|
|
+ for (User u : userList) {
|
|
|
+ UserUtils.pushMeIm(u.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ workContractInfoDao.update(workContractInfo);
|
|
|
+ return "保存审核意见成功!";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 工单执行(完成任务)
|
|
|
* @param workContractInfo
|