| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856 |
- package platform.modules.government.service;
- import com.github.pagehelper.PageHelper;
- import com.github.pagehelper.PageInfo;
- import org.apache.poi.xwpf.usermodel.XWPFDocument;
- import org.springframework.beans.BeanUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- 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.government.dao.IndustrialLandSupplyDetailDao;
- 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.ApprovalService;
- import platform.modules.sys.service.DepartmentService;
- import platform.modules.sys.service.GroupService;
- import platform.modules.sys.service.UserGroupService;
- import tk.mybatis.mapper.entity.Example;
- import javax.annotation.Resource;
- import javax.servlet.http.HttpServletResponse;
- import java.io.IOException;
- 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;
- 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";
- /**
- * @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) {
- param.setApproval_type(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY);
- if (Objects.equals("1", type)) {
- //待处理
- param.setApplyIds(getProjectIdsByGroup());
- } else if (Objects.equals("2", type)) {
- //已处理
- param.setApplyIds(getProjectIdsy());
- } else if (Objects.equals("3", type)) {
- //查看所有
- 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 (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) {
- 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_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_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_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) {
- //文件
- 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());
- }
- int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(FEEDBACK_TIME));
- landSupplyConsultation.setRemain_time(DateUtil.getTimeDiffStr(landSupplyConsultation.getConsultation_time(), days));
- }
- 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());
- }
- }
- int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(DISTRIBUTE_TIME));
- landSupplyDistribution.setRemain_time(DateUtil.getTimeDiffStr(landSupplyDistribution.getDistribute_time(), days));
- }
- 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));
- }
- //会审剩余时间
- 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));
- }
- //获取商务和商务分管领导审批意见
- // 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) {
- 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);
- }
- 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);
- 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());
- }
- 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);
- 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());
- }
- 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 {
- 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<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.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();
- 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.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 (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()));
- // ProjectIntelligent projectApplication = projectIntelligentDao.findApplyById(applyId);
- // User companyAdmin = userService.findCompanyAdmin(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_APPROVAL_REMIND;
- 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());
- // ProjectIntelligentDeclaration projectProvincesDeclaration = this.selectById(projectApplication.getDeclaration_id().toString());
- 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())) {
- sb.append(userGroup.getUser_id() + ",");
- // 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);
- //发送短信
- // AlibabaSMSUtil.sendSMSMessage(
- // user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params));
- }
- }
- }
- 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())) {
- sb.append(userGroup.getUser_id() + ",");
- }
- }
- }
- 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())) {
- sb.append(userGroup.getUser_id() + ",");
- }
- }
- }
- 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())) {
- sb.append(userGroup.getUser_id() + ",");
- }
- }
- }
- 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() + ",");
- }
- }
- }
- 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() + ",");
- }
- }
- }
- 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() + ",");
- }
- }
- }
- 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() + ",");
- }
- }
- }
- 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() + ",");
- }
- }
- }
- 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() + ",");
- }
- }
- }
- 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() + ",");
- }
- }
- }
- 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.PRE_APPROVE_PENDIND_DISTRIBUTE);
- entity.setProcess_stage(Constant.LandSupplyApproveStage.SUPPLY);
- industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
- approvalService.insertAndGetId(newApproval);
- 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())) {
- sb.append(userGroup.getUser_id() + ",");
- }
- }
- }
- 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() + ",");
- }
- }
- }
- 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() + ",");
- }
- }
- }
- 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() + ",");
- }
- }
- }
- 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;
- } 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() + ",");
- }
- }
- }
- 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;
- if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE, approval.getAfter_approvalstatus())) {
- //商务局业务办理员退回 --》 街道板块
- 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);
- //发送短信
- // AlibabaSMSUtil.sendSMS(
- // companyAdmin.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params));
- return true;
- } else 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_RETURN);
- newApproval.setNextchecker(entity.getCreate_by().toString());
- 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())) {
- //管委会领导退回 --》 商务局业务员
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_RETURN);
- newApproval.setNextchecker(entity.getCreate_by().toString());
- 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())) {
- //供地领导退回 --》 资源规划局务员
- newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PENDIND_HANDLE);
- newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_RETURN);
- newApproval.setNextchecker(entity.getCreate_by().toString());
- 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.SUBMIT);
- 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() + ",");
- }
- }
- }
- 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 + "");
- // User companyAdmin = userService.findCompanyAdmin(projectApplication.getCompany_id());
- 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);
- //发送短信
- // 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_UNPASS;
- // AlibabaSMSUtil.sendSMS(
- // companyAdmin.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params));
- 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);
- 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);
- 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(String applyId, List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList) {
- //保存咨询列表
- String dateTime = DateUtil.getTimeString(new Date());
- 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(applyId);
- if (CommonUtils.isNull(industrialLandSupplyConsultation.getConsultation_time())) {
- industrialLandSupplyConsultation.setConsultation_time(dateTime);
- }
- }
- if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
- industrialLandSupplyConsultationService.saveList(industrialLandSupplyConsultationList);
- }
- }
- }
- /**
- * @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.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);
- }
- }
- //直接提交申请,添加流程信息
- 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();
- if (!CollectionUtils.isEmpty(industrialLandSupplyDistributionList)) {
- Iterator<IndustrialLandSupplyDistribution> it = industrialLandSupplyDistributionList.iterator();
- // Map<String, String> map = new HashMap<>();
- while (it.hasNext()) {
- if (CommonUtils.isNull(it.next().getDistribution_file().getFile_id())) {
- it.remove();
- }
- }
- // IndustrialLandSupplyDistribution query = new IndustrialLandSupplyDistribution();
- // query.setIndustrial_land_supply_id(id + "");
- // industrialLandSupplyDistributionService.deleteByWhere(query);
- //
- // for (IndustrialLandSupplyDistribution industrialLandSupplyDistribution : industrialLandSupplyDistributionList) {
- // map.put(industrialLandSupplyDistribution.getDepartment_id(), null);
- // }
- //
- // List<IndustrialLandSupplyDistribution> industrialLandSupplyDistributions = new ArrayList<>();
- // Iterator<Map.Entry<String, String>> itm = map.entrySet().iterator();
- // while (itm.hasNext()) {
- // String key = itm.next().getKey();
- // IndustrialLandSupplyDistribution entity = new IndustrialLandSupplyDistribution();
- // entity.setIndustrial_land_supply_id(id + "");
- // if (CommonUtils.isNull(entity.getDistribute_time())) {
- // entity.setDistribute_time(dateTime);
- // }
- // List<FileDown> fileDownList = new ArrayList<>();
- // for (IndustrialLandSupplyDistribution industrialLandSupplyDistribution : industrialLandSupplyDistributionList) {
- // if (Objects.equals(key, industrialLandSupplyDistribution.getDepartment_id())) {
- // FileDown fileDown = new FileDown();
- // fileDown.setFile_id(industrialLandSupplyDistribution.getDistribution_file().getFile_id());
- // fileDownList.add(fileDown);
- // }
- // }
- // entity.setDistribution_file_list(fileDownList);
- // industrialLandSupplyDistributions.add(entity);
- // }
- //
- // for (IndustrialLandSupplyDistribution industrialLandSupplyDistribution : industrialLandSupplyDistributions) {
- //
- // industrialLandSupplyDistributionService.saveSelective(industrialLandSupplyDistribution);
- // //保存材料
- // List<FileDown> fileDownList = industrialLandSupplyDistribution.getDistribution_file_list();
- // if (!CollectionUtils.isEmpty(fileDownList)) {
- // for (FileDown fileDown : fileDownList) {
- // if (null != fileDown && null != fileDown.getFile_id()) {
- // attachmentService.deleteByBusiness(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE, industrialLandSupplyDistribution.getId());
- // attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE, industrialLandSupplyDistribution.getId(), fileDown.getFile_id());
- // }
- // }
- // }
- // }
- for (IndustrialLandSupplyDistribution industrialLandSupplyDistribution : industrialLandSupplyDistributionList) {
- 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());
- }
- }
- }
- //直接提交申请,添加流程信息
- 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 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);
- }
- }
|