| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427 |
- 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 void 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);
- }
- updateApplication(projectApplicationImportDtoList);
- }
- /**
- * 获取单元格值
- */
- 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 void 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();
- for (ProjectApplicationImportDto projectApplication : projectApplicationList) {
- for (ProjectApplicationImportDto projectApplicationImportDto : projectApplicationImportDtoList) {
- if (
- Objects.equals(projectApplicationImportDto.getProjectYear(), projectApplication.getProjectYear())
- && Objects.equals(projectApplicationImportDto.getCompanyName(), projectApplication.getCompanyName())
- && projectApplicationImportDto.getSuperTypeName().contains(projectApplication.getSuperTypeName())
- && projectApplicationImportDto.getTypeName().contains(projectApplication.getTypeName())
- ) {
- ProjectApplication projectApp = new ProjectApplication();
- projectApp.setId(Integer.valueOf(projectApplication.getId()));
- projectApp.setPass("通过");
- projectApplicationService.updateSelective(projectApp);
- break;
- }
- }
- }
- }
- }
|