|
@@ -2773,15 +2773,17 @@ public class RuralProjectMessageNewService extends CrudService<RuralProjectMessa
|
|
reported.setLianXiDH(records.getWorkContractInfo().getClient().getTelephone());
|
|
reported.setLianXiDH(records.getWorkContractInfo().getClient().getTelephone());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- reported.setDangABH(records.getReportData().getNumber());
|
|
|
|
-
|
|
|
|
- SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
- reported.setBaoGaoShuQianFaDate(formatter.format(records.getReportData().getReportDate()));
|
|
|
|
- reported.setHeTongJia(records.getReportData().getContractFee());
|
|
|
|
- reported.setSongShenJia(records.getReportData().getReviewFee());
|
|
|
|
- reported.setShenDingJia(records.getReportData().getApprovalFee());
|
|
|
|
- reported.setJingHeJianE(records.getReportData().getVerifyFee());
|
|
|
|
- reported.setJingHeJianLv(records.getReportData().getVerifyRate());
|
|
|
|
|
|
+ if(null != records.getReportData()){
|
|
|
|
+ reported.setDangABH(records.getReportData().getNumber());
|
|
|
|
+
|
|
|
|
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
+ reported.setBaoGaoShuQianFaDate(formatter.format(records.getReportData().getReportDate()));
|
|
|
|
+ reported.setHeTongJia(records.getReportData().getContractFee());
|
|
|
|
+ reported.setSongShenJia(records.getReportData().getReviewFee());
|
|
|
|
+ reported.setShenDingJia(records.getReportData().getApprovalFee());
|
|
|
|
+ reported.setJingHeJianE(records.getReportData().getVerifyFee());
|
|
|
|
+ reported.setJingHeJianLv(records.getReportData().getVerifyRate());
|
|
|
|
+ }
|
|
reported.setPorjectStruct("11");
|
|
reported.setPorjectStruct("11");
|
|
reported.setGCGMUnit("7");
|
|
reported.setGCGMUnit("7");
|
|
reported.setPorjectUse("17");
|
|
reported.setPorjectUse("17");
|
|
@@ -4334,4 +4336,703 @@ public class RuralProjectMessageNewService extends CrudService<RuralProjectMessa
|
|
return "保存审核意见失败!!";
|
|
return "保存审核意见失败!!";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 保存上报数据
|
|
|
|
+ * @param reported
|
|
|
|
+ */
|
|
|
|
+ @Transactional(readOnly = false)
|
|
|
|
+ public String saveOverallReportedInfo(RuralProjectRecordsReported reported, ProjectStatusEnum projectStatus) {
|
|
|
|
+ this.disposeList(reported);
|
|
|
|
+ String[] split = reported.getS3().split(",");
|
|
|
|
+ if(split.length==2){
|
|
|
|
+ reported.setS3(split[1]);
|
|
|
|
+ }else{
|
|
|
|
+ reported.setS3(reported.getS3().replaceAll(",",""));
|
|
|
|
+ }
|
|
|
|
+ Integer oldStatus = null;
|
|
|
|
+ if(StringUtils.isNotBlank(reported.getReportStatus())){
|
|
|
|
+ oldStatus = Integer.parseInt(reported.getReportStatus());
|
|
|
|
+ }
|
|
|
|
+ reported.setReportStatus(String.valueOf(projectStatus.getValue()));
|
|
|
|
+ //查询是否已经上报项目信息
|
|
|
|
+ if (StringUtils.isBlank(reported.getId())){
|
|
|
|
+ reported.setCompany(UserUtils.getSelectCompany());
|
|
|
|
+ reported.setOffice(UserUtils.getSelectOffice());
|
|
|
|
+ reported.preInsert();
|
|
|
|
+ //将项目id设置为id
|
|
|
|
+ reported.setId(reported.getProjectId());
|
|
|
|
+ ruralProjectRecordsReportedDao.insert(reported);
|
|
|
|
+ }else{
|
|
|
|
+ reported.preUpdate();
|
|
|
|
+ ruralProjectRecordsReportedDao.update(reported);
|
|
|
|
+ }
|
|
|
|
+ //删除上报咨询员信息
|
|
|
|
+ ruralProjectRecordsReportedDao.deleteConsultant(reported);
|
|
|
|
+ //保存咨询员信息
|
|
|
|
+ for (ReportedConsultant info : reported.getReportedConsultantList()){
|
|
|
|
+ if (info.getZixunyuan() == null){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ //添加项目上报id
|
|
|
|
+ info.setReportedId(reported.getId());
|
|
|
|
+ info.preInsert();
|
|
|
|
+ ruralProjectRecordsReportedDao.insertConsultant(info);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //保存附件信息
|
|
|
|
+ if(reported.getWorkAttachments().size()>0){
|
|
|
|
+ List<WorkClientAttachment> workAttachments = reported.getWorkAttachments();
|
|
|
|
+ for (WorkClientAttachment workClientAttachment: workAttachments) {
|
|
|
|
+ if (workClientAttachment.getId() == null){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ if (WorkClientAttachment.DEL_FLAG_NORMAL.equals(workClientAttachment.getDelFlag())){
|
|
|
|
+ workClientAttachment.setAttachmentId(reported.getId());
|
|
|
|
+ workClientAttachment.setAttachmentFlag("95");
|
|
|
|
+ workClientAttachment.setAttachmentUser(UserUtils.getUser().getId());
|
|
|
|
+ if (com.jeeplus.common.utils.StringUtils.isBlank(workClientAttachment.getId()) || "null".equals(workClientAttachment.getId())){
|
|
|
|
+ workattachmentService.insertOnWorkClientAttachment(workClientAttachment);
|
|
|
|
+ }else{
|
|
|
|
+ workattachmentService.updateOnWorkClientAttachment(workClientAttachment);
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ workClientAttachmentDao.delete(workClientAttachment);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //启动审核
|
|
|
|
+ if (Integer.parseInt(reported.getReportStatus())== ProjectStatusEnum.IN_APRL.getValue() &&(oldStatus==null|| ProjectStatusEnum.REJECTED.getValue()!=oldStatus)) {
|
|
|
|
+ this.startOverallAudit(reported, reported.getProcessInstanceId());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //修改项目信息中的上报状态
|
|
|
|
+ RuralProjectRecords records = new RuralProjectRecords();
|
|
|
|
+ records.setId(reported.getId());
|
|
|
|
+ records.setReportedState(String.valueOf(projectStatus.getValue()));
|
|
|
|
+ dao.updateReported(records);
|
|
|
|
+
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 启动审核
|
|
|
|
+ * @param reported
|
|
|
|
+ * @param processInstanceId
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private String startOverallAudit(RuralProjectRecordsReported reported, String processInstanceId) {
|
|
|
|
+ Map<String, Object> variables = new HashMap<String, Object>();
|
|
|
|
+ identityService.setAuthenticatedUserId(reported.getCurrentUser().getId());
|
|
|
|
+ //获取项目信息
|
|
|
|
+ ProjectRecords projectRecords = projectRecordsService.getRuralMasters(reported.getProjectId());
|
|
|
|
+ String titleStr = "全过程项目【"+projectRecords.getProjectName()+"】上报待审批";
|
|
|
|
+ String contentStr = "全过程项目【"+projectRecords.getProjectName()+"】上报待审批,项目" + (0 == projectRecords.getOverDueStatus()?"未超期":"超期");
|
|
|
|
+
|
|
|
|
+ String businessKey = reported.getId();
|
|
|
|
+ Office office = UserUtils.getSelectOffice();
|
|
|
|
+ WorkActivityMenu workActivityMenu = workActivityMenuService.findByParentAndOffice("gg3125f1f194582bdda9abcew750904", office);
|
|
|
|
+ // 启动流程
|
|
|
|
+ String processType = workActivityMenu.getProcessType();
|
|
|
|
+ StringBuffer buffer = new StringBuffer();
|
|
|
|
+ Activity activity = new Activity();
|
|
|
|
+ WorkProjectNotify workProjectNotify = UtilNotify
|
|
|
|
+ .saveNotify(reported.getId(),
|
|
|
|
+ null,
|
|
|
|
+ reported.getCompany().getId(),
|
|
|
|
+ titleStr,
|
|
|
|
+ contentStr,
|
|
|
|
+ "218",
|
|
|
|
+ "0",
|
|
|
|
+ "待审批",
|
|
|
|
+ ""
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ List<User> users = new ArrayList<>();
|
|
|
|
+ List<User> bmzrList = UserUtils.getByRoleActivityEnname("sbglyyjla",3,reported.getOffice().getId(),"4",reported.getCreateBy());
|
|
|
|
+ //判断审核增减率
|
|
|
|
+
|
|
|
|
+ variables.put("bmzrCount",bmzrList.size());
|
|
|
|
+ variables.put("bmzrList", bmzrList);
|
|
|
|
+ variables.put("pass",true);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ 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(),office.getId(),"11",reported.getCreateBy());
|
|
|
|
+ if (enusers.size()==0){
|
|
|
|
+ reported.setReportStatus(String.valueOf(ProjectStatusEnum.TSTORE.getValue()));
|
|
|
|
+ ruralProjectRecordsReportedDao.updateStatusById(reported);
|
|
|
|
+ return "流程审批人不能为空,角色"+a.getRole().getName()+"下无用户,请联系管理员!";
|
|
|
|
+ }
|
|
|
|
+ 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 && com.jeeplus.common.utils.StringUtils.isNotBlank(activity.getId())) {
|
|
|
|
+ //角色审批
|
|
|
|
+ if (com.jeeplus.common.utils.StringUtils.isNotBlank(activity.getRole().getEnname())) {
|
|
|
|
+ users = UserUtils.getByRoleActivityEnnames(activity.getRole().getEnname(),office.getId(),"11",reported.getCreateBy());
|
|
|
|
+ }
|
|
|
|
+ //人员审批
|
|
|
|
+ if (com.jeeplus.common.utils.StringUtils.isNotBlank(activity.getUser().getId())) {
|
|
|
|
+ users.add(activity.getUser());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ workProjectNotify.setId("");
|
|
|
|
+ } else {
|
|
|
|
+ if (bmzrList.size()==0 ){
|
|
|
|
+ reported.setReportStatus(String.valueOf(ProjectStatusEnum.TSTORE.getValue()));
|
|
|
|
+ ruralProjectRecordsReportedDao.updateStatusById(reported);
|
|
|
|
+ }
|
|
|
|
+ if (bmzrList.size()==0){
|
|
|
|
+ return "流程审批人不能为空,报告管理员下无用户,请联系管理员!";
|
|
|
|
+ }
|
|
|
|
+ processType = "overallReported";
|
|
|
|
+ users.addAll(bmzrList);
|
|
|
|
+ }
|
|
|
|
+ List<String> userIds = new ArrayList<>(users.size());
|
|
|
|
+ for (User u : users){
|
|
|
|
+ userIds.add(u.getId());
|
|
|
|
+ workProjectNotify.setUser(u);
|
|
|
|
+ workProjectNotify.setId("");
|
|
|
|
+ workProjectNotify.setNotifyRole("报告管理员审批");
|
|
|
|
+ workProjectNotifyService.save(workProjectNotify);
|
|
|
|
+ Map<String,Object> extras = new HashMap<>();
|
|
|
|
+ extras.put("type","7002");
|
|
|
|
+ extras.put("procDefKey","218");
|
|
|
|
+ extras.put("id",workProjectNotify.getId());
|
|
|
|
+ UserUtils.pushInfoToApp(titleStr, contentStr,extras,u.getId());
|
|
|
|
+ }
|
|
|
|
+ UserUtils.pushIm(userIds,contentStr);
|
|
|
|
+
|
|
|
|
+ variables.put("busId", businessKey);
|
|
|
|
+ variables.put("type", processType);
|
|
|
|
+ variables.put("title", "审批单:" + reported.getDangABH());//设置标题;
|
|
|
|
+
|
|
|
|
+ ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processType, businessKey, variables);
|
|
|
|
+ // workReceiptsSettle.setProcessInstance(processInstance);
|
|
|
|
+ if (StringUtils.isNotBlank(processInstanceId)) {
|
|
|
|
+ workActivityProcessService.updateProcessInstanceId(processInstance.getId(),processInstanceId);
|
|
|
|
+ workActivityProcessService.deleteProcessInstanceId(processInstanceId);
|
|
|
|
+ workActivityProcessService.deleteProcessIdAuditUsers(processInstanceId);
|
|
|
|
+ }
|
|
|
|
+ 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.setIsApproval("0");
|
|
|
|
+ workActivityProcess.setProcessInstanceId(processInstance.getId());
|
|
|
|
+ workActivityProcessService.save(workActivityProcess);
|
|
|
|
+ workActivityProcessService.insertAuditsByType(bmzrList,processInstance.getId(),1,1);
|
|
|
|
+ }
|
|
|
|
+ reported.setProcessInstanceId(processInstance.getId());
|
|
|
|
+ reported.setReportStatus(String.valueOf(ProjectStatusEnum.IN_APRL.getValue()));
|
|
|
|
+ ruralProjectRecordsReportedDao.updateProcessIdAndStatus(reported);
|
|
|
|
+ //通知添加流程实例ID
|
|
|
|
+ workProjectNotify.setProcessInstanceId(processInstance.getId());
|
|
|
|
+ workProjectNotifyService.save(workProjectNotify);
|
|
|
|
+
|
|
|
|
+ return "";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 上报审核
|
|
|
|
+ * @param reported
|
|
|
|
+ * @param auditUsers
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Transactional(readOnly = false)
|
|
|
|
+ public String auditOverallSaveReported(RuralProjectRecordsReported reported,List<User> auditUsers) {
|
|
|
|
+ try {
|
|
|
|
+ String str = "全过程项目报告号:"+reported.getDangABH()+",上报日期:"+ DateUtils.formatDate(reported.getCreateDate());
|
|
|
|
+ String title = "全过程项目报告号:"+ reported.getDangABH();
|
|
|
|
+ // 对不同环节的业务逻辑进行操作
|
|
|
|
+ String taskDefKey = reported.getAct().getTaskDefKey();
|
|
|
|
+ if (!"modifyApply".equals(taskDefKey) && !taskDefKey.contains("audit")) {
|
|
|
|
+ actTaskService.claim(reported.getAct().getTaskId(), UserUtils.getUser().getId());
|
|
|
|
+ }else {
|
|
|
|
+ reported.getAct().setFlag("yes");
|
|
|
|
+ ruralProjectRecordsReportedDao.update(reported);
|
|
|
|
+ //删除上报咨询员信息
|
|
|
|
+ ruralProjectRecordsReportedDao.deleteConsultant(reported);
|
|
|
|
+ //保存咨询员信息
|
|
|
|
+ for (ReportedConsultant info : reported.getReportedConsultantList()){
|
|
|
|
+ if (info.getZixunyuan() == null){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ //添加项目上报id
|
|
|
|
+ info.setReportedId(reported.getId());
|
|
|
|
+ info.preInsert();
|
|
|
|
+ ruralProjectRecordsReportedDao.insertConsultant(info);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ String comment = "";
|
|
|
|
+ if (String.valueOf(ProjectStatusEnum.REJECTED.getValue()).equals(reported.getReportStatus()) ){
|
|
|
|
+ comment = ("yes".equals(reported.getAct().getFlag())?"[重新申请] ":"[已撤销] ");
|
|
|
|
+ }else {
|
|
|
|
+ comment = ("yes".equals(reported.getAct().getFlag())?"[同意] ":"[驳回] ");
|
|
|
|
+ if(StringUtils.isNotBlank(reported.getAct().getComment())){
|
|
|
|
+ comment += reported.getAct().getComment();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //yes 的时候状态为审核通过 否则为未通过
|
|
|
|
+ //1 审核中 2 未通过
|
|
|
|
+ reported.setReportStatus(String.valueOf(("yes".equals(reported.getAct().getFlag()) ? ProjectStatusEnum.IN_APRL.getValue() : ProjectStatusEnum.REJECTED.getValue())));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //修改项目信息中的上报状态
|
|
|
|
+ RuralProjectRecords records = new RuralProjectRecords();
|
|
|
|
+ records.setId(reported.getId());
|
|
|
|
+ records.setReportedState(String.valueOf(("yes".equals(reported.getAct().getFlag()) ? ProjectStatusEnum.IN_APRL.getValue() : ProjectStatusEnum.REJECTED.getValue())));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ Map<String, Object> vars = Maps.newHashMap();
|
|
|
|
+ //业务逻辑对应的条件表达式
|
|
|
|
+ String exp = "";
|
|
|
|
+ String taskCount = "";
|
|
|
|
+ String notifyRole = "";
|
|
|
|
+ int key = 0;
|
|
|
|
+ String enname = "";
|
|
|
|
+ List<Activity> activitieList = activityService.getByProcessInstanceId(reported.getProcessInstanceId());
|
|
|
|
+ WorkActivityMenu workActivityMenu = new WorkActivityMenu();
|
|
|
|
+ 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(reported.getProcessInstanceId());
|
|
|
|
+ List<WorkActivityProcess> workActivityProcesses = workActivityProcessService.findList(selectProcess);
|
|
|
|
+ List<Activity> activities = workActivityMenu.getActivities();
|
|
|
|
+ if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("overallReported")) {
|
|
|
|
+ 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(reported.getAct().getFlag())) {
|
|
|
|
+ notifyRole = "调整上报信息";
|
|
|
|
+ reported.setReportStatus(String.valueOf(ProjectStatusEnum.REJECTED.getValue()));
|
|
|
|
+ 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")){
|
|
|
|
+ taskCount = "0";
|
|
|
|
+ exp = "pass";
|
|
|
|
+ workActivityProcess.setId("");
|
|
|
|
+ workActivityProcess.setCount(0);
|
|
|
|
+ if (!"yes".equals(reported.getAct().getFlag())) {
|
|
|
|
+ reported.setReportStatus(String.valueOf(ProjectStatusEnum.RECALL.getValue()));
|
|
|
|
+ workActivityProcess.setIsApproval("2");
|
|
|
|
+ } else {
|
|
|
|
+ workActivityProcess.setIsApproval("1");
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ //获取项目信息
|
|
|
|
+ RuralProjectRecords record = ruralProjectRecordsService.get(records);
|
|
|
|
+ workActivityMenu.setProcessType("overallReported");
|
|
|
|
+ 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(reported.getAct().getFlag())) {
|
|
|
|
+ notifyRole = "审批通过";
|
|
|
|
+ workActivityProcess.setIsApproval("1");
|
|
|
|
+ //处理上报数据
|
|
|
|
+ //Map<String,String> map = RuralProjectReportedUtil.reportedDataManage(reported);
|
|
|
|
+ //String mapStr = MapToXmlUtil.getMapToXML(map);
|
|
|
|
+ //进行上报
|
|
|
|
+ /*String client = RuralProjectReportedUtil.client(mapStr);
|
|
|
|
+ if(!"Success".equals(client)){
|
|
|
|
+ return "上报失败!";
|
|
|
|
+ }*/
|
|
|
|
+
|
|
|
|
+ //信用代码id
|
|
|
|
+ String jsonUscCode = "{\"uscCode\": \"91320000746823994F\"";
|
|
|
|
+ Map map = RuralProjectReportedInfoUtil.reportedDataManage(reported);
|
|
|
|
+ String jsonUscData = JSONObject.toJSONString(map);
|
|
|
|
+ byte[] privateKey = org.apache.commons.codec.binary.Base64.decodeBase64(PRIVATE_KEY);
|
|
|
|
+ //客户拿到密钥将自己的数据 jsonUscData 进行非对称加密。
|
|
|
|
+ byte[] encryptByPrivateKey = new byte[0];
|
|
|
|
+ try {
|
|
|
|
+ encryptByPrivateKey = Rsatool.encryptByPrivateKey(jsonUscData.getBytes(), privateKey);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ //将唯一标志和非对称加密后数据采用对称加密,方便传到服务段解析,并获得非对称的公钥来解密客户用密钥加密的数据
|
|
|
|
+ String encryString = jsonUscCode + ",\"data\":\"" + Base64.encodeBase64String(encryptByPrivateKey) + "\"}";
|
|
|
|
+ String encryptByAes = null;
|
|
|
|
+ try {
|
|
|
|
+ encryptByAes = Aestool.Encrypt(encryString, AES_KEY);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ //测试接口
|
|
|
|
+ //String url = "http://comp.jszj.com.cn:8031/api/testAddProject";
|
|
|
|
+ //正式接口
|
|
|
|
+ String url = "http://comp.jszj.com.cn:8031/api/addProject";
|
|
|
|
+ //发送请求
|
|
|
|
+ String returnResult = HttpPostTool.doPost(url, encryptByAes);
|
|
|
|
+ HashMap hashMap = JSON.parseObject(returnResult, HashMap.class);
|
|
|
|
+ if(!"1".equals(hashMap.get("code"))){
|
|
|
|
+ return "上报失败:" + hashMap.get("msg").toString();
|
|
|
|
+ }
|
|
|
|
+ //修改项目上报表中状态
|
|
|
|
+ reported.setReportStatus(String.valueOf(ProjectStatusEnum.SIGNED.getValue()));
|
|
|
|
+
|
|
|
|
+ //修改项目表中上报状态
|
|
|
|
+ //判断项目是否超期,如果超期则将上报标志改为超期上报(7) 否则变更为正常上报数据
|
|
|
|
+ if(1 == record.getOverDueStatus()){
|
|
|
|
+ records.setReportedState("7");
|
|
|
|
+ }else{
|
|
|
|
+ records.setReportedState(String.valueOf(ProjectStatusEnum.SIGNED.getValue()));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ notifyRole = "调整上报信息";
|
|
|
|
+ workActivityProcess.setIsApproval("2");
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ } else if ("modifyApply".equals(taskDefKey)&& count.contains("0")) {
|
|
|
|
+ notifyRole = "上报管理员审批";
|
|
|
|
+ taskCount = "0";
|
|
|
|
+ exp = "pass";
|
|
|
|
+ vars.put("bmzrList", auditUsers);
|
|
|
|
+ vars.put("bmzrCount",auditUsers.size());
|
|
|
|
+ workActivityProcess.setCount(0);
|
|
|
|
+ enname = "sbglyyjla";
|
|
|
|
+ if (!"yes".equals(reported.getAct().getFlag())) {
|
|
|
|
+ reported.setReportStatus(String.valueOf(ProjectStatusEnum.RECALL.getValue()));
|
|
|
|
+ }
|
|
|
|
+ workActivityProcessService.deleteProcessUser(reported.getAct().getProcInsId());
|
|
|
|
+ workActivityProcessService.insertAuditsByType(auditUsers,reported.getAct().getProcInsId(),1,1);
|
|
|
|
+ break;
|
|
|
|
+ } else if ("apply_end".equals(taskDefKey)) {
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 设置意见
|
|
|
|
+ reported.getAct().setComment(("yes".equals(reported.getAct().getFlag()) ? "[同意] " : "[驳回] ") + reported.getAct().getComment());
|
|
|
|
+ reported.preUpdate();
|
|
|
|
+ // 提交流程任务
|
|
|
|
+ vars.put(exp, "yes".equals(reported.getAct().getFlag()) ? true : false);
|
|
|
|
+ vars.put("passLv",true);
|
|
|
|
+ vars.put("passs",true);
|
|
|
|
+ workActivityProcessService.updateProcess(workActivityProcess,workActivityMenu,key,taskCount, reported.getProcessInstanceId(),taskDefKey,"modifyApply", reported.getAct().getFlag(),comment, activities);
|
|
|
|
+ // 提交流程任务
|
|
|
|
+ actTaskService.complete(reported.getAct().getTaskId(), reported.getAct().getProcInsId(), reported.getAct().getComment(), vars);
|
|
|
|
+ boolean state = actTaskService.isProcessEnd(reported.getAct().getProcInsId());
|
|
|
|
+ List<User> users = new ArrayList<>();
|
|
|
|
+ List<User> userList = new ArrayList<>();
|
|
|
|
+ ProjectRecords projectRecords = projectRecordsService.getRuralMasters(reported.getProjectId());
|
|
|
|
+ if (!state) {
|
|
|
|
+ users.add(reported.getCreateBy());
|
|
|
|
+ if ("yes".equals(reported.getAct().getFlag())) {
|
|
|
|
+
|
|
|
|
+ String titleStr = "全过程项目【"+projectRecords.getProjectName()+"】上报完成";
|
|
|
|
+ String content = "全过程项目【"+projectRecords.getProjectName()+"】上报完成,项目" + (0 == projectRecords.getOverDueStatus()?"未超期":"超期");
|
|
|
|
+ WorkProjectNotify notify = new WorkProjectNotify();
|
|
|
|
+ notify.setNotifyId(reported.getId());
|
|
|
|
+ userList = workProjectNotifyService.readByNotifyId(notify);
|
|
|
|
+ workProjectNotifyService
|
|
|
|
+ .save(UtilNotify
|
|
|
|
+ .saveNotify(reported.getId(),
|
|
|
|
+ reported.getCreateBy(),
|
|
|
|
+ reported.getCompany().getId(),
|
|
|
|
+ titleStr,
|
|
|
|
+ content,
|
|
|
|
+ "218",
|
|
|
|
+ "0",
|
|
|
|
+ "待通知",
|
|
|
|
+ notifyRole));
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ WorkProjectNotify notify = new WorkProjectNotify();
|
|
|
|
+ notify.setNotifyId(reported.getId());
|
|
|
|
+ userList = workProjectNotifyService.readByNotifyId(notify);
|
|
|
|
+ if (!String.valueOf(ProjectStatusEnum.RECALL.getValue()).equals(reported.getReportStatus())){
|
|
|
|
+ reported.setReportStatus(String.valueOf(ProjectStatusEnum.REJECTED.getValue()));
|
|
|
|
+ workProjectNotifyService
|
|
|
|
+ .save(UtilNotify
|
|
|
|
+ .saveNotify(reported.getId(),
|
|
|
|
+ reported.getCreateBy(),
|
|
|
|
+ reported.getCompany().getId(),
|
|
|
|
+ title,
|
|
|
|
+ str,
|
|
|
|
+ "218",
|
|
|
|
+ "0",
|
|
|
|
+ "待通知",
|
|
|
|
+ notifyRole));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ workActivityProcessService.deleteProcessIdAuditUsers(reported.getProcessInstanceId());
|
|
|
|
+ } else {
|
|
|
|
+ if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("overallReported")) {
|
|
|
|
+ WorkProjectNotify notify = new WorkProjectNotify();
|
|
|
|
+ notify.setNotifyId(reported.getId());
|
|
|
|
+ userList = workProjectNotifyService.readByNotifyId(notify);
|
|
|
|
+ //users.addAll(userList);
|
|
|
|
+ WorkProjectNotify workProjectNotify = UtilNotify
|
|
|
|
+ .saveNotify(reported.getId(),
|
|
|
|
+ new User(),
|
|
|
|
+ reported.getCompany().getId(),
|
|
|
|
+ title,
|
|
|
|
+ str,
|
|
|
|
+ "218",
|
|
|
|
+ "0",
|
|
|
|
+ "待审批",
|
|
|
|
+ notifyRole);
|
|
|
|
+ List<WorkProjectNotify> workProjectNotifys = activityService.getByFlagAndTaskDefKeyList(
|
|
|
|
+ activities,
|
|
|
|
+ workProjectNotify,
|
|
|
|
+ taskDefKey,
|
|
|
|
+ reported.getAct().getFlag(),
|
|
|
|
+ taskCount,
|
|
|
|
+ reported.getCreateBy(),
|
|
|
|
+ reported.getOffice().getId(),
|
|
|
|
+ "218");
|
|
|
|
+ for (WorkProjectNotify workProjectNotify1:workProjectNotifys){
|
|
|
|
+ users.add(workProjectNotify1.getUser());
|
|
|
|
+ workProjectNotify1.setId("");
|
|
|
|
+ workProjectNotify1.setIsNewRecord(false);
|
|
|
|
+ workProjectNotifyService
|
|
|
|
+ .save(workProjectNotify1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ if (!"yes".equals(reported.getAct().getFlag())) {//驳回待办提示
|
|
|
|
+ title = "全过程项目【"+projectRecords.getProjectName()+"】上报被驳回";
|
|
|
|
+ str = "全过程项目【"+projectRecords.getProjectName()+"】上报需重新修改定义,项目" + (0 == projectRecords.getOverDueStatus()?"未超期":"超期");
|
|
|
|
+ WorkProjectNotify notify = new WorkProjectNotify();
|
|
|
|
+ notify.setNotifyId(reported.getId());
|
|
|
|
+ userList = workProjectNotifyService.readByNotifyId(notify);
|
|
|
|
+ //users.addAll(userList);
|
|
|
|
+ workProjectNotifyService
|
|
|
|
+ .save(UtilNotify
|
|
|
|
+ .saveNotify(reported.getId(),
|
|
|
|
+ reported.getCreateBy(),
|
|
|
|
+ reported.getCompany().getId(),
|
|
|
|
+ title,
|
|
|
|
+ str,
|
|
|
|
+ "218",
|
|
|
|
+ "0",
|
|
|
|
+ "重新申请",
|
|
|
|
+ notifyRole));
|
|
|
|
+ users.add( reported.getCreateBy());
|
|
|
|
+ } else {
|
|
|
|
+ if (StringUtils.isNotBlank(enname)) {//驳回重新申请待办
|
|
|
|
+ title = "全过程项目【"+projectRecords.getProjectName()+"】上报重新申请,待审批";
|
|
|
|
+ str = "全过程项目【"+projectRecords.getProjectName()+"】上报重新申请,待审批,项目" + (0 == projectRecords.getOverDueStatus()?"未超期":"超期");
|
|
|
|
+ WorkProjectNotify notify = new WorkProjectNotify();
|
|
|
|
+ notify.setNotifyId(reported.getId());
|
|
|
|
+ userList = workProjectNotifyService.readByNotifyId(notify);
|
|
|
|
+ //users.addAll(userList1);
|
|
|
|
+ WorkProjectNotify workProjectNotify = UtilNotify
|
|
|
|
+ .saveNotify(reported.getId(),
|
|
|
|
+ new User(),
|
|
|
|
+ reported.getCompany().getId(),
|
|
|
|
+ title,
|
|
|
|
+ str,
|
|
|
|
+ "218",
|
|
|
|
+ "0",
|
|
|
|
+ "待审批",
|
|
|
|
+ notifyRole);
|
|
|
|
+ users.addAll(auditUsers);
|
|
|
|
+ for (User user1:auditUsers){
|
|
|
|
+ workProjectNotify.setUser(user1);
|
|
|
|
+ workProjectNotify.setId("");
|
|
|
|
+ workProjectNotify.setIsNewRecord(false);
|
|
|
|
+ workProjectNotifyService.save(workProjectNotify);
|
|
|
|
+ Map<String,Object> extras = new HashMap<>();
|
|
|
|
+ extras.put("type","7002");
|
|
|
|
+ extras.put("procDefKey","218");
|
|
|
|
+ extras.put("id",workProjectNotify.getId());
|
|
|
|
+ UserUtils.pushInfoToApp(title, str,extras,user1.getId());
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ WorkProjectNotify notify = new WorkProjectNotify();
|
|
|
|
+ notify.setNotifyId(reported.getId());
|
|
|
|
+ userList = workProjectNotifyService.readByNotifyId(notify);
|
|
|
|
+ users.add(reported.getCreateBy());
|
|
|
|
+ workProjectNotifyService
|
|
|
|
+ .save(UtilNotify
|
|
|
|
+ .saveNotify(reported.getId(),
|
|
|
|
+ reported.getCreateBy(),
|
|
|
|
+ reported.getCompany().getId(),
|
|
|
|
+ title,
|
|
|
|
+ str,
|
|
|
|
+ "218",
|
|
|
|
+ "0",
|
|
|
|
+ "重新申请",
|
|
|
|
+ notifyRole));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotBlank(title) && users!=null && users.size()!=0) {
|
|
|
|
+ for (User u : users) {
|
|
|
|
+ UserUtils.pushIm(u.getId(),title);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotBlank(title) && userList!=null && userList.size()!=0) {
|
|
|
|
+ for (User u : userList) {
|
|
|
|
+ UserUtils.pushMeIm(u.getId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ ruralProjectRecordsReportedDao.update(reported);
|
|
|
|
+ //修改项目表中字段信息
|
|
|
|
+ dao.updateReported(records);
|
|
|
|
+
|
|
|
|
+ return "保存审核意见成功!";
|
|
|
|
+ }catch (ActivitiObjectNotFoundException e){
|
|
|
|
+ logger.error("ActivitiObjectNotFoundException e:",e);
|
|
|
|
+ return "流程已审批,不能重新审批!";
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ logger.error("Exception e:",e);
|
|
|
|
+ return "保存审核意见失败!!";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 上报:强制撤销
|
|
|
|
+ * @param reported
|
|
|
|
+ */
|
|
|
|
+ @Transactional(readOnly = false)
|
|
|
|
+ public void cancelInvalidateByReported(RuralProjectRecordsReported reported) {
|
|
|
|
+ try {
|
|
|
|
+ String invalidateProcessInstanceId = reported.getProcessInstanceId();
|
|
|
|
+ //将流程图中尚未走到的task的流程追踪信息逻辑删除,添加一条"撤销"流程追踪信息
|
|
|
|
+ WorkActivityProcess process = new WorkActivityProcess();
|
|
|
|
+ process.setProcessInstanceId(reported.getProcessInstanceId());
|
|
|
|
+ process.setIsApproval("0");
|
|
|
|
+ WorkActivityProcess workActivityProcess = new WorkActivityProcess();
|
|
|
|
+ workActivityProcess.setProcessInstanceId(reported.getProcessInstanceId());
|
|
|
|
+ List<WorkActivityProcess> processList = workActivityProcessService.findList(workActivityProcess);
|
|
|
|
+ WorkProjectNotify notify = new WorkProjectNotify();
|
|
|
|
+ notify.setNotifyId(reported.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,"上报-强制撤销");
|
|
|
|
+ reported.setReportStatus(String.valueOf(ProjectStatusEnum.RECALL.getValue()));
|
|
|
|
+ ruralProjectRecordsReportedDao.updateProcessIdAndStatus(reported);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //修改项目信息中的上报状态
|
|
|
|
+ RuralProjectRecords records = new RuralProjectRecords();
|
|
|
|
+ records.setId(reported.getId());
|
|
|
|
+ records.setReportedState(String.valueOf(ProjectStatusEnum.RECALL.getValue()));
|
|
|
|
+ dao.updateReported(records);
|
|
|
|
+
|
|
|
|
+ }catch (ActivitiObjectNotFoundException e){
|
|
|
|
+ System.err.println("上报撤销异常,因为这个流程已不存在!");
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ logger.error("Exception e:"+e);
|
|
|
|
+ }
|
|
|
|
+ catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ logger.error("Exception e:"+e);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据项目id 查询上报咨询员列表
|
|
|
|
+ * @param reportedId 上报id
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public List<RuralReportConsultant> getReportedConsultantsList(String reportedId){
|
|
|
|
+ List<RuralReportConsultant> list=projectcontentinfoDao.getReportedConsultantsList(reportedId);
|
|
|
|
+ return list;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据父id查询上报地址信息
|
|
|
|
+ * @param parentId
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public List<Area> getProjectReportedAreaByParentId(String parentId){
|
|
|
|
+ return dao.getProjectReportedAreaByParentId(parentId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|