| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501 |
- package platform.modules.government.service;
- import com.aliyuncs.exceptions.ClientException;
- import com.github.pagehelper.PageHelper;
- import com.github.pagehelper.PageInfo;
- import org.apache.poi.xwpf.usermodel.XWPFDocument;
- 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.build.entity.BuildingInfo;
- 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 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;
- /**
- * @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() + "");
- 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());
- 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() + "");
- 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());
- 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) {
- FileDown fileDown = new FileDown(attachments.get(0).getId(), attachments.get(0).getFile_name(), attachments.get(0).getFile_url(), attachments.get(0).getDownload_uri());
- entity.setFileDown(fileDown);
- }
- //汇总附件
- attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_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())) {
- entity.setRecource(user.getDepartment_name());
- } else {
- entity.setRecource(user.getStreet_name());
- }
- } else if (CommonUtils.isNotNull(user) && Constant.UserType.GOVERNMENT.equals(user.getUser_type())) {
- entity.setRecource(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());
- }
- }
- 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());
- }
- }
- }
- entity.setDistributionList(industrialLandSupplyDistributionList);
- //获取商务和商务分管领导审批意见
- // 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.setRecource(user.getStreet_name());
- } else if (CommonUtils.isNotNull(user) && Constant.UserType.GOVERNMENT.equals(user.getUser_type())) {
- entity.setRecource(user.getDepartment_name());
- }
- IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
- industrialLandSupplyConsultation.setIndustrial_land_supply_id(id);
- industrialLandSupplyConsultation.setDepartment_id(ShiroUtils.getUserEntity().getDepartment_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(), attachments.get(0).getDownload_uri());
- landSupplyConsultation.setFileDown(fileDown);
- }
- Department department = departmentService.selectById(Integer.valueOf(landSupplyConsultation.getDepartment_id()));
- landSupplyConsultation.setDepartment_name(department.getName());
- }
- entity.setConsultationList(industrialLandSupplyConsultationList);
- IndustrialLandSupplyDistribution industrialLandSupplyDistribution = new IndustrialLandSupplyDistribution();
- industrialLandSupplyDistribution.setIndustrial_land_supply_id(id);
- industrialLandSupplyDistribution.setDepartment_id(ShiroUtils.getUserEntity().getDepartment_id() + "");
- 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 department = departmentService.selectById(Integer.valueOf(landSupplyDistribution.getDepartment_id()));
- landSupplyDistribution.setDepartment_name(department.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() + "");
- 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() + "");
- 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())) {
- consulApproveFlag = true;
- break;
- }
- }
- //是否被问
- 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());
- }
- //保存咨询列表
- 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) throws ClientException, InterruptedException {
- 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());
- }
- //保存咨询列表
- 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 (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() + ",您好。“" + 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.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.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<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<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());
- 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) {
- 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(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUBMIT);
- } 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 (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, 1);
- 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();
- List<Object> tempList = new ArrayList<Object>();
- tempList.add("项目标题:" + (title == null ? "" : title));
- list.add(tempList);
- tempList = new ArrayList<Object>();
- tempList.add("项目内容:" + (content == null ? "" : content));
- list.add(tempList);
- tempList = new ArrayList<Object>();
- tempList.add("用地信息:" + (location == null ? "" : location));
- list.add(tempList);
- tempList = new ArrayList<Object>();
- tempList.add("部门意见(商务汇总意见):" + (consultationSummary == null ? "" : consultationSummary));
- list.add(tempList);
- tempList = new ArrayList<Object>();
- tempList.add("领导批示和会签意见:");
- list.add(tempList);
- tempList = new ArrayList<Object>();
- tempList.add("日期:" + DateUtil.getCurrentDateString("yyyy-MM-yy"));
- 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("苏州国家高新区产业用地预审办文单.docx", "UTF-8"));
- ew.exportCheckWord(dataList, document, response);
- }
- }
|