| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468 |
- 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.apache.poi.ss.usermodel.Cell;
- import org.apache.poi.ss.usermodel.Row;
- import org.apache.poi.ss.usermodel.Sheet;
- import org.apache.poi.ss.usermodel.Workbook;
- 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.ExportExcel;
- 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.ProjectMaterialDao;
- import platform.modules.company.dto.ProjectApplicationSearchCondition;
- 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.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.report.OrderExports;
- import platform.modules.sys.service.*;
- import tk.mybatis.mapper.entity.Example;
- import javax.annotation.Resource;
- import javax.servlet.http.HttpServletResponse;
- import java.io.InputStream;
- import java.text.ParseException;
- import java.text.SimpleDateFormat;
- import java.time.LocalDateTime;
- import java.time.format.DateTimeFormatter;
- import java.util.*;
- import java.util.concurrent.*;
- @Service
- @Transactional
- public class ProjectDeclarationService extends BaseService<ProjectDeclaration> {
- @Resource
- private ProjectDeclarationDao projectDeclarationDao;
- @Autowired
- private NoticesService noticesService;
- @Autowired
- private NoticesAcceptService noticesAcceptService;
- @Autowired
- private MessageService messageService;
- @Resource
- 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 ProjectApplicationService projectApplicationService;
- @Resource
- private ProjectDao projectDao;
- @Resource
- private ApprovalDao approvalDao;
- @Autowired
- private DepartmentService departmentService;
- @Autowired
- private DictionaryItemService dictionaryItemService;
- @Autowired
- private ApprovalService approvalService;
- @Resource
- 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 WaitToDoService waitToDoService;
- @Autowired
- private ProjectFillingService projectFillingService;
- @Autowired
- private ProjectService projectService;
- public PageInfo<ProjectDeclaration> findPageInfo(String projectName, Integer pageNum, Integer pagesize,
- String startTime1, String startTime2, String endTime1, String endTime2) {
- PageHelper.startPage(pageNum, pagesize);
- List<ProjectDeclaration> list = projectDeclarationDao.findPageInfo(projectName, startTime1, startTime2, endTime1, endTime2);
- for (ProjectDeclaration projectDeclaration : list) {
- if (Objects.equals(projectDeclaration.getStatus(), "0")) {
- projectDeclaration.setStatus_name("待发布");
- } else {
- try {
- String end = projectDeclaration.getApply_enddate();
- if (end.length() <= 10) end += " 23:59:59";
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- Date endtime = sdf.parse(end);
- String start = projectDeclaration.getApply_startdate();
- if (start.length() <= 10) start += " 00:00:00";
- Date starttime = sdf.parse(start);
- Date now = new Date();
- if (now.after(endtime)) {
- projectDeclaration.setStatus_name("失效");
- } else if (now.before(starttime)) {
- projectDeclaration.setStatus_name("未开始");
- } else {
- projectDeclaration.setStatus_name("申请中");
- }
- } catch (Exception e) {
- projectDeclaration.setStatus_name("申请中");
- }
- }
- }
- return new PageInfo<ProjectDeclaration>(list);
- }
- public Integer save(ProjectDeclaration projectDeclaration) {
- //String apply_date_range = projectDeclaration.getApply_date_range();
- /*if (apply_date_range != null && apply_date_range != "") {
- if (apply_date_range.contains(" 至 ")) {
- String[] dateRange = apply_date_range.split(" 至 ");
- if (dateRange[0] == null || dateRange[0] == "" || dateRange[0] == "null") {
- projectDeclaration.setApply_startdate("");
- } else {
- projectDeclaration.setApply_startdate(dateRange[0]);
- }
- if (dateRange[1] == null || dateRange[1] == "" || dateRange[1] == "null") {
- projectDeclaration.setApply_enddate("");
- } else {
- projectDeclaration.setApply_enddate(dateRange[1]);
- }
- } else {
- projectDeclaration.setApply_startdate("");
- projectDeclaration.setApply_enddate("");
- }
- } else {
- projectDeclaration.setApply_startdate("");
- projectDeclaration.setApply_enddate("");
- }*/
- this.insertAndGetId(projectDeclaration);
- Integer activityId = projectDeclaration.getId();
- attachmentDao.deleteByBusiness(Constant.Attachment.PROJECT_DECLARATION, projectDeclaration.getId());
- attachmentDao.updateAttachment(Constant.Attachment.PROJECT_DECLARATION, projectDeclaration.getId(), projectDeclaration.getFileDown().getFile_id());
- pushNotices(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(projectDeclaration.getProject_name() + "准备申报");
- String projectName = projectDeclaration.getProject_name();
- String s = projectDeclaration.getApply_startdate();
- String e = projectDeclaration.getApply_enddate();
- try {
- SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
- Date date1 = sdf1.parse(s);
- Date date2 = sdf1.parse(e);
- SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy年MM月dd日");
- s = sdf2.format(date1);
- e = sdf2.format(date2);
- } catch (ParseException e1) {
- e1.printStackTrace();
- }
- String message = projectName + "自" + s + "开始可以进行申报,申报截止日期为" + e;
- 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 Integer update(ProjectDeclaration projectDeclaration) {
- String apply_date_range = projectDeclaration.getApply_date_range();
- /*if (apply_date_range != null && apply_date_range != "") {
- if (apply_date_range.contains(" 至 ")) {
- String[] dateRange = apply_date_range.split(" 至 ");
- if (dateRange[0] == null || dateRange[0] == "" || dateRange[0] == "null") {
- projectDeclaration.setApply_startdate("");
- } else {
- projectDeclaration.setApply_startdate(dateRange[0]);
- }
- if (dateRange[1] == null || dateRange[1] == "" || dateRange[1] == "null") {
- projectDeclaration.setApply_enddate("");
- } else {
- projectDeclaration.setApply_enddate(dateRange[1]);
- }
- } else {
- projectDeclaration.setApply_startdate("");
- projectDeclaration.setApply_enddate("");
- }
- } else {
- projectDeclaration.setApply_startdate("");
- projectDeclaration.setApply_enddate("");
- }*/
- this.updateSelective(projectDeclaration);
- Integer activityId = projectDeclaration.getId();
- attachmentDao.deleteByBusiness(Constant.Attachment.PROJECT_DECLARATION, projectDeclaration.getId());
- attachmentDao.updateAttachment(Constant.Attachment.PROJECT_DECLARATION, projectDeclaration.getId(), projectDeclaration.getFileDown().getFile_id());
- pushNotices(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(projectDeclaration.getProject_name() + "准备申报");
- String projectName = projectDeclaration.getProject_name();
- String s = projectDeclaration.getApply_startdate();
- String e = projectDeclaration.getApply_enddate();
- try {
- SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
- Date date1 = sdf1.parse(s);
- Date date2 = sdf1.parse(e);
- SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy年MM月dd日");
- s = sdf2.format(date1);
- e = sdf2.format(date2);
- } catch (ParseException e1) {
- e1.printStackTrace();
- }
- String message = projectName + "自" + s + "开始可以进行申报,申报截止日期为" + e;
- 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 ProjectDeclaration selectById(String id) {
- ProjectDeclaration projectDeclaration = projectDeclarationDao.selectById(id);
- //发布单位
- if (StringUtils.isNotBlank(projectDeclaration.getRelease_departments())) {
- String[] deptIds = projectDeclaration.getRelease_departments().split(",");
- List<Integer> release_departmentsIds = new ArrayList<Integer>();
- String release_departmentsNames = "";
- for (int i = 0; i < deptIds.length; i++) {
- Department dept = departmentService.findById(Integer.valueOf(deptIds[i]));
- if (null != dept) {
- release_departmentsIds.add(Integer.valueOf(deptIds[i]));
- release_departmentsNames += dept.getName() + ",";
- }
- }
- projectDeclaration.setRelease_departmentsIds(release_departmentsIds);
- if (StringUtils.isNotBlank(release_departmentsNames)) {
- String names = release_departmentsNames.substring(0, release_departmentsNames.length() - 1);
- projectDeclaration.setRelease_departments_name(names);
- }
- }
- //责任单位
- if (null != projectDeclaration.getDepartment_id()) {
- Department dept = departmentService.findById(projectDeclaration.getDepartment_id());
- if (null != dept) {
- projectDeclaration.setDepartment_name(dept.getName());
- }
- }
- //项目大类
- String superType = projectDeclaration.getProject_super_type();
- if (StringUtils.isNotBlank(superType)) {
- DictionaryItem superTypeItem = dictionaryItemService.findByTypeAndValue(Constant.DictionaryType.PROJECT_APPLICATION_SUPER_TYPE, superType);
- if (null != superTypeItem) {
- projectDeclaration.setProject_super_type_name(superTypeItem.getName());
- }
- }
- //项目来源
- 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_DECLARATION, 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);
- }
- try {
- projectDeclaration = getPushNames(projectDeclaration);
- } catch (Exception e) {
- e.printStackTrace();
- }
- return projectDeclaration;
- }
- public void push(Integer id) {
- ProjectDeclaration projectDeclaration = projectDeclarationDao.selectById(id.toString());
- pushNotices(projectDeclaration);
- }
- @Transactional
- public void pushNotices(ProjectDeclaration 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("1");
- if (Objects.equals(projectDeclaration.getMes_notice(), "1")) {
- notice.setNotice_type("3");
- }
- } else {
- if (Objects.equals(projectDeclaration.getMes_notice(), "1")) {
- notice.setNotice_type("2");
- }
- }
- 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);
- }
- }
- }
- }
- //查询推送单位名称
- public ProjectDeclaration getPushNames(ProjectDeclaration 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++) {
- 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 Boolean updatePushDetails(ProjectDeclaration projectDeclaration, String street_ids, String build_ids, String company_ids) throws Exception {
- String alreadyPushStreets = projectDeclaration.getPush_street_ids() == null ? "" : projectDeclaration.getPush_build_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])) {
- 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])) {
- 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])) {
- alreadyPushCompanys += "," + idsArr[i];
- }
- }
- } else {
- alreadyPushCompanys = company_ids;
- }
- }
- projectDeclaration.setPush_build_ids(alreadyPushBuilds.substring(0, alreadyPushBuilds.length()));
- projectDeclaration.setPush_build_ids(alreadyPushBuilds.substring(0, alreadyPushBuilds.length()));
- projectDeclaration.setPush_company_ids(alreadyPushCompanys.substring(0, alreadyPushCompanys.length()));
- return this.updateSelective(projectDeclaration) > 0;
- }
- //根据小组名称获取组内用户
- public String findUserIdByGroupName(String groupName) {
- Group group = groupService.findByName(groupName, null);
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- StringBuffer sb = new StringBuffer("");
- for (UserGroup userGroup : userGroups) {
- sb.append(userGroup.getUser_id() + ",");
- }
- return sb.toString();
- }
- //根据用户获取所在部门
- public String findUserDepartment(String userIds) {
- int currentUserId = ShiroUtils.getUserId();
- String[] userIdArr = userIds.split(",");
- List<String> list = Arrays.asList(userIdArr);
- if (ShiroUtils.getUserType().equals(Constant.UserType.GOVERNMENT)) {
- if (list.contains(String.valueOf(currentUserId))) {
- Integer departmentId = userService.findDepartmentIdByUserId(currentUserId);
- if (null != departmentId) {
- return departmentId.toString();
- }
- }
- }
- return null;
- }
- public void getProjectApproval(Integer id) {
- int currentUserId = ShiroUtils.getUserId();
- Example example = new Example(Project.class);
- Example.Criteria criteria = example.createCriteria();
- criteria.andEqualTo("id", id);
- List<Project> projectList = projectDao.selectByExample(example);
- if (!CollectionUtils.isEmpty(projectList)) {
- projectList.get(0).getDepartment_id();
- projectList.get(0).getDepartment_name();
- }
- //材料受理
- String sl = findUserIdByGroupName(Constant.XMSBCLSLZ);
- //材料审核
- String sh = findUserIdByGroupName(Constant.XMSBCLSHZ);
- }
- //获取项目申报id 待审批
- public List<String> getProjectIdsd() {
- /* boolean flag = false;*/
- int currentUserId = ShiroUtils.getUserId();
- /*Group group = groupService.findByName(Constant.XMSBFZR, null);
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- if (Objects.equals(userGroup.getUser_id(), currentUserId)) {
- flag = true;
- }
- }*/
- List<Approval> approvalList = approvalDao.selectAllApprovalDistinct(Constant.DictionaryType.PROJECT_APPLICATION);
- 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());
- }
- }
- }
- }
- }
- /*if (flag) {
- Example example = new Example(ProjectApplication.class);
- Example.Criteria criteria = example.createCriteria();
- criteria.andEqualTo("approve_status", Constant.ProjectApplicationStatus.NOTIFY);
- //criteria.orEqualTo("approve_status", Constant.ProjectApplicationStatus.APPROVED);
- List<ProjectApplication> projectList = projectApplicationDao.selectByExample(example);
- for (ProjectApplication project : projectList) {
- projectApplicationIds.add(project.getId().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_APPLICATION);
- 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;
- }
- //获取项目申报id 待通知
- public List<String> getProjectIdsn() {
- /*int currentUserId = ShiroUtils.getUserId();
- List<Approval> approvalList = approvalDao.selectAllApprovalDistinct();
- 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 != "") {
- String[] userIdArr = checkerIds.split(",");
- List<String> list = Arrays.asList(userIdArr);
- if (list.contains(String.valueOf(currentUserId))) {
- projectApplicationIds.add(approval.getApply_id().toString());
- }
- }
- }
- }
- }*/
- List<String> result = new ArrayList<>();
- Example example = new Example(ProjectApplication.class);
- Example.Criteria criteria = example.createCriteria();
- criteria.andEqualTo("approve_status", Constant.ProjectApplicationStatus.NOTIFY);
- //criteria.orEqualTo("approve_status", Constant.ProjectApplicationStatus.APPROVED);
- List<ProjectApplication> projectList = projectApplicationDao.selectByExample(example);
- for (ProjectApplication project : projectList) {
- result.add(project.getId().toString());
- }
- return result;
- }
- //获取项目申报id 查看所有
- public List<String> getProjectIdsc() {
- List<String> result = new ArrayList<>();
- Example example = new Example(ProjectApplication.class);
- Example.Criteria criteria = example.createCriteria();
- criteria.andEqualTo("approve_status", Constant.ProjectApplicationStatus.NOTIFY);//待通知
- criteria.orEqualTo("approve_status", Constant.ProjectApplicationStatus.LOCAL_AUDIT); //属地初审
- criteria.orEqualTo("approve_status", Constant.ProjectApplicationStatus.CENTRE_AUDIT);//材料审核
- criteria.orEqualTo("approve_status", Constant.ProjectApplicationStatus.DEPARTMENT_AUDIT);//处室(中心)审批
- criteria.orEqualTo("approve_status", Constant.ProjectApplicationStatus.FINANCE_AUDIT);//财政审批
- criteria.orEqualTo("approve_status", Constant.ProjectApplicationStatus.UPLOAD_REPORT);//待上传报告
- criteria.orEqualTo("approve_status", Constant.ProjectApplicationStatus.APPROVED);//通过
- criteria.orEqualTo("approve_status", Constant.ProjectApplicationStatus.REJECT_TO_COMPANY);//退回至企业
- criteria.orEqualTo("approve_status", Constant.ProjectApplicationStatus.REJECT_TO_DEPARTMENT);//退回至处室
- criteria.orEqualTo("approve_status", Constant.ProjectApplicationStatus.NOTAPPROVED);//不通过
- criteria.orEqualTo("approve_status", Constant.ProjectApplicationStatus.UPLOAD_CS);//待财政上传
- criteria.orEqualTo("approve_status", Constant.ProjectApplicationStatus.UPLOAD_CZ);//待处室上传
- criteria.orEqualTo("approve_status", Constant.ProjectApplicationStatus.COMMIT_FILE);//待中心窗口上传
- criteria.orEqualTo("del_flag", "0");//不显示删除的
- List<ProjectApplication> projectList = projectApplicationDao.selectByExample(example);
- for (ProjectApplication project : projectList) {
- result.add(project.getId().toString());
- }
- return result;
- }
- //根据用户组获取可查询到的项目
- public List<String> getProjectIdsByGroup() {
- List<ProjectApplication> projectLists = new ArrayList<>();
- Integer user_id = ShiroUtils.getUserId();
- Department department = departmentService.findById(ShiroUtils.getUserEntity().getDepartment_id());
- Integer departmentId = 21;//中心窗口
- if (!department.getParent_id().equals(departmentId)) departmentId = department.getId();
- Example example = new Example(Project.class);
- Example.Criteria criteria = example.createCriteria();
- criteria.andEqualTo("del_flag", "0");
- criteria.andEqualTo("department_id", departmentId);
- List<Project> projectList = projectDao.selectByExample(example);
- List<String> project_ids = new ArrayList<>();
- if (CollectionUtils.isEmpty(projectList)) return project_ids;
- for (Project project : projectList) {
- project_ids.add(project.getId() + "");
- }
- Group group;
- List<UserGroup> userGroups;
- List<String> apply_status_list = new ArrayList<>();
- if (ShiroUtils.getUserType() == Constant.UserType.STREET) {
- group = groupService.findByName(Constant.XMSBJDSLZ, null);
- if (null == group) {
- apply_status_list.add("");
- }
- userGroups = userGroupService.findByGroupId(group.getId());
- if (null == userGroups) {
- apply_status_list.add("");
- }
- for (UserGroup userGroup : userGroups) {
- if (Objects.equals(userGroup.getUser_id(), user_id)) {
- apply_status_list.add(Constant.ProjectProvincesStatus.LOCAL_AUDIT);
- break;
- }
- }
- } else {
- //材料受理
- group = groupService.findByName(Constant.XMSBCLSLZ, null);
- userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- if (Objects.equals(userGroup.getUser_id(), user_id)) {
- apply_status_list.add(Constant.ProjectApplicationStatus.CENTRE_AUDIT);
- apply_status_list.add(Constant.ProjectApplicationStatus.COMMIT_FILE);
- projectLists.addAll(projectApplicationDao.findByProjectIdAndApproveStatus(new ArrayList<>(), apply_status_list, null));
- break;
- }
- }
- //材料审核
- group = groupService.findByName(Constant.XMSBCLSHZ, null);
- userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- if (Objects.equals(userGroup.getUser_id(), user_id)) {
- apply_status_list.add(Constant.ProjectApplicationStatus.DEPARTMENT_AUDIT);
- apply_status_list.add(Constant.ProjectApplicationStatus.UPLOAD_REPORT);
- apply_status_list.add(Constant.ProjectApplicationStatus.UPLOAD_CZ);
- break;
- }
- }
- //项目申报财政审核组
- group = groupService.findByName(Constant.XMSBCZSHZ, null);
- userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- if (Objects.equals(userGroup.getUser_id(), user_id)) {
- apply_status_list.add(Constant.ProjectApplicationStatus.FINANCE_AUDIT);
- apply_status_list.add(Constant.ProjectApplicationStatus.UPLOAD_REPORT);
- apply_status_list.add(Constant.ProjectApplicationStatus.UPLOAD_CS);
- break;
- }
- }
- //项目申报负责人
- group = groupService.findByName(Constant.XMSBFZR, null);
- userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- if (Objects.equals(userGroup.getUser_id(), user_id)) {
- apply_status_list.add(Constant.ProjectApplicationStatus.NOTIFY);
- projectLists.addAll(projectApplicationDao.findByProjectIdAndApproveStatus(new ArrayList<>(), apply_status_list, null));
- break;
- }
- }
- }
- if (apply_status_list.size() <= 0) {
- apply_status_list.add("");
- }
- projectLists.addAll(projectApplicationDao.findByProjectIdAndApproveStatus(project_ids, apply_status_list, null));
- List<String> result = new ArrayList<>();
- for (ProjectApplication project : projectLists) {
- result.add(project.getId().toString());
- }
- return result;
- }
- //待审核分页
- public PageInfo<ApplicationDto> findPage(Integer pageNum, Integer pageSize, ParamApplication paramApplication, String type) {
- paramApplication.setApproval_type(Constant.DictionaryType.PROJECT_APPLICATION);
- if (Objects.equals("1", type)) {
- //paramApplication.setProjectIds(getProjectIdsd()); //原逻辑
- paramApplication.setProjectIds(getProjectIdsByGroup());//新逻辑
- } else if (Objects.equals("2", type)) {
- paramApplication.setProjectIds(getProjectIdsy());
- } /*else if (Objects.equals("3", type)) {
- paramApplication.setProjectIds(getProjectIdsn());
- }*/ else if (Objects.equals("4", type)) {
- paramApplication.setProjectIds(getProjectIdsc());
- }
- String year = paramApplication.getProject_year();
- if (year != null && !year.equals("")) {
- paramApplication.setProject_year_date(year + "-01-01 00:00:00");
- }
- PageHelper.startPage(pageNum, pageSize);
- List<ApplicationDto> applicationDtoList = projectApplicationDao.findPage(paramApplication);
- for (ApplicationDto app : applicationDtoList) {
- if (null != app.getProject_type()) {
- ProjectType projectType = projectTypeService.findById(Integer.parseInt(app.getProject_type()));
- //String type_name = dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.PROJECT_APPLICATION_TYPE, app.getProject_type());
- app.setProject_type(projectType.getType_name());
- }
- if (null != app.getApprove_status()) {
- String status_name = dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.PROJECT_APPROVE_STATUS, app.getApprove_status());
- app.setStatedesc(status_name);
- }
- }
- return new PageInfo<>(applicationDtoList);
- }
- //待审核分页
- public List<ApplicationDto> findList(ParamApplication paramApplication, String type) {
- paramApplication.setApproval_type(Constant.DictionaryType.PROJECT_APPLICATION);
- if (Objects.equals("1", type)) {
- //paramApplication.setProjectIds(getProjectIdsd()); //原逻辑
- paramApplication.setProjectIds(getProjectIdsByGroup());//新逻辑
- } else if (Objects.equals("2", type)) {
- paramApplication.setProjectIds(getProjectIdsy());
- } /*else if (Objects.equals("3", type)) {
- paramApplication.setProjectIds(getProjectIdsn());
- }*/ else if (Objects.equals("4", type)) {
- paramApplication.setProjectIds(getProjectIdsc());
- }
- String year = paramApplication.getProject_year();
- if (year != null && !year.equals("")) {
- paramApplication.setProject_year_date(year + "-01-01 00:00:00");
- }
- List<ApplicationDto> applicationDtoList = projectApplicationDao.findPage(paramApplication);
- for (ApplicationDto app : applicationDtoList) {
- if (null != app.getProject_type()) {
- ProjectType projectType = projectTypeService.findById(Integer.parseInt(app.getProject_type()));
- //String type_name = dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.PROJECT_APPLICATION_TYPE, app.getProject_type());
- app.setProject_type(projectType.getType_name());
- }
- if (null != app.getApprove_status()) {
- String status_name = dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.PROJECT_APPROVE_STATUS, app.getApprove_status());
- app.setStatedesc(status_name);
- }
- }
- return applicationDtoList;
- }
- //通过
- public Boolean pass(Integer projectId, String comment) throws ClientException, InterruptedException {
- ProjectApplication projectApplication = projectApplicationDao.selectById(projectId.toString());
- Project project = new Project();
- project.setId(projectApplication.getProject_id());
- project = projectDao.selectOne(project);
- //判断年份
- ProjectDeclaration declaration = findById(projectApplication.getDeclaration_id());
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
- int year = LocalDateTime.parse(declaration.getApply_startdate(), formatter).getYear();
- if (year == 2019) return refactorPass(projectId, comment);
- Approval approval = approvalDao.getLatestApproval(projectId, Constant.DictionaryType.PROJECT_APPLICATION);
- Approval a = new Approval();
- a.setApply_id(projectId);
- a.setType(Constant.DictionaryType.PROJECT_APPLICATION);
- 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()));
- //短信所需参数
- Map<String, String> params = new HashMap<>();
- params.put("project_no", projectApplication.getApply_no());
- params.put("apply_name", Constant.ProjectType.PROJECT_APPLICATION);
- Company company = companyService.findById(projectApplication.getCompany_id());
- User companyAdmin = userService.findCompanyAdmin(company.getId());
- if (Objects.equals(Constant.ProjectApplicationStatus.CENTRE_AUDIT, approval.getAfter_approvalstatus())) {
- //材料审核通过,进如处室(中心)审批
- a.setBefore_approvalstatus(Constant.ProjectApplicationStatus.CENTRE_AUDIT);
- a.setAfter_approvalstatus(Constant.ProjectApplicationStatus.DEPARTMENT_AUDIT);
- Integer departmentid = declaration.getDepartment_id();
- Group group = groupService.findByName(Constant.XMSBCLSHZ, null);
- if (null == group) {
- throw new BaseException("操作失败,项目申报材料审核组没有该项目责任单位的审核人员,请联系管理员配置");
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findUserBydepartmentIdWithoutApprovalLevel(departmentid.toString());
- StringBuffer sb = new StringBuffer("");
- // Company company = companyService.findById(projectApplication.getCompany_id());
- ProjectDeclaration projectDeclaration = this.findById(projectApplication.getDeclaration_id());
- String projectName = projectDeclaration.getProject_name();
- Message messages = new Message();
- messages.setApply_id(projectId);
- messages.setBusiness_type(Constant.Message_Business_type.PROJECT_APPLY);
- messages.setTitle("提醒处室审核");
- waitToDoService.completeAllTODO(projectApplication.getId(), Constant.DictionaryType.PROJECT_APPLICATION);
- for (UserGroup userGroup : userGroups) {
- for (User user : users) {
- if (Objects.equals(user.getId(), userGroup.getUser_id())) {
- sb.append(userGroup.getUser_id() + ",");
- //User u = userService.findById(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("项目申报审核", "/projectDeclaration/approve/" + projectApplication.getId(), Constant.WaitToDo_OperType.AUDIT, projectApplication.getId(),
- Constant.DictionaryType.PROJECT_APPLICATION, projectApplication.getApply_no(), userGroup.getUser_id().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false);
- //发送短信
- // String tempCode = Constant.SMS_TemplateCode.RPOJECT_APPLICATION_AUDIT;
- // AlibabaSMSUtil.sendSMSMessage(
- // user.getPhone(), tempCode, Constant.SINGNAMW, JSONObject.toJSONString(params));
- }
- }
- }
- a.setNextchecker(sb.toString());
- if (null == sb || sb.length() == 0) {
- throw new BaseException("操作失败,项目申报材料审核组没有该项目责任单位的审核人员,请联系管理员配置");
- }
- ProjectApplication pa = new ProjectApplication();
- pa.setId(projectId);
- pa.setApprove_status(Constant.ProjectApplicationStatus.DEPARTMENT_AUDIT);
- projectApplicationDao.updateByPrimaryKeySelective(pa);
- approvalService.insertAndGetId(a);
- return true;
- } else if (Objects.equals(Constant.ProjectApplicationStatus.DEPARTMENT_AUDIT, approval.getAfter_approvalstatus())) {
- //处室通过,进去中心窗口提交
- a.setBefore_approvalstatus(Constant.ProjectApplicationStatus.DEPARTMENT_AUDIT);
- a.setAfter_approvalstatus(Constant.ProjectApplicationStatus.COMMIT_FILE);
- ProjectDeclaration projectDeclaration = this.findById(projectApplication.getDeclaration_id());
- String projectName = projectDeclaration.getProject_name();
- if (project.getIs_technical()) {
- //技改类发送通知
- Message messages1 = new Message();
- messages1.setApply_id(projectId);
- messages1.setBusiness_type(Constant.Message_Business_type.PROJECT_APPLY);
- messages1.setTitle("提醒企业准备材料");
- String message = company.getCompany_name() + ",您好。您提交的单号为" + projectApplication.getApply_no() + "的区级工业经济扶持项目申请," + "审核流程已过半,请提前准备好申报的纸质材料,等待审核通过谢谢!";
- messages1.setContent(message);
- int[] streetArrInt = new int[1];
- streetArrInt[0] = projectApplication.getCompany_id();
- messageService.saveMessageAndPush(messages1, streetArrInt, Constant.UserType.COMPANY);
- //发送短信(提醒企业准备材料)
- String tempCode = Constant.SMS_TemplateCode.REMINSD_COMPNAY_PREPARE_MATERIALS;
- AlibabaSMSUtil.sendSMS(
- companyAdmin.getPhone(), tempCode, Constant.SINGNAMW, JSONObject.toJSONString(params));
- }
- Message messages = new Message();
- messages.setApply_id(projectId);
- messages.setBusiness_type(Constant.Message_Business_type.PROJECT_APPLY);
- messages.setTitle("提醒中心补充材料");
- Group group = groupService.findByName(Constant.XMSBCLSLZ, null);
- if (null == group) {
- throw new BaseException("操作失败,项目申报财政审核组没有该项目责任单位的审核人员,请联系管理员配置");
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- StringBuffer sb = new StringBuffer("");
- waitToDoService.completeAllTODO(projectApplication.getId(), Constant.DictionaryType.PROJECT_APPLICATION);
- for (UserGroup userGroup : userGroups) {
- sb.append(userGroup.getUser_id() + ",");
- User user = userService.findById(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("项目申报审核", "/projectDeclaration/approve/" + projectApplication.getId(), Constant.WaitToDo_OperType.AUDIT, projectApplication.getId(),
- Constant.DictionaryType.PROJECT_APPLICATION, projectApplication.getApply_no(), userGroup.getUser_id().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false);
- //发送短信
- // String tempCode = Constant.SMS_TemplateCode.RPOJECT_APPLICATION_AUDIT;
- // AlibabaSMSUtil.sendSMSMessage(
- // user.getPhone(), tempCode, Constant.SINGNAMW, JSONObject.toJSONString(params));
- }
- a.setNextchecker(sb.toString());
- if (sb.length() == 0) {
- throw new BaseException("操作失败,项目申报财政审核组没有该项目责任单位的审核人员,请联系管理员配置");
- }
- ProjectApplication pa = new ProjectApplication();
- pa.setId(projectId);
- pa.setApprove_status(Constant.ProjectApplicationStatus.COMMIT_FILE);
- projectApplicationDao.updateByPrimaryKeySelective(pa);
- approvalService.insertAndGetId(a);
- return true;
- } else if (Objects.equals(Constant.ProjectApplicationStatus.COMMIT_FILE, approval.getAfter_approvalstatus())) {
- //中心窗口提交完成 进入财政审批
- a.setBefore_approvalstatus(Constant.ProjectApplicationStatus.COMMIT_FILE);
- a.setAfter_approvalstatus(Constant.ProjectApplicationStatus.FINANCE_AUDIT);
- Integer departmentid = project.getDepartment_id();
- Group group = groupService.findByName(Constant.XMSBCZSHZ, null);
- if (null == group) {
- throw new BaseException("操作失败,项目申报材料受理组没有该项目责任单位的审核人员,请联系管理员配置");
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findUserBydepartmentIdWithoutApprovalLevel(departmentid.toString());
- StringBuffer sb = new StringBuffer("");
- ProjectDeclaration projectDeclaration = this.findById(projectApplication.getDeclaration_id());
- String projectName = projectDeclaration.getProject_name();
- Message messages = new Message();
- messages.setApply_id(projectId);
- messages.setBusiness_type(Constant.Message_Business_type.PROJECT_APPLY);
- messages.setTitle("提醒财政审核");
- waitToDoService.completeAllTODO(projectApplication.getId(), Constant.DictionaryType.PROJECT_APPLICATION);
- for (UserGroup userGroup : userGroups) {
- for (User user : users) {
- if (Objects.equals(user.getId(), userGroup.getUser_id())) {
- sb.append(userGroup.getUser_id() + ",");
- //User user = userService.findById(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("项目申报审核", "/projectDeclaration/approve/" + projectApplication.getId(), Constant.WaitToDo_OperType.AUDIT, projectApplication.getId(),
- Constant.DictionaryType.PROJECT_APPLICATION, projectApplication.getApply_no(), userGroup.getUser_id().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false);
- //发送短信
- // String tempCode = Constant.SMS_TemplateCode.RPOJECT_APPLICATION_AUDIT;
- // AlibabaSMSUtil.sendSMSMessage(
- // user.getPhone(), tempCode, Constant.SINGNAMW, JSONObject.toJSONString(params));
- }
- }
- }
- a.setNextchecker(sb.toString());
- if (sb.length() == 0) {
- throw new BaseException("操作失败,项目申报材料受理组没有该项目责任单位的审核人员,请联系管理员配置");
- }
- ProjectApplication pa = new ProjectApplication();
- pa.setId(projectId);
- pa.setApprove_status(Constant.ProjectApplicationStatus.FINANCE_AUDIT);
- projectApplicationDao.updateByPrimaryKeySelective(pa);
- approvalService.insertAndGetId(a);
- return true;
- } else if (Objects.equals(Constant.ProjectApplicationStatus.FINANCE_AUDIT, approval.getAfter_approvalstatus())) {
- //财政审核通过
- a.setBefore_approvalstatus(Constant.ProjectApplicationStatus.FINANCE_AUDIT);
- ProjectApplication pa = new ProjectApplication();
- pa.setId(projectId);
- if (project.getIs_technical()) {
- //技改类等待上传
- a.setAfter_approvalstatus(Constant.ProjectApplicationStatus.UPLOAD_REPORT);
- pa.setApprove_status(Constant.ProjectApplicationStatus.UPLOAD_REPORT);
- Integer departmentid = project.getDepartment_id();
- Group group = groupService.findByName(Constant.XMSBCLSHZ, null);
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findUserBydepartmentIdWithoutApprovalLevel(departmentid.toString());
- StringBuffer sb = new StringBuffer("");
- ProjectDeclaration projectDeclaration = this.findById(projectApplication.getDeclaration_id());
- String projectName = projectDeclaration.getProject_name();
- Message messages = new Message();
- messages.setApply_id(projectId);
- messages.setBusiness_type(Constant.Message_Business_type.PROJECT_APPLY);
- waitToDoService.completeAllTODO(projectApplication.getId(), Constant.DictionaryType.PROJECT_APPLICATION);
- for (UserGroup userGroup : userGroups) {
- for (User user : users) {
- if (Objects.equals(user.getId(), userGroup.getUser_id())) {
- sb.append(userGroup.getUser_id()).append(",");
- User userss = userService.findById(userGroup.getUser_id());
- messages.setTitle("提醒处室补充材料");
- String message = userss.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("项目申报上传材料", "/projectDeclaration/approve/" + projectApplication.getId(), Constant.WaitToDo_OperType.AUDIT, projectApplication.getId(),
- Constant.DictionaryType.PROJECT_APPLICATION, projectApplication.getApply_no(), userGroup.getUser_id().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false);
- //发送短信(提醒处室补充材料)
- // Map<String, String> paramMap = new HashMap<>();
- // paramMap.put("company_name", company.getCompany_name());
- // paramMap.put("project_name", projectName);
- // String tempCode = Constant.SMS_TemplateCode.RPOJECT_APPLICATION_REPORT;
- // AlibabaSMSUtil.sendSMS(
- // user.getPhone(), tempCode, Constant.SINGNAMW, JSONObject.toJSONString(paramMap));
- }
- }
- }
- Group groups = groupService.findByName(Constant.XMSBCZSHZ, null);
- if (null == group) {
- throw new BaseException("操作失败,项目申报财政审核组或项目申报材料审核组没有该项目责任单位的审核人员,请联系管理员配置");
- }
- List<UserGroup> userGroupss = userGroupService.findByGroupId(groups.getId());
- for (UserGroup userGroup : userGroupss) {
- sb.append(userGroup.getUser_id() + ",");
- User user = userService.findById(userGroup.getUser_id());
- messages.setTitle("提醒财政补充材料");
- 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("项目申报上传材料", "/projectDeclaration/approve/" + projectApplication.getId(), Constant.WaitToDo_OperType.AUDIT, projectApplication.getId(),
- Constant.DictionaryType.PROJECT_APPLICATION, projectApplication.getApply_no(), userGroup.getUser_id().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false);
- //发送短信(提醒财政补充材料)
- // Map<String, String> paramMap = new HashMap<>();
- // paramMap.put("company_name", company.getCompany_name());
- // paramMap.put("project_name", projectName);
- // String tempCode = Constant.SMS_TemplateCode.RPOJECT_APPLICATION_REPORT;
- // AlibabaSMSUtil.sendSMS(
- // user.getPhone(), tempCode, Constant.SINGNAMW, JSONObject.toJSONString(params));
- }
- a.setNextchecker(sb.toString());
- } else {
- // Company company = companyService.findById(projectApplication.getCompany_id());
- ProjectDeclaration projectDeclaration = this.findById(projectApplication.getDeclaration_id());
- String projectName = projectDeclaration.getProject_name();
- Message messages = new Message();
- messages.setApply_id(projectId);
- messages.setBusiness_type(Constant.Message_Business_type.PROJECT_APPLY);
- messages.setTitle("提醒中心负责人");
- a.setAfter_approvalstatus(Constant.ProjectApplicationStatus.NOTIFY);
- pa.setApprove_status(Constant.ProjectApplicationStatus.NOTIFY);
- Group group = groupService.findByName(Constant.XMSBFZR, null);
- if (null == group) {
- throw new BaseException("操作失败,项目申报财政审核组或项目申报材料审核组没有该项目责任单位的审核人员,请联系管理员配置");
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- StringBuffer sb = new StringBuffer("");
- waitToDoService.completeAllTODO(projectApplication.getId(), Constant.DictionaryType.PROJECT_APPLICATION);
- for (UserGroup userGroup : userGroups) {
- sb.append(userGroup.getUser_id() + ",");
- User user = userService.findById(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("项目申报审核", "/projectDeclaration/approve/" + projectApplication.getId(), Constant.WaitToDo_OperType.AUDIT, projectApplication.getId(),
- Constant.DictionaryType.PROJECT_APPLICATION, projectApplication.getApply_no(), userGroup.getUser_id().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false);
- //发送短信
- // String tempCode = Constant.SMS_TemplateCode.RPOJECT_APPLICATION_AUDIT;
- // AlibabaSMSUtil.sendSMSMessage(
- // user.getPhone(), tempCode, Constant.SINGNAMW, JSONObject.toJSONString(params));
- }
- a.setNextchecker(sb.toString());
- if (null == sb || sb.length() == 0) {
- throw new BaseException("操作失败,项目申报财政审核组或项目申报材料审核组没有该项目责任单位的审核人员,请联系管理员配置");
- }
- }
- projectApplicationDao.updateByPrimaryKeySelective(pa);
- approvalService.insertAndGetId(a);
- //发送短信
- // String tempCode = Constant.SMS_TemplateCode.RPOJECT_APPLICATION_FINANCIAL_PREARE_MATERIALS;
- // AlibabaSMSUtil.sendSMS(
- // companyAdmin.getPhone(), tempCode, Constant.SINGNAMW, JSONObject.toJSONString(params));
- return true;
- }
- return false;
- }
- /**
- * 2019审核流程
- *
- * @param projectId
- * @param comment
- */
- private boolean refactorPass(Integer projectId, String comment) {
- Approval approval = approvalDao.getLatestApproval(projectId, Constant.DictionaryType.PROJECT_APPLICATION);
- Approval a = new Approval();
- a.setApply_id(projectId);
- a.setType(Constant.DictionaryType.PROJECT_APPLICATION);
- 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()));
- ProjectApplication projectApplication = projectApplicationDao.selectById(projectId.toString());
- Project project = projectService.findById(projectApplication.getProject_id());
- Integer responsibleUnit = project.getDepartment_id();
- ProjectDeclaration declaration = findById(projectApplication.getDeclaration_id());
- String projectName = declaration.getProject_name();
- //短信所需参数
- Map<String, String> params = new HashMap<>();
- params.put("project_no", projectApplication.getApply_no());
- Company company = companyService.findById(projectApplication.getCompany_id());
- User companyAdmin = userService.findCompanyAdmin(company.getId());
- if (Objects.equals(Constant.ProjectApplicationStatus.CENTRE_AUDIT, approval.getAfter_approvalstatus())) {
- //材料审核通过,进如处室(中心)审批
- a.setBefore_approvalstatus(Constant.ProjectApplicationStatus.CENTRE_AUDIT);
- a.setAfter_approvalstatus(Constant.ProjectApplicationStatus.DEPARTMENT_AUDIT);
- Group group = groupService.findByName(Constant.XMSBCLSHZ, null);
- if (null == group) {
- throw new BaseException("操作失败,项目申报材料审核组没有该项目责任单位的审核人员,请联系管理员配置");
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findUserBydepartmentIdWithoutApprovalLevel(responsibleUnit.toString());
- StringBuffer sb = new StringBuffer("");
- Message messages = new Message();
- messages.setApply_id(projectId);
- messages.setBusiness_type(Constant.Message_Business_type.PROJECT_APPLY);
- messages.setTitle("提醒处室审核");
- waitToDoService.completeAllTODO(projectApplication.getId(), Constant.DictionaryType.PROJECT_APPLICATION);
- for (UserGroup userGroup : userGroups) {
- for (User user : users) {
- if (Objects.equals(user.getId(), userGroup.getUser_id())) {
- sb.append(userGroup.getUser_id() + ",");
- //User u = userService.findById(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("项目申报审核", "/projectDeclaration/approve/" + projectApplication.getId(), Constant.WaitToDo_OperType.AUDIT, projectApplication.getId(),
- Constant.DictionaryType.PROJECT_APPLICATION, 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("操作失败,项目申报材料审核组没有该项目责任单位的审核人员,请联系管理员配置");
- }
- ProjectApplication pa = new ProjectApplication();
- pa.setId(projectId);
- pa.setApprove_status(Constant.ProjectApplicationStatus.DEPARTMENT_AUDIT);
- projectApplicationDao.updateByPrimaryKeySelective(pa);
- approvalService.insertAndGetId(a);
- return true;
- } else if (Objects.equals(Constant.ProjectApplicationStatus.DEPARTMENT_AUDIT, approval.getAfter_approvalstatus())) {
- //处室通过,审核结束
- a.setBefore_approvalstatus(Constant.ProjectApplicationStatus.DEPARTMENT_AUDIT);
- a.setAfter_approvalstatus(Constant.ProjectApplicationStatus.APPROVED);
- ProjectApplication pa = new ProjectApplication();
- pa.setId(projectId);
- pa.setApprove_status(Constant.ProjectApplicationStatus.APPROVED);
- pa.setApply_status(Constant.ProjectApplyStatus.APPROVED);
- projectApplicationDao.updateByPrimaryKeySelective(pa);
- approvalService.insertAndGetId(a);
- ExecutorService threadPool = new ThreadPoolExecutor(
- 1,
- 2,
- 1L,
- TimeUnit.SECONDS,
- new LinkedBlockingDeque<>(),
- Executors.defaultThreadFactory(),
- new ThreadPoolExecutor.AbortPolicy());
- try {
- threadPool.execute(() -> {
- Message messages = new Message();
- messages.setApply_id(projectId);
- messages.setBusiness_type(Constant.Message_Business_type.PROJECT_APPLY);
- messages.setTitle("项目申报审核通过");
- String message = "您单号为 " + projectApplication.getApply_no() + " 的区级工业经济扶持项目申请,已审核通过," +
- "请将纸质材料(需与审核通过的电子档一致)交与属地经济主管部门。";
- messages.setContent(message);
- int[] streetArrInt = new int[1];
- streetArrInt[0] = companyAdmin.getId();
- messageService.saveMessageAndPush(messages, streetArrInt, Constant.UserType.GOVERNMENT);
- String tempCode = Constant.SMS_TemplateCode.RPOJECT_APPLICATION_PREARE_MATERIALS;
- try {
- AlibabaSMSUtil.sendSMS(
- companyAdmin.getPhone(), tempCode, Constant.SINGNAMW, JSONObject.toJSONString(params));
- } catch (ClientException | InterruptedException e) {
- e.printStackTrace();
- }
- });
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- threadPool.shutdown();
- }
- return true;
- }
- return false;
- }
- //退回
- public boolean untread(Integer projectId, String comment) {
- Boolean flag = false;
- Approval approval = approvalDao.getLatestApproval(projectId, Constant.DictionaryType.PROJECT_APPLICATION);
- Approval a = new Approval();
- a.setApply_id(projectId);
- a.setType(Constant.DictionaryType.PROJECT_APPLICATION);
- 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()));
- ProjectApplication projectApplication = projectApplicationDao.selectById(projectId.toString());
- Project project = new Project();
- project.setId(projectApplication.getProject_id());
- project = projectDao.selectOne(project);
- if (Objects.equals(Constant.ProjectApplicationStatus.CENTRE_AUDIT, approval.getAfter_approvalstatus())) {
- //材料审核退回,退回至企业
- a.setBefore_approvalstatus(Constant.ProjectApplicationStatus.CENTRE_AUDIT);
- a.setAfter_approvalstatus(Constant.ProjectApplicationStatus.REJECT_TO_COMPANY);
- a.setNextchecker(projectApplication.getCreate_by().toString());
- ProjectApplication p = new ProjectApplication();
- p.setId(projectId);
- p.setApply_status(Constant.ProjectApplyStatus.REJECT);
- p.setApprove_status(Constant.ProjectApplicationStatus.REJECT_TO_COMPANY);
- projectApplicationDao.updateByPrimaryKeySelective(p);
- approvalService.insertAndGetId(a);
- ProjectDeclaration 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_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("项目申报编辑", "/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);
- }
- flag = true;
- } else if (Objects.equals(Constant.ProjectApplicationStatus.DEPARTMENT_AUDIT, approval.getAfter_approvalstatus())) {
- //处室(中心)审核退回,退回至企业
- a.setBefore_approvalstatus(Constant.ProjectApplicationStatus.DEPARTMENT_AUDIT);
- a.setAfter_approvalstatus(Constant.ProjectApplicationStatus.REJECT_TO_COMPANY);
- a.setNextchecker(projectApplication.getCreate_by().toString());
- ProjectApplication p = new ProjectApplication();
- p.setId(projectId);
- p.setApply_status(Constant.ProjectApplyStatus.REJECT);
- p.setApprove_status(Constant.ProjectApplicationStatus.REJECT_TO_COMPANY);
- projectApplicationDao.updateByPrimaryKeySelective(p);
- approvalService.insertAndGetId(a);
- ProjectDeclaration 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_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("项目申报编辑", "/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);
- }
- flag = true;
- } /*else if (Objects.equals(Constant.ProjectApplicationStatus.COMMIT_FILE, approval.getAfter_approvalstatus())) {
- //中心窗口提交专家审核意见,退回中心(处室)
- a.setBefore_approvalstatus(Constant.ProjectApplicationStatus.COMMIT_FILE);
- a.setAfter_approvalstatus(Constant.ProjectApplicationStatus.DEPARTMENT_AUDIT);
- Integer departmentid = project.getDepartment_id();
- Group group = groupService.findByName(Constant.XMSBCLSHZ, null);
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findUserBydepartmentIdWithoutApprovalLevel(departmentid.toString());
- StringBuffer sb = new StringBuffer("");
- for (UserGroup userGroup : userGroups) {
- for (User user : users) {
- if (Objects.equals(user.getId(), userGroup.getUser_id())) {
- sb.append(userGroup.getUser_id() + ",");
- }
- }
- }
- a.setNextchecker(sb.toString());
- ProjectApplication p = new ProjectApplication();
- p.setId(projectId);
- //p.setApply_status(Constant.ProjectApplyStatus.REJECT);
- p.setApprove_status(Constant.ProjectApplicationStatus.REJECT_TO_DEPARTMENT);
- projectApplicationDao.updateByPrimaryKeySelective(p);
- approvalService.insertAndGetId(a);
- }*/ else if (Objects.equals(Constant.ProjectApplicationStatus.FINANCE_AUDIT, approval.getAfter_approvalstatus())) {
- //财政审核退回,退回至处室
- a.setBefore_approvalstatus(Constant.ProjectApplicationStatus.FINANCE_AUDIT);
- a.setAfter_approvalstatus(Constant.ProjectApplicationStatus.DEPARTMENT_AUDIT);
- Integer departmentid = project.getDepartment_id();
- Group group = groupService.findByName(Constant.XMSBCLSHZ, null);
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findUserBydepartmentIdWithoutApprovalLevel(departmentid.toString());
- StringBuffer sb = new StringBuffer("");
- ProjectDeclaration 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_APPLY);
- messages.setTitle("提醒企业");
- waitToDoService.completeAllTODO(projectApplication.getId(), Constant.DictionaryType.PROJECT_APPLICATION);
- 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());
- ProjectApplication p = new ProjectApplication();
- p.setId(projectId);
- p.setApply_status(Constant.ProjectApplyStatus.REJECT);
- p.setApprove_status(Constant.ProjectApplicationStatus.DEPARTMENT_AUDIT);
- projectApplicationDao.updateByPrimaryKeySelective(p);
- approvalService.insertAndGetId(a);
- flag = true;
- }
- //发送短信给企业
- Map<String, String> params = new HashMap<>();
- params.put("project_no", projectApplication.getApply_no());
- params.put("apply_name", Constant.ProjectType.PROJECT_APPLICATION);
- String templateCode = Constant.SMS_TemplateCode.RPOJECT_MATTERS_REJECT;
- try {
- User user = userService.findCompanyAdmin(projectApplication.getCompany_id());
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params));
- } catch (ClientException | InterruptedException e) {
- e.printStackTrace();
- }
- return flag;
- }
- //不通过
- public boolean reject(Integer projectId, String comment) {
- Approval approval = approvalDao.getLatestApproval(projectId, Constant.DictionaryType.PROJECT_APPLICATION);
- Approval a = new Approval();
- a.setApply_id(projectId);
- a.setType(Constant.DictionaryType.PROJECT_APPLICATION);
- 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.NOTAPPROVED);
- a.setDeal_time(DateUtil.getTimeString(new Date()));
- ProjectApplication projectApplication = projectApplicationDao.selectById(projectId.toString());
- a.setAfter_approvalstatus(Constant.ProjectApplicationStatus.NOTAPPROVED);
- a.setNextchecker(projectApplication.getCreate_by().toString());
- ProjectApplication p = new ProjectApplication();
- p.setId(projectId);
- p.setApply_status(Constant.ProjectApplyStatus.NOTAPPROVED);
- p.setApprove_status(Constant.ProjectApplicationStatus.NOTAPPROVED);
- projectApplicationDao.updateByPrimaryKeySelective(p);
- if (Objects.equals(Constant.ProjectApplicationStatus.CENTRE_AUDIT, approval.getAfter_approvalstatus())) {
- //材料审核退回,退回至企业
- a.setBefore_approvalstatus(Constant.ProjectApplicationStatus.CENTRE_AUDIT);
- } else if (Objects.equals(Constant.ProjectApplicationStatus.DEPARTMENT_AUDIT, approval.getAfter_approvalstatus())) {
- //处室(中心)审核退回,退回至企业
- a.setBefore_approvalstatus(Constant.ProjectApplicationStatus.DEPARTMENT_AUDIT);
- } else if (Objects.equals(Constant.ProjectApplicationStatus.FINANCE_AUDIT, approval.getAfter_approvalstatus())) {
- //财政审核退回,退回至处室中心
- a.setBefore_approvalstatus(Constant.ProjectApplicationStatus.FINANCE_AUDIT);
- }
- approvalService.insertAndGetId(a);
- ProjectDeclaration 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_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);
- //发送短信给企业
- Map<String, String> params = new HashMap<>();
- params.put("project_no", projectApplication.getApply_no());
- params.put("apply_name", Constant.ProjectType.PROJECT_APPLICATION);
- String templateCode = Constant.SMS_TemplateCode.RPOJECT_MATTERS_UNPASS;
- try {
- User user = userService.findCompanyAdmin(projectApplication.getCompany_id());
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params));
- } catch (ClientException | InterruptedException e) {
- e.printStackTrace();
- }
- return true;
- }
- //通知
- public boolean notify(Integer projectId, String payment) throws ClientException, InterruptedException {
- Approval approval = approvalDao.getLatestApproval(projectId, Constant.DictionaryType.PROJECT_APPLICATION);
- Approval a = new Approval();
- a.setApply_id(projectId);
- a.setDeal_time(DateUtil.getTimeString(new Date()));
- a.setType(Constant.DictionaryType.PROJECT_APPLICATION);
- String departmentname = departmentService.selectById(userService.getUser(ShiroUtils.getUserId()).getDepartment_id()).getName();
- a.setDepartment(departmentname);
- a.setChecker(ShiroUtils.getUserId());
- a.setOper_type(Constant.OperType.APPROVED);
- ProjectApplication projectApplication = projectApplicationDao.selectById(projectId.toString());
- a.setAfter_approvalstatus(Constant.ProjectApplicationStatus.APPROVED);
- //a.setNextchecker(projectApplication.getCreate_by().toString());
- ProjectApplication p = new ProjectApplication();
- p.setId(projectId);
- p.setProject_payment(payment);
- p.setApply_status(Constant.ProjectApplyStatus.APPROVED);
- p.setApprove_status(Constant.ProjectApplicationStatus.APPROVED);
- projectApplicationDao.updateByPrimaryKeySelective(p);
- a.setBefore_approvalstatus(Constant.ProjectApplicationStatus.NOTIFY);
- approvalService.insertAndGetId(a);
- ProjectDeclaration projectDeclaration = this.findById(projectApplication.getDeclaration_id());
- String projectName = projectDeclaration.getProject_name();
- Message messages = new Message();
- messages.setApply_id(projectId);
- messages.setTitle("企业项目审批完成通知");
- Company company = companyService.findById(projectApplication.getCompany_id());
- messages.setContent(company.getCompany_name() + ",您好。您的" + projectName + "项目申请成功,发放" + payment + "万元人民币,请开收据,提交纸质材料。谢谢。");
- messages.setBusiness_type(Constant.Message_Business_type.PROJECT_APPLY);
- int[] streetArrInt = new int[1];
- streetArrInt[0] = projectApplication.getCompany_id();
- messageService.saveMessageAndPush(messages, streetArrInt, Constant.UserType.COMPANY);
- //发送短信
- Map<String, String> params = new HashMap<>();
- User companyAdmin = userService.findCompanyAdmin(company.getId());
- String tempCode = Constant.SMS_TemplateCode.REMINSD_COMPNAY_PRINT_MATERIALS;
- params.put("project_no", projectApplication.getApply_no());
- params.put("apply_name", Constant.ProjectType.PROJECT_APPLICATION);
- AlibabaSMSUtil.sendSMS(
- companyAdmin.getPhone(), tempCode, Constant.SINGNAMW, JSONObject.toJSONString(params));
- return true;
- }
- //发送短信,通知审核
- public Boolean sendProjectMessage(ProjectApplication projectApplication) throws ClientException {
- String phone = "";
- Map<String, String> params = new HashMap<>();
- if (projectApplication != null) {
- 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();
- }
- params.put("project_id", projectApplication.getApply_no());
- String templatCode = Constant.SMS_TemplateCode.RPOJECT_APPLICATION_AUDIT;
- if (StringUtils.isNotBlank(phone)) {
- AlibabaSMSUtil.sendSMSMessage(phone, templatCode, Constant.SINGNAMW, JSONObject.toJSONString(params));
- return true;
- }
- }
- return false;
- }
- //发送短信
- public Boolean sendProjectSMS(ProjectApplication 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.ProjectApplyStatus.NOTAPPROVED)) {
- statusName = Constant.OperType.NOTAPPROVED;
- } else if (status.equals(Constant.ProjectApplyStatus.APPROVED)) {
- statusName = Constant.OperType.APPROVED;
- } else if (status.equals(Constant.ProjectApplyStatus.REJECT)) {
- statusName = Constant.OperType.REJECT;
- }
- if (StringUtils.isNotBlank(statusName)) {
- return sendProjectSMSToCompany(departmentname, projectApplication, statusName);
- }
- }
- return false;
- }
- public Boolean sendProjectSMSToCompany(String departmentname, ProjectApplication 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端查看。感谢您的支持。
- String project_name = projectApplication.getProject_name();
- String templateParam = "{\"department_name\":\"" + departmentname + "\",\"project_name\":\"" + project_name + "\",\"approve_status\":\"" + status + "\"}";
- AlibabaSMSUtil.sendSMS(phone, Constant.SMS_TemplateCode.PROJECT_APPLICATION_NOTIFY, Constant.SINGNAMW, templateParam);
- return true;
- } else {
- return false;
- }
- }
- //部门上传数据
- public void departmentUpload(ParamFile paramFile) {
- attachmentDao.deleteByBusiness(Constant.Attachment.PROJECT_CS, paramFile.getPid());
- attachmentDao.updateAttachment(Constant.Attachment.PROJECT_CS, paramFile.getPid(), paramFile.getFileDown().getFile_id());
- ProjectMaterial projectMaterial = new ProjectMaterial();
- projectMaterial.setApply_id(paramFile.getPid());
- projectMaterial.setTemplate_id(paramFile.getFileDown().getFile_id());
- projectMaterial.setMaterial_type(1);
- Example example = new Example(ProjectMaterial.class);
- Example.Criteria criteria = example.createCriteria();
- criteria.andEqualTo("apply_id", paramFile.getPid());
- criteria.andEqualTo("material_type", "1");
- List<ProjectMaterial> list = projectMaterialDao.selectByExample(example);
- if (CollectionUtils.isEmpty(list)) {
- projectMaterialDaoService.saveMaterial(projectMaterial);
- } else {
- projectMaterial.setId(list.get(0).getId());
- projectMaterialDaoService.updateMaterial(projectMaterial);
- }
- //判断两种文件是否全
- validateUploadedFile(paramFile.getPid());
- }
- //财政上传数据
- public void financeUpload(ParamFile paramFile) {
- attachmentDao.deleteByBusiness(Constant.Attachment.PROJECT_CZ, paramFile.getPid());
- attachmentDao.updateAttachment(Constant.Attachment.PROJECT_CZ, paramFile.getPid(), paramFile.getFileDown().getFile_id());
- ProjectMaterial projectMaterial = new ProjectMaterial();
- projectMaterial.setApply_id(paramFile.getPid());
- projectMaterial.setTemplate_id(paramFile.getFileDown().getFile_id());
- projectMaterial.setMaterial_type(2);
- Example example = new Example(ProjectMaterial.class);
- Example.Criteria criteria = example.createCriteria();
- criteria.andEqualTo("apply_id", paramFile.getPid());
- criteria.andEqualTo("material_type", "2");
- List<ProjectMaterial> list = projectMaterialDao.selectByExample(example);
- if (CollectionUtils.isEmpty(list)) {
- projectMaterialDaoService.saveMaterial(projectMaterial);
- } else {
- projectMaterial.setId(list.get(0).getId());
- projectMaterialDaoService.updateMaterial(projectMaterial);
- }
- //判断两种文件是否全
- validateUploadedFile(paramFile.getPid());
- }
- //中心上传数据
- public void centreUpload(ParamFile paramFile) {
- attachmentDao.deleteByBusiness(Constant.Attachment.PROJECT_ZX, paramFile.getPid());
- attachmentDao.updateAttachment(Constant.Attachment.PROJECT_ZX, paramFile.getPid(), paramFile.getFileDown().getFile_id());
- ProjectMaterial projectMaterial = new ProjectMaterial();
- projectMaterial.setApply_id(paramFile.getPid());
- projectMaterial.setTemplate_id(paramFile.getFileDown().getFile_id());
- projectMaterial.setMaterial_type(3);
- Example example = new Example(ProjectMaterial.class);
- Example.Criteria criteria = example.createCriteria();
- criteria.andEqualTo("apply_id", paramFile.getPid());
- criteria.andEqualTo("material_type", "3");
- List<ProjectMaterial> list = projectMaterialDao.selectByExample(example);
- if (CollectionUtils.isEmpty(list)) {
- projectMaterialDaoService.saveMaterial(projectMaterial);
- } else {
- projectMaterial.setId(list.get(0).getId());
- projectMaterialDaoService.updateMaterial(projectMaterial);
- }
- Approval a = new Approval();
- a.setApply_id(paramFile.getPid());
- a.setDeal_time(DateUtil.getTimeString(new Date()));
- a.setType(Constant.DictionaryType.PROJECT_APPLICATION);
- String departmentname = departmentService.selectById(userService.getUser(ShiroUtils.getUserId()).getDepartment_id()).getName();
- a.setDepartment(departmentname);
- a.setChecker(ShiroUtils.getUserId());
- a.setOper_type(Constant.OperType.APPROVED);
- a.setBefore_approvalstatus(Constant.ProjectApplicationStatus.COMMIT_FILE);
- a.setAfter_approvalstatus(Constant.ProjectApplicationStatus.FINANCE_AUDIT);
- Group group = groupService.findByName(Constant.XMSBCZSHZ, null);
- if (null == group) {
- throw new BaseException("操作失败,项目申报财政审核组没有该项目责任单位的审核人员,请联系管理员配置");
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- StringBuffer sb = new StringBuffer("");
- ProjectApplication projectApplication = projectApplicationDao.selectById(paramFile.getPid().toString());
- Company company = companyService.findById(projectApplication.getCompany_id());
- ProjectDeclaration projectDeclaration = this.findById(projectApplication.getDeclaration_id());
- String projectName = projectDeclaration.getProject_name();
- Message messages = new Message();
- messages.setApply_id(paramFile.getPid());
- messages.setBusiness_type(Constant.Message_Business_type.PROJECT_APPLY);
- messages.setTitle("提醒财政审核");
- waitToDoService.completeAllTODO(projectApplication.getId(), Constant.DictionaryType.PROJECT_APPLICATION);
- for (UserGroup userGroup : userGroups) {
- sb.append(userGroup.getUser_id() + ",");
- User user = userService.findById(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("项目申报审核", "/projectDeclaration/approve/" + projectApplication.getId(), Constant.WaitToDo_OperType.AUDIT, projectApplication.getId(),
- Constant.DictionaryType.PROJECT_APPLICATION, projectApplication.getApply_no(), user.getId().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false);
- }
- a.setNextchecker(sb.toString());
- if (null == sb || sb.length() == 0) {
- throw new BaseException("操作失败,项目申报财政审核组没有该项目责任单位的审核人员,请联系管理员配置");
- }
- approvalService.insertAndGetId(a);
- ProjectApplication pa = new ProjectApplication();
- pa.setId(paramFile.getPid());
- pa.setApprove_status(Constant.ProjectApplicationStatus.FINANCE_AUDIT);
- projectApplicationDao.updateByPrimaryKeySelective(pa);
- }
- private void validateUploadedFile(Integer id) {
- Example example1 = new Example(ProjectMaterial.class);
- Example example2 = new Example(ProjectMaterial.class);
- Example.Criteria criteria1 = example1.createCriteria();
- Example.Criteria criteria2 = example2.createCriteria();
- criteria1.andEqualTo("apply_id", id);
- criteria1.andEqualTo("material_type", "1");
- criteria2.andEqualTo("apply_id", id);
- criteria2.andEqualTo("material_type", "2");
- List<ProjectMaterial> list1 = projectMaterialDao.selectByExample(example1);
- List<ProjectMaterial> list2 = projectMaterialDao.selectByExample(example2);
- if (!CollectionUtils.isEmpty(list1) && !CollectionUtils.isEmpty(list2)) {
- Approval a = new Approval();
- a.setApply_id(id);
- a.setDeal_time(DateUtil.getTimeString(new Date()));
- a.setType(Constant.DictionaryType.PROJECT_APPLICATION);
- String departmentname = departmentService.selectById(userService.getUser(ShiroUtils.getUserId()).getDepartment_id()).getName();
- a.setDepartment(departmentname);
- a.setChecker(ShiroUtils.getUserId());
- a.setOper_type(Constant.OperType.APPROVED);
- a.setBefore_approvalstatus(Constant.ProjectApplicationStatus.UPLOAD_REPORT);
- a.setAfter_approvalstatus(Constant.ProjectApplicationStatus.NOTIFY);
- Group group = groupService.findByName(Constant.XMSBFZR, null);
- if (null == group) {
- throw new BaseException("操作失败,项目申报审核组没有该项目责任单位的审核人员,请联系管理员配置");
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- StringBuffer sb = new StringBuffer("");
- ProjectApplication projectApplication = projectApplicationDao.selectById(id.toString());
- Company company = companyService.findById(projectApplication.getCompany_id());
- ProjectDeclaration projectDeclaration = this.findById(projectApplication.getDeclaration_id());
- String projectName = projectDeclaration.getProject_name();
- Message messages = new Message();
- messages.setApply_id(id);
- messages.setBusiness_type(Constant.Message_Business_type.PROJECT_APPLY);
- messages.setTitle("提醒中心负责人");
- waitToDoService.completeAllTODO(projectApplication.getId(), Constant.DictionaryType.PROJECT_APPLICATION);
- for (UserGroup userGroup : userGroups) {
- sb.append(userGroup.getUser_id() + ",");
- User user = userService.findById(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("项目申报审核", "/projectDeclaration/approve/" + projectApplication.getId(), Constant.WaitToDo_OperType.AUDIT, projectApplication.getId(),
- Constant.DictionaryType.PROJECT_APPLICATION, projectApplication.getApply_no(), user.getId().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false);
- }
- a.setNextchecker(sb.toString());
- if (null == sb || sb.length() == 0) {
- throw new BaseException("操作失败,项目申报审核组没有该项目责任单位的审核人员,请联系管理员配置");
- }
- approvalService.insertAndGetId(a);
- ProjectApplication pa = new ProjectApplication();
- pa.setId(id);
- pa.setApprove_status(Constant.ProjectApplicationStatus.NOTIFY);
- projectApplicationDao.updateByPrimaryKeySelective(pa);
- } else if (CollectionUtils.isEmpty(list1) && !CollectionUtils.isEmpty(list2)) {
- Approval a = new Approval();
- a.setApply_id(id);
- a.setDeal_time(DateUtil.getTimeString(new Date()));
- a.setType(Constant.DictionaryType.PROJECT_APPLICATION);
- String departmentname = departmentService.selectById(userService.getUser(ShiroUtils.getUserId()).getDepartment_id()).getName();
- a.setDepartment(departmentname);
- a.setChecker(ShiroUtils.getUserId());
- a.setOper_type(Constant.OperType.APPROVED);
- a.setBefore_approvalstatus(Constant.ProjectApplicationStatus.UPLOAD_REPORT);
- a.setAfter_approvalstatus(Constant.ProjectApplicationStatus.UPLOAD_CZ);
- ProjectApplication projectApplication = projectApplicationDao.selectById(id.toString());
- Project project = new Project();
- project.setId(projectApplication.getProject_id());
- project = projectDao.selectOne(project);
- Integer departmentid = project.getDepartment_id();
- Group group = groupService.findByName(Constant.XMSBCLSHZ, null);
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findUserBydepartmentIdWithoutApprovalLevel(departmentid.toString());
- StringBuffer sb = new StringBuffer("");
- waitToDoService.completeAllTODO(projectApplication.getId(), Constant.DictionaryType.PROJECT_APPLICATION);
- for (UserGroup userGroup : userGroups) {
- for (User user : users) {
- if (Objects.equals(user.getId(), userGroup.getUser_id())) {
- sb.append(userGroup.getUser_id() + ",");
- waitToDoService.newTODO("项目申报审核", "/projectDeclaration/approve/" + projectApplication.getId(), Constant.WaitToDo_OperType.AUDIT, projectApplication.getId(),
- Constant.DictionaryType.PROJECT_APPLICATION, projectApplication.getApply_no(), user.getId().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false);
- }
- }
- }
- a.setNextchecker(sb.toString());
- approvalService.insertAndGetId(a);
- ProjectApplication pa = new ProjectApplication();
- pa.setId(id);
- pa.setApprove_status(Constant.ProjectApplicationStatus.UPLOAD_CZ);
- projectApplicationDao.updateByPrimaryKeySelective(pa);
- } else if (!CollectionUtils.isEmpty(list1) && CollectionUtils.isEmpty(list2)) {
- Approval a = new Approval();
- a.setApply_id(id);
- a.setDeal_time(DateUtil.getTimeString(new Date()));
- a.setType(Constant.DictionaryType.PROJECT_APPLICATION);
- ProjectApplication projectApplication = projectApplicationDao.selectById(id.toString());
- String departmentname = departmentService.selectById(userService.getUser(ShiroUtils.getUserId()).getDepartment_id()).getName();
- a.setDepartment(departmentname);
- a.setChecker(ShiroUtils.getUserId());
- a.setOper_type(Constant.OperType.APPROVED);
- a.setBefore_approvalstatus(Constant.ProjectApplicationStatus.UPLOAD_REPORT);
- a.setAfter_approvalstatus(Constant.ProjectApplicationStatus.UPLOAD_CS);
- StringBuffer sb = new StringBuffer("");
- Group groups = groupService.findByName(Constant.XMSBCZSHZ, null);
- List<UserGroup> userGroupss = userGroupService.findByGroupId(groups.getId());
- waitToDoService.completeAllTODO(projectApplication.getId(), Constant.DictionaryType.PROJECT_APPLICATION);
- for (UserGroup userGroup : userGroupss) {
- sb.append(userGroup.getUser_id() + ",");
- waitToDoService.newTODO("项目申报审核", "/projectDeclaration/approve/" + projectApplication.getId(), Constant.WaitToDo_OperType.AUDIT, projectApplication.getId(),
- Constant.DictionaryType.PROJECT_APPLICATION, projectApplication.getApply_no(), userGroup.getUser_id().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false);
- }
- a.setNextchecker(sb.toString());
- approvalService.insertAndGetId(a);
- ProjectApplication pa = new ProjectApplication();
- pa.setId(id);
- pa.setApprove_status(Constant.ProjectApplicationStatus.UPLOAD_CS);
- projectApplicationDao.updateByPrimaryKeySelective(pa);
- }
- }
- public ModelMap getMaterial(Integer id, ModelMap modelMap) {
- Example example = new Example(ProjectMaterial.class);
- Example.Criteria criteria = example.createCriteria();
- criteria.andEqualTo("apply_id", id);
- criteria.andEqualTo("del_flag", 0);
- List<ProjectMaterial> list = projectMaterialDao.selectByExample(example);
- //modelMap.addAttribute("approveMaterials", list);
- List<Attachment> attachments = attachmentDao.selectByIdAndBusinessId(Constant.Attachment.PROJECT_CS, id, null);
- List<Attachment> attachments2 = attachmentDao.selectByIdAndBusinessId(Constant.Attachment.PROJECT_CZ, id, null);
- List<Attachment> attachments3 = attachmentDao.selectByIdAndBusinessId(Constant.Attachment.PROJECT_ZX, id, null);
- attachments.addAll(attachments2);
- attachments.addAll(attachments3);
- FileDown fd = new FileDown();
- fd.setFile_name("");
- fd.setDownload_uri("");
- fd.setFile_url("");
- fd.setFile_id(null);
- modelMap.addAttribute("czMaterials", fd);
- modelMap.addAttribute("csMaterials", fd);
- modelMap.addAttribute("zxMaterials", fd);
- for (ProjectMaterial projectMaterial : list) {
- if (Objects.equals(1, projectMaterial.getMaterial_type())) {
- for (Attachment attachment : attachments) {
- if (Objects.equals(attachment.getId(), projectMaterial.getTemplate_id())) {
- FileDown fileDown = new FileDown(attachment.getId(), attachment.getFile_name(), attachment.getFile_url(), attachment.getDownload_uri());
- modelMap.addAttribute("csMaterials", fileDown);
- }
- }
- }
- if (Objects.equals(2, projectMaterial.getMaterial_type())) {
- for (Attachment attachment : attachments) {
- if (Objects.equals(attachment.getId(), projectMaterial.getTemplate_id())) {
- FileDown fileDown = new FileDown(attachment.getId(), attachment.getFile_name(), attachment.getFile_url(), attachment.getDownload_uri());
- modelMap.addAttribute("czMaterials", fileDown);
- }
- }
- }
- if (Objects.equals(3, projectMaterial.getMaterial_type())) {
- for (Attachment attachment : attachments) {
- if (Objects.equals(attachment.getId(), projectMaterial.getTemplate_id())) {
- FileDown fileDown = new FileDown(attachment.getId(), attachment.getFile_name(), attachment.getFile_url(), attachment.getDownload_uri());
- modelMap.addAttribute("zxMaterials", fileDown);
- }
- }
- }
- }
- return modelMap;
- }
- public boolean isFina() {
- //Group group = groupService.findByName(Constant.XMSBCLSHZ, null);
- Group group = groupService.findByName(Constant.XMSBCZSHZ, null);
- if (group == null) {
- return false;
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- //Department department = departmentService.findByName(Constant.QCZC, null);
- //List<User> users = userService.findUserBydepartmentId(department.getId().toString());
- StringBuffer sb = new StringBuffer("");
- for (UserGroup userGroup : userGroups) {
- //for (User user : users) {
- //if (Objects.equals(user.getId(), userGroup.getUser_id())) {
- if (String.valueOf(ShiroUtils.getUserId()).equals(String.valueOf(userGroup.getUser_id()))) {
- return true;
- }
- //}
- //}
- }
- return false;
- }
- public PageInfo<ProjectDeclaration> findByCompany(String projectName, Integer pageNum, Integer pagesize,
- String startTime1, String startTime2, String endTime1, String endTime2) {
- PageHelper.startPage(pageNum, pagesize);
- FindRequest request = new FindRequest();
- request.setUser_type(Constant.UserType.COMPANY);
- request.setCompany_id(ShiroUtils.getCompanyId());
- List<ProjectDeclaration> list = projectDeclarationDao.findByCondition(projectName, startTime1, startTime2, endTime1, endTime2, request, new ProjectDeclaration());
- for (ProjectDeclaration projectDeclaration : list) {
- if (Objects.equals(projectDeclaration.getStatus(), "0")) {
- projectDeclaration.setStatus_name("待发布");
- } else {
- try {
- String end = projectDeclaration.getApply_enddate();
- if (end.length() <= 10) end += " 23:59:59";
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- Date endtime = sdf.parse(end);
- Date now = new Date();
- if (now.before(endtime)) {
- projectDeclaration.setStatus_name("申请中");
- projectDeclaration.setCanApply(true);
- } else {
- projectDeclaration.setStatus_name("失效");
- projectDeclaration.setCanApply(false);
- }
- } catch (Exception e) {
- projectDeclaration.setStatus_name("申请中");
- }
- }
- }
- return new PageInfo<ProjectDeclaration>(list);
- }
- public ModelMap getDictInfo(ModelMap modelMap) {
- //项目大类
- List<DictionaryItem> projectSuperTypeList = dictionaryItemService.findListByTypeName(Constant.DictionaryType.PROJECT_APPLICATION_SUPER_TYPE);
- modelMap.put("projectSuperTypeList", projectSuperTypeList);
- //项目来源
- List<DictionaryItem> projectSourceList = dictionaryItemService.findListByTypeName(Constant.DictionaryType.PROJECT_SOURCE);
- modelMap.put("projectSourceList", projectSourceList);
- //责任单位
- Department department = new Department();
- department.setDel_flag(false);
- department.setUser_type(ShiroUtils.getUserEntity().getUser_type());
- department.setUser_type(Constant.UserType.GOVERNMENT);
- modelMap.addAttribute("departmentList", departmentService.findListByWhere(department));
- return modelMap;
- }
- //可以在线申报的项目
- public PageInfo<ProjectDeclaration> findActive(String projectName, Integer pageNum, Integer pagesize,
- String startTime1, String startTime2, String endTime1, String endTime2) {
- PageHelper.startPage(pageNum, pagesize);
- FindRequest request = new FindRequest();
- request.setIsActive(true);
- ProjectDeclaration decl = new ProjectDeclaration();
- decl.setIs_online_application("1");
- List<ProjectDeclaration> list = projectDeclarationDao.findByCondition(projectName, startTime1, startTime2, endTime1, endTime2, request, decl);
- for (ProjectDeclaration projectDeclaration : list) {
- if (Objects.equals(projectDeclaration.getStatus(), "0")) {
- projectDeclaration.setStatus_name("待发布");
- } else {
- try {
- String end = projectDeclaration.getApply_enddate();
- if (end.length() <= 10) end += " 23:59:59";
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- Date endtime = sdf.parse(end);
- Date now = new Date();
- if (now.before(endtime)) {
- projectDeclaration.setStatus_name("申请中");
- projectDeclaration.setCanApply(true);
- } else {
- projectDeclaration.setStatus_name("失效");
- projectDeclaration.setCanApply(false);
- }
- } catch (Exception e) {
- projectDeclaration.setStatus_name("申请中");
- }
- }
- }
- return new PageInfo<ProjectDeclaration>(list);
- }
- public FindResponseProject findProejctsOnHome(FindRequest request) {
- FindResponseProject response = new FindResponseProject();
- PageHelper.startPage(request.getPage_no(), request.getPage_size());
- List<ProjectDeclaration> contents;
- //报表填报
- if (request.getId() == 77) {
- contents = projectFillingService.findUnionProjectsOnHome(request);
- } else {//项目申报、省市申报
- contents = projectDeclarationDao.findUnionProjectsOnHome(request);
- }
- if (contents.size() > 0) {
- for (ProjectDeclaration project : contents) {
- if (null != project.getProject_source()) {
- String sourceName = dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.PROJECT_SOURCE, project.getProject_source());
- project.setProject_source_name(sourceName);
- }
- }
- }
- PageInfo<ProjectDeclaration> pageInfo = new PageInfo<>(contents);
- response.setProjects(contents);
- response.setCounts((int) pageInfo.getTotal());
- response.setPage_no(request.getPage_no());
- return response;
- }
- PageInfo<OrderTrackingDto> findOrderTrackingPage(Integer pageNum, Integer pagesize, String businessType, String typeId, String number, String companyName, String startDate, String endDate) {
- PageHelper.startPage(pageNum, pagesize);
- List<OrderTrackingDto> list = projectApplicationDao.findOrderTrackingPage(businessType, typeId, number, companyName, startDate, endDate);
- return new PageInfo<OrderTrackingDto>(list);
- }
- /**
- * 功能描述:单据追踪导出
- *
- * @param:
- * @return:
- * @auther: huZhiHao
- * @date: 2018/9/26 15:26
- */
- public void exportOrder(HttpServletResponse response, String businessType, String typeId, String number, String companyName, String startDate, String endDate) throws Exception {
- List<OrderTrackingDto> list = projectApplicationDao.findOrderTrackingPage(businessType, typeId, number, companyName, startDate, endDate);
- String fileName = "单据追踪.xlsx";
- List<OrderExports> applyList = new ArrayList<>();
- for (OrderTrackingDto orderTrackingDto : list) {
- OrderExports orderExports = new OrderExports();
- orderExports.setBusinessName(orderTrackingDto.getBusinessName());
- orderExports.setTypeName(orderTrackingDto.getTypeName());
- orderExports.setNumber(orderTrackingDto.getNumber());
- orderExports.setCompanyName(orderTrackingDto.getCompanyName());
- orderExports.setStatus(orderTrackingDto.getStatus());
- applyList.add(orderExports);
- }
- new ExportExcel("单据追踪", OrderExports.class).setDataList(applyList).write(response, fileName).dispose();
- }
- /**
- * 项目申报详情
- *
- * @param request
- * @return
- */
- public PageInfo<ProjectDeclaration> findProjectList(FindRequest request) {
- PageHelper.startPage(request.getPage_no(), request.getPage_size());
- List<ProjectDeclaration> contents = projectDeclarationDao.findUnionProjectsOnHome(request);
- return new PageInfo<>(contents);
- }
- public List<ProjectApplicationImportDto> importData(InputStream inputStream, Workbook wb) throws Exception {
- Row row = null;
- Cell cell = null;
- Sheet sheet = (Sheet) wb.getSheetAt(0);
- int tatalRows = sheet.getPhysicalNumberOfRows();
- if (tatalRows == 2) {
- throw new Exception("请添加数据");
- }
- String year = "";
- String street = "";
- String companyName = "";
- String projectType = "";
- String projectName = "";
- String projectName_ = "";
- List<ProjectApplicationImportDto> projectApplicationImportDtoList = new ArrayList<>();
- //从3行读取数据
- for (int r = 2; r < tatalRows; r++) {
- //获取行数据
- row = sheet.getRow(r);
- cell = row.getCell(0);
- year = getCellValue(cell, r, "年度") == "" ? year : getCellValue(cell, r, "年度");
- cell = row.getCell(1);
- street = getCellValue(cell, r, "属地") == "" ? street : getCellValue(cell, r, "属地");
- cell = row.getCell(2);
- companyName = getCellValue(cell, r, "企业名称");
- cell = row.getCell(3);
- projectType = getCellValue(cell, r, "项目大类");
- cell = row.getCell(4);
- projectName = getCellValue(cell, r, "项目小类");
- cell = row.getCell(5);
- projectName_ = getCellValue(cell, r, "申报项目名称");
- if (companyName == "" || projectType == "" || projectName == "") {
- continue;
- }
- ProjectApplicationImportDto projectApplicationImportDto = new ProjectApplicationImportDto();
- projectApplicationImportDto.setProjectYear(year);
- projectApplicationImportDto.setStreetName(street);
- projectApplicationImportDto.setCompanyName(companyName);
- projectApplicationImportDto.setSuperTypeName(projectType);
- projectApplicationImportDto.setTypeName(projectName);
- projectApplicationImportDto.setProjectName(projectName_);
- projectApplicationImportDtoList.add(projectApplicationImportDto);
- }
- List<ProjectApplicationImportDto> errorList = updateApplication(projectApplicationImportDtoList);
- return errorList;
- }
- /**
- * 获取单元格值
- */
- private static String getCellValue(Cell cell, int index, String thead) throws Exception {
- String value = null;
- if (cell != null) {
- cell.setCellType(Cell.CELL_TYPE_STRING);
- value = cell.getStringCellValue();
- if (StringUtils.isNotBlank(value)) {
- return value;
- }
- }
- return value;
- //throw new Exception("第"+(index+1)+"行"+thead+"不能为空");
- }
- private List<ProjectApplicationImportDto> updateApplication(List<ProjectApplicationImportDto> projectApplicationImportDtoList) {
- // Example example = new Example(ProjectApplication.class);
- // Example.Criteria criteria = example.createCriteria();
- // criteria.andEqualTo("del_flag", 0);
- // example.setOrderByClause("create_time desc");
- // List<ProjectApplication> applys = projectApplicationService.selectByExample(example);
- List<ProjectApplicationImportDto> projectApplicationList = projectApplicationService.importList();
- List<ProjectApplicationImportDto> errorList = new ArrayList<>();
- List<String> ids = new ArrayList<>();
- for (ProjectApplicationImportDto projectApplicationImportDto : projectApplicationImportDtoList) {
- boolean flag = true;
- for (ProjectApplicationImportDto projectApplication : projectApplicationList) {
- if (
- projectApplication.getPass() == null
- && projectApplication.getProjectYear() != null
- && projectApplication.getCompanyName() != null
- && projectApplication.getSuperTypeName() != null
- && projectApplication.getTypeName() != null
- && projectApplication.getProjectName() != null
- && projectApplicationImportDto.getProjectYear() != null
- && projectApplicationImportDto.getCompanyName() != null
- && projectApplicationImportDto.getSuperTypeName() != null
- && projectApplicationImportDto.getTypeName() != null
- && projectApplicationImportDto.getProjectName() != null
- ) {
- if (
- Objects.equals(StringUtils.trim(projectApplicationImportDto.getProjectYear()), StringUtils.trim(projectApplication.getProjectYear()))
- && Objects.equals(StringUtils.trim(projectApplicationImportDto.getCompanyName()), StringUtils.trim(projectApplication.getCompanyName()))
- && projectApplicationImportDto.getSuperTypeName().contains(projectApplication.getSuperTypeName())
- &&
- (
- projectApplicationImportDto.getTypeName().contains(projectApplication.getTypeName())
- || projectApplicationImportDto.getProjectName().contains(projectApplication.getProjectName())
- )
- ) {
- //判断是否已经更新过此id 因为会存在相同 名称 项目大小类的数据
- boolean duplicateId = false;
- for (String id : ids) {
- if (Objects.equals(projectApplication.getId(), id)) {
- duplicateId = true;
- continue;
- }
- }
- if (duplicateId) {
- continue;
- }
- ProjectApplication projectApp = new ProjectApplication();
- projectApp.setId(Integer.valueOf(projectApplication.getId()));
- projectApp.setPass("通过");
- projectApplicationService.updateSelective(projectApp);
- ids.add(projectApplication.getId());
- flag = false;
- break;
- }
- }
- }
- if (flag) {
- errorList.add(projectApplicationImportDto);
- }
- }
- System.out.println(ids.toString());
- return errorList;
- }
- }
|