| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228 |
- 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<ProjectFillingDeclaration> {
- @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<ProjectFillingDeclaration> findPageInfo(String projectName, String projectType, String projectSource, Integer pageNum, Integer pagesize) {
- PageHelper.startPage(pageNum, pagesize);
- List<ProjectFillingDeclaration> list = projectFillingDeclarationDao.findPageInfo(projectName, projectType, projectSource);
- List<DictionaryItem> 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<ProjectFillingDeclaration>(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<Company> companies = companyService.findCompanyList();
- String companyids = "";
- for (Company company : companies) {
- companyids += company.getId() + ",";
- }
- //所有街道
- List<Street> 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<UserGroup> 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<String> 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<String> 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<String> 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<Attachment> 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<NoticesAccept> ids = new ArrayList<NoticesAccept>();
- 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<String, String> 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<String> 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<ProjectServiceType> 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<Attachment> 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<String> streetNames = new ArrayList<String>();
- 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<String> buildNames = new ArrayList<String>();
- 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<String> companyNames = new ArrayList<String>();
- 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<ProjectFillingDto> 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<ProjectFillingDto> 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<ProjectFillingDto>(applicationDtoList);
- }
- //根据用户组获取可查询到的项目
- public List<String> getProjectIdsByGroup() {
- List<ProjectFilling> projectLists = new ArrayList<>();
- Integer user_id = ShiroUtils.getUserId();
- Group group = null;
- List<UserGroup> userGroups = null;
- List<String> 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<String> result = new ArrayList<>();
- for (ProjectFilling project : projectLists) {
- result.add(project.getId().toString());
- }
- return result;
- }
- //获取项目申报id 待审批
- public List<String> getProjectIdsd() {
- int currentUserId = ShiroUtils.getUserId();
- List<Approval> approvalList = approvalDao.selectAllApprovalDistinct(Constant.DictionaryType.PROJECT_FILLING);
- Set<String> projectApplicationIds = new HashSet<String>();
- 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<String> list = Arrays.asList(userIdArr);
- if (list.contains(String.valueOf(currentUserId))) {
- projectApplicationIds.add(approval.getApply_id().toString());
- }
- }
- }
- }
- }
- List<String> result = new ArrayList<>(projectApplicationIds);
- return result;
- }
- //获取项目申报id 已审批
- public List<String> getProjectIdsy() {
- int currentUserId = ShiroUtils.getUserId();
- List<Approval> approvalList = approvalDao.selectAllApproval(Constant.DictionaryType.PROJECT_FILLING);
- Set<String> projectApplicationIds = new HashSet<String>();
- 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<String> 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<User> 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<String, String> 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<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- // ProjectFillingDeclaration projectFillingDeclaration = this.selectById(projectApplication.getDeclaration_id().toString());
- // //List<User> users = userService.findUserBydepartmentIdWithoutApprovalLevel(projectFillingDeclaration.getDepartment_id().toString());
- // List<User> 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<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- // ProjectFillingDeclaration projectFillingDeclaration = this.selectById(projectApplication.getDeclaration_id().toString());
- // List<User> users = userService.findUserBydepartmentIdWithoutApprovalLevel(projectFillingDeclaration.getDepartment_id().toString());
- // //List<User> 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<User> 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<String, String> 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<User> 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<User> 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<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- // //List<User> users = userService.findUserBydepartmentIdWithoutApprovalLevel(departmentid.toString());
- // List<User> 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<ProjectFillingDeclaration> findFillingPageInfo(String projectName, String projectType,
- String projectSource, Integer pageNum, Integer pagesize) {
- PageHelper.startPage(pageNum, pagesize);
- List<ProjectFillingDeclaration> list = projectFillingDeclarationDao.findFillingPageInfo(projectName, projectType, projectSource);
- List<DictionaryItem> 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<ProjectFilling> projectFillingList = projectFillingService.findByDeclarationId(projectFillingDeclaration.getId());
- projectFillingDeclaration.setTotal(projectFillingList.size());
- projectFillingDeclaration.setCount(projectFillingService.getQuantityByDeclarationId(projectFillingDeclaration.getId().toString()));
- }
- }
- return new PageInfo<ProjectFillingDeclaration>(list);
- }
- public PageInfo<ProjectMessageDto> findMessageByIdAndType(Integer pageNum, Integer pageSize, String id) {
- PageHelper.startPage(pageNum, pageSize);
- List<ProjectMessageDto> applys = projectFillingDao.findMessageByIdAndType(id, Constant.Message_Business_type.PROJECT_PROVINCES_APPLY);
- return new PageInfo<ProjectMessageDto>(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<User> 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<String, String> 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<ProjectFillingDeclaration> findAll(StaticSearchCondition searchCondition) {
- return projectFillingDeclarationDao.findAll(searchCondition);
- }
- }
|