| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921 |
- 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 com.xiaoleilu.hutool.util.StrUtil;
- import org.apache.commons.lang3.StringUtils;
- import org.apache.poi.xwpf.usermodel.XWPFDocument;
- import org.springframework.beans.BeanUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.beans.factory.annotation.Value;
- import org.springframework.stereotype.Service;
- import org.springframework.transaction.annotation.Transactional;
- import org.springframework.util.CollectionUtils;
- import platform.common.Constant;
- import platform.common.base.service.BaseService;
- import platform.common.base.service.DictionaryItemService;
- import platform.common.exception.BaseException;
- import platform.common.util.*;
- import platform.common.util.word.ExportWord;
- import platform.modules.company.dto.LandSupplyApprovalDto;
- import platform.modules.company.entity.ProjectApplication;
- import platform.modules.government.dao.IndustrialLandSupplyDetailDao;
- import platform.modules.government.dto.DepartmentDto;
- import platform.modules.government.dto.IndustrialLandSupplyDto;
- import platform.modules.government.dto.IndustrialLandSupplyParam;
- import platform.modules.government.entity.*;
- import platform.modules.sys.entity.*;
- import platform.modules.sys.service.*;
- import tk.mybatis.mapper.entity.Example;
- import javax.annotation.Resource;
- import javax.servlet.http.HttpServletResponse;
- import java.io.File;
- import java.io.IOException;
- import java.io.UnsupportedEncodingException;
- import java.net.URLEncoder;
- import java.text.ParseException;
- import java.util.*;
- import java.util.stream.Collectors;
- /**
- * 功能描述: 产业供地详情
- *
- * @Author: huZhiHao
- * @Date: 2020/3/5
- **/
- @Service
- public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLandSupplyDetail> {
- @Resource
- private IndustrialLandSupplyDetailDao industrialLandSupplyDetailDao;
- @Autowired
- private IndustrialLandSupplyConsultationService industrialLandSupplyConsultationService;
- @Autowired
- private IndustrialLandSupplyDistributionService industrialLandSupplyDistributionService;
- @Autowired
- private IndustrialLandSupplyConfigService industrialLandSupplyConfigService;
- @Autowired
- private ApprovalService approvalService;
- @Autowired
- private AttachmentService attachmentService;
- @Autowired
- private UserService userService;
- @Autowired
- private GroupService groupService;
- @Autowired
- private UserGroupService userGroupService;
- @Autowired
- private DepartmentService departmentService;
- @Autowired
- private DictionaryItemService dictionaryItemService;
- @Autowired
- private SysConfigService sysConfigService;
- private static String FEEDBACK_TIME = "1";
- private static String SUMMARY_TIME = "2";
- private static String DISTRIBUTE_TIME = "3";
- private static String JOINT_TRIAL_TIME = "4";
- private static String CONSULTATION_MESSAGE = "请反馈明确意见";
- @Value("${repositoryPath}")
- public String repositoryPath;
- final private String attachmentType = "annex_template";
- /**
- * @Author: huZhiHao
- * @Description: 分页查询
- * @Date: 2020/3/6
- * @Params: [pageNum, pagesize, title, location, status, stage]
- * @Return: com.github.pagehelper.PageInfo<platform.modules.government.entity.IndustrialLandSupplyDetail>
- **/
- @Transactional
- public PageInfo<IndustrialLandSupplyDto> findPage(Integer pageNum, Integer pageSize, IndustrialLandSupplyParam param, String type) throws ParseException {
- param.setApproval_type(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY);
- //是否是待处理页面
- boolean flag = true;
- if (Objects.equals("1", type)) {
- //待处理
- flag = true;
- param.setApplyIds(getProjectIdsByGroup());
- } else if (Objects.equals("2", type)) {
- //已处理
- flag = false;
- param.setApplyIds(getProjectIdsy());
- } else if (Objects.equals("3", type)) {
- //查看所有
- flag = false;
- param.setApplyIds(getProjectIdsc());
- }
- PageHelper.startPage(pageNum, pageSize);
- List<IndustrialLandSupplyDto> list = industrialLandSupplyDetailDao.findPage(param);
- for (IndustrialLandSupplyDto entity : list) {
- if (null != entity.getApprove_status()) {
- String status_name = dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY_APPROVE_STATUS, entity.getApprove_status());
- entity.setApprove_status_desc(status_name);
- getPendingDepartment(entity);
- if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK, entity.getApprove_status())
- || Objects.equals("a", entity.getApprove_status())) {
- //咨询待反馈剩余时间
- int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(FEEDBACK_TIME));
- IndustrialLandSupplyConsultation landSupplyConsultation = new IndustrialLandSupplyConsultation();
- landSupplyConsultation.setIndustrial_land_supply_id(entity.getId());
- Department department = departmentService.findRootById(ShiroUtils.getUserEntity().getDepartment_id());
- landSupplyConsultation.setDepartment_id(department.getId() + "");
- List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(landSupplyConsultation);
- if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
- IndustrialLandSupplyConsultation industrialLandSupplyConsultation = industrialLandSupplyConsultationList.get(industrialLandSupplyConsultationList.size() - 1);
- // entity.setRemain_time(DateUtil.getTimeDiffStr(industrialLandSupplyConsultation.getConsultation_time(), days));
- String dealTime = null;
- if (!flag) {
- Approval approval = new Approval();
- approval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
- approval.setApply_id(Integer.parseInt(entity.getId()));
- approval.setCreate_by(ShiroUtils.getUserId());
- List<Approval> approvals = approvalService.findListByWhere(approval);
- if (!CollectionUtils.isEmpty(approvals)) {
- dealTime = approvals.get(approvals.size() - 1).getCreate_time();
- try {
- if (entity.getUpdate_time() == null) {
- entity.setUpdate_time("1970-01-01 00:00:00");
- }
- Date d1 = DateUtil.parseTimeStringToDate(entity.getUpdate_time(), "yyyy-MM-dd hh:mm:ss");
- Date d2 = DateUtil.parseTimeStringToDate(dealTime, "yyyy-MM-dd hh:mm:ss");
- if (d2.before(d1)) {
- dealTime = null;
- }
- } catch (ParseException e) {
- e.printStackTrace();
- }
- }
- }
- entity.setRemain_time(DateUtil.getTimeDiff(
- industrialLandSupplyConsultation.getConsultation_time(),
- dealTime,
- days,
- sysConfigService.getValueByKey("year_" + DateUtil.getCurrentDateString("yyyy"))
- ));
- }
- } else if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUMMARY, entity.getApprove_status())) {
- //咨询待汇总剩余时间
- Approval approval = new Approval();
- approval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUMMARY);
- approval.setApply_id(Integer.parseInt(entity.getId()));
- List<Approval> approvalList = approvalService.findListByWhere(approval);
- if (!CollectionUtils.isEmpty(approvalList)) {
- Approval approve = approvalList.get(approvalList.size() - 1);
- int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(SUMMARY_TIME));
- // entity.setRemain_time(DateUtil.getTimeDiffStr(approve.getCreate_time(), days));
- String dealTime = null;
- if (!flag) {
- approval = new Approval();
- approval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUMMARY);
- approval.setApply_id(Integer.parseInt(entity.getId()));
- List<Approval> approvals = approvalService.findListByWhere(approval);
- if (!CollectionUtils.isEmpty(approvals)) {
- dealTime = approvals.get(approvals.size() - 1).getCreate_time();
- try {
- Date d1 = DateUtil.parseTimeStringToDate(entity.getUpdate_time(), "yyyy-MM-dd hh:mm:ss");
- Date d2 = DateUtil.parseTimeStringToDate(dealTime, "yyyy-MM-dd hh:mm:ss");
- if (d2.before(d1)) {
- dealTime = null;
- }
- } catch (ParseException e) {
- e.printStackTrace();
- }
- }
- }
- entity.setRemain_time(DateUtil.getTimeDiff(
- approve.getCreate_time(),
- dealTime,
- days,
- sysConfigService.getValueByKey("year_" + DateUtil.getCurrentDateString("yyyy"))
- ));
- }
- } else if (Objects.equals(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK, entity.getApprove_status())
- || Objects.equals("a", entity.getApprove_status())) {
- //分发待反馈剩余时间
- /*int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(DISTRIBUTE_TIME));
- IndustrialLandSupplyDistribution landSupplyDistribution = new IndustrialLandSupplyDistribution();
- landSupplyDistribution.setIndustrial_land_supply_id(entity.getId());
- Department department = departmentService.findRootById(ShiroUtils.getUserEntity().getDepartment_id());
- landSupplyDistribution.setDepartment_id(department.getId() + "");
- List<IndustrialLandSupplyDistribution> industrialLandSupplylandSupplyDistributionList = industrialLandSupplyDistributionService.findListByWhere(landSupplyDistribution);
- if (!CollectionUtils.isEmpty(industrialLandSupplylandSupplyDistributionList)) {
- IndustrialLandSupplyDistribution industrialLandSupplyDistribution = industrialLandSupplylandSupplyDistributionList.get(industrialLandSupplylandSupplyDistributionList.size() - 1);
- // entity.setRemain_time(DateUtil.getTimeDiffStr(industrialLandSupplyDistribution.getDistribute_time(), days));
- String dealTime = null;
- if (!flag) {
- Approval approval = new Approval();
- approval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK);
- approval.setApply_id(Integer.parseInt(entity.getId()));
- approval.setCreate_by(ShiroUtils.getUserId());
- List<Approval> approvals = approvalService.findListByWhere(approval);
- if (!CollectionUtils.isEmpty(approvals)) {
- dealTime = approvals.get(approvals.size() - 1).getCreate_time();
- try {
- Date d1 = DateUtil.parseTimeStringToDate(entity.getUpdate_time(), "yyyy-MM-dd hh:mm:ss");
- Date d2 = DateUtil.parseTimeStringToDate(dealTime, "yyyy-MM-dd hh:mm:ss");
- if (d2.before(d1)) {
- dealTime = null;
- }
- } catch (ParseException e) {
- e.printStackTrace();
- }
- }
- }
- entity.setRemain_time(DateUtil.getTimeDiff(
- industrialLandSupplyDistribution.getDistribute_time(),
- dealTime,
- days,
- sysConfigService.getValueByKey("year_" + DateUtil.getCurrentDateString("yyyy"))
- ));
- }*/
- } else if (Objects.equals(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_SUMMARY, entity.getApprove_status())) {
- //会审审批剩余时间
- Approval approval = new Approval();
- approval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_SUMMARY);
- approval.setApply_id(Integer.parseInt(entity.getId()));
- List<Approval> approvalList = approvalService.findListByWhere(approval);
- if (!CollectionUtils.isEmpty(approvalList)) {
- Approval approve = approvalList.get(approvalList.size() - 1);
- int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(JOINT_TRIAL_TIME));
- // entity.setRemain_time(DateUtil.getTimeDiffStr(approve.getCreate_time(), days));
- String dealTime = null;
- if (!flag) {
- approval = new Approval();
- approval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PENDIND_HANDLE);
- approval.setApply_id(Integer.parseInt(entity.getId()));
- List<Approval> approvals = approvalService.findListByWhere(approval);
- if (!CollectionUtils.isEmpty(approvals)) {
- dealTime = approvals.get(approvals.size() - 1).getCreate_time();
- try {
- Date d1 = DateUtil.parseTimeStringToDate(entity.getUpdate_time(), "yyyy-MM-dd hh:mm:ss");
- Date d2 = DateUtil.parseTimeStringToDate(dealTime, "yyyy-MM-dd hh:mm:ss");
- if (d2.before(d1)) {
- dealTime = null;
- }
- } catch (ParseException e) {
- e.printStackTrace();
- }
- }
- }
- entity.setRemain_time(DateUtil.getTimeDiff(
- approve.getCreate_time(),
- dealTime,
- days,
- sysConfigService.getValueByKey("year_" + DateUtil.getCurrentDateString("yyyy"))
- ));
- }
- }
- }
- if (null != entity.getProcess_stage()) {
- String process_stage_name = dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY_APPROVE_STAGE, entity.getProcess_stage());
- entity.setProcess_stage_desc(process_stage_name);
- }
- List<Attachment> attachmentList = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_GS, Integer.valueOf(entity.getId()), null);
- if (null != entity.getGs_feedback() || !CollectionUtils.isEmpty(attachmentList)) {
- entity.setGs_feedback("0");
- }
- }
- return new PageInfo<IndustrialLandSupplyDto>(list);
- }
- /**
- * @Author: huZhiHao
- * @Description: 获取待咨询部门
- * @Date: 2020/3/11
- * @Params: [entity]
- * @Return: void
- **/
- private void getPendingDepartment(IndustrialLandSupplyDto entity) {
- if (Objects.equals(Constant.UserType.GOVERNMENT, ShiroUtils.getUserType())) {
- String id = entity.getId();
- String approveStatus = entity.getApprove_status();
- User user = ShiroUtils.getUserEntity();
- if (Objects.equals(approveStatus, Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK)) {
- IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
- industrialLandSupplyConsultation.setIndustrial_land_supply_id(id);
- //industrialLandSupplyConsultation.setDepartment_id(user.getDepartment_id() + "");
- Department department = departmentService.findRootById(user.getDepartment_id());
- industrialLandSupplyConsultation.setDepartment_id(department.getId() + "");
- List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
- boolean sumbitToSummary = false;
- for (IndustrialLandSupplyConsultation landSupplyConsultation : industrialLandSupplyConsultationList) {
- //是否所有咨询都已回答
- if (CommonUtils.isNull(landSupplyConsultation.getFeedback()) || CommonUtils.isNull(landSupplyConsultation.getUpdate_by())) {
- sumbitToSummary = false;
- break;
- } else {
- sumbitToSummary = true;
- }
- }
- //接受咨询的举办 负责的状态
- Group group = groupService.findByName(Constant.INDUSTRIALLANDSUPPLY_2, null);
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- if (Objects.equals(userGroup.getUser_id(), user.getId())) {
- //Department department = departmentService.selectById(user.getDepartment_id());
- department = departmentService.findRootById(user.getDepartment_id());
- if (sumbitToSummary) {
- entity.setApprove_status_desc(department.getName() + "已反馈");
- entity.setApprove_status("a");
- } else {
- entity.setApprove_status_desc(department.getName() + "待反馈");
- }
- break;
- }
- }
- } else if (Objects.equals(approveStatus, Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK)) {
- IndustrialLandSupplyDistribution industrialLandSupplyDistribution = new IndustrialLandSupplyDistribution();
- industrialLandSupplyDistribution.setIndustrial_land_supply_id(id);
- //industrialLandSupplyDistribution.setDepartment_id(user.getDepartment_id() + "");
- Department department = departmentService.findRootById(user.getDepartment_id());
- industrialLandSupplyDistribution.setDepartment_id(department.getId() + "");
- List<IndustrialLandSupplyDistribution> industrialLandSupplyDistributionList = industrialLandSupplyDistributionService.findListByWhere(industrialLandSupplyDistribution);
- boolean sumbitToSummary = false;
- for (IndustrialLandSupplyDistribution landSupplyDistribution : industrialLandSupplyDistributionList) {
- //是否所有咨询都已回答
- if (CommonUtils.isNull(landSupplyDistribution.getFeedback()) || CommonUtils.isNull(landSupplyDistribution.getUpdate_by())) {
- sumbitToSummary = false;
- break;
- } else {
- sumbitToSummary = true;
- }
- }
- //接受分发的举办 负责的状态
- Group group = groupService.findByName(Constant.INDUSTRIALLANDSUPPLY_5, null);
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- if (Objects.equals(userGroup.getUser_id(), user.getId())) {
- //Department department = departmentService.selectById(user.getDepartment_id());
- department = departmentService.findRootById(user.getDepartment_id());
- if (sumbitToSummary) {
- entity.setApprove_status_desc(department.getName() + "已反馈");
- entity.setApprove_status("a");
- } else {
- entity.setApprove_status_desc(department.getName() + "待反馈");
- }
- break;
- }
- }
- }
- }
- }
- /**
- * @Author: huZhiHao
- * @Description: 查询详情
- * @Date: 2020/3/11
- * @Params: [id]
- * @Return: platform.modules.government.entity.IndustrialLandSupplyDetail
- **/
- @Transactional
- public IndustrialLandSupplyDetail selectById(String id) throws ParseException {
- IndustrialLandSupplyDetail entity = industrialLandSupplyDetailDao.selectById(id);
- //文件
- List<Attachment> attachments = null;
- //基本信息附件
- attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY, entity.getId(), null);
- if (null != attachments && attachments.size() > 0) {
- List<FileDown> fileList = new ArrayList<>();
- for (Attachment attachment : attachments) {
- FileDown fileDown = new FileDown(attachment.getId(), attachment.getFile_name(), attachment.getFile_url(), attachment.getDownload_uri());
- fileList.add(fileDown);
- }
- entity.setFileList(fileList);
- }
- //补充附件
- attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_COMMERCE_SUPPLEMENT, entity.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());
- entity.setSupplement_file(fileDown);
- }
- //汇总附件
- attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_SUMMARY, entity.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());
- entity.setConsultation_summary_file(fileDown);
- }
- //商务局分管领导附件
- attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_COMMERCE_LEADER, entity.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());
- entity.setCommerce_leader_pre_approve_file(fileDown);
- }
- //管委会分管领导附件
- attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_MANAGEMENT_COMMITTEE_LEADER, entity.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());
- entity.setCommittee_leader_pre_approve_file(fileDown);
- }
- //分发汇总附件
- attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE_SUMMARY, entity.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());
- entity.setDistribution_summary_file(fileDown);
- }
- //专题会审附件
- attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_JOINT_TRIAL, entity.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());
- entity.setJoint_trial_file(fileDown);
- }
- //供地审批附件
- attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_APPROVE, entity.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());
- entity.setLand_supply_file(fileDown);
- }
- //最终信息附件
- attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_FINAL, entity.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());
- entity.setFinal_file(fileDown);
- }
- //行政反馈附件
- attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_GS, entity.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());
- entity.setGs_feedback_file(fileDown);
- }
- //会签附件
- attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_MANAGEMENT_COMMITTEE_LEADER_COUNTERSIGN, entity.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());
- entity.setCountersign_file(fileDown);
- }
- //状态详情
- if (null != entity.getApprove_status()) {
- String status_name = dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY_APPROVE_STATUS, entity.getApprove_status());
- entity.setApprove_status_desc(status_name);
- }
- if (null != entity.getProcess_stage()) {
- String process_stage_name = dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY_APPROVE_STAGE, entity.getProcess_stage());
- entity.setProcess_stage_desc(process_stage_name);
- }
- User user = userService.getUser(entity.getCreate_by());
- if (CommonUtils.isNotNull(user) && Constant.UserType.STREET.equals(user.getUser_type())) {
- if (CommonUtils.isNotNull(user.getDepartment_name()) && Objects.equals(user.getDepartment_name(), "招商中心")) {
- entity.setResource(user.getDepartment_name());
- } else {
- entity.setResource(user.getStreet_name());
- }
- } else if (CommonUtils.isNotNull(user) && Constant.UserType.GOVERNMENT.equals(user.getUser_type())) {
- entity.setResource(user.getDepartment_name());
- }
- //咨询列表
- IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
- industrialLandSupplyConsultation.setIndustrial_land_supply_id(id);
- industrialLandSupplyConsultation.setDel_flag(false);
- List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
- for (IndustrialLandSupplyConsultation landSupplyConsultation : industrialLandSupplyConsultationList) {
- /* if (Objects.equals(landSupplyConsultation.getConsultation(), CONSULTATION_MESSAGE)) {
- landSupplyConsultation.setIsDefault(true);
- } else */
- if (landSupplyConsultation.getIsDefault() == null) {
- landSupplyConsultation.setIsDefault(false);
- }
- //文件
- List<Attachment> feedbackAttachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_FEEDBACK, landSupplyConsultation.getId(), null);
- if (null != feedbackAttachments && feedbackAttachments.size() > 0) {
- FileDown fileDown = new FileDown(feedbackAttachments.get(0).getId(), feedbackAttachments.get(0).getFile_name(), feedbackAttachments.get(0).getFile_url(), feedbackAttachments.get(0).getDownload_uri());
- landSupplyConsultation.setFileDown(fileDown);
- }
- if (CommonUtils.isNull(landSupplyConsultation.getFeedback())) {
- landSupplyConsultation.setCanWithdraw(true);
- } else {
- landSupplyConsultation.setCanWithdraw(false);
- }
- Department department = departmentService.selectById(Integer.valueOf(landSupplyConsultation.getDepartment_id()));
- if (department != null) {
- landSupplyConsultation.setDepartment_name(department.getName());
- }
- //是否同意
- if (landSupplyConsultation.getIsAgree() != null) {
- String feedback = landSupplyConsultation.getFeedback();
- String str = "";
- if (landSupplyConsultation.getIsAgree()) {
- str = "同意。";
- } else {
- str = "不同意。";
- }
- landSupplyConsultation.setFeedback(str + feedback);
- }
- int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(FEEDBACK_TIME));
- // landSupplyConsultation.setRemain_time(DateUtil.getTimeDiffStr(landSupplyConsultation.getConsultation_time(), days));
- String dealTime = null;
- Approval approval = new Approval();
- approval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
- approval.setApply_id(Integer.parseInt(id));
- List<Approval> approvals = approvalService.findListByWhere(approval);
- if (!CollectionUtils.isEmpty(approvals)) {
- dealTime = approvals.get(approvals.size() - 1).getCreate_time();
- try {
- Date d1 = DateUtil.parseTimeStringToDate(entity.getUpdate_time() == null ? "1970-01-01 00:00:00" : entity.getUpdate_time(), "yyyy-MM-dd hh:mm:ss");
- Date d2 = DateUtil.parseTimeStringToDate(dealTime, "yyyy-MM-dd hh:mm:ss");
- if (d2.before(d1)) {
- dealTime = null;
- }
- } catch (ParseException e) {
- e.printStackTrace();
- }
- }
- // landSupplyConsultation.setRemain_time(DateUtil.getTimeDiff(landSupplyConsultation.getCreate_time(), dealTime, days));
- landSupplyConsultation.setRemain_time(DateUtil.getTimeDiff(
- landSupplyConsultation.getCreate_time(),
- landSupplyConsultation.getUpdate_time(),
- days,
- sysConfigService.getValueByKey("year_" + DateUtil.getCurrentDateString("yyyy"))
- ));
- }
- entity.setConsultationList(industrialLandSupplyConsultationList);
- //分发列表
- // IndustrialLandSupplyDistribution industrialLandSupplyDistribution = new IndustrialLandSupplyDistribution();
- // industrialLandSupplyDistribution.setIndustrial_land_supply_id(id);
- // industrialLandSupplyDistribution.setDel_flag(false);
- // List<IndustrialLandSupplyDistribution> industrialLandSupplyDistributionList = industrialLandSupplyDistributionService.findListByWhere(industrialLandSupplyDistribution);
- Example example = new Example(IndustrialLandSupplyDistribution.class);
- Example.Criteria criteria = example.createCriteria();
- criteria.andEqualTo("industrial_land_supply_id", id);
- criteria.andEqualTo("del_flag", 0);
- //倒序
- example.orderBy("department_id").asc();
- List<IndustrialLandSupplyDistribution> industrialLandSupplyDistributionList = industrialLandSupplyDistributionService.selectByExample(example);
- for (IndustrialLandSupplyDistribution landSupplyDistribution : industrialLandSupplyDistributionList) {
- List<Attachment> attachmentList = null;
- //分发文件
- attachmentList = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE, landSupplyDistribution.getId(), null);
- if (null != attachmentList && attachmentList.size() > 0) {
- FileDown fileDown = new FileDown(attachmentList.get(0).getId(), attachmentList.get(0).getFile_name(), attachmentList.get(0).getFile_url(), attachmentList.get(0).getDownload_uri());
- landSupplyDistribution.setDistribution_file(fileDown);
- }
- //分发反馈文件
- attachmentList = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE_FEEDBACK, landSupplyDistribution.getId(), null);
- if (null != attachmentList && attachmentList.size() > 0) {
- FileDown fileDown = new FileDown(attachmentList.get(0).getId(), attachmentList.get(0).getFile_name(), attachmentList.get(0).getFile_url(), attachmentList.get(0).getDownload_uri());
- landSupplyDistribution.setFeedback_file(fileDown);
- }
- if (Objects.equals(landSupplyDistribution.getDepartment_id(), "0")) {
- landSupplyDistribution.setDepartment_name("所有部门可见");
- } else {
- Department department = departmentService.selectById(Integer.valueOf(landSupplyDistribution.getDepartment_id()));
- if (department != null) {
- landSupplyDistribution.setDepartment_name(department.getName());
- }
- }
- //分发反馈剩余时间
- /*if (!Objects.equals(landSupplyDistribution.getDepartment_id(), "0")) {
- int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(DISTRIBUTE_TIME));
- // landSupplyDistribution.setRemain_time(DateUtil.getTimeDiffStr(landSupplyDistribution.getDistribute_time(), days));
- String dealTime = null;
- Approval approval = new Approval();
- approval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK);
- approval.setApply_id(Integer.parseInt(id));
- List<Approval> approvals = approvalService.findListByWhere(approval);
- if (!CollectionUtils.isEmpty(approvals)) {
- dealTime = approvals.get(approvals.size() - 1).getCreate_time();
- try {
- Date d1 = DateUtil.parseTimeStringToDate(entity.getUpdate_time(), "yyyy-MM-dd hh:mm:ss");
- Date d2 = DateUtil.parseTimeStringToDate(dealTime, "yyyy-MM-dd hh:mm:ss");
- if (d2.before(d1)) {
- dealTime = null;
- }
- } catch (ParseException e) {
- e.printStackTrace();
- }
- }
- // landSupplyDistribution.setRemain_time(DateUtil.getTimeDiff(landSupplyDistribution.getCreate_time(), dealTime, days));
- landSupplyDistribution.setRemain_time(DateUtil.getTimeDiff(
- landSupplyDistribution.getCreate_time(),
- landSupplyDistribution.getUpdate_time(),
- days,
- sysConfigService.getValueByKey("year_" + DateUtil.getCurrentDateString("yyyy"))
- ));
- }*/
- }
- entity.setDistributionList(industrialLandSupplyDistributionList);
- //汇总剩余时间
- //获取最后一次进入待汇总的时间作为节点
- Approval approval = new Approval();
- approval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUMMARY);
- approval.setApply_id(Integer.parseInt(id));
- List<Approval> approvalList = approvalService.findListByWhere(approval);
- if (!CollectionUtils.isEmpty(approvalList)) {
- Approval approve = approvalList.get(approvalList.size() - 1);
- int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(SUMMARY_TIME));
- // entity.setSummary_remain_time(DateUtil.getTimeDiffStr(approve.getCreate_time(), days));
- String dealTime = null;
- approval = new Approval();
- approval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
- approval.setApply_id(Integer.parseInt(id));
- approval.setCreate_by(ShiroUtils.getUserId());
- List<Approval> approvals = approvalService.findListByWhere(approval);
- if (!CollectionUtils.isEmpty(approvals)) {
- dealTime = approvals.get(approvals.size() - 1).getCreate_time();
- try {
- Date d1 = DateUtil.parseTimeStringToDate(entity.getUpdate_time(), "yyyy-MM-dd hh:mm:ss");
- Date d2 = DateUtil.parseTimeStringToDate(dealTime, "yyyy-MM-dd hh:mm:ss");
- if (d2.before(d1)) {
- dealTime = null;
- }
- } catch (ParseException e) {
- e.printStackTrace();
- }
- }
- entity.setSummary_remain_time(DateUtil.getTimeDiff(
- approve.getCreate_time(),
- dealTime,
- days,
- sysConfigService.getValueByKey("year_" + DateUtil.getCurrentDateString("yyyy"))
- ));
- }
- //会审剩余时间
- approval = new Approval();
- approval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_SUMMARY);
- approval.setApply_id(Integer.parseInt(id));
- approvalList = approvalService.findListByWhere(approval);
- if (!CollectionUtils.isEmpty(approvalList)) {
- Approval approve = approvalList.get(approvalList.size() - 1);
- int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(JOINT_TRIAL_TIME));
- // entity.setJoint_trial_remain_time(DateUtil.getTimeDiffStr(approve.getCreate_time(), days));
- String dealTime = null;
- approval = new Approval();
- approval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PENDIND_HANDLE);
- approval.setApply_id(Integer.parseInt(id));
- List<Approval> approvals = approvalService.findListByWhere(approval);
- if (!CollectionUtils.isEmpty(approvals)) {
- dealTime = approvals.get(approvals.size() - 1).getCreate_time();
- try {
- Date d1 = DateUtil.parseTimeStringToDate(entity.getUpdate_time(), "yyyy-MM-dd hh:mm:ss");
- Date d2 = DateUtil.parseTimeStringToDate(dealTime, "yyyy-MM-dd hh:mm:ss");
- if (d2.before(d1)) {
- dealTime = null;
- }
- } catch (ParseException e) {
- e.printStackTrace();
- }
- }
- entity.setSummary_remain_time(DateUtil.getTimeDiff(
- approve.getCreate_time(),
- dealTime,
- days,
- sysConfigService.getValueByKey("year_" + DateUtil.getCurrentDateString("yyyy"))
- ));
- }
- List<DepartmentDto> consulDepartmentList = new ArrayList<>();
- List<Department> departmentList = consulDepartmentList();
- if (!CollectionUtils.isEmpty(departmentList)) {
- for (Department department : departmentList) {
- DepartmentDto departmentDto = new DepartmentDto();
- BeanUtils.copyProperties(department, departmentDto);
- departmentDto.setIsDefault(false);
- for (IndustrialLandSupplyConsultation landSupplyConsultation : industrialLandSupplyConsultationList) {
- if (Objects.equals(departmentDto.getId() + "", landSupplyConsultation.getDepartment_id())
- && landSupplyConsultation.getIsDefault()) {
- departmentDto.setIsDefault(true);
- break;
- }
- }
- consulDepartmentList.add(departmentDto);
- }
- }
- entity.setConsulDepartmentList(consulDepartmentList);
- //获取商务和商务分管领导审批意见
- // Group group = null;
- // List<Approval> approvals = null;
- // group = groupService.findByName(Constant.INDUSTRIALLANDSUPPLY_1, null);
- // List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- //目前都只有一个人
- // if (!CollectionUtils.isEmpty(userGroups)) {
- //
- // Example example = new Example(Approval.class);
- // Example.Criteria criteria = example.createCriteria();
- // criteria.andEqualTo("apply_id", id);
- // criteria.andEqualTo("type", Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY);
- // criteria.andEqualTo("after_approvalstatus", Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
- // criteria.andEqualTo("checker", userGroups.get(0).getUser_id());
- // example.orderBy("create_time").desc();
- // approvals = approvalService.selectByExample(example);
- // if (!CollectionUtils.isEmpty(approvals)) {
- // Approval approval = approvals.get(0);
- // approval.getOper_type();
- // approval.getApproval_comment();
- // }
- // }
- return entity;
- }
- public IndustrialLandSupplyDetail selectByIdWithDepartment(String id) throws ParseException {
- IndustrialLandSupplyDetail entity = industrialLandSupplyDetailDao.selectById(id);
- //文件
- List<Attachment> attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY, entity.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());
- entity.setFileDown(fileDown);
- }
- //补充附件
- attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_COMMERCE_SUPPLEMENT, entity.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());
- entity.setSupplement_file(fileDown);
- }
- if (null != entity.getApprove_status()) {
- String status_name = dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY_APPROVE_STATUS, entity.getApprove_status());
- entity.setApprove_status_desc(status_name);
- }
- if (null != entity.getProcess_stage()) {
- String process_stage_name = dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY_APPROVE_STAGE, entity.getProcess_stage());
- entity.setProcess_stage_desc(process_stage_name);
- }
- User user = userService.getUser(entity.getCreate_by());
- if (CommonUtils.isNotNull(user) && Constant.UserType.STREET.equals(user.getUser_type())) {
- entity.setResource(user.getStreet_name());
- } else if (CommonUtils.isNotNull(user) && Constant.UserType.GOVERNMENT.equals(user.getUser_type())) {
- entity.setResource(user.getDepartment_name());
- }
- IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
- industrialLandSupplyConsultation.setIndustrial_land_supply_id(id);
- //industrialLandSupplyConsultation.setDepartment_id(ShiroUtils.getUserEntity().getDepartment_id() + "");
- Department department = departmentService.findRootById(ShiroUtils.getUserEntity().getDepartment_id());
- industrialLandSupplyConsultation.setDepartment_id(department.getId() + "");
- industrialLandSupplyConsultation.setDel_flag(false);
- List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
- int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(FEEDBACK_TIME));
- for (IndustrialLandSupplyConsultation landSupplyConsultation : industrialLandSupplyConsultationList) {
- //文件
- List<Attachment> feedbackAttachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_FEEDBACK, landSupplyConsultation.getId(), null);
- if (null != feedbackAttachments && feedbackAttachments.size() > 0) {
- FileDown fileDown = new FileDown(feedbackAttachments.get(0).getId(), feedbackAttachments.get(0).getFile_name(), feedbackAttachments.get(0).getFile_url(), attachments.get(0).getDownload_uri());
- landSupplyConsultation.setFileDown(fileDown);
- }
- Department depart = departmentService.selectById(Integer.valueOf(landSupplyConsultation.getDepartment_id()));
- landSupplyConsultation.setDepartment_name(depart.getName());
- //是否同意
- if (landSupplyConsultation.getIsAgree() != null) {
- String feedback = landSupplyConsultation.getFeedback();
- String str = "";
- if (landSupplyConsultation.getIsAgree()) {
- str = "同意。";
- } else {
- str = "不同意。";
- }
- landSupplyConsultation.setFeedback(str + feedback);
- }
- //剩余时间
- landSupplyConsultation.setRemain_time(DateUtil.getTimeDiff(
- landSupplyConsultation.getCreate_time(),
- landSupplyConsultation.getUpdate_time(),
- days,
- sysConfigService.getValueByKey("year_" + DateUtil.getCurrentDateString("yyyy"))
- ));
- }
- entity.setConsultationList(industrialLandSupplyConsultationList);
- IndustrialLandSupplyDistribution industrialLandSupplyDistribution = new IndustrialLandSupplyDistribution();
- industrialLandSupplyDistribution.setIndustrial_land_supply_id(id);
- //industrialLandSupplyDistribution.setDepartment_id(ShiroUtils.getUserEntity().getDepartment_id() + "");
- industrialLandSupplyDistribution.setDepartment_id(department.getId() + "");
- industrialLandSupplyDistribution.setDel_flag(false);
- List<IndustrialLandSupplyDistribution> industrialLandSupplyDistributionList = industrialLandSupplyDistributionService.findListByWhere(industrialLandSupplyDistribution);
- days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(DISTRIBUTE_TIME));
- for (IndustrialLandSupplyDistribution landSupplyDistribution : industrialLandSupplyDistributionList) {
- //文件
- List<Attachment> attachmentList = null;
- //分发文件
- attachmentList = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE, landSupplyDistribution.getId(), null);
- if (null != attachmentList && attachmentList.size() > 0) {
- FileDown fileDown = new FileDown(attachmentList.get(0).getId(), attachmentList.get(0).getFile_name(), attachmentList.get(0).getFile_url(), attachmentList.get(0).getDownload_uri());
- landSupplyDistribution.setDistribution_file(fileDown);
- }
- //分发反馈文件
- attachmentList = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE_FEEDBACK, landSupplyDistribution.getId(), null);
- if (null != attachmentList && attachmentList.size() > 0) {
- FileDown fileDown = new FileDown(attachmentList.get(0).getId(), attachmentList.get(0).getFile_name(), attachmentList.get(0).getFile_url(), attachmentList.get(0).getDownload_uri());
- landSupplyDistribution.setFeedback_file(fileDown);
- }
- Department depart = departmentService.selectById(Integer.valueOf(landSupplyDistribution.getDepartment_id()));
- landSupplyDistribution.setDepartment_name(depart.getName());
- //剩余时间
- /*landSupplyDistribution.setRemain_time(DateUtil.getTimeDiff(
- landSupplyDistribution.getCreate_time(),
- landSupplyDistribution.getUpdate_time(),
- days,
- sysConfigService.getValueByKey("year_" + DateUtil.getCurrentDateString("yyyy"))
- ));*/
- }
- entity.setDistributionList(industrialLandSupplyDistributionList);
- return entity;
- }
- /**
- * @Author: huZhiHao
- * @Description: 根据用户组获取可查询到的项目
- * @Date: 2020/3/7
- * @Params: []
- * @Return: java.util.List<java.lang.String>
- **/
- @Transactional
- public List<String> getProjectIdsByGroup() {
- List<IndustrialLandSupplyDetail> list = new ArrayList<>();
- Integer user_id = ShiroUtils.getUserId();
- Group group = null;
- List<UserGroup> userGroups = null;
- List<String> apply_status_list = new ArrayList<>();
- boolean industriallandsupply_2_flag = false;
- boolean industriallandsupply_5_flag = false;
- boolean industriallandsupply_6_flag = false;
- //街道人员 负责的状态
- if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
- apply_status_list.add(Constant.LandSupplyApproveStatus.PLATE_PENDING_SUBMIT);
- apply_status_list.add(Constant.LandSupplyApproveStatus.PLATE_WITHDRAW);
- apply_status_list.add(Constant.LandSupplyApproveStatus.COMMERCE_RETURN);
- } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
- //商务局受理员 负责的状态
- group = groupService.findByName(Constant.INDUSTRIALLANDSUPPLY_1, null);
- userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- if (Objects.equals(userGroup.getUser_id(), user_id)) {
- apply_status_list.add(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
- apply_status_list.add(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUBMIT);
- apply_status_list.add(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
- apply_status_list.add(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUMMARY);
- apply_status_list.add(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_RETURN);
- apply_status_list.add(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_RETURN);
- break;
- }
- }
- //接受咨询的举办 负责的状态
- group = groupService.findByName(Constant.INDUSTRIALLANDSUPPLY_2, null);
- userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- if (Objects.equals(userGroup.getUser_id(), user_id)) {
- apply_status_list.add(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
- industriallandsupply_2_flag = true;
- break;
- }
- }
- //商务局分管领导 负责的状态
- group = groupService.findByName(Constant.INDUSTRIALLANDSUPPLY_3, null);
- userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- if (Objects.equals(userGroup.getUser_id(), user_id)) {
- apply_status_list.add(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
- break;
- }
- }
- //管委会分管领导 负责的状态
- group = groupService.findByName(Constant.INDUSTRIALLANDSUPPLY_4, null);
- userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- if (Objects.equals(userGroup.getUser_id(), user_id)) {
- apply_status_list.add(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
- apply_status_list.add(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PENDIND_HANDLE);
- break;
- }
- }
- //项目供地 待分发局办
- group = groupService.findByName(Constant.INDUSTRIALLANDSUPPLY_5, null);
- userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- if (Objects.equals(userGroup.getUser_id(), user_id)) {
- apply_status_list.add(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK);
- industriallandsupply_5_flag = true;
- break;
- }
- }
- //项目供地 行政局反馈
- group = groupService.findByName(Constant.INDUSTRIALLANDSUPPLY_6, null);
- userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- if (Objects.equals(userGroup.getUser_id(), user_id)) {
- apply_status_list.add(Constant.LandSupplyApproveStatus.PRE_APPROVE_PENDIND_DISTRIBUTE);
- apply_status_list.add(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK);
- apply_status_list.add(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PENDIND_HANDLE);
- apply_status_list.add(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PASS);
- apply_status_list.add(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_REJECT);
- apply_status_list.add(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_SUMMARY);
- apply_status_list.add(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_RETURN);
- industriallandsupply_6_flag = true;
- break;
- }
- }
- //项目供地 资源规划局
- group = groupService.findByName(Constant.INDUSTRIALLANDSUPPLY_7, null);
- userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- if (Objects.equals(userGroup.getUser_id(), user_id)) {
- apply_status_list.add(Constant.LandSupplyApproveStatus.PRE_APPROVE_PENDIND_DISTRIBUTE);
- apply_status_list.add(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_SUMMARY);
- apply_status_list.add(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PASS);
- apply_status_list.add(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_RETURN);
- break;
- }
- }
- //todo 后续角色的待审批状态在此添加
- }
- if (apply_status_list.size() <= 0) {
- apply_status_list.add("");
- }
- list.addAll(industrialLandSupplyDetailDao.findByProjectIdAndApproveStatus(apply_status_list));
- List<Approval> consulApprovalList = new ArrayList<>();
- List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = new ArrayList<>();
- List<Approval> distApprovalList = new ArrayList<>();
- List<IndustrialLandSupplyDistribution> industrialLandSupplyDistributionList = new ArrayList<>();
- if (industriallandsupply_2_flag) {
- Approval approval = new Approval();
- approval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
- approval.setChecker(user_id);
- consulApprovalList = approvalService.findListByWhere(approval);
- IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
- //industrialLandSupplyConsultation.setDepartment_id(ShiroUtils.getUserEntity().getDepartment_id() + "");
- Department department = departmentService.findRootById(ShiroUtils.getUserEntity().getDepartment_id());
- industrialLandSupplyConsultation.setDepartment_id(department.getId() + "");
- industrialLandSupplyConsultation.setDel_flag(false);
- industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
- }
- if (industriallandsupply_5_flag) {
- Approval approval = new Approval();
- approval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK);
- approval.setChecker(user_id);
- distApprovalList = approvalService.findListByWhere(approval);
- IndustrialLandSupplyDistribution industrialLandSupplyDistribution = new IndustrialLandSupplyDistribution();
- //industrialLandSupplyDistribution.setDepartment_id(ShiroUtils.getUserEntity().getDepartment_id() + "");
- Department department = departmentService.findRootById(ShiroUtils.getUserEntity().getDepartment_id());
- industrialLandSupplyDistribution.setDepartment_id(department.getId() + "");
- industrialLandSupplyDistribution.setDel_flag(false);
- industrialLandSupplyDistributionList = industrialLandSupplyDistributionService.findListByWhere(industrialLandSupplyDistribution);
- }
- List<String> result = new ArrayList<>();
- for (IndustrialLandSupplyDetail entity : list) {
- if (
- Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK, entity.getApprove_status())
- || Objects.equals(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK, entity.getApprove_status())
- ) {
- if (industriallandsupply_2_flag || industriallandsupply_5_flag) {
- //是否被问
- boolean consulFlag = false;
- for (IndustrialLandSupplyConsultation industrialLandSupplyConsultation : industrialLandSupplyConsultationList) {
- if (Objects.equals(entity.getId() + "", industrialLandSupplyConsultation.getIndustrial_land_supply_id())) {
- consulFlag = true;
- break;
- }
- }
- //是否回答
- boolean consulApproveFlag = false;
- for (Approval approval : consulApprovalList) {
- if (Objects.equals(entity.getId(), approval.getApply_id())) {
- try {
- if (entity.getUpdate_time() == null) {
- entity.setUpdate_time("1970-01-01 00:00:00");
- }
- Date d1 = DateUtil.parseTimeStringToDate(entity.getUpdate_time(), "yyyy-MM-dd hh:mm:ss");
- Date d2 = DateUtil.parseTimeStringToDate(approval.getCreate_time(), "yyyy-MM-dd hh:mm:ss");
- if (d1.before(d2)) {
- consulApproveFlag = true;
- break;
- }
- } catch (ParseException e) {
- e.printStackTrace();
- }
- }
- }
- //是否被问
- boolean distFlag = false;
- for (IndustrialLandSupplyDistribution industrialLandSupplyDistribution : industrialLandSupplyDistributionList) {
- if (Objects.equals(entity.getId() + "", industrialLandSupplyDistribution.getIndustrial_land_supply_id())) {
- distFlag = true;
- break;
- }
- }
- //是否回答
- boolean distApproveFlag = false;
- for (Approval approval : distApprovalList) {
- if (Objects.equals(entity.getId(), approval.getApply_id())) {
- try {
- Date d1 = DateUtil.parseTimeStringToDate(entity.getUpdate_time(), "yyyy-MM-dd hh:mm:ss");
- Date d2 = DateUtil.parseTimeStringToDate(approval.getCreate_time(), "yyyy-MM-dd hh:mm:ss");
- if (d1.before(d2)) {
- distApproveFlag = true;
- break;
- }
- } catch (ParseException e) {
- e.printStackTrace();
- }
- }
- }
- if ((consulFlag && !consulApproveFlag) || (distFlag && !distApproveFlag)) {
- result.add(entity.getId().toString());
- }
- } else {
- result.add(entity.getId().toString());
- }
- } else if (industriallandsupply_6_flag) {
- List<Attachment> attachmentList = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_GS, entity.getId(), null);
- if (CommonUtils.isNull(entity.getGs_feedback()) && CollectionUtils.isEmpty(attachmentList)) {
- result.add(entity.getId().toString());
- }
- } else if (Objects.equals(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PASS, entity.getApprove_status())) {
- if (CommonUtils.isNull(entity.getFinal_result())) {
- result.add(entity.getId().toString());
- }
- } else {
- result.add(entity.getId().toString());
- }
- }
- return result;
- }
- /**
- * @Author: huZhiHao
- * @Description: 获取id 已处理
- * @Date: 2020/3/7
- * @Params: []
- * @Return: java.util.List<java.lang.String>
- **/
- @Transactional
- public List<String> getProjectIdsy() {
- int currentUserId = ShiroUtils.getUserId();
- List<Approval> approvalList = approvalService.selectAllApproval(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY);
- Set<String> applyIds = new HashSet<String>();
- if (!CollectionUtils.isEmpty(approvalList)) {
- for (Approval approval : approvalList) {
- String checkerIds = approval.getChecker() + "";
- if (checkerIds != null && checkerIds != "") {
- if (Objects.equals(checkerIds, String.valueOf(currentUserId))) {
- applyIds.add(approval.getApply_id().toString());
- }
- }
- }
- }
- List<String> result = new ArrayList<>(applyIds);
- return result;
- }
- /**
- * @Author: huZhiHao
- * @Description: 获取id 查看所有
- * @Date: 2020/3/7
- * @Params: []
- * @Return: java.util.List<java.lang.String>
- **/
- @Transactional
- public List<String> getProjectIdsc() {
- //根据当前登录人所在街道 查出该街道所有人员的id 将此id列表作为create_by筛选条件
- List<String> result = new ArrayList<>();
- Example example = new Example(IndustrialLandSupplyDetail.class);
- Example.Criteria criteria = example.createCriteria();
- criteria.orEqualTo("del_flag", "0");//不显示删除的
- // List<String> streetUserIds = new ArrayList<>();
- // if (ShiroUtils.getUserType().equals(Constant.UserType.STREET)) {
- // List<User> userList = userService.findUsersByStreetId(ShiroUtils.getStreetId());
- // for (User user : userList) {
- // streetUserIds.add(user.getId() + "");
- // }
- // criteria.andIn("create_by", streetUserIds);
- // }
- List<IndustrialLandSupplyDetail> list = industrialLandSupplyDetailDao.selectByExample(example);
- for (IndustrialLandSupplyDetail entity : list) {
- result.add(entity.getId().toString());
- }
- return result;
- }
- /**
- * @Author: huZhiHao
- * @Description: 保存
- * @Date: 2020/3/7
- * @Params: [apply, status]
- * @Return: void
- **/
- @Transactional
- public void save(IndustrialLandSupplyDetail apply, String status) {
- Integer userType = ShiroUtils.getUserType();
- if (Objects.equals(status, Constant.PublishStatus.DRAFT)) {
- if (Constant.UserType.STREET.equals(userType)) {
- apply.setApprove_status(Constant.LandSupplyApproveStatus.PLATE_PENDING_SUBMIT);
- } else if (Constant.UserType.GOVERNMENT.equals(userType)) {
- apply.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUBMIT);
- }
- } else if (Objects.equals(status, Constant.PublishStatus.RELEASE)) {
- if (Constant.UserType.STREET.equals(userType)) {
- apply.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
- } else if (Constant.UserType.GOVERNMENT.equals(userType)) {
- apply.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
- }
- }
- apply.setNo(GenerateNoUtil.generateIndustrialLandSupplyNo());
- //如果是发布,更新时间
- String dateTime = DateUtil.getTimeString(new Date());
- if (Constant.PublishStatus.RELEASE.equals(status)) {
- apply.setAccept_date(dateTime);
- }
- this.insertAndGetId(apply);
- //保存材料
- // if (null != apply.getFileDown() && null != apply.getFileDown().getFile_id()) {
- // attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY, apply.getId(), apply.getFileDown().getFile_id());
- // }
- if (!CollectionUtils.isEmpty(apply.getFileList())) {
- for (FileDown fileDown : apply.getFileList()) {
- if (null != fileDown && null != fileDown.getFile_id()) {
- attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY, apply.getId(), fileDown.getFile_id());
- }
- }
- }
- //保存默认咨询列表
- List<String> defaultList = apply.getDefaultList();
- if (!CollectionUtils.isEmpty(defaultList)) {
- for (String departmentId : defaultList) {
- if (departmentId != null && departmentId != "") {
- IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
- industrialLandSupplyConsultation.setIsDefault(true);
- industrialLandSupplyConsultation.setIndustrial_land_supply_id(apply.getId() + "");
- industrialLandSupplyConsultation.setConsultation_time(dateTime);
- industrialLandSupplyConsultation.setDepartment_id(departmentId);
- industrialLandSupplyConsultation.setConsultation(CONSULTATION_MESSAGE);
- industrialLandSupplyConsultationService.save(industrialLandSupplyConsultation);
- }
- }
- }
- //保存咨询列表
- List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = apply.getConsultationList();
- if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
- Iterator<IndustrialLandSupplyConsultation> it = industrialLandSupplyConsultationList.iterator();
- while (it.hasNext()) {
- if (CommonUtils.isNull(it.next().getConsultation())) {
- it.remove();
- }
- }
- for (IndustrialLandSupplyConsultation industrialLandSupplyConsultation : industrialLandSupplyConsultationList) {
- industrialLandSupplyConsultation.setIsDefault(false);
- industrialLandSupplyConsultation.setIndustrial_land_supply_id(apply.getId() + "");
- industrialLandSupplyConsultation.setConsultation_time(dateTime);
- }
- if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
- industrialLandSupplyConsultationService.saveList(industrialLandSupplyConsultationList);
- }
- }
- //如果是发布,进提交流程
- if (Constant.PublishStatus.RELEASE.equals(status)) {
- //直接提交申请,添加流程信息
- pass(apply.getId(), null);
- }
- }
- /**
- * @Author: huZhiHao
- * @Description: 修改
- * @Date: 2020/3/7
- * @Params: [apply, status]
- * @Return: void
- **/
- @Transactional
- public Integer update(IndustrialLandSupplyDetail apply, String status) {
- Integer userType = ShiroUtils.getUserType();
- if (Objects.equals(status, Constant.PublishStatus.DRAFT)) {
- if (Constant.UserType.STREET.equals(userType)) {
- apply.setApprove_status(Constant.LandSupplyApproveStatus.PLATE_PENDING_SUBMIT);
- } else if (Constant.UserType.GOVERNMENT.equals(userType)) {
- apply.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUBMIT);
- }
- } else if (Objects.equals(status, Constant.PublishStatus.RELEASE)) {
- if (Constant.UserType.STREET.equals(userType)) {
- apply.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
- } else if (Constant.UserType.GOVERNMENT.equals(userType)) {
- apply.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
- }
- }
- //如果是发布,更新时间
- if (Constant.PublishStatus.RELEASE.equals(status)) {
- apply.setAccept_date(DateUtil.getTimeString(new Date()));
- }
- this.updateSelective(apply);
- Integer id = apply.getId();
- //保存材料
- // if (null != apply.getFileDown() && null != apply.getFileDown().getFile_id()) {
- // attachmentService.deleteByBusiness(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY, apply.getId());
- // attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY, apply.getId(), apply.getFileDown().getFile_id());
- // }
- if (!CollectionUtils.isEmpty(apply.getFileList())) {
- attachmentService.deleteByBusiness(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY, apply.getId());
- for (FileDown fileDown : apply.getFileList()) {
- if (null != fileDown && null != fileDown.getFile_id()) {
- attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY, apply.getId(), fileDown.getFile_id());
- }
- }
- }
- //保存咨询列表
- String dateTime = DateUtil.getTimeString(new Date());
- List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = apply.getConsultationList();
- List<String> defaultList = apply.getDefaultList();
- if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList) && !CollectionUtils.isEmpty(defaultList)) {
- //过滤空的
- Iterator<IndustrialLandSupplyConsultation> it = industrialLandSupplyConsultationList.iterator();
- while (it.hasNext()) {
- if (CommonUtils.isNull(it.next().getConsultation())) {
- it.remove();
- }
- }
- for (IndustrialLandSupplyConsultation industrialLandSupplyConsultation : industrialLandSupplyConsultationList) {
- industrialLandSupplyConsultation.setIsDefault(false);
- industrialLandSupplyConsultation.setIndustrial_land_supply_id(apply.getId() + "");
- if (industrialLandSupplyConsultation.getId() != null) {
- IndustrialLandSupplyConsultation industrialLandSupplyConsultation1 = industrialLandSupplyConsultationService.findById(industrialLandSupplyConsultation.getId());
- //如果问的问题没变则保留id等信息 不然作为新的处理
- if (Objects.equals(industrialLandSupplyConsultation1.getConsultation(), industrialLandSupplyConsultation.getConsultation())) {
- BeanUtils.copyProperties(industrialLandSupplyConsultation1, industrialLandSupplyConsultation);
- }
- }
- if (CommonUtils.isNull(industrialLandSupplyConsultation.getConsultation_time())) {
- industrialLandSupplyConsultation.setConsultation_time(dateTime);
- }
- }
- IndustrialLandSupplyConsultation query = new IndustrialLandSupplyConsultation();
- query.setIndustrial_land_supply_id(apply.getId() + "");
- industrialLandSupplyConsultationService.deleteByWhere(query);
- if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
- industrialLandSupplyConsultationService.saveList(industrialLandSupplyConsultationList);
- }
- //保存默认咨询列表
- if (!CollectionUtils.isEmpty(defaultList)) {
- for (String departmentId : defaultList) {
- if (departmentId != null && departmentId != "") {
- IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
- industrialLandSupplyConsultation.setIsDefault(true);
- industrialLandSupplyConsultation.setIndustrial_land_supply_id(apply.getId() + "");
- industrialLandSupplyConsultation.setConsultation_time(dateTime);
- industrialLandSupplyConsultation.setDepartment_id(departmentId);
- industrialLandSupplyConsultation.setConsultation(CONSULTATION_MESSAGE);
- industrialLandSupplyConsultationService.save(industrialLandSupplyConsultation);
- }
- }
- }
- }
- //如果是发布,进提交流程
- if (Constant.PublishStatus.RELEASE.equals(status)) {
- //直接提交申请,添加流程信息
- pass(apply.getId(), null);
- }
- return id;
- }
- /**
- * @Author: huZhiHao
- * @Description: 通过
- * @Date: 2020/3/7
- * @Params: [applyId, comment]
- * @Return: java.lang.Boolean
- **/
- @Transactional
- public Boolean pass(Integer applyId, String comment) {
- Approval approval = approvalService.getLatestApproval(applyId, Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY);
- Approval newApproval = new Approval();
- newApproval.setApply_id(applyId);
- newApproval.setType(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY);
- if (ShiroUtils.getUserType().equals(Constant.UserType.GOVERNMENT)) {
- if (null != userService.getUser(ShiroUtils.getUserId()).getDepartment_id()) {
- String departmentname = departmentService.selectById(userService.getUser(ShiroUtils.getUserId()).getDepartment_id()).getName();
- newApproval.setDepartment(departmentname);
- }
- } else if (ShiroUtils.getUserType().equals(Constant.UserType.STREET)) {
- newApproval.setDepartment(ShiroUtils.getUserEntity().getStreet_name());
- }
- newApproval.setApproval_comment(comment);
- newApproval.setChecker(ShiroUtils.getUserId());
- newApproval.setOper_type(Constant.OperType.APPROVED);
- newApproval.setDeal_time(DateUtil.getTimeString(new Date()));
- //短信参数
- Map<String, String> params = new HashMap<>();
- IndustrialLandSupplyDetail detail = null;
- try {
- detail = this.selectById(applyId + "");
- } catch (ParseException e) {
- e.printStackTrace();
- }
- params.put("title", detail.getTitle());
- params.put("no", detail.getNo());
- String templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY;
- if (CommonUtils.isNull(approval)) {
- //待属地提交 --》待商务局受理员审核 或 待咨询反馈
- IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
- industrialLandSupplyConsultation.setIndustrial_land_supply_id(applyId + "");
- industrialLandSupplyConsultation.setDel_flag(false);
- List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
- boolean sumbitToLeader = false;
- if (CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
- //如果提交了咨询信息进入待反馈 未提交直接进入商务局分管领导审核
- sumbitToLeader = true;
- }
- Group group = null;
- newApproval.setOper_type(Constant.OperType.SUBMIT);
- if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.PLATE_PENDING_SUBMIT);
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
- if (null == group) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUBMIT);
- //如果提交了咨询信息进入待反馈 未提交直接进入商务局分管领导审核
- if (!sumbitToLeader) {
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_2);
- if (null == group) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- } else {
- //newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
- //临时跳过商务领导审核
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
- //group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_3);
- //临时跳过商务领导审核
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_4);
- if (null == group) {
- //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
- //临时跳过商务领导审核
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- }
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findListByWhere(new User());
- StringBuffer sb = new StringBuffer("");
- // platform.modules.build.entity.Company company = companyService.findById(projectApplication.getCompany_id());
- // String projectName = projectProvincesDeclaration.getProject_name();
- // Message messages = new Message();
- // messages.setApply_id(projectId);
- // messages.setBusiness_type(Constant.Message_Business_type.PROJECT_INTELLIGENT_APPLY);
- // messages.setTitle("提醒中心审核");
- // waitToDoService.completeAllTODO(projectApplication.getId(), Constant.DictionaryType.PROJECT_INTELLIGENT);
- for (UserGroup userGroup : userGroups) {
- for (User user : users) {
- if (Objects.equals(user.getId(), userGroup.getUser_id())) {
- if (newApproval.getAfter_approvalstatus().equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK)) {
- List<IndustrialLandSupplyConsultation> ids = detail.getConsultationList();
- for (IndustrialLandSupplyConsultation ilsc : ids) {
- if (Objects.equals(user.getDepartment_id() + "", ilsc.getDepartment_id())) {
- sb.append(userGroup.getUser_id() + ",");
- if (Objects.equals(ilsc.getConsultation(), CONSULTATION_MESSAGE)) {
- }
- //发送短信
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_CONSUL;
- int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(FEEDBACK_TIME));
- params.put("days", days + "");
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- break;
- }
- }
- } else {
- sb.append(userGroup.getUser_id() + ",");
- //发送短信
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_COMMERE;
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- // String message = user.getUser_name() +0 ",您好。“" + 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("区级智能制造审核", "/government/projectIntelligent/approve/" + projectApplication.getId(), Constant.WaitToDo_OperType.AUDIT, projectApplication.getId(),
- // Constant.DictionaryType.PROJECT_INTELLIGENT, projectApplication.getApply_no(), userGroup.getUser_id().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false);
- }
- }
- }
- newApproval.setNextchecker(sb.toString());
- if (sb.length() == 0) {
- if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
- } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
- if (!sumbitToLeader) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
- } else {
- //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
- //临时跳过商务领导审核
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- }
- }
- IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
- entity.setId(applyId);
- if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
- entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
- } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
- //如果提交了咨询信息进入待反馈 未提交直接进入商务局分管领导审核
- if (!sumbitToLeader) {
- entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
- } else {
- //entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
- //临时跳过商务领导审核
- entity.setApprove_status(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
- }
- }
- entity.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
- approvalService.insertAndGetId(newApproval);
- return true;
- } else if (Objects.equals(Constant.LandSupplyApproveStatus.PLATE_WITHDRAW, approval.getAfter_approvalstatus())) {
- //属地撤回 --》待商务局受理员审核 或 待咨询反馈
- IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
- industrialLandSupplyConsultation.setIndustrial_land_supply_id(applyId + "");
- industrialLandSupplyConsultation.setDel_flag(false);
- List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
- boolean sumbitToLeader = false;
- if (CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
- //如果提交了咨询信息进入待反馈 未提交直接进入商务局分管领导审核
- sumbitToLeader = true;
- }
- Group group = null;
- newApproval.setOper_type(Constant.OperType.SUBMIT);
- if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.PLATE_WITHDRAW);
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
- if (null == group) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUBMIT);
- //如果提交了咨询信息进入待反馈 未提交直接进入商务局分管领导审核
- if (!sumbitToLeader) {
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_2);
- if (null == group) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- } else {
- //newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
- //临时跳过商务领导审核
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
- //group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_3);
- //临时跳过商务领导审核
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_4);
- if (null == group) {
- //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
- //临时跳过商务领导审核
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- }
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findListByWhere(new User());
- StringBuffer sb = new StringBuffer("");
- for (UserGroup userGroup : userGroups) {
- for (User user : users) {
- if (Objects.equals(user.getId(), userGroup.getUser_id())) {
- if (newApproval.getAfter_approvalstatus().equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK)) {
- List<IndustrialLandSupplyConsultation> ids = detail.getConsultationList();
- for (IndustrialLandSupplyConsultation ilsc : ids) {
- if (Objects.equals(user.getDepartment_id() + "", ilsc.getDepartment_id())) {
- sb.append(userGroup.getUser_id() + ",");
- //发送短信
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_CONSUL;
- int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(FEEDBACK_TIME));
- params.put("days", days + "");
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- break;
- }
- }
- } else {
- sb.append(userGroup.getUser_id() + ",");
- //发送短信
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_COMMERE;
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- }
- newApproval.setNextchecker(sb.toString());
- if (sb.length() == 0) {
- if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
- } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
- if (!sumbitToLeader) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
- } else {
- //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
- //临时跳过商务领导审核
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- }
- }
- IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
- entity.setId(applyId);
- if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
- entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
- } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
- //如果提交了咨询信息进入待反馈 未提交直接进入商务局分管领导审核
- if (!sumbitToLeader) {
- entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
- } else {
- //entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
- //临时跳过商务领导审核
- entity.setApprove_status(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
- }
- }
- entity.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
- approvalService.insertAndGetId(newApproval);
- return true;
- } else if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUBMIT, approval.getAfter_approvalstatus())) {
- //商务局受理员待提交--》待商务局受理员审核 或 待咨询反馈
- IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
- industrialLandSupplyConsultation.setIndustrial_land_supply_id(applyId + "");
- industrialLandSupplyConsultation.setDel_flag(false);
- List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
- boolean sumbitToLeader = false;
- if (CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
- //如果提交了咨询信息进入待反馈 未提交直接进入商务局分管领导审核
- sumbitToLeader = true;
- }
- Group group = null;
- newApproval.setOper_type(Constant.OperType.SUBMIT);
- if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUBMIT);
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
- if (null == group) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUBMIT);
- //如果提交了咨询信息进入待反馈 未提交直接进入商务局分管领导审核
- if (!sumbitToLeader) {
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_2);
- if (null == group) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- } else {
- //newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
- //临时跳过商务领导审核
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
- //group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_3);
- //临时跳过商务领导审核
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_4);
- if (null == group) {
- //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
- //临时跳过商务领导审核
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- }
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findListByWhere(new User());
- StringBuffer sb = new StringBuffer("");
- for (UserGroup userGroup : userGroups) {
- for (User user : users) {
- if (Objects.equals(user.getId(), userGroup.getUser_id())) {
- if (newApproval.getAfter_approvalstatus().equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK)) {
- List<IndustrialLandSupplyConsultation> ids = detail.getConsultationList();
- for (IndustrialLandSupplyConsultation ilsc : ids) {
- if (Objects.equals(user.getDepartment_id() + "", ilsc.getDepartment_id())) {
- sb.append(userGroup.getUser_id() + ",");
- //发送短信
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_CONSUL;
- int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(FEEDBACK_TIME));
- params.put("days", days + "");
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- break;
- }
- }
- } else {
- sb.append(userGroup.getUser_id() + ",");
- //发送短信
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- }
- newApproval.setNextchecker(sb.toString());
- if (sb.length() == 0) {
- if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
- } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
- if (!sumbitToLeader) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
- } else {
- //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
- //临时跳过商务领导审核
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- }
- }
- IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
- entity.setId(applyId);
- if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
- entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
- } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
- //如果提交了咨询信息进入待反馈 未提交直接进入商务局分管领导审核
- if (!sumbitToLeader) {
- entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
- } else {
- //entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
- //临时跳过商务领导审核
- entity.setApprove_status(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
- }
- }
- entity.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
- approvalService.insertAndGetId(newApproval);
- return true;
- } else if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE, approval.getAfter_approvalstatus())) {
- //待商务局受理员审核 --》 待咨询反馈 或 管委会领导审核
- IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
- industrialLandSupplyConsultation.setIndustrial_land_supply_id(applyId + "");
- industrialLandSupplyConsultation.setDel_flag(false);
- List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
- boolean sumbitToLeader = false;
- if (CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
- sumbitToLeader = true;
- }
- Group group = null;
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
- if (sumbitToLeader) {
- newApproval.setOper_type(Constant.OperType.SUBMIT);
- //newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
- //临时跳过商务领导审核
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
- //group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_3);
- //临时跳过商务领导审核
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_4);
- if (null == group) {
- //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
- //临时跳过商务领导审核
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- } else {
- newApproval.setOper_type(Constant.OperType.DISTRIBUTE);
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_2);
- if (null == group) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findListByWhere(new User());
- StringBuffer sb = new StringBuffer("");
- for (UserGroup userGroup : userGroups) {
- for (User user : users) {
- if (Objects.equals(user.getId(), userGroup.getUser_id())) {
- if (newApproval.getAfter_approvalstatus().equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK)) {
- List<IndustrialLandSupplyConsultation> ids = detail.getConsultationList();
- for (IndustrialLandSupplyConsultation ilsc : ids) {
- if (Objects.equals(user.getDepartment_id() + "", ilsc.getDepartment_id())) {
- sb.append(userGroup.getUser_id() + ",");
- //发送短信
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_CONSUL;
- int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(FEEDBACK_TIME));
- params.put("days", days + "");
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- break;
- }
- }
- } else {
- sb.append(userGroup.getUser_id() + ",");
- //发送短信
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- }
- newApproval.setNextchecker(sb.toString());
- if (sumbitToLeader) {
- if (sb.length() == 0) {
- //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
- //临时跳过商务领导审核
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- } else {
- if (sb.length() == 0) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- }
- IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
- entity.setId(applyId);
- if (sumbitToLeader) {
- //entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
- //临时跳过商务领导审核
- entity.setApprove_status(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
- } else {
- entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
- }
- entity.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
- approvalService.insertAndGetId(newApproval);
- return true;
- } else if (Objects.equals(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_RETURN, approval.getAfter_approvalstatus())) {
- //预审退回 --》 待咨询反馈 或 咨询汇总
- IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
- industrialLandSupplyConsultation.setIndustrial_land_supply_id(applyId + "");
- industrialLandSupplyConsultation.setDel_flag(false);
- List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
- boolean sumbitToSummary = true;
- for (IndustrialLandSupplyConsultation landSupplyConsultation : industrialLandSupplyConsultationList) {
- //如果所有咨询都已回答 进入待汇总
- if (CommonUtils.isNull(landSupplyConsultation.getFeedback()) || CommonUtils.isNull(landSupplyConsultation.getUpdate_by())) {
- sumbitToSummary = false;
- break;
- } else {
- sumbitToSummary = true;
- }
- }
- Group group = null;
- newApproval.setOper_type(Constant.OperType.SUBMIT);
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_RETURN);
- if (sumbitToSummary) {
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUMMARY);
- } else {
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
- }
- if (sumbitToSummary) {
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
- } else {
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_2);
- }
- if (null == group) {
- if (sumbitToSummary) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
- } else {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findListByWhere(new User());
- 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() + ",");
- //发送短信
- if (sumbitToSummary) {
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_COMMERCE_SUMMARY;
- int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(SUMMARY_TIME));
- params.put("days", days + "");
- } else {
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_CONSUL;
- int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(FEEDBACK_TIME));
- params.put("days", days + "");
- }
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- newApproval.setNextchecker(sb.toString());
- if (sb.length() == 0) {
- if (sumbitToSummary) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
- } else {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- }
- IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
- entity.setId(applyId);
- if (sumbitToSummary) {
- entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUMMARY);
- } else {
- entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
- }
- entity.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
- approvalService.insertAndGetId(newApproval);
- return true;
- } else if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK, approval.getAfter_approvalstatus())) {
- //待咨询反馈 --》 待咨询汇总
- IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
- industrialLandSupplyConsultation.setIndustrial_land_supply_id(applyId + "");
- industrialLandSupplyConsultation.setDel_flag(false);
- List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
- boolean sumbitToSummary = true;
- for (IndustrialLandSupplyConsultation landSupplyConsultation : industrialLandSupplyConsultationList) {
- //如果所有咨询都已回答 进入待汇总
- if (/*CommonUtils.isNull(landSupplyConsultation.getFeedback()) || */CommonUtils.isNull(landSupplyConsultation.getUpdate_by())) {
- sumbitToSummary = false;
- break;
- } else {
- sumbitToSummary = true;
- }
- }
- Group group = null;
- newApproval.setOper_type(Constant.OperType.SUBMIT);
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
- if (sumbitToSummary) {
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUMMARY);
- } else {
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
- }
- if (sumbitToSummary) {
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
- } else {
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_2);
- }
- if (null == group) {
- if (sumbitToSummary) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
- } else {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findListByWhere(new User());
- 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() + ",");
- //发送短信
- if (sumbitToSummary) {
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_COMMERCE_SUMMARY;
- int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(SUMMARY_TIME));
- params.put("days", days + "");
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- }
- newApproval.setNextchecker(sb.toString());
- if (sb.length() == 0) {
- if (sumbitToSummary) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
- } else {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- }
- IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
- entity.setId(applyId);
- if (sumbitToSummary) {
- entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUMMARY);
- } else {
- entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
- }
- entity.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
- approvalService.insertAndGetId(newApproval);
- return true;
- } else if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUMMARY, approval.getAfter_approvalstatus())) {
- //待咨询汇总 --》 待商务局分管领导审批
- Group group = null;
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUMMARY);
- //newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
- //临时跳过商务领导审核
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
- //group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_3);
- //临时跳过商务领导审核
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_4);
- if (null == group) {
- //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
- //临时跳过商务领导审核
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findListByWhere(new User());
- 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() + ",");
- //发送短信
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_COMMITTEE_LEADER;
- int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(SUMMARY_TIME));
- params.put("days", days + "");
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- newApproval.setNextchecker(sb.toString());
- if (sb.length() == 0) {
- //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
- //临时跳过商务领导审核
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
- entity.setId(applyId);
- //entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
- //临时跳过商务领导审核
- entity.setApprove_status(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
- entity.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
- approvalService.insertAndGetId(newApproval);
- return true;
- } else if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE, approval.getAfter_approvalstatus())) {
- //待商务局分管领导审批 --》 待管委会分管领导审批
- Group group = null;
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_4);
- if (null == group) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findListByWhere(new User());
- 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() + ",");
- //发送短信
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- newApproval.setNextchecker(sb.toString());
- if (sb.length() == 0) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
- entity.setId(applyId);
- entity.setApprove_status(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
- entity.setProcess_stage(Constant.LandSupplyApproveStage.SUPPLY);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
- approvalService.insertAndGetId(newApproval);
- return true;
- } else if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_RETURN, approval.getAfter_approvalstatus())) {
- //商务局受理员退回--》待商务局受理员审核
- Group group = null;
- newApproval.setOper_type(Constant.OperType.SUBMIT);
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_RETURN);
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
- if (null == group) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findListByWhere(new User());
- 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() + ",");
- //发送短信
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_COMMERE;
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- newApproval.setNextchecker(sb.toString());
- if (sb.length() == 0) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
- entity.setId(applyId);
- entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
- entity.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
- approvalService.insertAndGetId(newApproval);
- return true;
- } else if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_RETURN, approval.getAfter_approvalstatus())) {
- //商务局分管领导退回 --》待商务局商务局分管领导审核
- Group group = null;
- newApproval.setOper_type(Constant.OperType.SUBMIT);
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_RETURN);
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_2);
- if (null == group) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findListByWhere(new User());
- 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() + ",");
- //发送短信
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- newApproval.setNextchecker(sb.toString());
- if (sb.length() == 0) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
- entity.setId(applyId);
- entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
- entity.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
- approvalService.insertAndGetId(newApproval);
- return true;
- } else if (Objects.equals(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE, approval.getAfter_approvalstatus())) {
- // 分管领导审核通过 --》 预审通过待分发
- Group group = null;
- newApproval.setOper_type(Constant.OperType.APPROVED);
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.PRE_APPROVE_PENDIND_DISTRIBUTE);
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_7);
- if (null == group) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_7 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findListByWhere(new User());
- 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() + ",");
- //发送短信
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_ZIGUI;
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- newApproval.setNextchecker(sb.toString());
- if (sb.length() == 0) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_7 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- //短信给行政审批局
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_6);
- userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- for (User user : users) {
- if (Objects.equals(user.getId(), userGroup.getUser_id())) {
- //发送短信
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_XINGZHENG;
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- //如果是政府业务员提交的 只给商务业务员发
- Integer createId = detail.getCreate_by();
- User creater = userService.getUser(createId);
- if (!Objects.equals(creater.getUser_type(), Constant.UserType.GOVERNMENT)) {
- //如果不是政府账号创建 说明是街道提交 则给提交人也发短信
- //发送短信
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_YS;
- try {
- AlibabaSMSUtil.sendSMS(
- creater.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- //短信给商务受理员
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
- userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- for (User user : users) {
- if (Objects.equals(user.getId(), userGroup.getUser_id())) {
- //发送短信
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_YS;
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
- entity.setId(applyId);
- entity.setApprove_status(Constant.LandSupplyApproveStatus.PRE_APPROVE_PENDIND_DISTRIBUTE);
- entity.setProcess_stage(Constant.LandSupplyApproveStage.SUPPLY);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
- approvalService.insertAndGetId(newApproval);
- // sendToLeader(params);
- return true;
- } else if (
- Objects.equals(Constant.LandSupplyApproveStatus.PRE_APPROVE_PENDIND_DISTRIBUTE, approval.getAfter_approvalstatus())
- || Objects.equals(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_RETURN, approval.getAfter_approvalstatus())
- ) {
- // 预审通过待分发 --》 分发待反馈
- Group group = null;
- newApproval.setOper_type(Constant.OperType.DISTRIBUTE);
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.PRE_APPROVE_PENDIND_DISTRIBUTE);
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK);
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_5);
- if (null == group) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_5 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findListByWhere(new User());
- StringBuffer sb = new StringBuffer("");
- for (UserGroup userGroup : userGroups) {
- for (User user : users) {
- if (Objects.equals(user.getId(), userGroup.getUser_id())) {
- if (newApproval.getAfter_approvalstatus().equals(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK)) {
- List<IndustrialLandSupplyDistribution> ids = detail.getDistributionList();
- for (IndustrialLandSupplyDistribution ilsc : ids) {
- if (Objects.equals(ilsc.getDepartment_id(), "0") ||
- Objects.equals(user.getDepartment_id() + "", ilsc.getDepartment_id())) {
- if (!sb.toString().contains(userGroup.getUser_id() + "")) {
- sb.append(userGroup.getUser_id() + ",");
- //发送短信
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE;
- int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(DISTRIBUTE_TIME));
- params.put("days", days + "");
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- break;
- }
- }
- } else {
- sb.append(userGroup.getUser_id() + ",");
- //发送短信
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- }
- newApproval.setNextchecker(sb.toString());
- if (sb.length() == 0) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_5 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
- entity.setId(applyId);
- entity.setApprove_status(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK);
- entity.setProcess_stage(Constant.LandSupplyApproveStage.SUPPLY);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
- approvalService.insertAndGetId(newApproval);
- return true;
- } else if (Objects.equals(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK, approval.getAfter_approvalstatus())) {
- //分发待反馈 --》 待分发汇总
- IndustrialLandSupplyDistribution industrialLandSupplyDistribution = new IndustrialLandSupplyDistribution();
- industrialLandSupplyDistribution.setIndustrial_land_supply_id(applyId + "");
- industrialLandSupplyDistribution.setDel_flag(false);
- List<IndustrialLandSupplyDistribution> industrialLandSupplyDistributionList = industrialLandSupplyDistributionService.findListByWhere(industrialLandSupplyDistribution);
- boolean sumbitToSummary = true;
- for (IndustrialLandSupplyDistribution landSupplyDistribution : industrialLandSupplyDistributionList) {
- //如果所有咨询都已回答 进入待汇总
- if (!Objects.equals(landSupplyDistribution.getDepartment_id(), "0")) {
- if (CommonUtils.isNull(landSupplyDistribution.getUpdate_by())) {
- sumbitToSummary = false;
- break;
- } else {
- sumbitToSummary = true;
- }
- }
- }
- Group group = null;
- newApproval.setOper_type(Constant.OperType.SUBMIT);
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK);
- if (sumbitToSummary) {
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_SUMMARY);
- } else {
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK);
- }
- if (sumbitToSummary) {
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_7);
- } else {
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_5);
- }
- if (null == group) {
- if (sumbitToSummary) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_7 + "没有该项目责任单位的人员,请联系管理员配置");
- } else {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_5 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findListByWhere(new User());
- 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() + ",");
- //发送短信
- if (sumbitToSummary) {
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE_SUMMARY;
- int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(FEEDBACK_TIME));
- params.put("days", days + "");
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- }
- newApproval.setNextchecker(sb.toString());
- if (sb.length() == 0) {
- if (sumbitToSummary) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_7 + "没有该项目责任单位的人员,请联系管理员配置");
- } else {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_5 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- }
- IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
- entity.setId(applyId);
- if (sumbitToSummary) {
- entity.setApprove_status(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_SUMMARY);
- } else {
- entity.setApprove_status(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK);
- }
- entity.setProcess_stage(Constant.LandSupplyApproveStage.SUPPLY);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
- approvalService.insertAndGetId(newApproval);
- return true;
- } else if (Objects.equals(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_SUMMARY, approval.getAfter_approvalstatus())) {
- //待分发汇总 --》 待供地审批
- Group group = null;
- newApproval.setOper_type(Constant.OperType.SUBMIT);
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_SUMMARY);
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PENDIND_HANDLE);
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_4);
- if (null == group) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findListByWhere(new User());
- 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() + ",");
- //发送短信
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_LEADER_HANDLE;
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- newApproval.setNextchecker(sb.toString());
- if (sb.length() == 0) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
- entity.setId(applyId);
- entity.setApprove_status(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PENDIND_HANDLE);
- entity.setProcess_stage(Constant.LandSupplyApproveStage.SUPPLY);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
- approvalService.insertAndGetId(newApproval);
- return true;
- } else if (Objects.equals(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PENDIND_HANDLE, approval.getAfter_approvalstatus())) {
- //待供地审批 --》 待供地审批通过
- Group group = null;
- newApproval.setOper_type(Constant.OperType.SUBMIT);
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PENDIND_HANDLE);
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PASS);
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_7);
- if (null == group) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_7 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findListByWhere(new User());
- 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() + ",");
- //发送短信
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_GD;
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- newApproval.setNextchecker(sb.toString());
- if (sb.length() == 0) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_7 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- //如果是政府业务员提交的 只给商务业务员发
- Integer createId = detail.getCreate_by();
- User creater = userService.getUser(createId);
- if (!Objects.equals(creater.getUser_type(), Constant.UserType.GOVERNMENT)) {
- //如果不是政府账号创建 说明是街道提交 则给提交人也发短信
- //发送短信
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_GD;
- try {
- AlibabaSMSUtil.sendSMS(
- creater.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- //短信给商务受理员
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
- userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- for (User user : users) {
- if (Objects.equals(user.getId(), userGroup.getUser_id())) {
- //发送短信
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_GD;
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- //短信给经发
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_8);
- userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- for (User user : users) {
- if (Objects.equals(user.getId(), userGroup.getUser_id())) {
- //发送短信
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_GD;
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
- entity.setId(applyId);
- entity.setApprove_status(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PASS);
- entity.setProcess_stage(Constant.LandSupplyApproveStage.SUPPLY);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
- approvalService.insertAndGetId(newApproval);
- return true;
- } else if (Objects.equals(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PASS, approval.getAfter_approvalstatus())) {
- //待供地审批通过 --》 最终信息 待供地审批通过
- Group group = null;
- newApproval.setOper_type(Constant.OperType.FINAL);
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PASS);
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PASS);
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_7);
- if (null == group) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_7 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findListByWhere(new User());
- 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() + ",");
- //发送短信
- // try {
- // AlibabaSMSUtil.sendSMS(
- // user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- // );
- // } catch (ClientException e) {
- // e.printStackTrace();
- // }
- }
- }
- }
- newApproval.setNextchecker(sb.toString());
- if (sb.length() == 0) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_7 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
- entity.setId(applyId);
- entity.setApprove_status(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PASS);
- entity.setProcess_stage(Constant.LandSupplyApproveStage.SUPPLY);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
- approvalService.insertAndGetId(newApproval);
- return true;
- }
- return false;
- }
- /**
- * @Author: huZhiHao
- * @Description: 退回
- * @Date: 2020/3/9
- * @Params: [applyId, comment]
- * @Return: boolean
- **/
- @Transactional
- public boolean untread(Integer applyId, String comment) {
- Approval approval = approvalService.getLatestApproval(applyId, Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY);
- Approval newApproval = new Approval();
- newApproval.setApply_id(applyId);
- newApproval.setType(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY);
- if (ShiroUtils.getUserType().equals(Constant.UserType.GOVERNMENT)) {
- if (null != userService.getUser(ShiroUtils.getUserId()).getDepartment_id()) {
- String departmentname = departmentService.selectById(userService.getUser(ShiroUtils.getUserId()).getDepartment_id()).getName();
- newApproval.setDepartment(departmentname);
- }
- } else if (ShiroUtils.getUserType().equals(Constant.UserType.STREET)) {
- newApproval.setDepartment(ShiroUtils.getUserEntity().getStreet_name());
- }
- newApproval.setApproval_comment(comment);
- newApproval.setChecker(ShiroUtils.getUserId());
- newApproval.setOper_type(Constant.OperType.REJECT);
- newApproval.setDeal_time(DateUtil.getTimeString(new Date()));
- IndustrialLandSupplyDetail entity = industrialLandSupplyDetailDao.selectById(applyId + "");
- // User companyAdmin = userService.findCompanyAdmin(projectApplication.getCompany_id());
- // Message messages = new Message();
- // messages.setApply_id(projectApplication.getId());
- // messages.setBusiness_type(Constant.Message_Business_type.PROJECT_INTELLIGENT_APPLY);
- // messages.setTitle("提醒企业");
- // String message = "您有单号为" + projectApplication.getApply_no() + "的" +
- // Constant.ProjectType.PROJECT_INTELLIGENT + ",经审核被退回,要求修改,详情请登录平台查看。退回原因:" + comment;
- // messages.setContent(message);
- // int[] streetArrInt = new int[1];
- // streetArrInt[0] = projectApplication.getCompany_id();
- // Map<String, String> params = new HashMap<>();
- // params.put("project_no", projectApplication.getApply_no());
- // params.put("apply_name", Constant.ProjectType.PROJECT_INTELLIGENT);
- // String templateCode = Constant.SMS_TemplateCode.RPOJECT_MATTERS_REJECT;
- //短信参数
- Map<String, String> params = new HashMap<>();
- IndustrialLandSupplyDetail detail = this.findById(applyId);
- params.put("title", detail.getTitle());
- params.put("no", detail.getNo());
- params.put("reason", comment);
- String templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY;
- if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE, approval.getAfter_approvalstatus())) {
- //商务局业务办理员退回 --》 街道板块
- newApproval.setOper_type(Constant.OperType.REJECT);
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_RETURN);
- newApproval.setNextchecker(entity.getCreate_by().toString());
- IndustrialLandSupplyDetail p = new IndustrialLandSupplyDetail();
- p.setId(applyId);
- p.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_RETURN);
- p.setProcess_stage(null);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(p);
- approvalService.insertAndGetId(newApproval);
- // messageService.saveMessageAndPush(messages, streetArrInt, Constant.UserType.COMPANY);
- // waitToDoService.completeAllTODO(projectApplication.getId(), Constant.DictionaryType.PROJECT_INTELLIGENT);
- // waitToDoService.newTODO("智能制造编辑", "/projectIntelligent/edit/" + projectApplication.getId(), Constant.WaitToDo_OperType.EDIT, projectApplication.getId(),
- // Constant.DictionaryType.PROJECT_INTELLIGENT, projectApplication.getApply_no(), companyAdmin.getId().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false);
- //发送短信
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_UNTREAD;
- try {
- AlibabaSMSUtil.sendSMS(
- userService.getUser(entity.getCreate_by()).getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- return true;
- } else if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE, approval.getAfter_approvalstatus())) {
- //商务局领导退回 --》 商务局业务员
- Group group = null;
- newApproval.setOper_type(Constant.OperType.REJECT);
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_RETURN);
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
- if (null == group) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findListByWhere(new User());
- 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() + ",");
- //发送短信
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_UNTREAD;
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- newApproval.setNextchecker(sb.toString());
- if (sb.length() == 0) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- IndustrialLandSupplyDetail p = new IndustrialLandSupplyDetail();
- p.setId(applyId);
- p.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_RETURN);
- p.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(p);
- approvalService.insertAndGetId(newApproval);
- return true;
- } else if (Objects.equals(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE, approval.getAfter_approvalstatus())) {
- //管委会领导退回 --》 商务局业务员
- Group group = null;
- newApproval.setOper_type(Constant.OperType.REJECT);
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_RETURN);
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
- if (null == group) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findListByWhere(new User());
- 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() + ",");
- //发送短信
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_UNTREAD;
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- newApproval.setNextchecker(sb.toString());
- if (sb.length() == 0) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- IndustrialLandSupplyDetail p = new IndustrialLandSupplyDetail();
- p.setId(applyId);
- p.setApprove_status(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_RETURN);
- p.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(p);
- approvalService.insertAndGetId(newApproval);
- return true;
- } else if (Objects.equals(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PENDIND_HANDLE, approval.getAfter_approvalstatus())) {
- //供地领导退回 --》 资源规划局务员
- Group group = null;
- newApproval.setOper_type(Constant.OperType.REJECT);
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PENDIND_HANDLE);
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_RETURN);
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_7);
- if (null == group) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_7 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findListByWhere(new User());
- 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() + ",");
- //发送短信
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_UNTREAD;
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- newApproval.setNextchecker(sb.toString());
- if (sb.length() == 0) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_5 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- IndustrialLandSupplyDetail p = new IndustrialLandSupplyDetail();
- p.setId(applyId);
- p.setApprove_status(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_RETURN);
- p.setProcess_stage(Constant.LandSupplyApproveStage.SUPPLY);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(p);
- approvalService.insertAndGetId(newApproval);
- return true;
- } else if (Objects.equals(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_RETURN, approval.getAfter_approvalstatus())) {
- //供地审批退回 --》 预审通过待分发
- Group group = null;
- newApproval.setOper_type(Constant.OperType.REJECT);
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_RETURN);
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.PRE_APPROVE_PENDIND_DISTRIBUTE);
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_5);
- if (null == group) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_5 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findListByWhere(new User());
- 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() + ",");
- //发送短信
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_UNTREAD;
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- newApproval.setNextchecker(sb.toString());
- if (sb.length() == 0) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_5 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- IndustrialLandSupplyDetail p = new IndustrialLandSupplyDetail();
- p.setId(applyId);
- p.setApprove_status(Constant.LandSupplyApproveStatus.PRE_APPROVE_PENDIND_DISTRIBUTE);
- p.setProcess_stage(Constant.LandSupplyApproveStage.SUPPLY);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(p);
- approvalService.insertAndGetId(newApproval);
- return true;
- }
- return false;
- }
- /**
- * @Author: huZhiHao
- * @Description: 拒绝
- * @Date: 2020/3/9
- * @Params: [applyId, comment]
- * @Return: boolean
- **/
- @Transactional
- public boolean refuse(Integer applyId, String comment) {
- Approval approval = approvalService.getLatestApproval(applyId, Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY);
- Approval newApproval = new Approval();
- newApproval.setApply_id(applyId);
- newApproval.setType(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY);
- if (ShiroUtils.getUserType().equals(Constant.UserType.GOVERNMENT)) {
- if (null != userService.getUser(ShiroUtils.getUserId()).getDepartment_id()) {
- String departmentname = departmentService.selectById(userService.getUser(ShiroUtils.getUserId()).getDepartment_id()).getName();
- newApproval.setDepartment(departmentname);
- }
- } else if (ShiroUtils.getUserType().equals(Constant.UserType.STREET)) {
- newApproval.setDepartment(ShiroUtils.getUserEntity().getStreet_name());
- }
- newApproval.setApproval_comment(comment);
- newApproval.setChecker(ShiroUtils.getUserId());
- newApproval.setOper_type(Constant.OperType.NOTAPPROVED);
- newApproval.setDeal_time(DateUtil.getTimeString(new Date()));
- IndustrialLandSupplyDetail entity = industrialLandSupplyDetailDao.selectById(applyId + "");
- //短信参数
- Map<String, String> params = new HashMap<>();
- IndustrialLandSupplyDetail detail = this.findById(applyId);
- params.put("title", detail.getTitle());
- params.put("no", detail.getNo());
- String templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY;
- if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE, approval.getAfter_approvalstatus())) {
- //商务局分管领导拒绝
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_REJECT);
- newApproval.setNextchecker(entity.getCreate_by().toString());
- IndustrialLandSupplyDetail p = new IndustrialLandSupplyDetail();
- p.setId(applyId);
- p.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_REJECT);
- p.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(p);
- approvalService.insertAndGetId(newApproval);
- // ProjectIntelligentDeclaration 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_INTELLIGENT_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);
- //发送短信
- // try {
- // AlibabaSMSUtil.sendSMS(
- // userService.getUser(entity.getCreate_by()).getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- // );
- // } catch (ClientException e) {
- // e.printStackTrace();
- // }
- return true;
- } else if (Objects.equals(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE, approval.getAfter_approvalstatus())) {
- //管委会分管领导拒绝
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_REJECT);
- newApproval.setNextchecker(entity.getCreate_by().toString());
- IndustrialLandSupplyDetail p = new IndustrialLandSupplyDetail();
- p.setId(applyId);
- p.setApprove_status(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_REJECT);
- p.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(p);
- approvalService.insertAndGetId(newApproval);
- //发送短信
- // try {
- // AlibabaSMSUtil.sendSMS(
- // userService.getUser(entity.getCreate_by()).getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- // );
- // } catch (ClientException e) {
- // e.printStackTrace();
- // }
- return true;
- } else if (Objects.equals(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PENDIND_HANDLE, approval.getAfter_approvalstatus())) {
- //供地分管领导拒绝
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PENDIND_HANDLE);
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_REJECT);
- newApproval.setNextchecker(entity.getCreate_by().toString());
- IndustrialLandSupplyDetail p = new IndustrialLandSupplyDetail();
- p.setId(applyId);
- p.setApprove_status(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_REJECT);
- p.setProcess_stage(Constant.LandSupplyApproveStage.SUPPLY);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(p);
- approvalService.insertAndGetId(newApproval);
- //发送短信
- // try {
- // AlibabaSMSUtil.sendSMS(
- // userService.getUser(entity.getCreate_by()).getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- // );
- // } catch (ClientException e) {
- // e.printStackTrace();
- // }
- return true;
- }
- return false;
- }
- /**
- * @Author: huZhiHao
- * @Description: 是否可以新增
- * @Date: 2020/3/9
- * @Params: []
- * @Return: java.lang.Boolean
- **/
- @Transactional
- public Boolean canAdd() {
- if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
- return true;
- } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
- Group group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- if (Objects.equals(userGroup.getUser_id(), ShiroUtils.getUserId())) {
- return true;
- }
- }
- }
- return false;
- }
- /**
- * @Author: huZhiHao
- * @Description: 是否可以咨询
- * @Date: 2020/3/9
- * @Params: []
- * @Return: java.lang.Boolean
- **/
- @Transactional
- public Boolean canAsk() {
- if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
- Group group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- if (Objects.equals(userGroup.getUser_id(), ShiroUtils.getUserId())) {
- return true;
- }
- }
- }
- return false;
- }
- public String detailType() {
- if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
- return "0";
- }
- return "1";
- }
- /**
- * @Author: huZhiHao
- * @Description: 用户所在组
- * @Date: 2020/3/9
- * @Params: []
- * @Return: java.lang.String
- **/
- @Transactional
- public String userGroupType() {
- String str = "";
- if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
- str += "0,";
- }
- if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
- Group group = null;
- List<UserGroup> userGroups = null;
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
- userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- if (Objects.equals(userGroup.getUser_id(), ShiroUtils.getUserId())) {
- str += "1,";
- }
- }
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_2);
- userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- if (Objects.equals(userGroup.getUser_id(), ShiroUtils.getUserId())) {
- str += "2,";
- }
- }
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_3);
- userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- if (Objects.equals(userGroup.getUser_id(), ShiroUtils.getUserId())) {
- str += "3,";
- }
- }
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_4);
- userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- if (Objects.equals(userGroup.getUser_id(), ShiroUtils.getUserId())) {
- str += "4,";
- }
- }
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_5);
- userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- if (Objects.equals(userGroup.getUser_id(), ShiroUtils.getUserId())) {
- str += "5,";
- }
- }
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_6);
- userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- if (Objects.equals(userGroup.getUser_id(), ShiroUtils.getUserId())) {
- str += "6,";
- }
- }
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_7);
- userGroups = userGroupService.findByGroupId(group.getId());
- for (UserGroup userGroup : userGroups) {
- if (Objects.equals(userGroup.getUser_id(), ShiroUtils.getUserId())) {
- str += "7,";
- }
- }
- // group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_8);
- // userGroups = userGroupService.findByGroupId(group.getId());
- // for (UserGroup userGroup : userGroups) {
- // if (Objects.equals(userGroup.getUser_id(), ShiroUtils.getUserId())) {
- // str += "8,";
- // }
- // }
- }
- return str;
- }
- /**
- * @Author: huZhiHao
- * @Description: 部门
- * @Date: 2020/3/9
- * @Params: []
- * @Return: java.util.List<platform.modules.sys.entity.Department>
- **/
- @Transactional
- public List<Department> consulDepartmentList() {
- List<Department> list = new ArrayList<>();
- Group group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_2);
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findListByWhere(new User());
- StringBuffer sb = new StringBuffer("");
- for (UserGroup userGroup : userGroups) {
- for (User user : users) {
- if (Objects.equals(user.getId(), userGroup.getUser_id())) {
- //list.add(departmentService.selectById(user.getDepartment_id()));
- //获取根目录部门
- list.add(departmentService.findRootById(user.getDepartment_id()));
- }
- }
- }
- List<Department> myList = list.stream().distinct().collect(Collectors.toList());
- return myList;
- }
- /**
- * @Author: huZhiHao
- * @Description: 分发部门
- * @Date: 2020/3/9
- * @Params: []
- * @Return: java.util.List<platform.modules.sys.entity.Department>
- **/
- @Transactional
- public List<Department> distDepartmentList() {
- List<Department> list = new ArrayList<>();
- Group group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_5);
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findListByWhere(new User());
- StringBuffer sb = new StringBuffer("");
- for (UserGroup userGroup : userGroups) {
- for (User user : users) {
- if (Objects.equals(user.getId(), userGroup.getUser_id())) {
- //list.add(departmentService.selectById(user.getDepartment_id()));
- //获取根目录部门
- list.add(departmentService.findRootById(user.getDepartment_id()));
- }
- }
- }
- List<Department> myList = list.stream().distinct().collect(Collectors.toList());
- return myList;
- }
- /**
- * @Author: huZhiHao
- * @Description: 保存反馈
- * @Date: 2020/3/10
- * @Params: [industrialLandSupplyConsultationList]
- * @Return: void
- **/
- @Transactional
- public void saveFeedback(List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList) {
- String dateTime = DateUtil.getTimeString(new Date());
- for (IndustrialLandSupplyConsultation industrialLandSupplyConsultation : industrialLandSupplyConsultationList) {
- industrialLandSupplyConsultation.setFeedback_time(dateTime);
- industrialLandSupplyConsultationService.updateSelective(industrialLandSupplyConsultation);
- //保存材料
- if (null != industrialLandSupplyConsultation.getFileDown() && null != industrialLandSupplyConsultation.getFileDown().getFile_id()) {
- attachmentService.deleteByBusiness(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_FEEDBACK, industrialLandSupplyConsultation.getId());
- attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_FEEDBACK, industrialLandSupplyConsultation.getId(), industrialLandSupplyConsultation.getFileDown().getFile_id());
- }
- }
- IndustrialLandSupplyConsultation industrialLandSupplyConsultation = industrialLandSupplyConsultationService.findById(industrialLandSupplyConsultationList.get(0).getId());
- this.pass(Integer.valueOf(industrialLandSupplyConsultation.getIndustrial_land_supply_id()), null);
- }
- /**
- * @Author: huZhiHao
- * @Description: 保存反馈
- * @Date: 2020/3/10
- * @Params: [industrialLandSupplyConsultationList]
- * @Return: void
- **/
- @Transactional
- public void saveFeedbackAppend(IndustrialLandSupplyDetail apply) {
- //保存咨询列表
- String dateTime = DateUtil.getTimeString(new Date());
- List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = apply.getConsultationList();
- if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
- Iterator<IndustrialLandSupplyConsultation> it = industrialLandSupplyConsultationList.iterator();
- while (it.hasNext()) {
- IndustrialLandSupplyConsultation industrialLandSupplyConsultation = it.next();
- if (CommonUtils.isNull(industrialLandSupplyConsultation.getConsultation()) || CommonUtils.isNotNull(industrialLandSupplyConsultation.getId())) {
- it.remove();
- }
- }
- for (IndustrialLandSupplyConsultation industrialLandSupplyConsultation : industrialLandSupplyConsultationList) {
- industrialLandSupplyConsultation.setIndustrial_land_supply_id(apply.getId() + "");
- industrialLandSupplyConsultation.setIsDefault(false);
- if (CommonUtils.isNull(industrialLandSupplyConsultation.getConsultation_time())) {
- industrialLandSupplyConsultation.setConsultation_time(dateTime);
- }
- }
- //短信参数
- Map<String, String> params = new HashMap<>();
- IndustrialLandSupplyDetail detail = null;
- try {
- detail = this.selectById(apply.getId() + "");
- } catch (ParseException e) {
- e.printStackTrace();
- }
- params.put("title", detail.getTitle());
- params.put("no", detail.getNo());
- String templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY;
- Group group = null;
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_2);
- if (null == group) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findListByWhere(new User());
- StringBuffer sb = new StringBuffer("");
- for (UserGroup userGroup : userGroups) {
- for (User user : users) {
- if (Objects.equals(user.getId(), userGroup.getUser_id())) {
- List<IndustrialLandSupplyConsultation> ids = industrialLandSupplyConsultationList;
- for (IndustrialLandSupplyConsultation ilsc : ids) {
- if (Objects.equals(user.getDepartment_id() + "", ilsc.getDepartment_id())) {
- sb.append(userGroup.getUser_id() + ",");
- //发送短信
- templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_CONSUL;
- int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(FEEDBACK_TIME));
- params.put("days", days + "");
- try {
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- break;
- }
- }
- }
- }
- }
- if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
- industrialLandSupplyConsultationService.saveList(industrialLandSupplyConsultationList);
- }
- //保存默认咨询列表
- List<String> defaultList = apply.getDefaultList();
- if (!CollectionUtils.isEmpty(defaultList)) {
- IndustrialLandSupplyConsultation query = new IndustrialLandSupplyConsultation();
- query.setIndustrial_land_supply_id(apply.getId() + "");
- query.setDel_flag(false);
- List<IndustrialLandSupplyConsultation> oldList = industrialLandSupplyConsultationService.findListByWhere(query);
- for (String departmentId : defaultList) {
- if (departmentId != null) {
- boolean flag = true;
- for (IndustrialLandSupplyConsultation industrialLandSupplyConsultation : oldList) {
- if (industrialLandSupplyConsultation.getIsDefault() &&
- Objects.equals(industrialLandSupplyConsultation.getDepartment_id(), departmentId)) {
- flag = false;
- }
- }
- if (flag) {
- IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
- industrialLandSupplyConsultation.setIsDefault(true);
- industrialLandSupplyConsultation.setIndustrial_land_supply_id(apply.getId() + "");
- industrialLandSupplyConsultation.setConsultation_time(dateTime);
- industrialLandSupplyConsultation.setDepartment_id(departmentId);
- industrialLandSupplyConsultation.setConsultation(CONSULTATION_MESSAGE);
- industrialLandSupplyConsultationService.save(industrialLandSupplyConsultation);
- }
- }
- }
- }
- }
- }
- /**
- * @Author: huZhiHao
- * @Description: 保存汇总
- * @Date: 2020/3/10
- * @Params: [industrialLandSupplyDetail]
- * @Return: void
- **/
- @Transactional
- public void saveSummary(IndustrialLandSupplyDetail industrialLandSupplyDetail) {
- IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
- entity.setId(industrialLandSupplyDetail.getId());
- entity.setConsultation_summary(industrialLandSupplyDetail.getConsultation_summary());
- entity.setConsultation_summary_text(industrialLandSupplyDetail.getConsultation_summary_text());
- this.updateSelective(entity);
- //保存材料
- if (null != industrialLandSupplyDetail.getFileDown() && null != industrialLandSupplyDetail.getFileDown().getFile_id()) {
- attachmentService.deleteByBusiness(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_SUMMARY, industrialLandSupplyDetail.getId());
- attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_SUMMARY, industrialLandSupplyDetail.getId(), industrialLandSupplyDetail.getFileDown().getFile_id());
- }
- this.pass(industrialLandSupplyDetail.getId(), null);
- }
- /**
- * @Author: huZhiHao
- * @Description: 撤回咨询
- * @Date: 2020/3/7
- * @Params: [applyId, comment]
- * @Return: java.lang.Boolean
- **/
- @Transactional
- public Boolean withDrawConsul(String id) {
- IndustrialLandSupplyConsultation industrialLandSupplyConsultation = industrialLandSupplyConsultationService.findById(Integer.valueOf(id));
- industrialLandSupplyConsultation.setDel_flag(true);
- industrialLandSupplyConsultationService.updateSelective(industrialLandSupplyConsultation);
- return this.withdraw(Integer.valueOf(industrialLandSupplyConsultation.getIndustrial_land_supply_id()), null);
- }
- /**
- * @Author: huZhiHao
- * @Description: 撤回申请
- * @Date: 2020/3/7
- * @Params: [applyId, comment]
- * @Return: java.lang.Boolean
- **/
- @Transactional
- public void withdrawApply(String id) {
- // IndustrialLandSupplyDetail industrialLandSupplyDetail = this.selectById(id);
- // industrialLandSupplyDetail.setApprove_status(Constant.LandSupplyApproveStatus.PLATE_WITHDRAW);
- // industrialLandSupplyDetail.setProcess_stage("");
- // industrialLandSupplyDetail.setAccept_date("");
- // this.updateSelective(industrialLandSupplyDetail);
- // Approval approval = new Approval();
- // approval.setApply_id(Integer.valueOf(id));
- // approvalService.deleteByWhere(approval);
- withdraw(Integer.valueOf(id), null);
- }
- /**
- * @Author: huZhiHao
- * @Description: 撤回
- * @Date: 2020/3/7
- * @Params: [applyId, comment]
- * @Return: java.lang.Boolean
- **/
- @Transactional
- public Boolean withdraw(Integer applyId, String comment) {
- Approval approval = approvalService.getLatestApproval(applyId, Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY);
- Approval newApproval = new Approval();
- newApproval.setApply_id(applyId);
- newApproval.setType(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY);
- String departmentname = departmentService.selectById(userService.getUser(ShiroUtils.getUserId()).getDepartment_id()).getName();
- newApproval.setDepartment(departmentname);
- newApproval.setApproval_comment(comment);
- newApproval.setChecker(ShiroUtils.getUserId());
- newApproval.setOper_type(Constant.OperType.WITHDRAW);
- newApproval.setDeal_time(DateUtil.getTimeString(new Date()));
- if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK, approval.getAfter_approvalstatus())) {
- //待咨询反馈 --》 待咨询汇总
- IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
- industrialLandSupplyConsultation.setIndustrial_land_supply_id(applyId + "");
- industrialLandSupplyConsultation.setDel_flag(false);
- List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
- boolean sumbitToSummary = true;
- boolean backToSubmit = false;
- //如果剩下的没有反馈了 退回到待提交
- if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
- for (IndustrialLandSupplyConsultation landSupplyConsultation : industrialLandSupplyConsultationList) {
- //如果剩下的都是已反馈的咨询 则进入汇总
- if (CommonUtils.isNull(landSupplyConsultation.getFeedback()) || CommonUtils.isNull(landSupplyConsultation.getUpdate_by())) {
- sumbitToSummary = false;
- break;
- } else {
- sumbitToSummary = true;
- }
- }
- } else {
- backToSubmit = true;
- }
- if (sumbitToSummary || backToSubmit) {
- Group group = null;
- newApproval.setOper_type(Constant.OperType.SUBMIT);
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
- if (backToSubmit) {
- IndustrialLandSupplyDetail industrialLandSupplyDetail = this.findById(applyId);
- if (industrialLandSupplyDetail != null && industrialLandSupplyDetail.getCreate_by() != null) {
- User user = userService.getUser(industrialLandSupplyDetail.getCreate_by());
- if (Objects.equals(Constant.UserType.STREET, user.getUser_type())) {
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
- } else {
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUBMIT);
- }
- }
- } else if (sumbitToSummary) {
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUMMARY);
- }
- group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
- if (null == group) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- List<User> users = userService.findListByWhere(new User());
- 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() + ",");
- }
- }
- }
- newApproval.setNextchecker(sb.toString());
- if (sb.length() == 0) {
- throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
- }
- IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
- entity.setId(applyId);
- if (backToSubmit) {
- entity.setApprove_status(newApproval.getAfter_approvalstatus());
- } else if (sumbitToSummary) {
- entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUMMARY);
- }
- entity.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
- approvalService.insertAndGetId(newApproval);
- return true;
- }
- } else if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE, approval.getAfter_approvalstatus())) {
- //待商务业务员处理 --》 已撤回
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.PLATE_WITHDRAW);
- newApproval.setNextchecker(ShiroUtils.getUserId() + "");
- IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
- entity.setId(applyId);
- entity.setApprove_status(Constant.LandSupplyApproveStatus.PLATE_WITHDRAW);
- entity.setProcess_stage("");
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
- approvalService.insertAndGetId(newApproval);
- return true;
- }
- return false;
- }
- @Transactional
- public Integer commerceApprove(IndustrialLandSupplyDetail apply) {
- Integer id = apply.getId();
- IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
- entity.setId(id);
- entity.setSupplement(apply.getSupplement());
- this.updateSelective(entity);
- //保存材料
- if (null != apply.getFileDown() && null != apply.getFileDown().getFile_id()) {
- attachmentService.deleteByBusiness(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_COMMERCE_SUPPLEMENT, id);
- attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_COMMERCE_SUPPLEMENT, id, apply.getFileDown().getFile_id());
- }
- //保存咨询列表
- String dateTime = DateUtil.getTimeString(new Date());
- List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = apply.getConsultationList();
- if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
- Iterator<IndustrialLandSupplyConsultation> it = industrialLandSupplyConsultationList.iterator();
- while (it.hasNext()) {
- if (CommonUtils.isNull(it.next().getConsultation())) {
- it.remove();
- }
- }
- for (IndustrialLandSupplyConsultation industrialLandSupplyConsultation : industrialLandSupplyConsultationList) {
- industrialLandSupplyConsultation.setIsDefault(false);
- industrialLandSupplyConsultation.setIndustrial_land_supply_id(id + "");
- if (industrialLandSupplyConsultation.getId() != null) {
- IndustrialLandSupplyConsultation industrialLandSupplyConsultation1 = industrialLandSupplyConsultationService.findById(industrialLandSupplyConsultation.getId());
- //如果问的问题没变则保留id等信息 不然作为新的处理
- if (Objects.equals(industrialLandSupplyConsultation1.getConsultation(), industrialLandSupplyConsultation.getConsultation())) {
- BeanUtils.copyProperties(industrialLandSupplyConsultation1, industrialLandSupplyConsultation);
- }
- }
- if (CommonUtils.isNull(industrialLandSupplyConsultation.getConsultation_time())) {
- industrialLandSupplyConsultation.setConsultation_time(dateTime);
- }
- }
- IndustrialLandSupplyConsultation query = new IndustrialLandSupplyConsultation();
- query.setIndustrial_land_supply_id(id + "");
- industrialLandSupplyConsultationService.deleteByWhere(query);
- if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
- industrialLandSupplyConsultationService.saveList(industrialLandSupplyConsultationList);
- }
- }
- //保存默认咨询列表
- List<String> defaultList = apply.getDefaultList();
- if (!CollectionUtils.isEmpty(defaultList)) {
- for (String departmentId : defaultList) {
- if (departmentId != null && departmentId != "") {
- IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
- industrialLandSupplyConsultation.setIsDefault(true);
- industrialLandSupplyConsultation.setIndustrial_land_supply_id(apply.getId() + "");
- industrialLandSupplyConsultation.setConsultation_time(dateTime);
- industrialLandSupplyConsultation.setDepartment_id(departmentId);
- industrialLandSupplyConsultation.setConsultation(CONSULTATION_MESSAGE);
- industrialLandSupplyConsultationService.save(industrialLandSupplyConsultation);
- }
- }
- }
- //直接提交申请,添加流程信息
- pass(id, null);
- return id;
- }
- /**
- * @Author: huZhiHao
- * @Description: 保存
- * @Date: 2020/3/7
- * @Params: [apply, status]
- * @Return: void
- **/
- @Transactional
- public void updateAttachment(LandSupplyApprovalDto approval) {
- IndustrialLandSupplyDetail industrialLandSupplyDetail = new IndustrialLandSupplyDetail();
- industrialLandSupplyDetail.setId(approval.getApply_id());
- //保存材料
- if (Objects.equals(approval.getType(), "1")) {
- //商务领导审核附件
- if (null != approval.getFileDown() && null != approval.getFileDown().getFile_id()) {
- attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_COMMERCE_LEADER, approval.getApply_id(), approval.getFileDown().getFile_id());
- }
- industrialLandSupplyDetail.setCommerce_leader_pre_approve_comment(approval.getApproval_comment());
- if (approval.getStatus().equals(Constant.ApproveButtonStatus.APPROVED)) {
- //通过
- industrialLandSupplyDetail.setCommerce_leader_pre_approve_operate("通过");
- } else if (approval.getStatus().equals(Constant.ApproveButtonStatus.REJECT)) {
- //退回
- industrialLandSupplyDetail.setCommerce_leader_pre_approve_operate("退回");
- } else if (approval.getStatus().equals(Constant.ApproveButtonStatus.NOTAPPROVED)) {
- //不通过
- industrialLandSupplyDetail.setCommerce_leader_pre_approve_operate("不通过");
- }
- } else if (Objects.equals(approval.getType(), "2")) {
- //管委会领导审核附件
- if (null != approval.getFileDown() && null != approval.getFileDown().getFile_id()) {
- attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_MANAGEMENT_COMMITTEE_LEADER, approval.getApply_id(), approval.getFileDown().getFile_id());
- }
- if (null != approval.getCountersign_file() && null != approval.getCountersign_file().getFile_id()) {
- attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_MANAGEMENT_COMMITTEE_LEADER_COUNTERSIGN, approval.getApply_id(), approval.getCountersign_file().getFile_id());
- }
- industrialLandSupplyDetail.setCommittee_leader_pre_approve_comment(approval.getApproval_comment());
- industrialLandSupplyDetail.setCountersign_comment(approval.getCountersign_comment());
- if (approval.getStatus().equals(Constant.ApproveButtonStatus.APPROVED)) {
- //通过
- industrialLandSupplyDetail.setCommittee_leader_pre_approve_operate("通过");
- } else if (approval.getStatus().equals(Constant.ApproveButtonStatus.REJECT)) {
- //退回
- industrialLandSupplyDetail.setCommittee_leader_pre_approve_operate("退回");
- } else if (approval.getStatus().equals(Constant.ApproveButtonStatus.NOTAPPROVED)) {
- //不通过
- industrialLandSupplyDetail.setCommittee_leader_pre_approve_operate("不通过");
- }
- } else if (Objects.equals(approval.getType(), "3")) {
- //管委会领导审核附件
- if (null != approval.getFileDown() && null != approval.getFileDown().getFile_id()) {
- attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_APPROVE, approval.getApply_id(), approval.getFileDown().getFile_id());
- }
- industrialLandSupplyDetail.setLand_supply_comment(approval.getApproval_comment());
- if (approval.getStatus().equals(Constant.ApproveButtonStatus.APPROVED)) {
- //通过
- industrialLandSupplyDetail.setLand_supply_result("通过");
- } else if (approval.getStatus().equals(Constant.ApproveButtonStatus.REJECT)) {
- //退回
- industrialLandSupplyDetail.setLand_supply_result("退回");
- } else if (approval.getStatus().equals(Constant.ApproveButtonStatus.NOTAPPROVED)) {
- //不通过
- industrialLandSupplyDetail.setLand_supply_result("不通过");
- }
- } else if (Objects.equals(approval.getType(), "4")) {
- //管委会领导审核附件
- if (null != approval.getFileDown() && null != approval.getFileDown().getFile_id()) {
- attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_FINAL, approval.getApply_id(), approval.getFileDown().getFile_id());
- }
- industrialLandSupplyDetail.setFinal_comment(approval.getApproval_comment());
- if (approval.getStatus().equals(Constant.ApproveButtonStatus.APPROVED)) {
- //通过
- industrialLandSupplyDetail.setFinal_result("通过");
- } else if (approval.getStatus().equals(Constant.ApproveButtonStatus.REJECT)) {
- //退回
- industrialLandSupplyDetail.setFinal_result("退回");
- } else if (approval.getStatus().equals(Constant.ApproveButtonStatus.NOTAPPROVED)) {
- //不通过
- industrialLandSupplyDetail.setFinal_result("不通过");
- }
- }
- this.updateSelective(industrialLandSupplyDetail);
- }
- @Transactional
- public Integer distribute(IndustrialLandSupplyDetail apply) {
- Integer id = apply.getId();
- String dateTime = DateUtil.getTimeString(new Date());
- List<IndustrialLandSupplyDistribution> industrialLandSupplyDistributionList = apply.getDistributionList();
- Iterator<IndustrialLandSupplyDistribution> it = industrialLandSupplyDistributionList.iterator();
- while (it.hasNext()) {
- if (CommonUtils.isNull(it.next().getDistribution_file().getFile_id())) {
- it.remove();
- }
- }
- IndustrialLandSupplyDetail industrialLandSupplyDetail = new IndustrialLandSupplyDetail();
- industrialLandSupplyDetail.setId(id);
- industrialLandSupplyDetail.setDescription_of_submitted(apply.getDescription_of_submitted());
- this.updateSelective(industrialLandSupplyDetail);
- //获取所有待分发的部门
- List<Department> departmentIds = this.distDepartmentList();
- //如果分发时有资料说明 但是没附件
- if (
- CommonUtils.isNotNull(apply.getDescription_of_submitted())
- && CollectionUtils.isEmpty(industrialLandSupplyDistributionList)
- ) {
- for (Department department : departmentIds) {
- IndustrialLandSupplyDistribution industrialLandSupplyDistribution = new IndustrialLandSupplyDistribution();
- industrialLandSupplyDistribution.setDepartment_id(department.getId() + "");
- industrialLandSupplyDistribution.setIndustrial_land_supply_id(id + "");
- industrialLandSupplyDistribution.setContent(apply.getDescription_of_submitted_text());
- if (CommonUtils.isNull(industrialLandSupplyDistribution.getDistribute_time())) {
- industrialLandSupplyDistribution.setDistribute_time(dateTime);
- }
- industrialLandSupplyDistributionService.saveSelective(industrialLandSupplyDistribution);
- }
- }
- //如果分发时有资料说明 有附件
- if (
- CommonUtils.isNotNull(apply.getDescription_of_submitted())
- && !CollectionUtils.isEmpty(industrialLandSupplyDistributionList)
- ) {
- for (IndustrialLandSupplyDistribution industrialLandSupplyDistribution : industrialLandSupplyDistributionList) {
- //注释了 现在只把department=0的这个公共文件给所有部门看
- /* industrialLandSupplyDistribution.setIndustrial_land_supply_id(id + "");
- if (CommonUtils.isNull(industrialLandSupplyDistribution.getDistribute_time())) {
- industrialLandSupplyDistribution.setDistribute_time(dateTime);
- }
- industrialLandSupplyDistributionService.saveSelective(industrialLandSupplyDistribution);
- //保存材料
- if (null != industrialLandSupplyDistribution.getDistribution_file() && null != industrialLandSupplyDistribution.getDistribution_file().getFile_id()) {
- attachmentService.deleteByBusiness(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE, industrialLandSupplyDistribution.getId());
- attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE, industrialLandSupplyDistribution.getId(), industrialLandSupplyDistribution.getDistribution_file().getFile_id());
- }*/
- if (Objects.equals("0", industrialLandSupplyDistribution.getDepartment_id())) {
- Integer fileId = null;
- if (null != industrialLandSupplyDistribution.getDistribution_file() && null != industrialLandSupplyDistribution.getDistribution_file().getFile_id()) {
- fileId = industrialLandSupplyDistribution.getDistribution_file().getFile_id();
- }
- Attachment attachment = attachmentService.findById(fileId);
- for (Department department : departmentIds) {
- industrialLandSupplyDistribution.setId(null);
- industrialLandSupplyDistribution.setDepartment_id(department.getId() + "");
- industrialLandSupplyDistribution.setIndustrial_land_supply_id(id + "");
- industrialLandSupplyDistribution.setContent(apply.getDescription_of_submitted_text());
- if (CommonUtils.isNull(industrialLandSupplyDistribution.getDistribute_time())) {
- industrialLandSupplyDistribution.setDistribute_time(dateTime);
- }
- industrialLandSupplyDistributionService.saveSelective(industrialLandSupplyDistribution);
- attachment.setId(null);
- attachment.setBusiness_type(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE);
- attachment.setBusiness_id(industrialLandSupplyDistribution.getId());
- attachmentService.saveSelective(attachment);
- }
- }
- }
- }
- //直接提交申请,添加流程信息
- pass(id, null);
- return id;
- }
- public List<FileDown> getAllDepartmentFile(String id) {
- List<FileDown> fileDownList = new ArrayList<>();
- List<Attachment> attachments = new ArrayList<>();
- IndustrialLandSupplyDistribution industrialLandSupplyDistribution = new IndustrialLandSupplyDistribution();
- industrialLandSupplyDistribution.setIndustrial_land_supply_id(id);
- industrialLandSupplyDistribution.setDepartment_id("0");
- industrialLandSupplyDistribution.setDel_flag(false);
- List<IndustrialLandSupplyDistribution> industrialLandSupplyDistributionList = industrialLandSupplyDistributionService.findListByWhere(industrialLandSupplyDistribution);
- if (!CollectionUtils.isEmpty(industrialLandSupplyDistributionList)) {
- for (IndustrialLandSupplyDistribution landSupplyDistribution : industrialLandSupplyDistributionList) {
- attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE, landSupplyDistribution.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());
- fileDownList.add(fileDown);
- }
- }
- return fileDownList;
- }
- return fileDownList;
- }
- @Transactional
- public void distributeFeedback(List<IndustrialLandSupplyDistribution> industrialLandSupplyDistributionList) {
- for (IndustrialLandSupplyDistribution industrialLandSupplyDistribution : industrialLandSupplyDistributionList) {
- industrialLandSupplyDistributionService.updateSelective(industrialLandSupplyDistribution);
- FileDown file = industrialLandSupplyDistribution.getFeedback_file();
- //保存材料
- if (null != file && null != file.getFile_id()) {
- attachmentService.deleteByBusiness(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE_FEEDBACK, industrialLandSupplyDistribution.getId());
- attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE_FEEDBACK, industrialLandSupplyDistribution.getId(), file.getFile_id());
- }
- }
- IndustrialLandSupplyDistribution industrialLandSupplyDistribution = industrialLandSupplyDistributionService.findById(industrialLandSupplyDistributionList.get(0).getId());
- this.pass(Integer.valueOf(industrialLandSupplyDistribution.getIndustrial_land_supply_id()), null);
- }
- @Transactional
- public void distributeSummary(IndustrialLandSupplyDetail industrialLandSupplyDetail) {
- IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
- entity.setId(industrialLandSupplyDetail.getId());
- entity.setJoint_trial(industrialLandSupplyDetail.getJoint_trial());
- if (industrialLandSupplyDetail.getJoint_trial()) {
- entity.setJoint_trial_comment(industrialLandSupplyDetail.getJoint_trial_comment());
- entity.setJoint_trial_result(industrialLandSupplyDetail.getJoint_trial_result());
- }
- entity.setDistribution_summary(industrialLandSupplyDetail.getDistribution_summary());
- this.updateSelective(entity);
- //保存材料
- if (null != industrialLandSupplyDetail.getDistribution_summary_file() && null != industrialLandSupplyDetail.getDistribution_summary_file().getFile_id()) {
- attachmentService.deleteByBusiness(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE_SUMMARY, industrialLandSupplyDetail.getId());
- attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE_SUMMARY, industrialLandSupplyDetail.getId(), industrialLandSupplyDetail.getDistribution_summary_file().getFile_id());
- }
- if (industrialLandSupplyDetail.getJoint_trial()) {
- if (null != industrialLandSupplyDetail.getJoint_trial_file() && null != industrialLandSupplyDetail.getJoint_trial_file().getFile_id()) {
- attachmentService.deleteByBusiness(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_JOINT_TRIAL, industrialLandSupplyDetail.getId());
- attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_JOINT_TRIAL, industrialLandSupplyDetail.getId(), industrialLandSupplyDetail.getJoint_trial_file().getFile_id());
- }
- }
- this.pass(industrialLandSupplyDetail.getId(), null);
- }
- @Transactional
- public void gsFeedback(IndustrialLandSupplyDetail industrialLandSupplyDetail) {
- IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
- entity.setId(industrialLandSupplyDetail.getId());
- entity.setGs_feedback(industrialLandSupplyDetail.getGs_feedback());
- this.updateSelective(entity);
- //保存材料
- if (null != industrialLandSupplyDetail.getFileDown() && null != industrialLandSupplyDetail.getFileDown().getFile_id()) {
- attachmentService.deleteByBusiness(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_GS, industrialLandSupplyDetail.getId());
- attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_GS, industrialLandSupplyDetail.getId(), industrialLandSupplyDetail.getFileDown().getFile_id());
- }
- // this.pass(industrialLandSupplyDetail.getId(), null);
- }
- public void sendToLeader(Map<String, String> params) {
- String ids = userService.getUserIdsByUserTypeAndRole(0, "产业供地领导", null);
- String[] idArr = ids.split(",");
- for (String id : idArr) {
- //发送短信
- try {
- String templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY_LEADER;
- User user = userService.getUser(Integer.parseInt(id));
- AlibabaSMSUtil.sendSMS(
- user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- public void exportCountersignWord(int id, HttpServletResponse response) throws IOException {
- IndustrialLandSupplyDetail entity = this.findById(id);
- ExportWord ew = new ExportWord();
- XWPFDocument document = ew.createXWPFDocument(6, 2);
- List<List<Object>> list = new ArrayList<List<Object>>();
- String title = entity.getTitle();
- String content = entity.getContent_text();
- String location = entity.getLocation();
- String consultationSummary = entity.getConsultation_summary_text();
- List<Object> tempList = new ArrayList<Object>();
- tempList.add("项目标题");
- tempList.add(title == null ? "" : title);
- list.add(tempList);
- tempList = new ArrayList<Object>();
- tempList.add("项目内容");
- tempList.add(content == null ? "" : content);
- list.add(tempList);
- tempList = new ArrayList<Object>();
- tempList.add("用地信息");
- tempList.add(location == null ? "" : location);
- list.add(tempList);
- tempList = new ArrayList<Object>();
- tempList.add("部门意见\r" +
- "(商务汇总意见)");
- tempList.add(consultationSummary == null ? "" : consultationSummary);
- list.add(tempList);
- tempList = new ArrayList<Object>();
- tempList.add("领导批示和会签意见");
- tempList.add("");
- list.add(tempList);
- tempList = new ArrayList<Object>();
- tempList.add("日期");
- String time = DateUtil.getCurrentDateString("yyyy-MM-yy");
- tempList.add(time);
- list.add(tempList);
- Map<String, Object> dataList = new HashMap<String, Object>();
- dataList.put("TITLE", "苏州国家高新区产业用地预审办文单");
- dataList.put("TABLEDATA", list);
- response.reset();
- response.setContentType("application/octet-stream; charset=utf-8");
- response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode("苏州国家高新区产业用地预审办文单" + "-" + time + ".docx", "UTF-8"));
- ew.exportCheckWord(dataList, document, response);
- }
- public void exportCountersignWord2(int id, HttpServletResponse response) throws Exception {
- IndustrialLandSupplyDetail entity = this.findById(id);
- generateWord(entity, response);
- }
- private void generateWord(IndustrialLandSupplyDetail entity, HttpServletResponse response) throws Exception {
- String time = DateUtil.getTimeString(new Date()).split(" ")[0];
- final String name = "苏州国家高新区产业用地预审办文单" + "-" + time + ".docx";
- // String templateUrl = repositoryPath + "/docs/annex_template/annex4.docx";
- String templateUrl = "template/苏州高新区产业用地预审办文单.docx";
- //文件数据库存储路径
- // String outputUrl = getFilePath(name, "docs") + ".docx";
- String title = entity.getTitle();
- String content = entity.getContent_text();
- String location = entity.getLocation();
- String consultationSummary = entity.getConsultation_summary_text();
- Map<String, String> dataMap = new HashMap<>();
- dataMap.put("title", title == null ? "" : title);
- dataMap.put("content", content == null ? "" : content);
- dataMap.put("location", location == null ? "" : location);
- dataMap.put("consultationSummary", consultationSummary == null ? "" : consultationSummary);
- dataMap.put("time", time);
- response.reset();
- response.setContentType("application/octet-stream; charset=utf-8");
- response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode("苏州国家高新区产业用地预审办文单" + "-" + time + ".docx", "UTF-8"));
- changWord(templateUrl, response, dataMap);
- }
- public String getFilePath(String sourceFileName, String typeFolder) {
- String baseFolder = repositoryPath + File.separator + typeFolder;
- Date nowDate = new Date();
- // yyyy/MM/dd
- String fileFolder = baseFolder + File.separator + com.xiaoleilu.hutool.date.DateUtil.format(nowDate, "yyyy")
- + File.separator + com.xiaoleilu.hutool.date.DateUtil.format(nowDate, "MM") + File.separator
- + com.xiaoleilu.hutool.date.DateUtil.format(nowDate, "dd");
- File file = new File(fileFolder);
- if (!file.isDirectory()) {
- // 如果目录不存在,则创建目录
- file.mkdirs();
- }
- // 生成新的文件名
- String fileName = com.xiaoleilu.hutool.date.DateUtil.format(nowDate, "yyyyMMddHHmmss") + sourceFileName;
- return fileFolder + File.separator + fileName;
- }
- private void changWord(String annexOneTempUrl, HttpServletResponse response, Map<String, String> dataMap) {
- BokeWordUtils.changWord(annexOneTempUrl, response, dataMap, null);
- }
- }
|