package platform.modules.government.service; import com.alibaba.fastjson.JSONObject; import com.aliyuncs.exceptions.ClientException; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; 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 org.springframework.ui.ModelMap; import org.springframework.util.CollectionUtils; import platform.common.Constant; import platform.common.base.model.DictionaryItem; import platform.common.base.service.BaseService; import platform.common.base.service.DictionaryItemService; import platform.common.exception.BaseException; import platform.common.util.AlibabaSMSUtil; import platform.common.util.DateUtil; import platform.common.util.ShiroUtils; import platform.modules.build.entity.Company; import platform.modules.build.entity.CompanyContact; import platform.modules.build.service.BuildInfoService; import platform.modules.build.service.CompanyContactService; import platform.modules.build.service.CompanyService; import platform.modules.company.dao.ProjectApplicationDao; import platform.modules.company.dao.ProjectFillingDao; import platform.modules.company.dao.ProjectMaterialDao; import platform.modules.company.entity.*; import platform.modules.company.service.ProjectApplicationCompanyInfoService; import platform.modules.company.service.ProjectApplicationService; import platform.modules.company.service.ProjectFillingService; import platform.modules.company.service.ProjectMaterialService; import platform.modules.government.dao.AttachmentDao; import platform.modules.government.dao.ProjectDao; import platform.modules.government.dao.ProjectDeclarationDao; import platform.modules.government.dao.ProjectFillingDeclarationDao; import platform.modules.government.dto.*; import platform.modules.government.entity.*; import platform.modules.home.request.FindRequest; import platform.modules.home.response.FindResponseProject; import platform.modules.sys.dao.ApprovalDao; import platform.modules.sys.entity.*; import platform.modules.sys.service.*; import tk.mybatis.mapper.entity.Example; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; @Service @Transactional public class ProjectFillingDeclarationService extends BaseService { @Autowired private ProjectFillingDeclarationDao projectFillingDeclarationDao; @Autowired private ProjectServiceTypeService projectServiceTypeService; @Autowired private NoticesService noticesService; @Autowired private NoticesAcceptService noticesAcceptService; @Autowired private MessageService messageService; @Autowired private AttachmentDao attachmentDao; @Autowired private StreetService streetService; @Autowired private BuildInfoService buildInfoService; @Autowired private CompanyService companyService; @Autowired private GroupService groupService; @Autowired private UserGroupService userGroupService; @Autowired private UserService userService; @Autowired private ProjectApplicationDao projectApplicationDao; @Autowired private ProjectDao projectDao; @Autowired private ApprovalDao approvalDao; @Autowired private DepartmentService departmentService; @Autowired private DictionaryItemService dictionaryItemService; @Autowired private ApprovalService approvalService; @Autowired private ProjectMaterialDao projectMaterialDao; @Autowired private ProjectMaterialService projectMaterialDaoService; @Autowired private AttachmentService attachmentService; @Autowired private ProjectTypeService projectTypeService; @Autowired private CompanyContactService companyContactService; @Autowired private ProjectApplicationCompanyInfoService projectApplicationCompanyInfoService; @Autowired private ProjectApplicationService projectApplicationService; @Autowired private WaitToDoService waitToDoService; @Autowired private ProjectFillingService projectFillingService; @Autowired private ProjectFillingDao projectFillingDao; public PageInfo findPageInfo(String projectName, String projectType, String projectSource, Integer pageNum, Integer pagesize) { PageHelper.startPage(pageNum, pagesize); List list = projectFillingDeclarationDao.findPageInfo(projectName, projectType, projectSource); List projectTypeList = dictionaryItemService.findListByTypeName(Constant.DictionaryType.PROJECT_SERVICE_SUPER_TYPE); for (DictionaryItem dictionaryItem : projectTypeList) { for (ProjectFillingDeclaration projectFillingDeclaration : list) { if (Objects.equals(dictionaryItem.getValue(), projectFillingDeclaration.getProject_type())) { projectFillingDeclaration.setProject_type_name(dictionaryItem.getName()); } if (StringUtils.isNotBlank(projectFillingDeclaration.getProject_service_type())) { String name = projectServiceTypeService.findById(projectFillingDeclaration.getProject_service_type()).get(0).getService_type_name(); projectFillingDeclaration.setProject_service_type_name(name); } String companyIds = projectFillingDeclaration.getPush_company_ids(); if (StringUtils.isNotBlank(companyIds)) { String[] companyIdsArr = companyIds.split(","); projectFillingDeclaration.setTotal(companyIdsArr.length); } else { projectFillingDeclaration.setTotal(0); } projectFillingDeclaration.setCount(projectFillingService.getQuantityByDeclarationId(projectFillingDeclaration.getId().toString())); } } return new PageInfo(list); } public Integer save(ProjectFillingDeclaration projectDeclaration) { if (StringUtils.isNotBlank(projectDeclaration.getProject_service_type())) { String name = projectServiceTypeService.findById(projectDeclaration.getProject_service_type()).get(0).getService_type_name(); String year = projectDeclaration.getYear(); String jy = projectDeclaration.getSeason_or_month(); String projectNames = ""; if (StringUtils.isNotBlank(year)) { projectNames += year + "年"; } if (StringUtils.isNotBlank(jy)) { if (Objects.equals("J", jy)) { projectNames += "第" + projectDeclaration.getSeason() + "季度"; } else if (Objects.equals("Y", jy)) { projectNames += "第" + projectDeclaration.getMonth() + "月度"; } } projectNames += name; projectDeclaration.setProject_name(projectNames); } this.insertAndGetId(projectDeclaration); Integer activityId = projectDeclaration.getId(); attachmentDao.deleteByBusiness(Constant.Attachment.PROJECT_FILLING_DEC, projectDeclaration.getId()); attachmentDao.updateAttachment(Constant.Attachment.PROJECT_FILLING_DEC, projectDeclaration.getId(), projectDeclaration.getFileDown().getFile_id()); if ("1".equals(projectDeclaration.getStatus())) { pushNotices(projectDeclaration); //TODO 初始化企业填报数据 initFillingData(projectDeclaration); } /*if (projectDeclaration.getStatus().equals(Constant.ProjectDeclarationStatus.RELEASE)) { //所有企业 List companies = companyService.findCompanyList(); String companyids = ""; for (Company company : companies) { companyids += company.getId() + ","; } //所有街道 List streets = streetService.findList(); String streetids = ""; for (Street street : streets) { streetids += street.getId() + ","; } //中心窗口 StringBuffer governmentids = new StringBuffer(""); Group group = groupService.findByName(Constant.XMSBCLSLZ, null); if (null == group) { throw new BaseException("操作失败,项目申报审核组没有该项目责任单位的审核人员,请联系管理员配置"); } List userGroups = userGroupService.findByGroupId(group.getId()); for (UserGroup userGroup : userGroups) { governmentids.append(userGroup.getUser_id() + ","); } //处室 group = groupService.findByName(Constant.XMSBCLSHZ, null); if (null == group) { throw new BaseException("操作失败,项目申报审核组没有该项目责任单位的审核人员,请联系管理员配置"); } userGroups = userGroupService.findByGroupId(group.getId()); for (UserGroup userGroup : userGroups) { governmentids.append(userGroup.getUser_id() + ","); } //财政 group = groupService.findByName(Constant.XMSBCZSHZ, null); if (null == group) { throw new BaseException("操作失败,项目申报审核组没有该项目责任单位的审核人员,请联系管理员配置"); } userGroups = userGroupService.findByGroupId(group.getId()); for (UserGroup userGroup : userGroups) { governmentids.append(userGroup.getUser_id() + ","); } Message messages = new Message(); messages.setApply_id(activityId); messages.setTitle("项目申报发布通知"); String projectName = projectDeclaration.getProject_name(); String message = "您好,“" + projectName + "项目”可以进行申报。谢谢。"; messages.setContent(message); messages.setBusiness_type(Constant.Message_Business_type.PROJECT_APPLY); if (!StringUtils.isEmpty(streetids)) { String[] streetArr = streetids.split(","); Set set = new HashSet<>(); for (int i = 0; i < streetArr.length; i++) { set.add(streetArr[i]); } String[] streetArrs = (String[]) set.toArray(new String[set.size()]); int[] streetArrInt = new int[streetArrs.length]; for (int i = 0; i < streetArrs.length; i++) { streetArrInt[i] = Integer.parseInt(streetArrs[i]); } messageService.saveMessageAndPush(messages, streetArrInt, Constant.UserType.STREET); } if (!StringUtils.isEmpty(companyids)) { String[] companyArr = companyids.split(","); Set set = new HashSet<>(); for (int i = 0; i < companyArr.length; i++) { set.add(companyArr[i]); } String[] companyArrs = (String[]) set.toArray(new String[set.size()]); int[] companyArrInt = new int[companyArrs.length]; for (int i = 0; i < companyArrs.length; i++) { companyArrInt[i] = Integer.parseInt(companyArrs[i]); } messageService.saveMessageAndPush(messages, companyArrInt, Constant.UserType.COMPANY); } if (!StringUtils.isEmpty(governmentids.toString())) { String[] governmentArr = governmentids.toString().split(","); Set set = new HashSet<>(); for (int i = 0; i < governmentArr.length; i++) { set.add(governmentArr[i]); } String[] governmentArrs = (String[]) set.toArray(new String[set.size()]); int[] governmentArrInt = new int[governmentArrs.length]; for (int i = 0; i < governmentArrs.length; i++) { governmentArrInt[i] = Integer.parseInt(governmentArrs[i]); } messageService.saveMessageAndPush(messages, governmentArrInt, Constant.UserType.GOVERNMENT); } }*/ return activityId; } //初始化空的企业填报数据 public void initFillingData(ProjectFillingDeclaration projectDeclaration) { String companyIds = projectDeclaration.getNew_push_company_ids(); if (StringUtils.isNotBlank(companyIds)) { String[] companyIdsArr = companyIds.split(","); if (companyIdsArr.length > 0) { for (String id : companyIdsArr) { ProjectFilling filling = new ProjectFilling(); filling.setCompany_id(Integer.valueOf(id)); filling.setDeclaration_id(projectDeclaration.getId()); filling.setApply_status(Constant.ProjectFillingStatus_Company.PENDING_SUBMIT); projectFillingService.saveSelective(filling); } } } } public Integer update(ProjectFillingDeclaration projectDeclaration) { if (StringUtils.isNotBlank(projectDeclaration.getProject_service_type())) { String name = projectServiceTypeService.findById(projectDeclaration.getProject_service_type()).get(0).getService_type_name(); String year = projectDeclaration.getYear(); String jy = projectDeclaration.getSeason_or_month(); String projectNames = ""; if (StringUtils.isNotBlank(year)) { projectNames += year + "年"; } if (StringUtils.isNotBlank(jy)) { if (Objects.equals("J", jy)) { projectNames += "第" + projectDeclaration.getSeason() + "季度"; } else if (Objects.equals("Y", jy)) { projectNames += "第" + projectDeclaration.getMonth() + "月度"; } } projectNames += name; projectDeclaration.setProject_name(projectNames); } this.updateSelective(projectDeclaration); Integer activityId = projectDeclaration.getId(); // List attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.PROJECT_FILLING_DEC, projectDeclaration.getId(), null); // if (null != attachments && attachments.size() > 0) { // FileDown fileDown = new FileDown(attachments.get(0).getId(), attachments.get(0).getFile_name(), attachments.get(0).getFile_url(), attachments.get(0).getDownload_uri()); // if (!fileDown.getFile_id().equals(projectDeclaration.getFileDown().getFile_id())) { attachmentDao.deleteByBusiness(Constant.Attachment.PROJECT_FILLING_DEC, projectDeclaration.getId()); attachmentDao.updateAttachment(Constant.Attachment.PROJECT_FILLING_DEC, projectDeclaration.getId(), projectDeclaration.getFileDown().getFile_id()); // } // } if ("1".equals(projectDeclaration.getStatus())) { pushNotices(projectDeclaration); initFillingData(projectDeclaration); } return activityId; } @Transactional public void pushNotices(ProjectFillingDeclaration projectDeclaration) { if (null != projectDeclaration.getNew_push_company_ids()) { try { updatePushDetails(projectDeclaration, projectDeclaration.getNew_push_street_ids(), projectDeclaration.getNew_push_build_ids(), projectDeclaration.getNew_push_company_ids()); } catch (Exception e) { e.printStackTrace(); } String company_ids = projectDeclaration.getNew_push_company_ids(); projectDeclaration.setPush_company_ids(company_ids); } if (Objects.equals(projectDeclaration.getStatus(), "1") && projectDeclaration.getPush_company_ids() != null && !projectDeclaration.getPush_company_ids().isEmpty()) { Notices notice = new Notices(); if (Objects.equals(projectDeclaration.getApp_notice(), "1")) { notice.setNotice_type(Constant.NOTICE_TYPE.APP); if (Objects.equals(projectDeclaration.getMes_notice(), "1")) { notice.setNotice_type(Constant.NOTICE_TYPE.APP_MSG); } } else { if (Objects.equals(projectDeclaration.getMes_notice(), "1")) { notice.setNotice_type(Constant.NOTICE_TYPE.MSG); } } notice.setMessage_content(""); notice.setRecorde_id(projectDeclaration.getId().toString()); noticesService.insertAndGetId(notice); Integer noticesId = notice.getId(); String companyIds = projectDeclaration.getPush_company_ids(); String[] companyIdsArr = companyIds.split(","); List ids = new ArrayList(); if (companyIdsArr.length > 0) { for (String id : companyIdsArr) { NoticesAccept noticesAccept = new NoticesAccept(); noticesAccept.setNotice_id(noticesId); noticesAccept.setRead_statu(0); noticesAccept.setUser_type(Constant.UserType.COMPANY); noticesAccept.setRecorde_type(2); noticesAccept.setRecorde_id(projectDeclaration.getId()); noticesAccept.setUser_id(Integer.parseInt(id)); noticesAccept.setUser_type(3); noticesAcceptService.insertAndGetId(noticesAccept); //发送短信通知 User companyAdmin = userService.findCompanyAdmin(Integer.parseInt(id)); Map params = new HashMap<>(); params.put("project_no", projectDeclaration.getProject_name()); params.put("start_time", projectDeclaration.getApply_startdate()); params.put("end_time", projectDeclaration.getApply_enddate()); String tempalteCode = Constant.SMS_TemplateCode.REMIND_COMPANY_APPLY_PROJECT; try { AlibabaSMSUtil.sendSMS( companyAdmin.getPhone(), tempalteCode, Constant.SINGNAMW, JSONObject.toJSONString(params)); } catch (ClientException | InterruptedException e) { e.printStackTrace(); } } } } } /** * 更新通知推送单位 */ public Boolean updatePushDetails(ProjectFillingDeclaration projectDeclaration, String street_ids, String build_ids, String company_ids) throws Exception { String alreadyPushStreets = projectDeclaration.getPush_street_ids() == null ? "" : projectDeclaration.getPush_street_ids(); String alreadyPushBuilds = projectDeclaration.getPush_build_ids() == null ? "" : projectDeclaration.getPush_build_ids(); String alreadyPushCompanys = projectDeclaration.getPush_company_ids() == null ? "" : projectDeclaration.getPush_company_ids(); if (StringUtils.isNotBlank(street_ids)) { String[] idsArr = street_ids.split(","); if (idsArr.length > 0) { for (int i = 0; i < idsArr.length; i++) { if (!alreadyPushStreets.contains(idsArr[i])) { if (StringUtils.isBlank(alreadyPushStreets)) { alreadyPushStreets += idsArr[i]; } else { alreadyPushStreets += "," + idsArr[i]; } } } } else { alreadyPushStreets = street_ids; } } if (StringUtils.isNotBlank(build_ids)) { String[] idsArr = build_ids.split(","); if (idsArr.length > 0) { for (int i = 0; i < idsArr.length; i++) { if (!alreadyPushBuilds.contains(idsArr[i])) { if (StringUtils.isBlank(alreadyPushBuilds)) { alreadyPushBuilds += idsArr[i]; } else { alreadyPushBuilds += "," + idsArr[i]; } } } } else { alreadyPushBuilds = build_ids; } } if (StringUtils.isNotBlank(company_ids)) { String[] idsArr = company_ids.split(","); if (idsArr.length > 0) { for (int i = 0; i < idsArr.length; i++) { if (!alreadyPushCompanys.contains(idsArr[i])) { if (StringUtils.isBlank(alreadyPushCompanys)) { alreadyPushCompanys += idsArr[i]; } else { alreadyPushCompanys += "," + idsArr[i]; } } } } else { alreadyPushCompanys = company_ids; } } projectDeclaration.setPush_street_ids(alreadyPushStreets.substring(0, alreadyPushStreets.length())); projectDeclaration.setPush_build_ids(alreadyPushBuilds.substring(0, alreadyPushBuilds.length())); projectDeclaration.setPush_company_ids(alreadyPushCompanys.substring(0, alreadyPushCompanys.length())); return this.updateSelective(projectDeclaration) > 0; } /** * 批量修改启用禁用状态 * * @param idList */ public void updateForbiddenStateBatch(List idList, ProjectFillingDeclaration projectFillingDeclaration) { projectFillingDeclarationDao.updateForbiddenStateBatch(idList, projectFillingDeclaration); } public ProjectFillingDeclaration selectById(String id) { ProjectFillingDeclaration projectDeclaration = projectFillingDeclarationDao.selectById(id); //责任单位 if (null != projectDeclaration.getDepartment_id()) { Department dept = departmentService.findById(projectDeclaration.getDepartment_id()); if (null != dept) { projectDeclaration.setDepartment_name(dept.getName()); } } //项目大类 String superType = projectDeclaration.getProject_type(); if (StringUtils.isNotBlank(superType)) { DictionaryItem superTypeItem = dictionaryItemService.findByTypeAndValue(Constant.DictionaryType.PROJECT_SERVICE_SUPER_TYPE, superType); if (null != superTypeItem) { projectDeclaration.setProject_type_name(superTypeItem.getName()); } } //服务事项 String serviceType = projectDeclaration.getProject_service_type(); if (StringUtils.isNotBlank(serviceType)) { List projectServiceTypeList = projectServiceTypeService.findById(serviceType); if (!CollectionUtils.isEmpty(projectServiceTypeList)) { projectDeclaration.setProject_service_type_name(projectServiceTypeList.get(0).getService_type_name()); } } //项目来源 String source = projectDeclaration.getProject_source(); if (StringUtils.isNotBlank(source)) { DictionaryItem sourceItem = dictionaryItemService.findByTypeAndValue(Constant.DictionaryType.PROJECT_SOURCE, source); if (null != sourceItem) { projectDeclaration.setProject_source_name(sourceItem.getName()); } } //文件 List attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.PROJECT_FILLING_DEC, projectDeclaration.getId(), null); if (null != attachments && attachments.size() > 0) { FileDown fileDown = new FileDown(attachments.get(0).getId(), attachments.get(0).getFile_name(), attachments.get(0).getFile_url(), attachments.get(0).getDownload_uri()); projectDeclaration.setFileDown(fileDown); } String companyIds = projectDeclaration.getPush_company_ids(); String[] companyIdsArr = companyIds.split(","); projectDeclaration.setTotal(companyIdsArr.length); projectDeclaration.setCount(projectFillingService.getQuantityByDeclarationId(projectDeclaration.getId().toString())); try { projectDeclaration = getPushNames(projectDeclaration); } catch (Exception e) { e.printStackTrace(); } return projectDeclaration; } //查询推送单位名称 public ProjectFillingDeclaration getPushNames(ProjectFillingDeclaration projectDeclaration) throws Exception { String pushNames = ""; if (StringUtils.isNotBlank(projectDeclaration.getPush_street_ids())) { List streetNames = new ArrayList(); String[] streetIds = projectDeclaration.getPush_street_ids().split(","); for (int i = 0; i < streetIds.length; i++) { String name = streetService.getStreetName(Integer.valueOf(streetIds[i])); streetNames.add(name); } projectDeclaration.setPush_street_names(String.join(",", streetNames)); pushNames += String.join(",", streetNames); } if (StringUtils.isNotBlank(projectDeclaration.getPush_build_ids())) { List buildNames = new ArrayList(); String[] buildIds = projectDeclaration.getPush_build_ids().split(","); for (int i = 0; i < buildIds.length; i++) { String name = buildInfoService.getBuildName(Integer.valueOf(buildIds[i])); buildNames.add(name); } projectDeclaration.setPush_build_names(String.join(",", buildNames)); pushNames += " ; " + String.join(",", buildNames); } if (StringUtils.isNotBlank(projectDeclaration.getPush_company_ids())) { List companyNames = new ArrayList(); String[] companyIds = projectDeclaration.getPush_company_ids().split(","); for (int i = 0; i < companyIds.length; i++) { if (StringUtils.isNotEmpty(companyIds[i])){ String name = companyService.getCompanyName(Integer.valueOf(companyIds[i])); companyNames.add(name); } } projectDeclaration.setPush_company_names(String.join(",", companyNames)); pushNames += " ; " + String.join(",", companyNames); } projectDeclaration.setPush_names(pushNames); return projectDeclaration; } public PageInfo findPage(Integer pageNum, Integer pageSize, ParamApplication paramApplication, String type) { paramApplication.setApproval_type(Constant.DictionaryType.PROJECT_FILLING); if (Objects.equals("1", type)) { //待审批 //paramApplication.setProjectIds(getProjectIdsd()); paramApplication.setProjectIds(getProjectIdsByGroup()); } else if (Objects.equals("2", type)) { //已审批 paramApplication.setProjectIds(getProjectIdsy()); } PageHelper.startPage(pageNum, pageSize); List applicationDtoList = projectFillingDao.findPage(paramApplication); for (ProjectFillingDto app : applicationDtoList) { if (null != app.getProject_type()) { //ProjectType projectType = projectTypeService.findById(Integer.parseInt(app.getProject_type())); String type_name = dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.PROJECT_SERVICE_SUPER_TYPE, app.getProject_type()); app.setProject_type_desc(type_name); } if (null != app.getProject_service_type()) { String name = projectServiceTypeService.findById(Integer.parseInt(app.getProject_service_type())).getService_type_name(); app.setProject_service_type_desc(name); } if (null != app.getApprove_status()) { String status_name = dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.PROJECT_FILLING_APPROVE_STATUS, app.getApprove_status()); app.setApprove_status_desc(status_name); } } return new PageInfo(applicationDtoList); } //根据用户组获取可查询到的项目 public List getProjectIdsByGroup() { List projectLists = new ArrayList<>(); Integer user_id = ShiroUtils.getUserId(); Group group = null; List userGroups = null; List apply_status_list = new ArrayList<>(); //中心 group = groupService.findByName(Constant.XMTBCLSHZ, null); userGroups = userGroupService.findByGroupId(group.getId()); for (UserGroup userGroup : userGroups) { if (Objects.equals(userGroup.getUser_id(), user_id)) { apply_status_list.add(Constant.ProjectFillingStatus.E_DOC_AUDIT); break; } } if (apply_status_list.size() <= 0) { apply_status_list.add(""); } projectLists.addAll(projectFillingDao.findByProjectIdAndApproveStatus(apply_status_list)); List result = new ArrayList<>(); for (ProjectFilling project : projectLists) { result.add(project.getId().toString()); } return result; } //获取项目申报id 待审批 public List getProjectIdsd() { int currentUserId = ShiroUtils.getUserId(); List approvalList = approvalDao.selectAllApprovalDistinct(Constant.DictionaryType.PROJECT_FILLING); Set projectApplicationIds = new HashSet(); if (Objects.equals(ShiroUtils.getUserType(), Constant.UserType.GOVERNMENT)) { if (!CollectionUtils.isEmpty(approvalList)) { for (Approval approval : approvalList) { String nextCheckerIds = approval.getNextchecker(); if (nextCheckerIds != null && nextCheckerIds != "") { String[] userIdArr = nextCheckerIds.split(","); List list = Arrays.asList(userIdArr); if (list.contains(String.valueOf(currentUserId))) { projectApplicationIds.add(approval.getApply_id().toString()); } } } } } List result = new ArrayList<>(projectApplicationIds); return result; } //获取项目申报id 已审批 public List getProjectIdsy() { int currentUserId = ShiroUtils.getUserId(); List approvalList = approvalDao.selectAllApproval(Constant.DictionaryType.PROJECT_FILLING); Set projectApplicationIds = new HashSet(); if (Objects.equals(ShiroUtils.getUserType(), Constant.UserType.GOVERNMENT)) { if (!CollectionUtils.isEmpty(approvalList)) { for (Approval approval : approvalList) { String checkerIds = approval.getChecker() + ""; if (checkerIds != null && checkerIds != "") { if (Objects.equals(checkerIds, String.valueOf(currentUserId))) { projectApplicationIds.add(approval.getApply_id().toString()); } } } } } List result = new ArrayList<>(projectApplicationIds); return result; } //通过 public Boolean pass(Integer projectId, String comment) { // Approval approval = approvalDao.getLatestApproval(projectId, Constant.DictionaryType.PROJECT_FILLING); Approval a = new Approval(); a.setApply_id(projectId); a.setType(Constant.DictionaryType.PROJECT_FILLING); if (null != userService.getUser(ShiroUtils.getUserId()).getDepartment_id()) { String departmentname = departmentService.selectById(userService.getUser(ShiroUtils.getUserId()).getDepartment_id()).getName(); a.setDepartment(departmentname); } a.setApproval_comment(comment); a.setChecker(ShiroUtils.getUserId()); a.setOper_type(Constant.OperType.APPROVED); a.setDeal_time(DateUtil.getTimeString(new Date())); a.setBefore_approvalstatus(Constant.ProjectFillingStatus.E_DOC_AUDIT); a.setAfter_approvalstatus(Constant.ProjectFillingStatus.APPROVED); ProjectFilling projectApplication = projectFillingDao.findApplyById(projectId); ProjectFilling pa = projectFillingService.findById(projectId); pa.setApply_status(Constant.ProjectFillingStatus_Company.APPROVED); pa.setApprove_status(Constant.ProjectFillingStatus.APPROVED); projectFillingDao.updateByPrimaryKeySelective(pa); approvalService.insertAndGetId(a); ProjectFillingDeclaration projectDeclaration = this.findById(projectApplication.getDeclaration_id()); String projectName = projectDeclaration.getProject_name(); Company company = companyService.findById(projectApplication.getCompany_id()); Message messages = new Message(); messages.setApply_id(projectApplication.getId()); messages.setBusiness_type(Constant.Message_Business_type.PROJECT_FILING_APPLY); messages.setTitle("提醒企业"); String message = company.getCompany_name() + ",您好。您提交的" + projectName + "报表填报,已审批通过"; messages.setContent(message); int[] streetArrInt = new int[1]; streetArrInt[0] = projectApplication.getCompany_id(); messageService.saveMessageAndPush(messages, streetArrInt, Constant.UserType.COMPANY); // List users = userService.findUsersByCompanyId(projectApplication.getCompany_id()); User user = userService.findCompanyAdmin(projectApplication.getCompany_id()); waitToDoService.completeAllTODO(projectApplication.getId(), Constant.DictionaryType.PROJECT_FILLING); // for (User user : users) { waitToDoService.newTODO("报表填报查看", "/company/projectFilling/check/" + projectApplication.getId(), Constant.WaitToDo_OperType.CONFIRM_AND_NOTIFY, projectApplication.getId(), Constant.DictionaryType.PROJECT_FILLING, projectApplication.getApply_no(), user.getId().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false); // } //发送短信 Map params = new HashMap<>(); params.put("project_no", projectApplication.getApply_no()); params.put("apply_name", Constant.ProjectType.PROJECT_FILLING); String templateCode = Constant.SMS_TemplateCode.RPOJECT_FILLING_AUDIT; try { AlibabaSMSUtil.sendSMS( user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)); } catch (ClientException | InterruptedException e) { e.printStackTrace(); } return true; // if (Objects.equals(Constant.ProjectFillingStatus.E_DOC_AUDIT, approval.getAfter_approvalstatus())) { // //电子档通过,通知提交纸质档 // a.setBefore_approvalstatus(Constant.ProjectFillingStatus.E_DOC_AUDIT); // a.setAfter_approvalstatus(Constant.ProjectFillingStatus.P_DOC_AUDIT); // // Group group = groupService.findByName(Constant.XMTBCLSLZ, null); // if (null == group) { // throw new BaseException("操作失败,项目申报材料受理组没有该项目责任单位的审核人员,请联系管理员配置"); // } // List userGroups = userGroupService.findByGroupId(group.getId()); // ProjectFillingDeclaration projectFillingDeclaration = this.selectById(projectApplication.getDeclaration_id().toString()); // //List users = userService.findUserBydepartmentIdWithoutApprovalLevel(projectFillingDeclaration.getDepartment_id().toString()); // List users = userService.findListByWhere(new User()); // StringBuffer sb = new StringBuffer(""); // Company company = companyService.findById(projectApplication.getCompany_id()); // String projectName = projectFillingDeclaration.getProject_name(); // Message messages = new Message(); // messages.setApply_id(projectId); // messages.setBusiness_type(Constant.Message_Business_type.PROJECT_FILING_APPLY); // messages.setTitle("提醒中心审核"); // // waitToDoService.completeAllTODO(projectApplication.getId(), Constant.DictionaryType.PROJECT_FILLING); // for (UserGroup userGroup : userGroups) { // for (User user : users) { // if (Objects.equals(user.getId(), userGroup.getUser_id())) { // sb.append(userGroup.getUser_id() + ","); // String message = user.getUser_name() + ",您好。“" + company.getCompany_name() + "企业”的“" + projectName + "项目”申请需要您审核。谢谢。"; // messages.setContent(message); // int[] streetArrInt = new int[1]; // streetArrInt[0] = userGroup.getUser_id(); // messageService.saveMessageAndPush(messages, streetArrInt, Constant.UserType.GOVERNMENT); // waitToDoService.newTODO("项目填报审核", "/projectFilling/approve/" + projectApplication.getId(), Constant.WaitToDo_OperType.AUDIT, projectApplication.getId(), // Constant.DictionaryType.PROJECT_FILLING, projectApplication.getApply_no(), userGroup.getUser_id().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false); // } // } // } // a.setNextchecker(sb.toString()); // if (null == sb || sb.length() == 0) { // throw new BaseException("操作失败,项目申报材料审核组没有该项目责任单位的审核人员,请联系管理员配置"); // } // ProjectFilling pa = new ProjectFilling(); // pa.setId(projectId); // pa.setApprove_status(Constant.ProjectFillingStatus.P_DOC_AUDIT); // projectFillingDao.updateByPrimaryKeySelective(pa); // approvalService.insertAndGetId(a); // return true; // // } else if (Objects.equals(Constant.ProjectFillingStatus.P_DOC_AUDIT, approval.getAfter_approvalstatus())) { // //纸质档通过,进入处室 待留档确认 // // a.setBefore_approvalstatus(Constant.ProjectFillingStatus.P_DOC_AUDIT); // a.setAfter_approvalstatus(Constant.ProjectFillingStatus.FILE_CONFIRMATION); // // Group group = groupService.findByName(Constant.XMTBCLSHZ, null); // if (null == group) { // throw new BaseException("操作失败,项目申报材料受理组没有该项目责任单位的审核人员,请联系管理员配置"); // } // List userGroups = userGroupService.findByGroupId(group.getId()); // ProjectFillingDeclaration projectFillingDeclaration = this.selectById(projectApplication.getDeclaration_id().toString()); // List users = userService.findUserBydepartmentIdWithoutApprovalLevel(projectFillingDeclaration.getDepartment_id().toString()); // //List users = userService.findListByWhere(new User()); // StringBuffer sb = new StringBuffer(""); // Company company = companyService.findById(projectApplication.getCompany_id()); // String projectName = projectFillingDeclaration.getProject_name(); // Message messages = new Message(); // messages.setApply_id(projectId); // messages.setBusiness_type(Constant.Message_Business_type.PROJECT_FILING_APPLY); // messages.setTitle("提醒处室审核"); // // waitToDoService.completeAllTODO(projectApplication.getId(), Constant.DictionaryType.PROJECT_FILLING); // for (UserGroup userGroup : userGroups) { // for (User user : users) { // if (Objects.equals(user.getId(), userGroup.getUser_id())) { // sb.append(userGroup.getUser_id() + ","); // String message = user.getUser_name() + ",您好。“" + company.getCompany_name() + "企业”的“" + projectName + "项目”申请需要您审核。谢谢。"; // messages.setContent(message); // int[] streetArrInt = new int[1]; // streetArrInt[0] = userGroup.getUser_id(); // messageService.saveMessageAndPush(messages, streetArrInt, Constant.UserType.GOVERNMENT); // waitToDoService.newTODO("项目填报审核", "/projectFilling/approve/" + projectApplication.getId(), Constant.WaitToDo_OperType.AUDIT, projectApplication.getId(), // Constant.DictionaryType.PROJECT_FILLING, projectApplication.getApply_no(), userGroup.getUser_id().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false); // } // } // } // a.setNextchecker(sb.toString()); // if (null == sb || sb.length() == 0) { // throw new BaseException("操作失败,项目申报材料审核组没有该项目责任单位的审核人员,请联系管理员配置"); // } // ProjectFilling pa = new ProjectFilling(); // pa.setId(projectId); // pa.setApprove_status(Constant.ProjectFillingStatus.FILE_CONFIRMATION); // projectFillingDao.updateByPrimaryKeySelective(pa); // approvalService.insertAndGetId(a); // return true; // // } else if (Objects.equals(Constant.ProjectFillingStatus.FILE_CONFIRMATION, approval.getAfter_approvalstatus())) { // // 留档确认 留档完成 // // a.setBefore_approvalstatus(Constant.ProjectFillingStatus.FILE_CONFIRMATION); // a.setAfter_approvalstatus(Constant.ProjectFillingStatus.FILE_COMPLETION); // // ProjectFilling pa = new ProjectFilling(); // pa.setId(projectId); // pa.setApply_status(Constant.ProjectFillingStatus_Company.APPROVED); // pa.setApprove_status(Constant.ProjectFillingStatus.FILE_COMPLETION); // projectFillingDao.updateByPrimaryKeySelective(pa); // approvalService.insertAndGetId(a); // return true; // // } else if (Objects.equals(Constant.ProjectFillingStatus.WAITING_FOR_CONFIRM, approval.getAfter_approvalstatus())) { // //报表填报 待确定 通过 变为 已通过 // // a.setBefore_approvalstatus(Constant.ProjectFillingStatus.WAITING_FOR_CONFIRM); // a.setAfter_approvalstatus(Constant.ProjectFillingStatus.CONFIRMED); // // ProjectFilling pa = new ProjectFilling(); // pa.setId(projectId); // pa.setApply_status(Constant.ProjectFillingStatus_Company.CONFIRMED); // pa.setApprove_status(Constant.ProjectFillingStatus.CONFIRMED); // projectFillingDao.updateByPrimaryKeySelective(pa); // approvalService.insertAndGetId(a); // return true; // // } // return false; } //退回 public boolean untread(Integer projectId, String comment) { Approval approval = approvalDao.getLatestApproval(projectId, Constant.DictionaryType.PROJECT_FILLING); Approval a = new Approval(); a.setApply_id(projectId); a.setType(Constant.DictionaryType.PROJECT_FILLING); String departmentname = departmentService.selectById(userService.getUser(ShiroUtils.getUserId()).getDepartment_id()).getName(); a.setDepartment(departmentname); a.setApproval_comment(comment); a.setChecker(ShiroUtils.getUserId()); a.setOper_type(Constant.OperType.REJECT); a.setDeal_time(DateUtil.getTimeString(new Date())); ProjectFilling projectApplication = projectFillingDao.findApplyById(projectId); //项目填报退回 退回至企业 a.setBefore_approvalstatus(Constant.ProjectFillingStatus.E_DOC_AUDIT); a.setAfter_approvalstatus(Constant.ProjectFillingStatus.REJECT); ProjectFilling pa = projectFillingService.findById(projectId); pa.setApply_status(Constant.ProjectFillingStatus_Company.REJECT); pa.setApprove_status(Constant.ProjectFillingStatus.REJECT); projectFillingDao.updateByPrimaryKeySelective(pa); approvalService.insertAndGetId(a); ProjectFillingDeclaration projectDeclaration = this.findById(projectApplication.getDeclaration_id()); String projectName = projectDeclaration.getProject_name(); Company company = companyService.findById(projectApplication.getCompany_id()); Message messages = new Message(); messages.setApply_id(projectApplication.getId()); messages.setBusiness_type(Constant.Message_Business_type.PROJECT_FILING_APPLY); messages.setTitle("提醒企业"); String message = company.getCompany_name() + ",您好。您提交的" + projectName + "报表填报,请修改后重新提交,谢谢。退回原因:" + comment; messages.setContent(message); int[] streetArrInt = new int[1]; streetArrInt[0] = projectApplication.getCompany_id(); messageService.saveMessageAndPush(messages, streetArrInt, Constant.UserType.COMPANY); List users = userService.findUsersByCompanyId(projectApplication.getCompany_id()); waitToDoService.completeAllTODO(projectApplication.getId(), Constant.DictionaryType.PROJECT_FILLING); for (User user : users) { waitToDoService.newTODO("项目申报编辑", "/company/projectFilling/edit/" + projectApplication.getId(), Constant.WaitToDo_OperType.EDIT, projectApplication.getId(), Constant.DictionaryType.PROJECT_FILLING, projectApplication.getApply_no(), user.getId().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false); } //发送短信 Map params = new HashMap<>(); params.put("project_no", projectApplication.getApply_no()); params.put("apply_name", Constant.ProjectType.PROJECT_FILLING); String templateCode = Constant.SMS_TemplateCode.RPOJECT_FILLING_REJECT; User user = userService.findCompanyAdmin(company.getId()); try { AlibabaSMSUtil.sendSMS( user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)); } catch (ClientException | InterruptedException e) { e.printStackTrace(); } return true; // if (Objects.equals(Constant.ProjectFillingStatus.E_DOC_AUDIT, approval.getAfter_approvalstatus())) { // //电子档退回 // // a.setBefore_approvalstatus(Constant.ProjectFillingStatus.E_DOC_AUDIT); // a.setAfter_approvalstatus(Constant.ProjectFillingStatus.REJECT_TO_COMPANY); // a.setNextchecker(projectApplication.getCreate_by().toString()); // ProjectFilling p = new ProjectFilling(); // p.setId(projectId); // p.setApply_status(Constant.ProjectFillingStatus_Company.REJECT); // p.setApprove_status(Constant.ProjectFillingStatus.REJECT_TO_COMPANY); // projectFillingDao.updateByPrimaryKeySelective(p); // approvalService.insertAndGetId(a); // // ProjectFillingDeclaration projectDeclaration = this.findById(projectApplication.getDeclaration_id()); // String projectName = projectDeclaration.getProject_name(); // Company company = companyService.findById(projectApplication.getCompany_id()); // // Message messages = new Message(); // messages.setApply_id(projectApplication.getId()); // messages.setBusiness_type(Constant.Message_Business_type.PROJECT_FILING_APPLY); // messages.setTitle("提醒企业"); // String message = company.getCompany_name() + ",您好。您提交的" + projectName + "项目申报,请修改后重新提交,谢谢。退回原因:" + comment; // messages.setContent(message); // int[] streetArrInt = new int[1]; // streetArrInt[0] = projectApplication.getCompany_id(); // messageService.saveMessageAndPush(messages, streetArrInt, Constant.UserType.COMPANY); // // List users = userService.findUsersByCompanyId(projectApplication.getCompany_id()); // waitToDoService.completeAllTODO(projectApplication.getId(), Constant.DictionaryType.PROJECT_APPLICATION); // for (User user : users) { // waitToDoService.newTODO("项目申报编辑", "/company/projectFilling/edit/" + projectApplication.getId(), Constant.WaitToDo_OperType.EDIT, projectApplication.getId(), // Constant.DictionaryType.PROJECT_APPLICATION, projectApplication.getApply_no(), user.getId().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false); // } // return true; // // } else if (Objects.equals(Constant.ProjectFillingStatus.P_DOC_AUDIT, approval.getAfter_approvalstatus())) { // //纸质档退回 // // a.setBefore_approvalstatus(Constant.ProjectFillingStatus.P_DOC_AUDIT); // a.setAfter_approvalstatus(Constant.ProjectFillingStatus.REJECT_TO_COMPANY); // a.setNextchecker(projectApplication.getCreate_by().toString()); // ProjectFilling p = new ProjectFilling(); // p.setId(projectId); // p.setApply_status(Constant.ProjectFillingStatus_Company.REJECT); // p.setApprove_status(Constant.ProjectFillingStatus.REJECT_TO_COMPANY); // projectFillingDao.updateByPrimaryKeySelective(p); // approvalService.insertAndGetId(a); // // ProjectFillingDeclaration projectDeclaration = this.findById(projectApplication.getDeclaration_id()); // String projectName = projectDeclaration.getProject_name(); // Company company = companyService.findById(projectApplication.getCompany_id()); // // Message messages = new Message(); // messages.setApply_id(projectApplication.getId()); // messages.setBusiness_type(Constant.Message_Business_type.PROJECT_FILING_APPLY); // messages.setTitle("提醒企业"); // String message = company.getCompany_name() + ",您好。您提交的" + projectName + "项目申报,请修改后重新提交,谢谢。退回原因:" + comment; // messages.setContent(message); // int[] streetArrInt = new int[1]; // streetArrInt[0] = projectApplication.getCompany_id(); // messageService.saveMessageAndPush(messages, streetArrInt, Constant.UserType.COMPANY); // // List users = userService.findUsersByCompanyId(projectApplication.getCompany_id()); // waitToDoService.completeAllTODO(projectApplication.getId(), Constant.DictionaryType.PROJECT_APPLICATION); // for (User user : users) { // waitToDoService.newTODO("项目申报编辑", "/company/projectFilling/edit/" + projectApplication.getId(), Constant.WaitToDo_OperType.EDIT, projectApplication.getId(), // Constant.DictionaryType.PROJECT_APPLICATION, projectApplication.getApply_no(), user.getId().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false); // } // return true; // // } else if (Objects.equals(Constant.ProjectFillingStatus.FILE_CONFIRMATION, approval.getAfter_approvalstatus())) { // //待留档确认退回 退回至中心 // // a.setBefore_approvalstatus(Constant.ProjectFillingStatus.FILE_CONFIRMATION); // a.setAfter_approvalstatus(Constant.ProjectFillingStatus.REJECT); // Group group = groupService.findByName(Constant.XMTBCLSLZ, null); // List userGroups = userGroupService.findByGroupId(group.getId()); // //List users = userService.findUserBydepartmentIdWithoutApprovalLevel(departmentid.toString()); // List users = userService.findListByWhere(new User()); // StringBuffer sb = new StringBuffer(""); // ProjectFillingDeclaration projectDeclaration = this.findById(projectApplication.getDeclaration_id()); // String projectName = projectDeclaration.getProject_name(); // Company company = companyService.findById(projectApplication.getCompany_id()); // // Message messages = new Message(); // messages.setApply_id(projectApplication.getId()); // messages.setBusiness_type(Constant.Message_Business_type.PROJECT_FILING_APPLY); // messages.setTitle("提醒中心"); // waitToDoService.completeAllTODO(projectApplication.getId(), Constant.DictionaryType.PROJECT_FILLING); // for (UserGroup userGroup : userGroups) { // for (User user : users) { // if (Objects.equals(user.getId(), userGroup.getUser_id())) { // sb.append(userGroup.getUser_id() + ","); // String message = company.getCompany_name() + ",您好。您提交的" + projectName + ",项目返回修改请复审。谢谢。退回原因:" + comment; // messages.setContent(message); // int[] streetArrInt = new int[1]; // streetArrInt[0] = projectApplication.getCompany_id(); // messageService.saveMessageAndPush(messages, streetArrInt, Constant.UserType.GOVERNMENT); // // waitToDoService.newTODO("项目填报审核", "/projectDeclaration/approve/" + projectApplication.getId(), Constant.WaitToDo_OperType.EDIT, projectApplication.getId(), // Constant.DictionaryType.PROJECT_APPLICATION, projectApplication.getApply_no(), user.getId().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false); // } // } // } // a.setNextchecker(sb.toString()); // ProjectFilling p = new ProjectFilling(); // p.setId(projectId); // p.setApply_status(Constant.ProjectFillingStatus_Company.REJECT); // p.setApprove_status(Constant.ProjectFillingStatus.REJECT_TO_CENTER); // projectFillingDao.updateByPrimaryKeySelective(p); // approvalService.insertAndGetId(a); // // return true; // // } else if (Objects.equals(Constant.ProjectFillingStatus.REJECT, approval.getAfter_approvalstatus())) { // //项目申报退回 待通知 // // a.setBefore_approvalstatus(Constant.ProjectFillingStatus.REJECT); // a.setAfter_approvalstatus(Constant.ProjectFillingStatus.REJECT); // // ProjectFilling pa = new ProjectFilling(); // pa.setId(projectId); // pa.setApply_status(Constant.ProjectApplyStatus.REJECT); // pa.setApprove_status(Constant.ProjectFillingStatus.REJECT_TO_COMPANY); // projectFillingDao.updateByPrimaryKeySelective(pa); // approvalService.insertAndGetId(a); // return true; // // } else if (Objects.equals(Constant.ProjectFillingStatus.WAITING_FOR_CONFIRM, approval.getAfter_approvalstatus())) { // //项目填报退回 退回至企业 // // a.setBefore_approvalstatus(Constant.ProjectFillingStatus.REJECT); // a.setAfter_approvalstatus(Constant.ProjectFillingStatus.REJECT); // // ProjectFilling pa = new ProjectFilling(); // pa.setId(projectId); // pa.setApply_status(Constant.ProjectApplyStatus.REJECT); // pa.setApprove_status(Constant.ProjectFillingStatus.REJECT_TO_COMPANY); // projectFillingDao.updateByPrimaryKeySelective(pa); // approvalService.insertAndGetId(a); // return true; // // } // return false; } //发送短信 public Boolean sendProjectSMS(ProjectFilling projectApplication) throws ClientException, InterruptedException { if (null != projectApplication) { String departmentname = departmentService.selectById(userService.getUser(ShiroUtils.getUserId()).getDepartment_id()).getName(); String status = projectApplication.getApply_status(); String statusName = ""; if (status.equals(Constant.ProjectFillingStatus.NOTAPPROVED)) { statusName = Constant.OperType.NOTAPPROVED; } else if (status.equals(Constant.ProjectFillingStatus.APPROVED)) { statusName = Constant.OperType.APPROVED; } else if (status.equals(Constant.ProjectFillingStatus.REJECT)) { statusName = Constant.OperType.REJECT; } if (StringUtils.isNotBlank(statusName)) { return sendProjectSMSToCompany(departmentname, projectApplication, statusName); } } return false; } public Boolean sendProjectSMSToCompany(String departmentname, ProjectFilling projectApplication, String status) throws ClientException, InterruptedException { String phone = ""; CompanyContact contact = companyContactService.findFirstByCompanyId(projectApplication.getCompany_id()); ProjectApplicationCompanyInfo companyInfo = projectApplicationCompanyInfoService.findByApplyIdAndType(projectApplication.getId(), Constant.DictionaryType.PROJECT_APPLICATION); if (null != companyInfo && null != companyInfo.getContact_phone()) { phone = companyInfo.getContact_phone(); } else if (null != contact) { phone = contact.getPhone(); } if (StringUtils.isNotBlank(phone)) { //${department_name}提醒您,您申请的${project_name}单据已审核 ${approve_status}。具体信息请登录PC端查看。感谢您的支持。 ProjectFillingDeclaration projectDeclaration = this.findById(projectApplication.getDeclaration_id()); String project_name = projectDeclaration.getProject_name(); String templateParam = "{\"department_name\":\"" + departmentname + "\",\"project_name\":\"" + project_name + "\",\"approve_status\":\"" + status + "\"}"; AlibabaSMSUtil.sendSMS(phone, Constant.SMS_TemplateCode.PROJECT_APPLICATION_NOTIFY, "企业提升发展服务平台", templateParam); return true; } else { return false; } } public PageInfo findFillingPageInfo(String projectName, String projectType, String projectSource, Integer pageNum, Integer pagesize) { PageHelper.startPage(pageNum, pagesize); List list = projectFillingDeclarationDao.findFillingPageInfo(projectName, projectType, projectSource); List projectTypeList = dictionaryItemService.findListByTypeName(Constant.DictionaryType.PROJECT_SERVICE_SUPER_TYPE); for (DictionaryItem dictionaryItem : projectTypeList) { for (ProjectFillingDeclaration projectFillingDeclaration : list) { if (Objects.equals(dictionaryItem.getValue(), projectFillingDeclaration.getProject_type())) { projectFillingDeclaration.setProject_type_name(dictionaryItem.getName()); } if (StringUtils.isNotBlank(projectFillingDeclaration.getProject_service_type())) { String name = projectServiceTypeService.findById(projectFillingDeclaration.getProject_service_type()).get(0).getService_type_name(); projectFillingDeclaration.setProject_service_type_name(name); } // String companyIds = projectFillingDeclaration.getPush_company_ids(); // String[] companyIdsArr = companyIds.split(","); List projectFillingList = projectFillingService.findByDeclarationId(projectFillingDeclaration.getId()); projectFillingDeclaration.setTotal(projectFillingList.size()); projectFillingDeclaration.setCount(projectFillingService.getQuantityByDeclarationId(projectFillingDeclaration.getId().toString())); } } return new PageInfo(list); } public PageInfo findMessageByIdAndType(Integer pageNum, Integer pageSize, String id) { PageHelper.startPage(pageNum, pageSize); List applys = projectFillingDao.findMessageByIdAndType(id, Constant.Message_Business_type.PROJECT_PROVINCES_APPLY); return new PageInfo(applys); } public Boolean fail(Integer projectId, String comment) { Approval a = new Approval(); a.setApply_id(projectId); a.setType(Constant.DictionaryType.PROJECT_FILLING); String departmentname = departmentService.selectById(userService.getUser(ShiroUtils.getUserId()).getDepartment_id()).getName(); a.setDepartment(departmentname); a.setApproval_comment(comment); a.setChecker(ShiroUtils.getUserId()); a.setOper_type(Constant.OperType.REJECT); a.setDeal_time(DateUtil.getTimeString(new Date())); ProjectFilling projectApplication = projectFillingDao.findApplyById(projectId); //项目填报退回 退回至企业 a.setBefore_approvalstatus(Constant.ProjectFillingStatus.E_DOC_AUDIT); a.setAfter_approvalstatus(Constant.ProjectFillingStatus.NOTAPPROVED); ProjectFilling pa = projectFillingService.findById(projectId); pa.setApply_status(Constant.ProjectFillingStatus_Company.NOTAPPROVED); pa.setApprove_status(Constant.ProjectFillingStatus.NOTAPPROVED); projectFillingDao.updateByPrimaryKeySelective(pa); approvalService.insertAndGetId(a); ProjectFillingDeclaration projectDeclaration = this.findById(projectApplication.getDeclaration_id()); String projectName = projectDeclaration.getProject_name(); Company company = companyService.findById(projectApplication.getCompany_id()); Message messages = new Message(); messages.setApply_id(projectApplication.getId()); messages.setBusiness_type(Constant.Message_Business_type.PROJECT_FILING_APPLY); messages.setTitle("提醒企业"); String message = company.getCompany_name() + ",您好。您提交的" + projectName + "报表填报,审核不通过。不通过原因:" + comment; messages.setContent(message); int[] streetArrInt = new int[1]; streetArrInt[0] = projectApplication.getCompany_id(); messageService.saveMessageAndPush(messages, streetArrInt, Constant.UserType.COMPANY); List users = userService.findUsersByCompanyId(projectApplication.getCompany_id()); waitToDoService.completeAllTODO(projectApplication.getId(), Constant.DictionaryType.PROJECT_FILLING); for (User user : users) { waitToDoService.newTODO("报表填报查看", "/company/projectFilling/check/" + projectApplication.getId(), Constant.WaitToDo_OperType.CONFIRM_AND_NOTIFY, projectApplication.getId(), Constant.DictionaryType.PROJECT_FILLING, projectApplication.getApply_no(), user.getId().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false); } //发送短信 Map params = new HashMap<>(); params.put("project_no", projectApplication.getApply_no()); params.put("apply_name", Constant.ProjectType.PROJECT_FILLING); String templateCode = Constant.SMS_TemplateCode.RPOJECT_FILLING_UNPASS; User user = userService.findCompanyAdmin(company.getId()); try { AlibabaSMSUtil.sendSMS( user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)); } catch (ClientException | InterruptedException e) { e.printStackTrace(); } return true; } public List findAll(StaticSearchCondition searchCondition) { return projectFillingDeclarationDao.findAll(searchCondition); } }