IndustrialLandSupplyDetailService.java 164 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856
  1. package platform.modules.government.service;
  2. import com.github.pagehelper.PageHelper;
  3. import com.github.pagehelper.PageInfo;
  4. import org.apache.poi.xwpf.usermodel.XWPFDocument;
  5. import org.springframework.beans.BeanUtils;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.stereotype.Service;
  8. import org.springframework.transaction.annotation.Transactional;
  9. import org.springframework.util.CollectionUtils;
  10. import platform.common.Constant;
  11. import platform.common.base.service.BaseService;
  12. import platform.common.base.service.DictionaryItemService;
  13. import platform.common.exception.BaseException;
  14. import platform.common.util.*;
  15. import platform.common.util.word.ExportWord;
  16. import platform.modules.company.dto.LandSupplyApprovalDto;
  17. import platform.modules.government.dao.IndustrialLandSupplyDetailDao;
  18. import platform.modules.government.dto.IndustrialLandSupplyDto;
  19. import platform.modules.government.dto.IndustrialLandSupplyParam;
  20. import platform.modules.government.entity.*;
  21. import platform.modules.sys.entity.*;
  22. import platform.modules.sys.service.ApprovalService;
  23. import platform.modules.sys.service.DepartmentService;
  24. import platform.modules.sys.service.GroupService;
  25. import platform.modules.sys.service.UserGroupService;
  26. import tk.mybatis.mapper.entity.Example;
  27. import javax.annotation.Resource;
  28. import javax.servlet.http.HttpServletResponse;
  29. import java.io.IOException;
  30. import java.net.URLEncoder;
  31. import java.text.ParseException;
  32. import java.util.*;
  33. import java.util.stream.Collectors;
  34. /**
  35. * 功能描述: 产业供地详情
  36. *
  37. * @Author: huZhiHao
  38. * @Date: 2020/3/5
  39. **/
  40. @Service
  41. public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLandSupplyDetail> {
  42. @Resource
  43. private IndustrialLandSupplyDetailDao industrialLandSupplyDetailDao;
  44. @Autowired
  45. private IndustrialLandSupplyConsultationService industrialLandSupplyConsultationService;
  46. @Autowired
  47. private IndustrialLandSupplyDistributionService industrialLandSupplyDistributionService;
  48. @Autowired
  49. private IndustrialLandSupplyConfigService industrialLandSupplyConfigService;
  50. @Autowired
  51. private ApprovalService approvalService;
  52. @Autowired
  53. private AttachmentService attachmentService;
  54. @Autowired
  55. private UserService userService;
  56. @Autowired
  57. private GroupService groupService;
  58. @Autowired
  59. private UserGroupService userGroupService;
  60. @Autowired
  61. private DepartmentService departmentService;
  62. @Autowired
  63. private DictionaryItemService dictionaryItemService;
  64. private static String FEEDBACK_TIME = "1";
  65. private static String SUMMARY_TIME = "2";
  66. private static String DISTRIBUTE_TIME = "3";
  67. private static String JOINT_TRIAL_TIME = "4";
  68. /**
  69. * @Author: huZhiHao
  70. * @Description: 分页查询
  71. * @Date: 2020/3/6
  72. * @Params: [pageNum, pagesize, title, location, status, stage]
  73. * @Return: com.github.pagehelper.PageInfo<platform.modules.government.entity.IndustrialLandSupplyDetail>
  74. **/
  75. @Transactional
  76. public PageInfo<IndustrialLandSupplyDto> findPage(Integer pageNum, Integer pageSize, IndustrialLandSupplyParam param, String type) {
  77. param.setApproval_type(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY);
  78. if (Objects.equals("1", type)) {
  79. //待处理
  80. param.setApplyIds(getProjectIdsByGroup());
  81. } else if (Objects.equals("2", type)) {
  82. //已处理
  83. param.setApplyIds(getProjectIdsy());
  84. } else if (Objects.equals("3", type)) {
  85. //查看所有
  86. param.setApplyIds(getProjectIdsc());
  87. }
  88. PageHelper.startPage(pageNum, pageSize);
  89. List<IndustrialLandSupplyDto> list = industrialLandSupplyDetailDao.findPage(param);
  90. for (IndustrialLandSupplyDto entity : list) {
  91. if (null != entity.getApprove_status()) {
  92. String status_name = dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY_APPROVE_STATUS, entity.getApprove_status());
  93. entity.setApprove_status_desc(status_name);
  94. getPendingDepartment(entity);
  95. }
  96. if (null != entity.getProcess_stage()) {
  97. String process_stage_name = dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY_APPROVE_STAGE, entity.getProcess_stage());
  98. entity.setProcess_stage_desc(process_stage_name);
  99. }
  100. List<Attachment> attachmentList = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_GS, Integer.valueOf(entity.getId()), null);
  101. if (null != entity.getGs_feedback() || !CollectionUtils.isEmpty(attachmentList)) {
  102. entity.setGs_feedback("0");
  103. }
  104. }
  105. return new PageInfo<IndustrialLandSupplyDto>(list);
  106. }
  107. /**
  108. * @Author: huZhiHao
  109. * @Description: 获取待咨询部门
  110. * @Date: 2020/3/11
  111. * @Params: [entity]
  112. * @Return: void
  113. **/
  114. private void getPendingDepartment(IndustrialLandSupplyDto entity) {
  115. if (Objects.equals(Constant.UserType.GOVERNMENT, ShiroUtils.getUserType())) {
  116. String id = entity.getId();
  117. String approveStatus = entity.getApprove_status();
  118. User user = ShiroUtils.getUserEntity();
  119. if (Objects.equals(approveStatus, Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK)) {
  120. IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
  121. industrialLandSupplyConsultation.setIndustrial_land_supply_id(id);
  122. //industrialLandSupplyConsultation.setDepartment_id(user.getDepartment_id() + "");
  123. Department department = departmentService.findRootById(user.getDepartment_id());
  124. industrialLandSupplyConsultation.setDepartment_id(department.getId() + "");
  125. List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
  126. boolean sumbitToSummary = false;
  127. for (IndustrialLandSupplyConsultation landSupplyConsultation : industrialLandSupplyConsultationList) {
  128. //是否所有咨询都已回答
  129. if (CommonUtils.isNull(landSupplyConsultation.getFeedback()) || CommonUtils.isNull(landSupplyConsultation.getUpdate_by())) {
  130. sumbitToSummary = false;
  131. break;
  132. } else {
  133. sumbitToSummary = true;
  134. }
  135. }
  136. //接受咨询的举办 负责的状态
  137. Group group = groupService.findByName(Constant.INDUSTRIALLANDSUPPLY_2, null);
  138. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  139. for (UserGroup userGroup : userGroups) {
  140. if (Objects.equals(userGroup.getUser_id(), user.getId())) {
  141. //Department department = departmentService.selectById(user.getDepartment_id());
  142. department = departmentService.findRootById(user.getDepartment_id());
  143. if (sumbitToSummary) {
  144. entity.setApprove_status_desc(department.getName() + "已反馈");
  145. entity.setApprove_status("a");
  146. } else {
  147. entity.setApprove_status_desc(department.getName() + "待反馈");
  148. }
  149. break;
  150. }
  151. }
  152. } else if (Objects.equals(approveStatus, Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK)) {
  153. IndustrialLandSupplyDistribution industrialLandSupplyDistribution = new IndustrialLandSupplyDistribution();
  154. industrialLandSupplyDistribution.setIndustrial_land_supply_id(id);
  155. //industrialLandSupplyDistribution.setDepartment_id(user.getDepartment_id() + "");
  156. Department department = departmentService.findRootById(user.getDepartment_id());
  157. industrialLandSupplyDistribution.setDepartment_id(department.getId() + "");
  158. List<IndustrialLandSupplyDistribution> industrialLandSupplyDistributionList = industrialLandSupplyDistributionService.findListByWhere(industrialLandSupplyDistribution);
  159. boolean sumbitToSummary = false;
  160. for (IndustrialLandSupplyDistribution landSupplyDistribution : industrialLandSupplyDistributionList) {
  161. //是否所有咨询都已回答
  162. if (CommonUtils.isNull(landSupplyDistribution.getFeedback()) || CommonUtils.isNull(landSupplyDistribution.getUpdate_by())) {
  163. sumbitToSummary = false;
  164. break;
  165. } else {
  166. sumbitToSummary = true;
  167. }
  168. }
  169. //接受分发的举办 负责的状态
  170. Group group = groupService.findByName(Constant.INDUSTRIALLANDSUPPLY_5, null);
  171. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  172. for (UserGroup userGroup : userGroups) {
  173. if (Objects.equals(userGroup.getUser_id(), user.getId())) {
  174. //Department department = departmentService.selectById(user.getDepartment_id());
  175. department = departmentService.findRootById(user.getDepartment_id());
  176. if (sumbitToSummary) {
  177. entity.setApprove_status_desc(department.getName() + "已反馈");
  178. entity.setApprove_status("a");
  179. } else {
  180. entity.setApprove_status_desc(department.getName() + "待反馈");
  181. }
  182. break;
  183. }
  184. }
  185. }
  186. }
  187. }
  188. /**
  189. * @Author: huZhiHao
  190. * @Description: 查询详情
  191. * @Date: 2020/3/11
  192. * @Params: [id]
  193. * @Return: platform.modules.government.entity.IndustrialLandSupplyDetail
  194. **/
  195. @Transactional
  196. public IndustrialLandSupplyDetail selectById(String id) {
  197. IndustrialLandSupplyDetail entity = industrialLandSupplyDetailDao.selectById(id);
  198. //文件
  199. List<Attachment> attachments = null;
  200. //基本信息附件
  201. attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY, entity.getId(), null);
  202. if (null != attachments && attachments.size() > 0) {
  203. List<FileDown> fileList = new ArrayList<>();
  204. for (Attachment attachment : attachments) {
  205. FileDown fileDown = new FileDown(attachment.getId(), attachment.getFile_name(), attachment.getFile_url(), attachment.getDownload_uri());
  206. fileList.add(fileDown);
  207. }
  208. entity.setFileList(fileList);
  209. }
  210. //汇总附件
  211. attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_SUMMARY, entity.getId(), null);
  212. if (null != attachments && attachments.size() > 0) {
  213. FileDown fileDown = new FileDown(attachments.get(0).getId(), attachments.get(0).getFile_name(), attachments.get(0).getFile_url(), attachments.get(0).getDownload_uri());
  214. entity.setConsultation_summary_file(fileDown);
  215. }
  216. //补充附件
  217. attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_COMMERCE_SUPPLEMENT, entity.getId(), null);
  218. if (null != attachments && attachments.size() > 0) {
  219. FileDown fileDown = new FileDown(attachments.get(0).getId(), attachments.get(0).getFile_name(), attachments.get(0).getFile_url(), attachments.get(0).getDownload_uri());
  220. entity.setSupplement_file(fileDown);
  221. }
  222. //商务局分管领导附件
  223. attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_COMMERCE_LEADER, entity.getId(), null);
  224. if (null != attachments && attachments.size() > 0) {
  225. FileDown fileDown = new FileDown(attachments.get(0).getId(), attachments.get(0).getFile_name(), attachments.get(0).getFile_url(), attachments.get(0).getDownload_uri());
  226. entity.setCommerce_leader_pre_approve_file(fileDown);
  227. }
  228. //管委会分管领导附件
  229. attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_MANAGEMENT_COMMITTEE_LEADER, entity.getId(), null);
  230. if (null != attachments && attachments.size() > 0) {
  231. FileDown fileDown = new FileDown(attachments.get(0).getId(), attachments.get(0).getFile_name(), attachments.get(0).getFile_url(), attachments.get(0).getDownload_uri());
  232. entity.setCommittee_leader_pre_approve_file(fileDown);
  233. }
  234. //分发汇总附件
  235. attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE_SUMMARY, entity.getId(), null);
  236. if (null != attachments && attachments.size() > 0) {
  237. FileDown fileDown = new FileDown(attachments.get(0).getId(), attachments.get(0).getFile_name(), attachments.get(0).getFile_url(), attachments.get(0).getDownload_uri());
  238. entity.setDistribution_summary_file(fileDown);
  239. }
  240. //专题会审附件
  241. attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_JOINT_TRIAL, entity.getId(), null);
  242. if (null != attachments && attachments.size() > 0) {
  243. FileDown fileDown = new FileDown(attachments.get(0).getId(), attachments.get(0).getFile_name(), attachments.get(0).getFile_url(), attachments.get(0).getDownload_uri());
  244. entity.setJoint_trial_file(fileDown);
  245. }
  246. //供地审批附件
  247. attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_APPROVE, entity.getId(), null);
  248. if (null != attachments && attachments.size() > 0) {
  249. FileDown fileDown = new FileDown(attachments.get(0).getId(), attachments.get(0).getFile_name(), attachments.get(0).getFile_url(), attachments.get(0).getDownload_uri());
  250. entity.setLand_supply_file(fileDown);
  251. }
  252. //最终信息附件
  253. attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_FINAL, entity.getId(), null);
  254. if (null != attachments && attachments.size() > 0) {
  255. FileDown fileDown = new FileDown(attachments.get(0).getId(), attachments.get(0).getFile_name(), attachments.get(0).getFile_url(), attachments.get(0).getDownload_uri());
  256. entity.setFinal_file(fileDown);
  257. }
  258. //行政反馈附件
  259. attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_GS, entity.getId(), null);
  260. if (null != attachments && attachments.size() > 0) {
  261. FileDown fileDown = new FileDown(attachments.get(0).getId(), attachments.get(0).getFile_name(), attachments.get(0).getFile_url(), attachments.get(0).getDownload_uri());
  262. entity.setGs_feedback_file(fileDown);
  263. }
  264. //会签附件
  265. attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_MANAGEMENT_COMMITTEE_LEADER_COUNTERSIGN, entity.getId(), null);
  266. if (null != attachments && attachments.size() > 0) {
  267. FileDown fileDown = new FileDown(attachments.get(0).getId(), attachments.get(0).getFile_name(), attachments.get(0).getFile_url(), attachments.get(0).getDownload_uri());
  268. entity.setCountersign_file(fileDown);
  269. }
  270. //状态详情
  271. if (null != entity.getApprove_status()) {
  272. String status_name = dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY_APPROVE_STATUS, entity.getApprove_status());
  273. entity.setApprove_status_desc(status_name);
  274. }
  275. if (null != entity.getProcess_stage()) {
  276. String process_stage_name = dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY_APPROVE_STAGE, entity.getProcess_stage());
  277. entity.setProcess_stage_desc(process_stage_name);
  278. }
  279. User user = userService.getUser(entity.getCreate_by());
  280. if (CommonUtils.isNotNull(user) && Constant.UserType.STREET.equals(user.getUser_type())) {
  281. if (CommonUtils.isNotNull(user.getDepartment_name()) && Objects.equals(user.getDepartment_name(), "招商中心")) {
  282. entity.setResource(user.getDepartment_name());
  283. } else {
  284. entity.setResource(user.getStreet_name());
  285. }
  286. } else if (CommonUtils.isNotNull(user) && Constant.UserType.GOVERNMENT.equals(user.getUser_type())) {
  287. entity.setResource(user.getDepartment_name());
  288. }
  289. //咨询列表
  290. IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
  291. industrialLandSupplyConsultation.setIndustrial_land_supply_id(id);
  292. industrialLandSupplyConsultation.setDel_flag(false);
  293. List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
  294. for (IndustrialLandSupplyConsultation landSupplyConsultation : industrialLandSupplyConsultationList) {
  295. //文件
  296. List<Attachment> feedbackAttachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_FEEDBACK, landSupplyConsultation.getId(), null);
  297. if (null != feedbackAttachments && feedbackAttachments.size() > 0) {
  298. FileDown fileDown = new FileDown(feedbackAttachments.get(0).getId(), feedbackAttachments.get(0).getFile_name(), feedbackAttachments.get(0).getFile_url(), feedbackAttachments.get(0).getDownload_uri());
  299. landSupplyConsultation.setFileDown(fileDown);
  300. }
  301. if (CommonUtils.isNull(landSupplyConsultation.getFeedback())) {
  302. landSupplyConsultation.setCanWithdraw(true);
  303. } else {
  304. landSupplyConsultation.setCanWithdraw(false);
  305. }
  306. Department department = departmentService.selectById(Integer.valueOf(landSupplyConsultation.getDepartment_id()));
  307. if (department != null) {
  308. landSupplyConsultation.setDepartment_name(department.getName());
  309. }
  310. int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(FEEDBACK_TIME));
  311. landSupplyConsultation.setRemain_time(DateUtil.getTimeDiffStr(landSupplyConsultation.getConsultation_time(), days));
  312. }
  313. entity.setConsultationList(industrialLandSupplyConsultationList);
  314. //分发列表
  315. // IndustrialLandSupplyDistribution industrialLandSupplyDistribution = new IndustrialLandSupplyDistribution();
  316. // industrialLandSupplyDistribution.setIndustrial_land_supply_id(id);
  317. // industrialLandSupplyDistribution.setDel_flag(false);
  318. // List<IndustrialLandSupplyDistribution> industrialLandSupplyDistributionList = industrialLandSupplyDistributionService.findListByWhere(industrialLandSupplyDistribution);
  319. Example example = new Example(IndustrialLandSupplyDistribution.class);
  320. Example.Criteria criteria = example.createCriteria();
  321. criteria.andEqualTo("industrial_land_supply_id", id);
  322. criteria.andEqualTo("del_flag", 0);
  323. //倒序
  324. example.orderBy("department_id").asc();
  325. List<IndustrialLandSupplyDistribution> industrialLandSupplyDistributionList = industrialLandSupplyDistributionService.selectByExample(example);
  326. for (IndustrialLandSupplyDistribution landSupplyDistribution : industrialLandSupplyDistributionList) {
  327. List<Attachment> attachmentList = null;
  328. //分发文件
  329. attachmentList = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE, landSupplyDistribution.getId(), null);
  330. if (null != attachmentList && attachmentList.size() > 0) {
  331. FileDown fileDown = new FileDown(attachmentList.get(0).getId(), attachmentList.get(0).getFile_name(), attachmentList.get(0).getFile_url(), attachmentList.get(0).getDownload_uri());
  332. landSupplyDistribution.setDistribution_file(fileDown);
  333. }
  334. //分发反馈文件
  335. attachmentList = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE_FEEDBACK, landSupplyDistribution.getId(), null);
  336. if (null != attachmentList && attachmentList.size() > 0) {
  337. FileDown fileDown = new FileDown(attachmentList.get(0).getId(), attachmentList.get(0).getFile_name(), attachmentList.get(0).getFile_url(), attachmentList.get(0).getDownload_uri());
  338. landSupplyDistribution.setFeedback_file(fileDown);
  339. }
  340. if (Objects.equals(landSupplyDistribution.getDepartment_id(), "0")) {
  341. landSupplyDistribution.setDepartment_name("所有部门可见");
  342. } else {
  343. Department department = departmentService.selectById(Integer.valueOf(landSupplyDistribution.getDepartment_id()));
  344. if (department != null) {
  345. landSupplyDistribution.setDepartment_name(department.getName());
  346. }
  347. }
  348. int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(DISTRIBUTE_TIME));
  349. landSupplyDistribution.setRemain_time(DateUtil.getTimeDiffStr(landSupplyDistribution.getDistribute_time(), days));
  350. }
  351. entity.setDistributionList(industrialLandSupplyDistributionList);
  352. //汇总剩余时间
  353. //获取最后一次进入待汇总的时间作为节点
  354. Approval approval = new Approval();
  355. approval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUMMARY);
  356. approval.setApply_id(Integer.parseInt(id));
  357. List<Approval> approvalList = approvalService.findListByWhere(approval);
  358. if (!CollectionUtils.isEmpty(approvalList)) {
  359. Approval approve = approvalList.get(approvalList.size() - 1);
  360. int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(SUMMARY_TIME));
  361. entity.setSummary_remain_time(DateUtil.getTimeDiffStr(approve.getCreate_time(), days));
  362. }
  363. //会审剩余时间
  364. approval = new Approval();
  365. approval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_SUMMARY);
  366. approval.setApply_id(Integer.parseInt(id));
  367. approvalList = approvalService.findListByWhere(approval);
  368. if (!CollectionUtils.isEmpty(approvalList)) {
  369. Approval approve = approvalList.get(approvalList.size() - 1);
  370. int days = Integer.parseInt(industrialLandSupplyConfigService.getValueByType(JOINT_TRIAL_TIME));
  371. entity.setJoint_trial_remain_time(DateUtil.getTimeDiffStr(approve.getCreate_time(), days));
  372. }
  373. //获取商务和商务分管领导审批意见
  374. // Group group = null;
  375. // List<Approval> approvals = null;
  376. // group = groupService.findByName(Constant.INDUSTRIALLANDSUPPLY_1, null);
  377. // List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  378. //目前都只有一个人
  379. // if (!CollectionUtils.isEmpty(userGroups)) {
  380. //
  381. // Example example = new Example(Approval.class);
  382. // Example.Criteria criteria = example.createCriteria();
  383. // criteria.andEqualTo("apply_id", id);
  384. // criteria.andEqualTo("type", Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY);
  385. // criteria.andEqualTo("after_approvalstatus", Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
  386. // criteria.andEqualTo("checker", userGroups.get(0).getUser_id());
  387. // example.orderBy("create_time").desc();
  388. // approvals = approvalService.selectByExample(example);
  389. // if (!CollectionUtils.isEmpty(approvals)) {
  390. // Approval approval = approvals.get(0);
  391. // approval.getOper_type();
  392. // approval.getApproval_comment();
  393. // }
  394. // }
  395. return entity;
  396. }
  397. public IndustrialLandSupplyDetail selectByIdWithDepartment(String id) {
  398. IndustrialLandSupplyDetail entity = industrialLandSupplyDetailDao.selectById(id);
  399. //文件
  400. List<Attachment> attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY, entity.getId(), null);
  401. if (null != attachments && attachments.size() > 0) {
  402. FileDown fileDown = new FileDown(attachments.get(0).getId(), attachments.get(0).getFile_name(), attachments.get(0).getFile_url(), attachments.get(0).getDownload_uri());
  403. entity.setFileDown(fileDown);
  404. }
  405. if (null != entity.getApprove_status()) {
  406. String status_name = dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY_APPROVE_STATUS, entity.getApprove_status());
  407. entity.setApprove_status_desc(status_name);
  408. }
  409. if (null != entity.getProcess_stage()) {
  410. String process_stage_name = dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY_APPROVE_STAGE, entity.getProcess_stage());
  411. entity.setProcess_stage_desc(process_stage_name);
  412. }
  413. User user = userService.getUser(entity.getCreate_by());
  414. if (CommonUtils.isNotNull(user) && Constant.UserType.STREET.equals(user.getUser_type())) {
  415. entity.setResource(user.getStreet_name());
  416. } else if (CommonUtils.isNotNull(user) && Constant.UserType.GOVERNMENT.equals(user.getUser_type())) {
  417. entity.setResource(user.getDepartment_name());
  418. }
  419. IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
  420. industrialLandSupplyConsultation.setIndustrial_land_supply_id(id);
  421. //industrialLandSupplyConsultation.setDepartment_id(ShiroUtils.getUserEntity().getDepartment_id() + "");
  422. Department department = departmentService.findRootById(ShiroUtils.getUserEntity().getDepartment_id());
  423. industrialLandSupplyConsultation.setDepartment_id(department.getId() + "");
  424. industrialLandSupplyConsultation.setDel_flag(false);
  425. List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
  426. for (IndustrialLandSupplyConsultation landSupplyConsultation : industrialLandSupplyConsultationList) {
  427. //文件
  428. List<Attachment> feedbackAttachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_FEEDBACK, landSupplyConsultation.getId(), null);
  429. if (null != feedbackAttachments && feedbackAttachments.size() > 0) {
  430. FileDown fileDown = new FileDown(feedbackAttachments.get(0).getId(), feedbackAttachments.get(0).getFile_name(), feedbackAttachments.get(0).getFile_url(), attachments.get(0).getDownload_uri());
  431. landSupplyConsultation.setFileDown(fileDown);
  432. }
  433. Department depart = departmentService.selectById(Integer.valueOf(landSupplyConsultation.getDepartment_id()));
  434. landSupplyConsultation.setDepartment_name(depart.getName());
  435. }
  436. entity.setConsultationList(industrialLandSupplyConsultationList);
  437. IndustrialLandSupplyDistribution industrialLandSupplyDistribution = new IndustrialLandSupplyDistribution();
  438. industrialLandSupplyDistribution.setIndustrial_land_supply_id(id);
  439. //industrialLandSupplyDistribution.setDepartment_id(ShiroUtils.getUserEntity().getDepartment_id() + "");
  440. industrialLandSupplyDistribution.setDepartment_id(department.getId() + "");
  441. industrialLandSupplyDistribution.setDel_flag(false);
  442. List<IndustrialLandSupplyDistribution> industrialLandSupplyDistributionList = industrialLandSupplyDistributionService.findListByWhere(industrialLandSupplyDistribution);
  443. for (IndustrialLandSupplyDistribution landSupplyDistribution : industrialLandSupplyDistributionList) {
  444. //文件
  445. List<Attachment> attachmentList = null;
  446. //分发文件
  447. attachmentList = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE, landSupplyDistribution.getId(), null);
  448. if (null != attachmentList && attachmentList.size() > 0) {
  449. FileDown fileDown = new FileDown(attachmentList.get(0).getId(), attachmentList.get(0).getFile_name(), attachmentList.get(0).getFile_url(), attachmentList.get(0).getDownload_uri());
  450. landSupplyDistribution.setDistribution_file(fileDown);
  451. }
  452. //分发反馈文件
  453. attachmentList = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE_FEEDBACK, landSupplyDistribution.getId(), null);
  454. if (null != attachmentList && attachmentList.size() > 0) {
  455. FileDown fileDown = new FileDown(attachmentList.get(0).getId(), attachmentList.get(0).getFile_name(), attachmentList.get(0).getFile_url(), attachmentList.get(0).getDownload_uri());
  456. landSupplyDistribution.setFeedback_file(fileDown);
  457. }
  458. Department depart = departmentService.selectById(Integer.valueOf(landSupplyDistribution.getDepartment_id()));
  459. landSupplyDistribution.setDepartment_name(depart.getName());
  460. }
  461. entity.setDistributionList(industrialLandSupplyDistributionList);
  462. return entity;
  463. }
  464. /**
  465. * @Author: huZhiHao
  466. * @Description: 根据用户组获取可查询到的项目
  467. * @Date: 2020/3/7
  468. * @Params: []
  469. * @Return: java.util.List<java.lang.String>
  470. **/
  471. @Transactional
  472. public List<String> getProjectIdsByGroup() {
  473. List<IndustrialLandSupplyDetail> list = new ArrayList<>();
  474. Integer user_id = ShiroUtils.getUserId();
  475. Group group = null;
  476. List<UserGroup> userGroups = null;
  477. List<String> apply_status_list = new ArrayList<>();
  478. boolean industriallandsupply_2_flag = false;
  479. boolean industriallandsupply_5_flag = false;
  480. boolean industriallandsupply_6_flag = false;
  481. //街道人员 负责的状态
  482. if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
  483. apply_status_list.add(Constant.LandSupplyApproveStatus.PLATE_PENDING_SUBMIT);
  484. apply_status_list.add(Constant.LandSupplyApproveStatus.PLATE_WITHDRAW);
  485. apply_status_list.add(Constant.LandSupplyApproveStatus.COMMERCE_RETURN);
  486. } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
  487. //商务局受理员 负责的状态
  488. group = groupService.findByName(Constant.INDUSTRIALLANDSUPPLY_1, null);
  489. userGroups = userGroupService.findByGroupId(group.getId());
  490. for (UserGroup userGroup : userGroups) {
  491. if (Objects.equals(userGroup.getUser_id(), user_id)) {
  492. apply_status_list.add(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
  493. apply_status_list.add(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUBMIT);
  494. apply_status_list.add(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
  495. apply_status_list.add(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUMMARY);
  496. apply_status_list.add(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_RETURN);
  497. apply_status_list.add(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_RETURN);
  498. break;
  499. }
  500. }
  501. //接受咨询的举办 负责的状态
  502. group = groupService.findByName(Constant.INDUSTRIALLANDSUPPLY_2, null);
  503. userGroups = userGroupService.findByGroupId(group.getId());
  504. for (UserGroup userGroup : userGroups) {
  505. if (Objects.equals(userGroup.getUser_id(), user_id)) {
  506. apply_status_list.add(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
  507. industriallandsupply_2_flag = true;
  508. break;
  509. }
  510. }
  511. //商务局分管领导 负责的状态
  512. group = groupService.findByName(Constant.INDUSTRIALLANDSUPPLY_3, null);
  513. userGroups = userGroupService.findByGroupId(group.getId());
  514. for (UserGroup userGroup : userGroups) {
  515. if (Objects.equals(userGroup.getUser_id(), user_id)) {
  516. apply_status_list.add(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
  517. break;
  518. }
  519. }
  520. //管委会分管领导 负责的状态
  521. group = groupService.findByName(Constant.INDUSTRIALLANDSUPPLY_4, null);
  522. userGroups = userGroupService.findByGroupId(group.getId());
  523. for (UserGroup userGroup : userGroups) {
  524. if (Objects.equals(userGroup.getUser_id(), user_id)) {
  525. apply_status_list.add(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
  526. apply_status_list.add(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PENDIND_HANDLE);
  527. break;
  528. }
  529. }
  530. //项目供地 待分发局办
  531. group = groupService.findByName(Constant.INDUSTRIALLANDSUPPLY_5, null);
  532. userGroups = userGroupService.findByGroupId(group.getId());
  533. for (UserGroup userGroup : userGroups) {
  534. if (Objects.equals(userGroup.getUser_id(), user_id)) {
  535. apply_status_list.add(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK);
  536. industriallandsupply_5_flag = true;
  537. break;
  538. }
  539. }
  540. //项目供地 行政局反馈
  541. group = groupService.findByName(Constant.INDUSTRIALLANDSUPPLY_6, null);
  542. userGroups = userGroupService.findByGroupId(group.getId());
  543. for (UserGroup userGroup : userGroups) {
  544. if (Objects.equals(userGroup.getUser_id(), user_id)) {
  545. apply_status_list.add(Constant.LandSupplyApproveStatus.PRE_APPROVE_PENDIND_DISTRIBUTE);
  546. apply_status_list.add(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK);
  547. apply_status_list.add(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PENDIND_HANDLE);
  548. apply_status_list.add(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PASS);
  549. apply_status_list.add(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_REJECT);
  550. apply_status_list.add(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_SUMMARY);
  551. apply_status_list.add(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_RETURN);
  552. industriallandsupply_6_flag = true;
  553. break;
  554. }
  555. }
  556. //项目供地 资源规划局
  557. group = groupService.findByName(Constant.INDUSTRIALLANDSUPPLY_7, null);
  558. userGroups = userGroupService.findByGroupId(group.getId());
  559. for (UserGroup userGroup : userGroups) {
  560. if (Objects.equals(userGroup.getUser_id(), user_id)) {
  561. apply_status_list.add(Constant.LandSupplyApproveStatus.PRE_APPROVE_PENDIND_DISTRIBUTE);
  562. apply_status_list.add(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_SUMMARY);
  563. apply_status_list.add(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PASS);
  564. apply_status_list.add(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_RETURN);
  565. break;
  566. }
  567. }
  568. //todo 后续角色的待审批状态在此添加
  569. }
  570. if (apply_status_list.size() <= 0) {
  571. apply_status_list.add("");
  572. }
  573. list.addAll(industrialLandSupplyDetailDao.findByProjectIdAndApproveStatus(apply_status_list));
  574. List<Approval> consulApprovalList = new ArrayList<>();
  575. List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = new ArrayList<>();
  576. List<Approval> distApprovalList = new ArrayList<>();
  577. List<IndustrialLandSupplyDistribution> industrialLandSupplyDistributionList = new ArrayList<>();
  578. if (industriallandsupply_2_flag) {
  579. Approval approval = new Approval();
  580. approval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
  581. approval.setChecker(user_id);
  582. consulApprovalList = approvalService.findListByWhere(approval);
  583. IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
  584. //industrialLandSupplyConsultation.setDepartment_id(ShiroUtils.getUserEntity().getDepartment_id() + "");
  585. Department department = departmentService.findRootById(ShiroUtils.getUserEntity().getDepartment_id());
  586. industrialLandSupplyConsultation.setDepartment_id(department.getId() + "");
  587. industrialLandSupplyConsultation.setDel_flag(false);
  588. industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
  589. }
  590. if (industriallandsupply_5_flag) {
  591. Approval approval = new Approval();
  592. approval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK);
  593. approval.setChecker(user_id);
  594. distApprovalList = approvalService.findListByWhere(approval);
  595. IndustrialLandSupplyDistribution industrialLandSupplyDistribution = new IndustrialLandSupplyDistribution();
  596. //industrialLandSupplyDistribution.setDepartment_id(ShiroUtils.getUserEntity().getDepartment_id() + "");
  597. Department department = departmentService.findRootById(ShiroUtils.getUserEntity().getDepartment_id());
  598. industrialLandSupplyDistribution.setDepartment_id(department.getId() + "");
  599. industrialLandSupplyDistribution.setDel_flag(false);
  600. industrialLandSupplyDistributionList = industrialLandSupplyDistributionService.findListByWhere(industrialLandSupplyDistribution);
  601. }
  602. List<String> result = new ArrayList<>();
  603. for (IndustrialLandSupplyDetail entity : list) {
  604. if (
  605. Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK, entity.getApprove_status())
  606. || Objects.equals(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK, entity.getApprove_status())
  607. ) {
  608. if (industriallandsupply_2_flag || industriallandsupply_5_flag) {
  609. //是否被问
  610. boolean consulFlag = false;
  611. for (IndustrialLandSupplyConsultation industrialLandSupplyConsultation : industrialLandSupplyConsultationList) {
  612. if (Objects.equals(entity.getId() + "", industrialLandSupplyConsultation.getIndustrial_land_supply_id())) {
  613. consulFlag = true;
  614. break;
  615. }
  616. }
  617. //是否回答
  618. boolean consulApproveFlag = false;
  619. for (Approval approval : consulApprovalList) {
  620. if (Objects.equals(entity.getId(), approval.getApply_id())) {
  621. try {
  622. Date d1 = DateUtil.parseTimeStringToDate(entity.getUpdate_time(), "yyyy-MM-dd hh:mm:ss");
  623. Date d2 = DateUtil.parseTimeStringToDate(approval.getCreate_time(), "yyyy-MM-dd hh:mm:ss");
  624. if (d1.before(d2)) {
  625. consulApproveFlag = true;
  626. break;
  627. }
  628. } catch (ParseException e) {
  629. e.printStackTrace();
  630. }
  631. }
  632. }
  633. //是否被问
  634. boolean distFlag = false;
  635. for (IndustrialLandSupplyDistribution industrialLandSupplyDistribution : industrialLandSupplyDistributionList) {
  636. if (Objects.equals(entity.getId() + "", industrialLandSupplyDistribution.getIndustrial_land_supply_id())) {
  637. distFlag = true;
  638. break;
  639. }
  640. }
  641. //是否回答
  642. boolean distApproveFlag = false;
  643. for (Approval approval : distApprovalList) {
  644. if (Objects.equals(entity.getId(), approval.getApply_id())) {
  645. try {
  646. Date d1 = DateUtil.parseTimeStringToDate(entity.getUpdate_time(), "yyyy-MM-dd hh:mm:ss");
  647. Date d2 = DateUtil.parseTimeStringToDate(approval.getCreate_time(), "yyyy-MM-dd hh:mm:ss");
  648. if (d1.before(d2)) {
  649. distApproveFlag = true;
  650. break;
  651. }
  652. } catch (ParseException e) {
  653. e.printStackTrace();
  654. }
  655. }
  656. }
  657. if ((consulFlag && !consulApproveFlag) || (distFlag && !distApproveFlag)) {
  658. result.add(entity.getId().toString());
  659. }
  660. } else {
  661. result.add(entity.getId().toString());
  662. }
  663. } else if (industriallandsupply_6_flag) {
  664. List<Attachment> attachmentList = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_GS, entity.getId(), null);
  665. if (CommonUtils.isNull(entity.getGs_feedback()) && CollectionUtils.isEmpty(attachmentList)) {
  666. result.add(entity.getId().toString());
  667. }
  668. } else if (Objects.equals(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PASS, entity.getApprove_status())) {
  669. if (CommonUtils.isNull(entity.getFinal_result())) {
  670. result.add(entity.getId().toString());
  671. }
  672. } else {
  673. result.add(entity.getId().toString());
  674. }
  675. }
  676. return result;
  677. }
  678. /**
  679. * @Author: huZhiHao
  680. * @Description: 获取id 已处理
  681. * @Date: 2020/3/7
  682. * @Params: []
  683. * @Return: java.util.List<java.lang.String>
  684. **/
  685. @Transactional
  686. public List<String> getProjectIdsy() {
  687. int currentUserId = ShiroUtils.getUserId();
  688. List<Approval> approvalList = approvalService.selectAllApproval(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY);
  689. Set<String> applyIds = new HashSet<String>();
  690. if (!CollectionUtils.isEmpty(approvalList)) {
  691. for (Approval approval : approvalList) {
  692. String checkerIds = approval.getChecker() + "";
  693. if (checkerIds != null && checkerIds != "") {
  694. if (Objects.equals(checkerIds, String.valueOf(currentUserId))) {
  695. applyIds.add(approval.getApply_id().toString());
  696. }
  697. }
  698. }
  699. }
  700. List<String> result = new ArrayList<>(applyIds);
  701. return result;
  702. }
  703. /**
  704. * @Author: huZhiHao
  705. * @Description: 获取id 查看所有
  706. * @Date: 2020/3/7
  707. * @Params: []
  708. * @Return: java.util.List<java.lang.String>
  709. **/
  710. @Transactional
  711. public List<String> getProjectIdsc() {
  712. //根据当前登录人所在街道 查出该街道所有人员的id 将此id列表作为create_by筛选条件
  713. List<String> result = new ArrayList<>();
  714. Example example = new Example(IndustrialLandSupplyDetail.class);
  715. Example.Criteria criteria = example.createCriteria();
  716. criteria.orEqualTo("del_flag", "0");//不显示删除的
  717. // List<String> streetUserIds = new ArrayList<>();
  718. // if (ShiroUtils.getUserType().equals(Constant.UserType.STREET)) {
  719. // List<User> userList = userService.findUsersByStreetId(ShiroUtils.getStreetId());
  720. // for (User user : userList) {
  721. // streetUserIds.add(user.getId() + "");
  722. // }
  723. // criteria.andIn("create_by", streetUserIds);
  724. // }
  725. List<IndustrialLandSupplyDetail> list = industrialLandSupplyDetailDao.selectByExample(example);
  726. for (IndustrialLandSupplyDetail entity : list) {
  727. result.add(entity.getId().toString());
  728. }
  729. return result;
  730. }
  731. /**
  732. * @Author: huZhiHao
  733. * @Description: 保存
  734. * @Date: 2020/3/7
  735. * @Params: [apply, status]
  736. * @Return: void
  737. **/
  738. @Transactional
  739. public void save(IndustrialLandSupplyDetail apply, String status) {
  740. Integer userType = ShiroUtils.getUserType();
  741. if (Objects.equals(status, Constant.PublishStatus.DRAFT)) {
  742. if (Constant.UserType.STREET.equals(userType)) {
  743. apply.setApprove_status(Constant.LandSupplyApproveStatus.PLATE_PENDING_SUBMIT);
  744. } else if (Constant.UserType.GOVERNMENT.equals(userType)) {
  745. apply.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUBMIT);
  746. }
  747. } else if (Objects.equals(status, Constant.PublishStatus.RELEASE)) {
  748. if (Constant.UserType.STREET.equals(userType)) {
  749. apply.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
  750. } else if (Constant.UserType.GOVERNMENT.equals(userType)) {
  751. apply.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
  752. }
  753. }
  754. apply.setNo(GenerateNoUtil.generateIndustrialLandSupplyNo());
  755. //如果是发布,更新时间
  756. String dateTime = DateUtil.getTimeString(new Date());
  757. if (Constant.PublishStatus.RELEASE.equals(status)) {
  758. apply.setAccept_date(dateTime);
  759. }
  760. this.insertAndGetId(apply);
  761. //保存材料
  762. // if (null != apply.getFileDown() && null != apply.getFileDown().getFile_id()) {
  763. // attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY, apply.getId(), apply.getFileDown().getFile_id());
  764. // }
  765. if (!CollectionUtils.isEmpty(apply.getFileList())) {
  766. for (FileDown fileDown : apply.getFileList()) {
  767. if (null != fileDown && null != fileDown.getFile_id()) {
  768. attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY, apply.getId(), fileDown.getFile_id());
  769. }
  770. }
  771. }
  772. //保存咨询列表
  773. List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = apply.getConsultationList();
  774. if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
  775. Iterator<IndustrialLandSupplyConsultation> it = industrialLandSupplyConsultationList.iterator();
  776. while (it.hasNext()) {
  777. if (CommonUtils.isNull(it.next().getConsultation())) {
  778. it.remove();
  779. }
  780. }
  781. for (IndustrialLandSupplyConsultation industrialLandSupplyConsultation : industrialLandSupplyConsultationList) {
  782. industrialLandSupplyConsultation.setIndustrial_land_supply_id(apply.getId() + "");
  783. industrialLandSupplyConsultation.setConsultation_time(dateTime);
  784. }
  785. if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
  786. industrialLandSupplyConsultationService.saveList(industrialLandSupplyConsultationList);
  787. }
  788. }
  789. //如果是发布,进提交流程
  790. if (Constant.PublishStatus.RELEASE.equals(status)) {
  791. //直接提交申请,添加流程信息
  792. pass(apply.getId(), null);
  793. }
  794. }
  795. /**
  796. * @Author: huZhiHao
  797. * @Description: 修改
  798. * @Date: 2020/3/7
  799. * @Params: [apply, status]
  800. * @Return: void
  801. **/
  802. @Transactional
  803. public Integer update(IndustrialLandSupplyDetail apply, String status) {
  804. Integer userType = ShiroUtils.getUserType();
  805. if (Objects.equals(status, Constant.PublishStatus.DRAFT)) {
  806. if (Constant.UserType.STREET.equals(userType)) {
  807. apply.setApprove_status(Constant.LandSupplyApproveStatus.PLATE_PENDING_SUBMIT);
  808. } else if (Constant.UserType.GOVERNMENT.equals(userType)) {
  809. apply.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUBMIT);
  810. }
  811. } else if (Objects.equals(status, Constant.PublishStatus.RELEASE)) {
  812. if (Constant.UserType.STREET.equals(userType)) {
  813. apply.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
  814. } else if (Constant.UserType.GOVERNMENT.equals(userType)) {
  815. apply.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
  816. }
  817. }
  818. //如果是发布,更新时间
  819. if (Constant.PublishStatus.RELEASE.equals(status)) {
  820. apply.setAccept_date(DateUtil.getTimeString(new Date()));
  821. }
  822. this.updateSelective(apply);
  823. Integer id = apply.getId();
  824. //保存材料
  825. // if (null != apply.getFileDown() && null != apply.getFileDown().getFile_id()) {
  826. // attachmentService.deleteByBusiness(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY, apply.getId());
  827. // attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY, apply.getId(), apply.getFileDown().getFile_id());
  828. // }
  829. if (!CollectionUtils.isEmpty(apply.getFileList())) {
  830. attachmentService.deleteByBusiness(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY, apply.getId());
  831. for (FileDown fileDown : apply.getFileList()) {
  832. if (null != fileDown && null != fileDown.getFile_id()) {
  833. attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY, apply.getId(), fileDown.getFile_id());
  834. }
  835. }
  836. }
  837. //保存咨询列表
  838. String dateTime = DateUtil.getTimeString(new Date());
  839. List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = apply.getConsultationList();
  840. if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
  841. //过滤空的
  842. Iterator<IndustrialLandSupplyConsultation> it = industrialLandSupplyConsultationList.iterator();
  843. while (it.hasNext()) {
  844. if (CommonUtils.isNull(it.next().getConsultation())) {
  845. it.remove();
  846. }
  847. }
  848. for (IndustrialLandSupplyConsultation industrialLandSupplyConsultation : industrialLandSupplyConsultationList) {
  849. industrialLandSupplyConsultation.setIndustrial_land_supply_id(apply.getId() + "");
  850. if (industrialLandSupplyConsultation.getId() != null) {
  851. IndustrialLandSupplyConsultation industrialLandSupplyConsultation1 = industrialLandSupplyConsultationService.findById(industrialLandSupplyConsultation.getId());
  852. //如果问的问题没变则保留id等信息 不然作为新的处理
  853. if (Objects.equals(industrialLandSupplyConsultation1.getConsultation(), industrialLandSupplyConsultation.getConsultation())) {
  854. BeanUtils.copyProperties(industrialLandSupplyConsultation1, industrialLandSupplyConsultation);
  855. }
  856. }
  857. if (CommonUtils.isNull(industrialLandSupplyConsultation.getConsultation_time())) {
  858. industrialLandSupplyConsultation.setConsultation_time(dateTime);
  859. }
  860. }
  861. IndustrialLandSupplyConsultation query = new IndustrialLandSupplyConsultation();
  862. query.setIndustrial_land_supply_id(apply.getId() + "");
  863. industrialLandSupplyConsultationService.deleteByWhere(query);
  864. if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
  865. industrialLandSupplyConsultationService.saveList(industrialLandSupplyConsultationList);
  866. }
  867. }
  868. //如果是发布,进提交流程
  869. if (Constant.PublishStatus.RELEASE.equals(status)) {
  870. //直接提交申请,添加流程信息
  871. pass(apply.getId(), null);
  872. }
  873. return id;
  874. }
  875. /**
  876. * @Author: huZhiHao
  877. * @Description: 通过
  878. * @Date: 2020/3/7
  879. * @Params: [applyId, comment]
  880. * @Return: java.lang.Boolean
  881. **/
  882. @Transactional
  883. public Boolean pass(Integer applyId, String comment) {
  884. Approval approval = approvalService.getLatestApproval(applyId, Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY);
  885. Approval newApproval = new Approval();
  886. newApproval.setApply_id(applyId);
  887. newApproval.setType(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY);
  888. if (ShiroUtils.getUserType().equals(Constant.UserType.GOVERNMENT)) {
  889. if (null != userService.getUser(ShiroUtils.getUserId()).getDepartment_id()) {
  890. String departmentname = departmentService.selectById(userService.getUser(ShiroUtils.getUserId()).getDepartment_id()).getName();
  891. newApproval.setDepartment(departmentname);
  892. }
  893. } else if (ShiroUtils.getUserType().equals(Constant.UserType.STREET)) {
  894. newApproval.setDepartment(ShiroUtils.getUserEntity().getStreet_name());
  895. }
  896. newApproval.setApproval_comment(comment);
  897. newApproval.setChecker(ShiroUtils.getUserId());
  898. newApproval.setOper_type(Constant.OperType.APPROVED);
  899. newApproval.setDeal_time(DateUtil.getTimeString(new Date()));
  900. // ProjectIntelligent projectApplication = projectIntelligentDao.findApplyById(applyId);
  901. // User companyAdmin = userService.findCompanyAdmin(projectApplication.getCompany_id());
  902. //短信参数
  903. // Map<String, String> params = new HashMap<>();
  904. // params.put("project_no", projectApplication.getApply_no());
  905. // params.put("apply_name", Constant.ProjectType.PROJECT_INTELLIGENT);
  906. // String templateCode = Constant.SMS_TemplateCode.RPOJECT_APPROVAL_REMIND;
  907. if (CommonUtils.isNull(approval)) {
  908. //待属地提交 --》待商务局受理员审核 或 待咨询反馈
  909. IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
  910. industrialLandSupplyConsultation.setIndustrial_land_supply_id(applyId + "");
  911. industrialLandSupplyConsultation.setDel_flag(false);
  912. List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
  913. boolean sumbitToLeader = false;
  914. if (CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
  915. //如果提交了咨询信息进入待反馈 未提交直接进入商务局分管领导审核
  916. sumbitToLeader = true;
  917. }
  918. Group group = null;
  919. newApproval.setOper_type(Constant.OperType.SUBMIT);
  920. if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
  921. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.PLATE_PENDING_SUBMIT);
  922. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
  923. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
  924. if (null == group) {
  925. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
  926. }
  927. } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
  928. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUBMIT);
  929. //如果提交了咨询信息进入待反馈 未提交直接进入商务局分管领导审核
  930. if (!sumbitToLeader) {
  931. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
  932. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_2);
  933. if (null == group) {
  934. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
  935. }
  936. } else {
  937. //newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
  938. //临时跳过商务领导审核
  939. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
  940. //group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_3);
  941. //临时跳过商务领导审核
  942. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_4);
  943. if (null == group) {
  944. //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
  945. //临时跳过商务领导审核
  946. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
  947. }
  948. }
  949. }
  950. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  951. // ProjectIntelligentDeclaration projectProvincesDeclaration = this.selectById(projectApplication.getDeclaration_id().toString());
  952. List<User> users = userService.findListByWhere(new User());
  953. StringBuffer sb = new StringBuffer("");
  954. // platform.modules.build.entity.Company company = companyService.findById(projectApplication.getCompany_id());
  955. // String projectName = projectProvincesDeclaration.getProject_name();
  956. // Message messages = new Message();
  957. // messages.setApply_id(projectId);
  958. // messages.setBusiness_type(Constant.Message_Business_type.PROJECT_INTELLIGENT_APPLY);
  959. // messages.setTitle("提醒中心审核");
  960. // waitToDoService.completeAllTODO(projectApplication.getId(), Constant.DictionaryType.PROJECT_INTELLIGENT);
  961. for (UserGroup userGroup : userGroups) {
  962. for (User user : users) {
  963. if (Objects.equals(user.getId(), userGroup.getUser_id())) {
  964. sb.append(userGroup.getUser_id() + ",");
  965. // String message = user.getUser_name() +0 ",您好。“" + company.getCompany_name() + "企业”的“" + projectName + "项目”申请需要您审核。谢谢。";
  966. // messages.setContent(message);
  967. // int[] streetArrInt = new int[1];
  968. // streetArrInt[0] = userGroup.getUser_id();
  969. // messageService.saveMessageAndPush(messages, streetArrInt, Constant.UserType.GOVERNMENT);
  970. // waitToDoService.newTODO("区级智能制造审核", "/government/projectIntelligent/approve/" + projectApplication.getId(), Constant.WaitToDo_OperType.AUDIT, projectApplication.getId(),
  971. // Constant.DictionaryType.PROJECT_INTELLIGENT, projectApplication.getApply_no(), userGroup.getUser_id().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false);
  972. //发送短信
  973. // AlibabaSMSUtil.sendSMSMessage(
  974. // user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params));
  975. }
  976. }
  977. }
  978. newApproval.setNextchecker(sb.toString());
  979. if (sb.length() == 0) {
  980. if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
  981. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
  982. } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
  983. if (!sumbitToLeader) {
  984. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
  985. } else {
  986. //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
  987. //临时跳过商务领导审核
  988. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
  989. }
  990. }
  991. }
  992. IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
  993. entity.setId(applyId);
  994. if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
  995. entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
  996. } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
  997. //如果提交了咨询信息进入待反馈 未提交直接进入商务局分管领导审核
  998. if (!sumbitToLeader) {
  999. entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
  1000. } else {
  1001. //entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
  1002. //临时跳过商务领导审核
  1003. entity.setApprove_status(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
  1004. }
  1005. }
  1006. entity.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
  1007. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
  1008. approvalService.insertAndGetId(newApproval);
  1009. return true;
  1010. } else if (Objects.equals(Constant.LandSupplyApproveStatus.PLATE_WITHDRAW, approval.getAfter_approvalstatus())) {
  1011. //属地撤回 --》待商务局受理员审核 或 待咨询反馈
  1012. IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
  1013. industrialLandSupplyConsultation.setIndustrial_land_supply_id(applyId + "");
  1014. industrialLandSupplyConsultation.setDel_flag(false);
  1015. List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
  1016. boolean sumbitToLeader = false;
  1017. if (CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
  1018. //如果提交了咨询信息进入待反馈 未提交直接进入商务局分管领导审核
  1019. sumbitToLeader = true;
  1020. }
  1021. Group group = null;
  1022. newApproval.setOper_type(Constant.OperType.SUBMIT);
  1023. if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
  1024. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.PLATE_WITHDRAW);
  1025. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
  1026. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
  1027. if (null == group) {
  1028. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
  1029. }
  1030. } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
  1031. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUBMIT);
  1032. //如果提交了咨询信息进入待反馈 未提交直接进入商务局分管领导审核
  1033. if (!sumbitToLeader) {
  1034. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
  1035. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_2);
  1036. if (null == group) {
  1037. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
  1038. }
  1039. } else {
  1040. //newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
  1041. //临时跳过商务领导审核
  1042. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
  1043. //group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_3);
  1044. //临时跳过商务领导审核
  1045. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_4);
  1046. if (null == group) {
  1047. //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
  1048. //临时跳过商务领导审核
  1049. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
  1050. }
  1051. }
  1052. }
  1053. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  1054. List<User> users = userService.findListByWhere(new User());
  1055. StringBuffer sb = new StringBuffer("");
  1056. for (UserGroup userGroup : userGroups) {
  1057. for (User user : users) {
  1058. if (Objects.equals(user.getId(), userGroup.getUser_id())) {
  1059. sb.append(userGroup.getUser_id() + ",");
  1060. }
  1061. }
  1062. }
  1063. newApproval.setNextchecker(sb.toString());
  1064. if (sb.length() == 0) {
  1065. if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
  1066. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
  1067. } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
  1068. if (!sumbitToLeader) {
  1069. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
  1070. } else {
  1071. //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
  1072. //临时跳过商务领导审核
  1073. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
  1074. }
  1075. }
  1076. }
  1077. IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
  1078. entity.setId(applyId);
  1079. if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
  1080. entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
  1081. } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
  1082. //如果提交了咨询信息进入待反馈 未提交直接进入商务局分管领导审核
  1083. if (!sumbitToLeader) {
  1084. entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
  1085. } else {
  1086. //entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
  1087. //临时跳过商务领导审核
  1088. entity.setApprove_status(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
  1089. }
  1090. }
  1091. entity.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
  1092. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
  1093. approvalService.insertAndGetId(newApproval);
  1094. return true;
  1095. } else if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUBMIT, approval.getAfter_approvalstatus())) {
  1096. //商务局受理员待提交--》待商务局受理员审核 或 待咨询反馈
  1097. IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
  1098. industrialLandSupplyConsultation.setIndustrial_land_supply_id(applyId + "");
  1099. industrialLandSupplyConsultation.setDel_flag(false);
  1100. List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
  1101. boolean sumbitToLeader = false;
  1102. if (CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
  1103. //如果提交了咨询信息进入待反馈 未提交直接进入商务局分管领导审核
  1104. sumbitToLeader = true;
  1105. }
  1106. Group group = null;
  1107. newApproval.setOper_type(Constant.OperType.SUBMIT);
  1108. if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
  1109. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUBMIT);
  1110. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
  1111. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
  1112. if (null == group) {
  1113. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
  1114. }
  1115. } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
  1116. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUBMIT);
  1117. //如果提交了咨询信息进入待反馈 未提交直接进入商务局分管领导审核
  1118. if (!sumbitToLeader) {
  1119. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
  1120. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_2);
  1121. if (null == group) {
  1122. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
  1123. }
  1124. } else {
  1125. //newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
  1126. //临时跳过商务领导审核
  1127. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
  1128. //group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_3);
  1129. //临时跳过商务领导审核
  1130. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_4);
  1131. if (null == group) {
  1132. //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
  1133. //临时跳过商务领导审核
  1134. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
  1135. }
  1136. }
  1137. }
  1138. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  1139. List<User> users = userService.findListByWhere(new User());
  1140. StringBuffer sb = new StringBuffer("");
  1141. for (UserGroup userGroup : userGroups) {
  1142. for (User user : users) {
  1143. if (Objects.equals(user.getId(), userGroup.getUser_id())) {
  1144. sb.append(userGroup.getUser_id() + ",");
  1145. }
  1146. }
  1147. }
  1148. newApproval.setNextchecker(sb.toString());
  1149. if (sb.length() == 0) {
  1150. if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
  1151. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
  1152. } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
  1153. if (!sumbitToLeader) {
  1154. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
  1155. } else {
  1156. //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
  1157. //临时跳过商务领导审核
  1158. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
  1159. }
  1160. }
  1161. }
  1162. IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
  1163. entity.setId(applyId);
  1164. if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
  1165. entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
  1166. } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
  1167. //如果提交了咨询信息进入待反馈 未提交直接进入商务局分管领导审核
  1168. if (!sumbitToLeader) {
  1169. entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
  1170. } else {
  1171. //entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
  1172. //临时跳过商务领导审核
  1173. entity.setApprove_status(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
  1174. }
  1175. }
  1176. entity.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
  1177. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
  1178. approvalService.insertAndGetId(newApproval);
  1179. return true;
  1180. } else if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE, approval.getAfter_approvalstatus())) {
  1181. //待商务局受理员审核 --》 待咨询反馈
  1182. IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
  1183. industrialLandSupplyConsultation.setIndustrial_land_supply_id(applyId + "");
  1184. industrialLandSupplyConsultation.setDel_flag(false);
  1185. List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
  1186. boolean sumbitToLeader = false;
  1187. if (CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
  1188. sumbitToLeader = true;
  1189. }
  1190. Group group = null;
  1191. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
  1192. if (sumbitToLeader) {
  1193. newApproval.setOper_type(Constant.OperType.SUBMIT);
  1194. //newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
  1195. //临时跳过商务领导审核
  1196. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
  1197. //group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_3);
  1198. //临时跳过商务领导审核
  1199. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_4);
  1200. if (null == group) {
  1201. //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
  1202. //临时跳过商务领导审核
  1203. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
  1204. }
  1205. } else {
  1206. newApproval.setOper_type(Constant.OperType.DISTRIBUTE);
  1207. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
  1208. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_2);
  1209. if (null == group) {
  1210. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
  1211. }
  1212. }
  1213. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  1214. List<User> users = userService.findListByWhere(new User());
  1215. StringBuffer sb = new StringBuffer("");
  1216. for (UserGroup userGroup : userGroups) {
  1217. for (User user : users) {
  1218. if (Objects.equals(user.getId(), userGroup.getUser_id())) {
  1219. sb.append(userGroup.getUser_id() + ",");
  1220. }
  1221. }
  1222. }
  1223. newApproval.setNextchecker(sb.toString());
  1224. if (sumbitToLeader) {
  1225. if (sb.length() == 0) {
  1226. //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
  1227. //临时跳过商务领导审核
  1228. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
  1229. }
  1230. } else {
  1231. if (sb.length() == 0) {
  1232. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
  1233. }
  1234. }
  1235. IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
  1236. entity.setId(applyId);
  1237. if (sumbitToLeader) {
  1238. //entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
  1239. //临时跳过商务领导审核
  1240. entity.setApprove_status(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
  1241. } else {
  1242. entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
  1243. }
  1244. entity.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
  1245. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
  1246. approvalService.insertAndGetId(newApproval);
  1247. return true;
  1248. } else if (Objects.equals(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_RETURN, approval.getAfter_approvalstatus())) {
  1249. //预审退回 --》 待咨询反馈 或 咨询汇总
  1250. IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
  1251. industrialLandSupplyConsultation.setIndustrial_land_supply_id(applyId + "");
  1252. industrialLandSupplyConsultation.setDel_flag(false);
  1253. List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
  1254. boolean sumbitToSummary = true;
  1255. for (IndustrialLandSupplyConsultation landSupplyConsultation : industrialLandSupplyConsultationList) {
  1256. //如果所有咨询都已回答 进入待汇总
  1257. if (CommonUtils.isNull(landSupplyConsultation.getFeedback()) || CommonUtils.isNull(landSupplyConsultation.getUpdate_by())) {
  1258. sumbitToSummary = false;
  1259. break;
  1260. } else {
  1261. sumbitToSummary = true;
  1262. }
  1263. }
  1264. Group group = null;
  1265. newApproval.setOper_type(Constant.OperType.SUBMIT);
  1266. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_RETURN);
  1267. if (sumbitToSummary) {
  1268. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUMMARY);
  1269. } else {
  1270. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
  1271. }
  1272. if (sumbitToSummary) {
  1273. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
  1274. } else {
  1275. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_2);
  1276. }
  1277. if (null == group) {
  1278. if (sumbitToSummary) {
  1279. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
  1280. } else {
  1281. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
  1282. }
  1283. }
  1284. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  1285. List<User> users = userService.findListByWhere(new User());
  1286. StringBuffer sb = new StringBuffer("");
  1287. for (UserGroup userGroup : userGroups) {
  1288. for (User user : users) {
  1289. if (Objects.equals(user.getId(), userGroup.getUser_id())) {
  1290. sb.append(userGroup.getUser_id() + ",");
  1291. }
  1292. }
  1293. }
  1294. newApproval.setNextchecker(sb.toString());
  1295. if (sb.length() == 0) {
  1296. if (sumbitToSummary) {
  1297. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
  1298. } else {
  1299. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
  1300. }
  1301. }
  1302. IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
  1303. entity.setId(applyId);
  1304. if (sumbitToSummary) {
  1305. entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUMMARY);
  1306. } else {
  1307. entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
  1308. }
  1309. entity.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
  1310. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
  1311. approvalService.insertAndGetId(newApproval);
  1312. return true;
  1313. } else if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK, approval.getAfter_approvalstatus())) {
  1314. //待咨询反馈 --》 待咨询汇总
  1315. IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
  1316. industrialLandSupplyConsultation.setIndustrial_land_supply_id(applyId + "");
  1317. industrialLandSupplyConsultation.setDel_flag(false);
  1318. List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
  1319. boolean sumbitToSummary = true;
  1320. for (IndustrialLandSupplyConsultation landSupplyConsultation : industrialLandSupplyConsultationList) {
  1321. //如果所有咨询都已回答 进入待汇总
  1322. if (CommonUtils.isNull(landSupplyConsultation.getFeedback()) || CommonUtils.isNull(landSupplyConsultation.getUpdate_by())) {
  1323. sumbitToSummary = false;
  1324. break;
  1325. } else {
  1326. sumbitToSummary = true;
  1327. }
  1328. }
  1329. Group group = null;
  1330. newApproval.setOper_type(Constant.OperType.SUBMIT);
  1331. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
  1332. if (sumbitToSummary) {
  1333. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUMMARY);
  1334. } else {
  1335. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
  1336. }
  1337. if (sumbitToSummary) {
  1338. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
  1339. } else {
  1340. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_2);
  1341. }
  1342. if (null == group) {
  1343. if (sumbitToSummary) {
  1344. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
  1345. } else {
  1346. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
  1347. }
  1348. }
  1349. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  1350. List<User> users = userService.findListByWhere(new User());
  1351. StringBuffer sb = new StringBuffer("");
  1352. for (UserGroup userGroup : userGroups) {
  1353. for (User user : users) {
  1354. if (Objects.equals(user.getId(), userGroup.getUser_id())) {
  1355. sb.append(userGroup.getUser_id() + ",");
  1356. }
  1357. }
  1358. }
  1359. newApproval.setNextchecker(sb.toString());
  1360. if (sb.length() == 0) {
  1361. if (sumbitToSummary) {
  1362. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
  1363. } else {
  1364. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
  1365. }
  1366. }
  1367. IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
  1368. entity.setId(applyId);
  1369. if (sumbitToSummary) {
  1370. entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUMMARY);
  1371. } else {
  1372. entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
  1373. }
  1374. entity.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
  1375. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
  1376. approvalService.insertAndGetId(newApproval);
  1377. return true;
  1378. } else if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUMMARY, approval.getAfter_approvalstatus())) {
  1379. //待咨询汇总 --》 待商务局分管领导审批
  1380. Group group = null;
  1381. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUMMARY);
  1382. //newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
  1383. //临时跳过商务领导审核
  1384. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
  1385. //group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_3);
  1386. //临时跳过商务领导审核
  1387. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_4);
  1388. if (null == group) {
  1389. //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
  1390. //临时跳过商务领导审核
  1391. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
  1392. }
  1393. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  1394. List<User> users = userService.findListByWhere(new User());
  1395. StringBuffer sb = new StringBuffer("");
  1396. for (UserGroup userGroup : userGroups) {
  1397. for (User user : users) {
  1398. if (Objects.equals(user.getId(), userGroup.getUser_id())) {
  1399. sb.append(userGroup.getUser_id() + ",");
  1400. }
  1401. }
  1402. }
  1403. newApproval.setNextchecker(sb.toString());
  1404. if (sb.length() == 0) {
  1405. //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
  1406. //临时跳过商务领导审核
  1407. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
  1408. }
  1409. IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
  1410. entity.setId(applyId);
  1411. //entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
  1412. //临时跳过商务领导审核
  1413. entity.setApprove_status(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
  1414. entity.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
  1415. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
  1416. approvalService.insertAndGetId(newApproval);
  1417. return true;
  1418. } else if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE, approval.getAfter_approvalstatus())) {
  1419. //待商务局分管领导审批 --》 待管委会分管领导审批
  1420. Group group = null;
  1421. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
  1422. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
  1423. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_4);
  1424. if (null == group) {
  1425. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
  1426. }
  1427. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  1428. List<User> users = userService.findListByWhere(new User());
  1429. StringBuffer sb = new StringBuffer("");
  1430. for (UserGroup userGroup : userGroups) {
  1431. for (User user : users) {
  1432. if (Objects.equals(user.getId(), userGroup.getUser_id())) {
  1433. sb.append(userGroup.getUser_id() + ",");
  1434. }
  1435. }
  1436. }
  1437. newApproval.setNextchecker(sb.toString());
  1438. if (sb.length() == 0) {
  1439. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
  1440. }
  1441. IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
  1442. entity.setId(applyId);
  1443. entity.setApprove_status(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
  1444. entity.setProcess_stage(Constant.LandSupplyApproveStage.SUPPLY);
  1445. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
  1446. approvalService.insertAndGetId(newApproval);
  1447. return true;
  1448. } else if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_RETURN, approval.getAfter_approvalstatus())) {
  1449. //商务局受理员退回--》待商务局受理员审核
  1450. Group group = null;
  1451. newApproval.setOper_type(Constant.OperType.SUBMIT);
  1452. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_RETURN);
  1453. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
  1454. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
  1455. if (null == group) {
  1456. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
  1457. }
  1458. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  1459. List<User> users = userService.findListByWhere(new User());
  1460. StringBuffer sb = new StringBuffer("");
  1461. for (UserGroup userGroup : userGroups) {
  1462. for (User user : users) {
  1463. if (Objects.equals(user.getId(), userGroup.getUser_id())) {
  1464. sb.append(userGroup.getUser_id() + ",");
  1465. }
  1466. }
  1467. }
  1468. newApproval.setNextchecker(sb.toString());
  1469. if (sb.length() == 0) {
  1470. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
  1471. }
  1472. IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
  1473. entity.setId(applyId);
  1474. entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
  1475. entity.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
  1476. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
  1477. approvalService.insertAndGetId(newApproval);
  1478. return true;
  1479. } else if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_RETURN, approval.getAfter_approvalstatus())) {
  1480. //商务局分管领导退回 --》待商务局商务局分管领导审核
  1481. Group group = null;
  1482. newApproval.setOper_type(Constant.OperType.SUBMIT);
  1483. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_RETURN);
  1484. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
  1485. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_2);
  1486. if (null == group) {
  1487. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
  1488. }
  1489. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  1490. List<User> users = userService.findListByWhere(new User());
  1491. StringBuffer sb = new StringBuffer("");
  1492. for (UserGroup userGroup : userGroups) {
  1493. for (User user : users) {
  1494. if (Objects.equals(user.getId(), userGroup.getUser_id())) {
  1495. sb.append(userGroup.getUser_id() + ",");
  1496. }
  1497. }
  1498. }
  1499. newApproval.setNextchecker(sb.toString());
  1500. if (sb.length() == 0) {
  1501. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
  1502. }
  1503. IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
  1504. entity.setId(applyId);
  1505. entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
  1506. entity.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
  1507. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
  1508. approvalService.insertAndGetId(newApproval);
  1509. return true;
  1510. } else if (Objects.equals(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE, approval.getAfter_approvalstatus())) {
  1511. // 分管领导审核通过 --》 预审通过待分发
  1512. Group group = null;
  1513. newApproval.setOper_type(Constant.OperType.APPROVED);
  1514. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
  1515. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.PRE_APPROVE_PENDIND_DISTRIBUTE);
  1516. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_7);
  1517. if (null == group) {
  1518. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_7 + "没有该项目责任单位的人员,请联系管理员配置");
  1519. }
  1520. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  1521. List<User> users = userService.findListByWhere(new User());
  1522. StringBuffer sb = new StringBuffer("");
  1523. for (UserGroup userGroup : userGroups) {
  1524. for (User user : users) {
  1525. if (Objects.equals(user.getId(), userGroup.getUser_id())) {
  1526. sb.append(userGroup.getUser_id() + ",");
  1527. }
  1528. }
  1529. }
  1530. newApproval.setNextchecker(sb.toString());
  1531. if (sb.length() == 0) {
  1532. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_7 + "没有该项目责任单位的人员,请联系管理员配置");
  1533. }
  1534. IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
  1535. entity.setId(applyId);
  1536. entity.setApprove_status(Constant.LandSupplyApproveStatus.PRE_APPROVE_PENDIND_DISTRIBUTE);
  1537. entity.setProcess_stage(Constant.LandSupplyApproveStage.SUPPLY);
  1538. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
  1539. approvalService.insertAndGetId(newApproval);
  1540. return true;
  1541. } else if (
  1542. Objects.equals(Constant.LandSupplyApproveStatus.PRE_APPROVE_PENDIND_DISTRIBUTE, approval.getAfter_approvalstatus())
  1543. || Objects.equals(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_RETURN, approval.getAfter_approvalstatus())
  1544. ) {
  1545. // 预审通过待分发 --》 分发待反馈
  1546. Group group = null;
  1547. newApproval.setOper_type(Constant.OperType.DISTRIBUTE);
  1548. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.PRE_APPROVE_PENDIND_DISTRIBUTE);
  1549. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK);
  1550. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_5);
  1551. if (null == group) {
  1552. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_5 + "没有该项目责任单位的人员,请联系管理员配置");
  1553. }
  1554. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  1555. List<User> users = userService.findListByWhere(new User());
  1556. StringBuffer sb = new StringBuffer("");
  1557. for (UserGroup userGroup : userGroups) {
  1558. for (User user : users) {
  1559. if (Objects.equals(user.getId(), userGroup.getUser_id())) {
  1560. sb.append(userGroup.getUser_id() + ",");
  1561. }
  1562. }
  1563. }
  1564. newApproval.setNextchecker(sb.toString());
  1565. if (sb.length() == 0) {
  1566. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_5 + "没有该项目责任单位的人员,请联系管理员配置");
  1567. }
  1568. IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
  1569. entity.setId(applyId);
  1570. entity.setApprove_status(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK);
  1571. entity.setProcess_stage(Constant.LandSupplyApproveStage.SUPPLY);
  1572. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
  1573. approvalService.insertAndGetId(newApproval);
  1574. return true;
  1575. } else if (Objects.equals(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK, approval.getAfter_approvalstatus())) {
  1576. //分发待反馈 --》 待分发汇总
  1577. IndustrialLandSupplyDistribution industrialLandSupplyDistribution = new IndustrialLandSupplyDistribution();
  1578. industrialLandSupplyDistribution.setIndustrial_land_supply_id(applyId + "");
  1579. industrialLandSupplyDistribution.setDel_flag(false);
  1580. List<IndustrialLandSupplyDistribution> industrialLandSupplyDistributionList = industrialLandSupplyDistributionService.findListByWhere(industrialLandSupplyDistribution);
  1581. boolean sumbitToSummary = true;
  1582. for (IndustrialLandSupplyDistribution landSupplyDistribution : industrialLandSupplyDistributionList) {
  1583. //如果所有咨询都已回答 进入待汇总
  1584. if (!Objects.equals(landSupplyDistribution.getDepartment_id(), "0")) {
  1585. if (CommonUtils.isNull(landSupplyDistribution.getUpdate_by())) {
  1586. sumbitToSummary = false;
  1587. break;
  1588. } else {
  1589. sumbitToSummary = true;
  1590. }
  1591. }
  1592. }
  1593. Group group = null;
  1594. newApproval.setOper_type(Constant.OperType.SUBMIT);
  1595. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK);
  1596. if (sumbitToSummary) {
  1597. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_SUMMARY);
  1598. } else {
  1599. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK);
  1600. }
  1601. if (sumbitToSummary) {
  1602. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_7);
  1603. } else {
  1604. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_5);
  1605. }
  1606. if (null == group) {
  1607. if (sumbitToSummary) {
  1608. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_7 + "没有该项目责任单位的人员,请联系管理员配置");
  1609. } else {
  1610. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_5 + "没有该项目责任单位的人员,请联系管理员配置");
  1611. }
  1612. }
  1613. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  1614. List<User> users = userService.findListByWhere(new User());
  1615. StringBuffer sb = new StringBuffer("");
  1616. for (UserGroup userGroup : userGroups) {
  1617. for (User user : users) {
  1618. if (Objects.equals(user.getId(), userGroup.getUser_id())) {
  1619. sb.append(userGroup.getUser_id() + ",");
  1620. }
  1621. }
  1622. }
  1623. newApproval.setNextchecker(sb.toString());
  1624. if (sb.length() == 0) {
  1625. if (sumbitToSummary) {
  1626. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_7 + "没有该项目责任单位的人员,请联系管理员配置");
  1627. } else {
  1628. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_5 + "没有该项目责任单位的人员,请联系管理员配置");
  1629. }
  1630. }
  1631. IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
  1632. entity.setId(applyId);
  1633. if (sumbitToSummary) {
  1634. entity.setApprove_status(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_SUMMARY);
  1635. } else {
  1636. entity.setApprove_status(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK);
  1637. }
  1638. entity.setProcess_stage(Constant.LandSupplyApproveStage.SUPPLY);
  1639. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
  1640. approvalService.insertAndGetId(newApproval);
  1641. return true;
  1642. } else if (Objects.equals(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_SUMMARY, approval.getAfter_approvalstatus())) {
  1643. //待分发汇总 --》 待供地审批
  1644. Group group = null;
  1645. newApproval.setOper_type(Constant.OperType.SUBMIT);
  1646. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_SUMMARY);
  1647. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PENDIND_HANDLE);
  1648. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_4);
  1649. if (null == group) {
  1650. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
  1651. }
  1652. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  1653. List<User> users = userService.findListByWhere(new User());
  1654. StringBuffer sb = new StringBuffer("");
  1655. for (UserGroup userGroup : userGroups) {
  1656. for (User user : users) {
  1657. if (Objects.equals(user.getId(), userGroup.getUser_id())) {
  1658. sb.append(userGroup.getUser_id() + ",");
  1659. }
  1660. }
  1661. }
  1662. newApproval.setNextchecker(sb.toString());
  1663. if (sb.length() == 0) {
  1664. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
  1665. }
  1666. IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
  1667. entity.setId(applyId);
  1668. entity.setApprove_status(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PENDIND_HANDLE);
  1669. entity.setProcess_stage(Constant.LandSupplyApproveStage.SUPPLY);
  1670. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
  1671. approvalService.insertAndGetId(newApproval);
  1672. return true;
  1673. } else if (Objects.equals(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PENDIND_HANDLE, approval.getAfter_approvalstatus())) {
  1674. //待供地审批 --》 待供地审批通过
  1675. Group group = null;
  1676. newApproval.setOper_type(Constant.OperType.SUBMIT);
  1677. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PENDIND_HANDLE);
  1678. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PASS);
  1679. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_7);
  1680. if (null == group) {
  1681. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_7 + "没有该项目责任单位的人员,请联系管理员配置");
  1682. }
  1683. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  1684. List<User> users = userService.findListByWhere(new User());
  1685. StringBuffer sb = new StringBuffer("");
  1686. for (UserGroup userGroup : userGroups) {
  1687. for (User user : users) {
  1688. if (Objects.equals(user.getId(), userGroup.getUser_id())) {
  1689. sb.append(userGroup.getUser_id() + ",");
  1690. }
  1691. }
  1692. }
  1693. newApproval.setNextchecker(sb.toString());
  1694. if (sb.length() == 0) {
  1695. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_7 + "没有该项目责任单位的人员,请联系管理员配置");
  1696. }
  1697. IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
  1698. entity.setId(applyId);
  1699. entity.setApprove_status(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PASS);
  1700. entity.setProcess_stage(Constant.LandSupplyApproveStage.SUPPLY);
  1701. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
  1702. approvalService.insertAndGetId(newApproval);
  1703. return true;
  1704. } else if (Objects.equals(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PASS, approval.getAfter_approvalstatus())) {
  1705. //待供地审批通过 --》 最终信息 待供地审批通过
  1706. Group group = null;
  1707. newApproval.setOper_type(Constant.OperType.FINAL);
  1708. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PASS);
  1709. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PASS);
  1710. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_7);
  1711. if (null == group) {
  1712. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_7 + "没有该项目责任单位的人员,请联系管理员配置");
  1713. }
  1714. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  1715. List<User> users = userService.findListByWhere(new User());
  1716. StringBuffer sb = new StringBuffer("");
  1717. for (UserGroup userGroup : userGroups) {
  1718. for (User user : users) {
  1719. if (Objects.equals(user.getId(), userGroup.getUser_id())) {
  1720. sb.append(userGroup.getUser_id() + ",");
  1721. }
  1722. }
  1723. }
  1724. newApproval.setNextchecker(sb.toString());
  1725. if (sb.length() == 0) {
  1726. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_7 + "没有该项目责任单位的人员,请联系管理员配置");
  1727. }
  1728. IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
  1729. entity.setId(applyId);
  1730. entity.setApprove_status(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PASS);
  1731. entity.setProcess_stage(Constant.LandSupplyApproveStage.SUPPLY);
  1732. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
  1733. approvalService.insertAndGetId(newApproval);
  1734. return true;
  1735. }
  1736. return false;
  1737. }
  1738. /**
  1739. * @Author: huZhiHao
  1740. * @Description: 退回
  1741. * @Date: 2020/3/9
  1742. * @Params: [applyId, comment]
  1743. * @Return: boolean
  1744. **/
  1745. @Transactional
  1746. public boolean untread(Integer applyId, String comment) {
  1747. Approval approval = approvalService.getLatestApproval(applyId, Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY);
  1748. Approval newApproval = new Approval();
  1749. newApproval.setApply_id(applyId);
  1750. newApproval.setType(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY);
  1751. if (ShiroUtils.getUserType().equals(Constant.UserType.GOVERNMENT)) {
  1752. if (null != userService.getUser(ShiroUtils.getUserId()).getDepartment_id()) {
  1753. String departmentname = departmentService.selectById(userService.getUser(ShiroUtils.getUserId()).getDepartment_id()).getName();
  1754. newApproval.setDepartment(departmentname);
  1755. }
  1756. } else if (ShiroUtils.getUserType().equals(Constant.UserType.STREET)) {
  1757. newApproval.setDepartment(ShiroUtils.getUserEntity().getStreet_name());
  1758. }
  1759. newApproval.setApproval_comment(comment);
  1760. newApproval.setChecker(ShiroUtils.getUserId());
  1761. newApproval.setOper_type(Constant.OperType.REJECT);
  1762. newApproval.setDeal_time(DateUtil.getTimeString(new Date()));
  1763. IndustrialLandSupplyDetail entity = industrialLandSupplyDetailDao.selectById(applyId + "");
  1764. // User companyAdmin = userService.findCompanyAdmin(projectApplication.getCompany_id());
  1765. // Message messages = new Message();
  1766. // messages.setApply_id(projectApplication.getId());
  1767. // messages.setBusiness_type(Constant.Message_Business_type.PROJECT_INTELLIGENT_APPLY);
  1768. // messages.setTitle("提醒企业");
  1769. // String message = "您有单号为" + projectApplication.getApply_no() + "的" +
  1770. // Constant.ProjectType.PROJECT_INTELLIGENT + ",经审核被退回,要求修改,详情请登录平台查看。退回原因:" + comment;
  1771. // messages.setContent(message);
  1772. // int[] streetArrInt = new int[1];
  1773. // streetArrInt[0] = projectApplication.getCompany_id();
  1774. // Map<String, String> params = new HashMap<>();
  1775. // params.put("project_no", projectApplication.getApply_no());
  1776. // params.put("apply_name", Constant.ProjectType.PROJECT_INTELLIGENT);
  1777. // String templateCode = Constant.SMS_TemplateCode.RPOJECT_MATTERS_REJECT;
  1778. if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE, approval.getAfter_approvalstatus())) {
  1779. //商务局业务办理员退回 --》 街道板块
  1780. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
  1781. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_RETURN);
  1782. newApproval.setNextchecker(entity.getCreate_by().toString());
  1783. IndustrialLandSupplyDetail p = new IndustrialLandSupplyDetail();
  1784. p.setId(applyId);
  1785. p.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_RETURN);
  1786. p.setProcess_stage(null);
  1787. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(p);
  1788. approvalService.insertAndGetId(newApproval);
  1789. // messageService.saveMessageAndPush(messages, streetArrInt, Constant.UserType.COMPANY);
  1790. // waitToDoService.completeAllTODO(projectApplication.getId(), Constant.DictionaryType.PROJECT_INTELLIGENT);
  1791. // waitToDoService.newTODO("智能制造编辑", "/projectIntelligent/edit/" + projectApplication.getId(), Constant.WaitToDo_OperType.EDIT, projectApplication.getId(),
  1792. // Constant.DictionaryType.PROJECT_INTELLIGENT, projectApplication.getApply_no(), companyAdmin.getId().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false);
  1793. //发送短信
  1794. // AlibabaSMSUtil.sendSMS(
  1795. // companyAdmin.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params));
  1796. return true;
  1797. } else if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE, approval.getAfter_approvalstatus())) {
  1798. //商务局领导退回 --》 商务局业务员
  1799. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
  1800. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_RETURN);
  1801. newApproval.setNextchecker(entity.getCreate_by().toString());
  1802. IndustrialLandSupplyDetail p = new IndustrialLandSupplyDetail();
  1803. p.setId(applyId);
  1804. p.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_RETURN);
  1805. p.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
  1806. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(p);
  1807. approvalService.insertAndGetId(newApproval);
  1808. return true;
  1809. } else if (Objects.equals(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE, approval.getAfter_approvalstatus())) {
  1810. //管委会领导退回 --》 商务局业务员
  1811. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
  1812. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_RETURN);
  1813. newApproval.setNextchecker(entity.getCreate_by().toString());
  1814. IndustrialLandSupplyDetail p = new IndustrialLandSupplyDetail();
  1815. p.setId(applyId);
  1816. p.setApprove_status(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_RETURN);
  1817. p.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
  1818. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(p);
  1819. approvalService.insertAndGetId(newApproval);
  1820. return true;
  1821. } else if (Objects.equals(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PENDIND_HANDLE, approval.getAfter_approvalstatus())) {
  1822. //供地领导退回 --》 资源规划局务员
  1823. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PENDIND_HANDLE);
  1824. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_RETURN);
  1825. newApproval.setNextchecker(entity.getCreate_by().toString());
  1826. IndustrialLandSupplyDetail p = new IndustrialLandSupplyDetail();
  1827. p.setId(applyId);
  1828. p.setApprove_status(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_RETURN);
  1829. p.setProcess_stage(Constant.LandSupplyApproveStage.SUPPLY);
  1830. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(p);
  1831. approvalService.insertAndGetId(newApproval);
  1832. return true;
  1833. } else if (Objects.equals(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_RETURN, approval.getAfter_approvalstatus())) {
  1834. //供地审批退回 --》 预审通过待分发
  1835. Group group = null;
  1836. newApproval.setOper_type(Constant.OperType.SUBMIT);
  1837. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_RETURN);
  1838. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.PRE_APPROVE_PENDIND_DISTRIBUTE);
  1839. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_5);
  1840. if (null == group) {
  1841. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_5 + "没有该项目责任单位的人员,请联系管理员配置");
  1842. }
  1843. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  1844. List<User> users = userService.findListByWhere(new User());
  1845. StringBuffer sb = new StringBuffer("");
  1846. for (UserGroup userGroup : userGroups) {
  1847. for (User user : users) {
  1848. if (Objects.equals(user.getId(), userGroup.getUser_id())) {
  1849. sb.append(userGroup.getUser_id() + ",");
  1850. }
  1851. }
  1852. }
  1853. newApproval.setNextchecker(sb.toString());
  1854. if (sb.length() == 0) {
  1855. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_5 + "没有该项目责任单位的人员,请联系管理员配置");
  1856. }
  1857. IndustrialLandSupplyDetail p = new IndustrialLandSupplyDetail();
  1858. p.setId(applyId);
  1859. p.setApprove_status(Constant.LandSupplyApproveStatus.PRE_APPROVE_PENDIND_DISTRIBUTE);
  1860. p.setProcess_stage(Constant.LandSupplyApproveStage.SUPPLY);
  1861. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(p);
  1862. approvalService.insertAndGetId(newApproval);
  1863. return true;
  1864. }
  1865. return false;
  1866. }
  1867. /**
  1868. * @Author: huZhiHao
  1869. * @Description: 拒绝
  1870. * @Date: 2020/3/9
  1871. * @Params: [applyId, comment]
  1872. * @Return: boolean
  1873. **/
  1874. @Transactional
  1875. public boolean refuse(Integer applyId, String comment) {
  1876. Approval approval = approvalService.getLatestApproval(applyId, Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY);
  1877. Approval newApproval = new Approval();
  1878. newApproval.setApply_id(applyId);
  1879. newApproval.setType(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY);
  1880. if (ShiroUtils.getUserType().equals(Constant.UserType.GOVERNMENT)) {
  1881. if (null != userService.getUser(ShiroUtils.getUserId()).getDepartment_id()) {
  1882. String departmentname = departmentService.selectById(userService.getUser(ShiroUtils.getUserId()).getDepartment_id()).getName();
  1883. newApproval.setDepartment(departmentname);
  1884. }
  1885. } else if (ShiroUtils.getUserType().equals(Constant.UserType.STREET)) {
  1886. newApproval.setDepartment(ShiroUtils.getUserEntity().getStreet_name());
  1887. }
  1888. newApproval.setApproval_comment(comment);
  1889. newApproval.setChecker(ShiroUtils.getUserId());
  1890. newApproval.setOper_type(Constant.OperType.NOTAPPROVED);
  1891. newApproval.setDeal_time(DateUtil.getTimeString(new Date()));
  1892. IndustrialLandSupplyDetail entity = industrialLandSupplyDetailDao.selectById(applyId + "");
  1893. // User companyAdmin = userService.findCompanyAdmin(projectApplication.getCompany_id());
  1894. if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE, approval.getAfter_approvalstatus())) {
  1895. //商务局分管领导拒绝
  1896. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
  1897. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_REJECT);
  1898. newApproval.setNextchecker(entity.getCreate_by().toString());
  1899. IndustrialLandSupplyDetail p = new IndustrialLandSupplyDetail();
  1900. p.setId(applyId);
  1901. p.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_REJECT);
  1902. p.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
  1903. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(p);
  1904. approvalService.insertAndGetId(newApproval);
  1905. // ProjectIntelligentDeclaration projectDeclaration = this.findById(projectApplication.getDeclaration_id());
  1906. // String projectName = projectDeclaration.getProject_name();
  1907. // Company company = companyService.findById(projectApplication.getCompany_id());
  1908. // Message messages = new Message();
  1909. // messages.setApply_id(projectApplication.getId());
  1910. // messages.setBusiness_type(Constant.Message_Business_type.PROJECT_INTELLIGENT_APPLY);
  1911. // messages.setTitle("提醒企业");
  1912. // String message = company.getCompany_name() + ",您好。您提交的" + projectName + "审核不通过,请知悉。不通过原因:" + comment;
  1913. // messages.setContent(message);
  1914. // int[] streetArrInt = new int[1];
  1915. // streetArrInt[0] = projectApplication.getCompany_id();
  1916. // messageService.saveMessageAndPush(messages, streetArrInt, Constant.UserType.COMPANY);
  1917. //发送短信
  1918. // Map<String, String> params = new HashMap<>();
  1919. // params.put("project_no", projectApplication.getApply_no());
  1920. // params.put("apply_name", Constant.ProjectType.PROJECT_INTELLIGENT);
  1921. // String templateCode = Constant.SMS_TemplateCode.RPOJECT_MATTERS_UNPASS;
  1922. // AlibabaSMSUtil.sendSMS(
  1923. // companyAdmin.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params));
  1924. return true;
  1925. } else if (Objects.equals(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE, approval.getAfter_approvalstatus())) {
  1926. //管委会分管领导拒绝
  1927. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
  1928. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_REJECT);
  1929. newApproval.setNextchecker(entity.getCreate_by().toString());
  1930. IndustrialLandSupplyDetail p = new IndustrialLandSupplyDetail();
  1931. p.setId(applyId);
  1932. p.setApprove_status(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_REJECT);
  1933. p.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
  1934. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(p);
  1935. approvalService.insertAndGetId(newApproval);
  1936. return true;
  1937. } else if (Objects.equals(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PENDIND_HANDLE, approval.getAfter_approvalstatus())) {
  1938. //供地分管领导拒绝
  1939. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_PENDIND_HANDLE);
  1940. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_REJECT);
  1941. newApproval.setNextchecker(entity.getCreate_by().toString());
  1942. IndustrialLandSupplyDetail p = new IndustrialLandSupplyDetail();
  1943. p.setId(applyId);
  1944. p.setApprove_status(Constant.LandSupplyApproveStatus.LAND_SUPPLY_LEADER_REJECT);
  1945. p.setProcess_stage(Constant.LandSupplyApproveStage.SUPPLY);
  1946. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(p);
  1947. approvalService.insertAndGetId(newApproval);
  1948. return true;
  1949. }
  1950. return false;
  1951. }
  1952. /**
  1953. * @Author: huZhiHao
  1954. * @Description: 是否可以新增
  1955. * @Date: 2020/3/9
  1956. * @Params: []
  1957. * @Return: java.lang.Boolean
  1958. **/
  1959. @Transactional
  1960. public Boolean canAdd() {
  1961. if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
  1962. return true;
  1963. } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
  1964. Group group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
  1965. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  1966. for (UserGroup userGroup : userGroups) {
  1967. if (Objects.equals(userGroup.getUser_id(), ShiroUtils.getUserId())) {
  1968. return true;
  1969. }
  1970. }
  1971. }
  1972. return false;
  1973. }
  1974. /**
  1975. * @Author: huZhiHao
  1976. * @Description: 是否可以咨询
  1977. * @Date: 2020/3/9
  1978. * @Params: []
  1979. * @Return: java.lang.Boolean
  1980. **/
  1981. @Transactional
  1982. public Boolean canAsk() {
  1983. if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
  1984. Group group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
  1985. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  1986. for (UserGroup userGroup : userGroups) {
  1987. if (Objects.equals(userGroup.getUser_id(), ShiroUtils.getUserId())) {
  1988. return true;
  1989. }
  1990. }
  1991. }
  1992. return false;
  1993. }
  1994. public String detailType() {
  1995. if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
  1996. return "0";
  1997. }
  1998. return "1";
  1999. }
  2000. /**
  2001. * @Author: huZhiHao
  2002. * @Description: 用户所在组
  2003. * @Date: 2020/3/9
  2004. * @Params: []
  2005. * @Return: java.lang.String
  2006. **/
  2007. @Transactional
  2008. public String userGroupType() {
  2009. String str = "";
  2010. if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
  2011. str += "0,";
  2012. }
  2013. if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
  2014. Group group = null;
  2015. List<UserGroup> userGroups = null;
  2016. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
  2017. userGroups = userGroupService.findByGroupId(group.getId());
  2018. for (UserGroup userGroup : userGroups) {
  2019. if (Objects.equals(userGroup.getUser_id(), ShiroUtils.getUserId())) {
  2020. str += "1,";
  2021. }
  2022. }
  2023. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_2);
  2024. userGroups = userGroupService.findByGroupId(group.getId());
  2025. for (UserGroup userGroup : userGroups) {
  2026. if (Objects.equals(userGroup.getUser_id(), ShiroUtils.getUserId())) {
  2027. str += "2,";
  2028. }
  2029. }
  2030. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_3);
  2031. userGroups = userGroupService.findByGroupId(group.getId());
  2032. for (UserGroup userGroup : userGroups) {
  2033. if (Objects.equals(userGroup.getUser_id(), ShiroUtils.getUserId())) {
  2034. str += "3,";
  2035. }
  2036. }
  2037. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_4);
  2038. userGroups = userGroupService.findByGroupId(group.getId());
  2039. for (UserGroup userGroup : userGroups) {
  2040. if (Objects.equals(userGroup.getUser_id(), ShiroUtils.getUserId())) {
  2041. str += "4,";
  2042. }
  2043. }
  2044. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_5);
  2045. userGroups = userGroupService.findByGroupId(group.getId());
  2046. for (UserGroup userGroup : userGroups) {
  2047. if (Objects.equals(userGroup.getUser_id(), ShiroUtils.getUserId())) {
  2048. str += "5,";
  2049. }
  2050. }
  2051. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_6);
  2052. userGroups = userGroupService.findByGroupId(group.getId());
  2053. for (UserGroup userGroup : userGroups) {
  2054. if (Objects.equals(userGroup.getUser_id(), ShiroUtils.getUserId())) {
  2055. str += "6,";
  2056. }
  2057. }
  2058. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_7);
  2059. userGroups = userGroupService.findByGroupId(group.getId());
  2060. for (UserGroup userGroup : userGroups) {
  2061. if (Objects.equals(userGroup.getUser_id(), ShiroUtils.getUserId())) {
  2062. str += "7,";
  2063. }
  2064. }
  2065. // group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_8);
  2066. // userGroups = userGroupService.findByGroupId(group.getId());
  2067. // for (UserGroup userGroup : userGroups) {
  2068. // if (Objects.equals(userGroup.getUser_id(), ShiroUtils.getUserId())) {
  2069. // str += "8,";
  2070. // }
  2071. // }
  2072. }
  2073. return str;
  2074. }
  2075. /**
  2076. * @Author: huZhiHao
  2077. * @Description: 部门
  2078. * @Date: 2020/3/9
  2079. * @Params: []
  2080. * @Return: java.util.List<platform.modules.sys.entity.Department>
  2081. **/
  2082. @Transactional
  2083. public List<Department> consulDepartmentList() {
  2084. List<Department> list = new ArrayList<>();
  2085. Group group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_2);
  2086. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  2087. List<User> users = userService.findListByWhere(new User());
  2088. StringBuffer sb = new StringBuffer("");
  2089. for (UserGroup userGroup : userGroups) {
  2090. for (User user : users) {
  2091. if (Objects.equals(user.getId(), userGroup.getUser_id())) {
  2092. //list.add(departmentService.selectById(user.getDepartment_id()));
  2093. //获取根目录部门
  2094. list.add(departmentService.findRootById(user.getDepartment_id()));
  2095. }
  2096. }
  2097. }
  2098. List<Department> myList = list.stream().distinct().collect(Collectors.toList());
  2099. return myList;
  2100. }
  2101. /**
  2102. * @Author: huZhiHao
  2103. * @Description: 分发部门
  2104. * @Date: 2020/3/9
  2105. * @Params: []
  2106. * @Return: java.util.List<platform.modules.sys.entity.Department>
  2107. **/
  2108. @Transactional
  2109. public List<Department> distDepartmentList() {
  2110. List<Department> list = new ArrayList<>();
  2111. Group group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_5);
  2112. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  2113. List<User> users = userService.findListByWhere(new User());
  2114. StringBuffer sb = new StringBuffer("");
  2115. for (UserGroup userGroup : userGroups) {
  2116. for (User user : users) {
  2117. if (Objects.equals(user.getId(), userGroup.getUser_id())) {
  2118. //list.add(departmentService.selectById(user.getDepartment_id()));
  2119. //获取根目录部门
  2120. list.add(departmentService.findRootById(user.getDepartment_id()));
  2121. }
  2122. }
  2123. }
  2124. List<Department> myList = list.stream().distinct().collect(Collectors.toList());
  2125. return myList;
  2126. }
  2127. /**
  2128. * @Author: huZhiHao
  2129. * @Description: 保存反馈
  2130. * @Date: 2020/3/10
  2131. * @Params: [industrialLandSupplyConsultationList]
  2132. * @Return: void
  2133. **/
  2134. @Transactional
  2135. public void saveFeedback(List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList) {
  2136. String dateTime = DateUtil.getTimeString(new Date());
  2137. for (IndustrialLandSupplyConsultation industrialLandSupplyConsultation : industrialLandSupplyConsultationList) {
  2138. industrialLandSupplyConsultation.setFeedback_time(dateTime);
  2139. industrialLandSupplyConsultationService.updateSelective(industrialLandSupplyConsultation);
  2140. //保存材料
  2141. if (null != industrialLandSupplyConsultation.getFileDown() && null != industrialLandSupplyConsultation.getFileDown().getFile_id()) {
  2142. attachmentService.deleteByBusiness(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_FEEDBACK, industrialLandSupplyConsultation.getId());
  2143. attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_FEEDBACK, industrialLandSupplyConsultation.getId(), industrialLandSupplyConsultation.getFileDown().getFile_id());
  2144. }
  2145. }
  2146. IndustrialLandSupplyConsultation industrialLandSupplyConsultation = industrialLandSupplyConsultationService.findById(industrialLandSupplyConsultationList.get(0).getId());
  2147. this.pass(Integer.valueOf(industrialLandSupplyConsultation.getIndustrial_land_supply_id()), null);
  2148. }
  2149. /**
  2150. * @Author: huZhiHao
  2151. * @Description: 保存反馈
  2152. * @Date: 2020/3/10
  2153. * @Params: [industrialLandSupplyConsultationList]
  2154. * @Return: void
  2155. **/
  2156. @Transactional
  2157. public void saveFeedbackAppend(String applyId, List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList) {
  2158. //保存咨询列表
  2159. String dateTime = DateUtil.getTimeString(new Date());
  2160. if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
  2161. Iterator<IndustrialLandSupplyConsultation> it = industrialLandSupplyConsultationList.iterator();
  2162. while (it.hasNext()) {
  2163. IndustrialLandSupplyConsultation industrialLandSupplyConsultation = it.next();
  2164. if (CommonUtils.isNull(industrialLandSupplyConsultation.getConsultation()) || CommonUtils.isNotNull(industrialLandSupplyConsultation.getId())) {
  2165. it.remove();
  2166. }
  2167. }
  2168. for (IndustrialLandSupplyConsultation industrialLandSupplyConsultation : industrialLandSupplyConsultationList) {
  2169. industrialLandSupplyConsultation.setIndustrial_land_supply_id(applyId);
  2170. if (CommonUtils.isNull(industrialLandSupplyConsultation.getConsultation_time())) {
  2171. industrialLandSupplyConsultation.setConsultation_time(dateTime);
  2172. }
  2173. }
  2174. if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
  2175. industrialLandSupplyConsultationService.saveList(industrialLandSupplyConsultationList);
  2176. }
  2177. }
  2178. }
  2179. /**
  2180. * @Author: huZhiHao
  2181. * @Description: 保存汇总
  2182. * @Date: 2020/3/10
  2183. * @Params: [industrialLandSupplyDetail]
  2184. * @Return: void
  2185. **/
  2186. @Transactional
  2187. public void saveSummary(IndustrialLandSupplyDetail industrialLandSupplyDetail) {
  2188. IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
  2189. entity.setId(industrialLandSupplyDetail.getId());
  2190. entity.setConsultation_summary(industrialLandSupplyDetail.getConsultation_summary());
  2191. entity.setConsultation_summary_text(industrialLandSupplyDetail.getConsultation_summary_text());
  2192. this.updateSelective(entity);
  2193. //保存材料
  2194. if (null != industrialLandSupplyDetail.getFileDown() && null != industrialLandSupplyDetail.getFileDown().getFile_id()) {
  2195. attachmentService.deleteByBusiness(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_SUMMARY, industrialLandSupplyDetail.getId());
  2196. attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_SUMMARY, industrialLandSupplyDetail.getId(), industrialLandSupplyDetail.getFileDown().getFile_id());
  2197. }
  2198. this.pass(industrialLandSupplyDetail.getId(), null);
  2199. }
  2200. /**
  2201. * @Author: huZhiHao
  2202. * @Description: 撤回咨询
  2203. * @Date: 2020/3/7
  2204. * @Params: [applyId, comment]
  2205. * @Return: java.lang.Boolean
  2206. **/
  2207. @Transactional
  2208. public Boolean withDrawConsul(String id) {
  2209. IndustrialLandSupplyConsultation industrialLandSupplyConsultation = industrialLandSupplyConsultationService.findById(Integer.valueOf(id));
  2210. industrialLandSupplyConsultation.setDel_flag(true);
  2211. industrialLandSupplyConsultationService.updateSelective(industrialLandSupplyConsultation);
  2212. return this.withdraw(Integer.valueOf(industrialLandSupplyConsultation.getIndustrial_land_supply_id()), null);
  2213. }
  2214. /**
  2215. * @Author: huZhiHao
  2216. * @Description: 撤回申请
  2217. * @Date: 2020/3/7
  2218. * @Params: [applyId, comment]
  2219. * @Return: java.lang.Boolean
  2220. **/
  2221. @Transactional
  2222. public void withdrawApply(String id) {
  2223. // IndustrialLandSupplyDetail industrialLandSupplyDetail = this.selectById(id);
  2224. // industrialLandSupplyDetail.setApprove_status(Constant.LandSupplyApproveStatus.PLATE_WITHDRAW);
  2225. // industrialLandSupplyDetail.setProcess_stage("");
  2226. // industrialLandSupplyDetail.setAccept_date("");
  2227. // this.updateSelective(industrialLandSupplyDetail);
  2228. // Approval approval = new Approval();
  2229. // approval.setApply_id(Integer.valueOf(id));
  2230. // approvalService.deleteByWhere(approval);
  2231. withdraw(Integer.valueOf(id), null);
  2232. }
  2233. /**
  2234. * @Author: huZhiHao
  2235. * @Description: 撤回
  2236. * @Date: 2020/3/7
  2237. * @Params: [applyId, comment]
  2238. * @Return: java.lang.Boolean
  2239. **/
  2240. @Transactional
  2241. public Boolean withdraw(Integer applyId, String comment) {
  2242. Approval approval = approvalService.getLatestApproval(applyId, Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY);
  2243. Approval newApproval = new Approval();
  2244. newApproval.setApply_id(applyId);
  2245. newApproval.setType(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY);
  2246. String departmentname = departmentService.selectById(userService.getUser(ShiroUtils.getUserId()).getDepartment_id()).getName();
  2247. newApproval.setDepartment(departmentname);
  2248. newApproval.setApproval_comment(comment);
  2249. newApproval.setChecker(ShiroUtils.getUserId());
  2250. newApproval.setOper_type(Constant.OperType.WITHDRAW);
  2251. newApproval.setDeal_time(DateUtil.getTimeString(new Date()));
  2252. if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK, approval.getAfter_approvalstatus())) {
  2253. //待咨询反馈 --》 待咨询汇总
  2254. IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
  2255. industrialLandSupplyConsultation.setIndustrial_land_supply_id(applyId + "");
  2256. industrialLandSupplyConsultation.setDel_flag(false);
  2257. List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
  2258. boolean sumbitToSummary = true;
  2259. boolean backToSubmit = false;
  2260. //如果剩下的没有反馈了 退回到待提交
  2261. if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
  2262. for (IndustrialLandSupplyConsultation landSupplyConsultation : industrialLandSupplyConsultationList) {
  2263. //如果剩下的都是已反馈的咨询 则进入汇总
  2264. if (CommonUtils.isNull(landSupplyConsultation.getFeedback()) || CommonUtils.isNull(landSupplyConsultation.getUpdate_by())) {
  2265. sumbitToSummary = false;
  2266. break;
  2267. } else {
  2268. sumbitToSummary = true;
  2269. }
  2270. }
  2271. } else {
  2272. backToSubmit = true;
  2273. }
  2274. if (sumbitToSummary || backToSubmit) {
  2275. Group group = null;
  2276. newApproval.setOper_type(Constant.OperType.SUBMIT);
  2277. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
  2278. if (backToSubmit) {
  2279. IndustrialLandSupplyDetail industrialLandSupplyDetail = this.findById(applyId);
  2280. if (industrialLandSupplyDetail != null && industrialLandSupplyDetail.getCreate_by() != null) {
  2281. User user = userService.getUser(industrialLandSupplyDetail.getCreate_by());
  2282. if (Objects.equals(Constant.UserType.STREET, user.getUser_type())) {
  2283. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
  2284. } else {
  2285. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUBMIT);
  2286. }
  2287. }
  2288. } else if (sumbitToSummary) {
  2289. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUMMARY);
  2290. }
  2291. group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
  2292. if (null == group) {
  2293. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
  2294. }
  2295. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  2296. List<User> users = userService.findListByWhere(new User());
  2297. StringBuffer sb = new StringBuffer("");
  2298. for (UserGroup userGroup : userGroups) {
  2299. for (User user : users) {
  2300. if (Objects.equals(user.getId(), userGroup.getUser_id())) {
  2301. sb.append(userGroup.getUser_id() + ",");
  2302. }
  2303. }
  2304. }
  2305. newApproval.setNextchecker(sb.toString());
  2306. if (sb.length() == 0) {
  2307. throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
  2308. }
  2309. IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
  2310. entity.setId(applyId);
  2311. if (backToSubmit) {
  2312. entity.setApprove_status(newApproval.getAfter_approvalstatus());
  2313. } else if (sumbitToSummary) {
  2314. entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUMMARY);
  2315. }
  2316. entity.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
  2317. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
  2318. approvalService.insertAndGetId(newApproval);
  2319. return true;
  2320. }
  2321. } else if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE, approval.getAfter_approvalstatus())) {
  2322. //待商务业务员处理 --》 已撤回
  2323. newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
  2324. newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.PLATE_WITHDRAW);
  2325. newApproval.setNextchecker(ShiroUtils.getUserId() + "");
  2326. IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
  2327. entity.setId(applyId);
  2328. entity.setApprove_status(Constant.LandSupplyApproveStatus.PLATE_WITHDRAW);
  2329. entity.setProcess_stage("");
  2330. industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
  2331. approvalService.insertAndGetId(newApproval);
  2332. return true;
  2333. }
  2334. return false;
  2335. }
  2336. @Transactional
  2337. public Integer commerceApprove(IndustrialLandSupplyDetail apply) {
  2338. Integer id = apply.getId();
  2339. IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
  2340. entity.setId(id);
  2341. entity.setSupplement(apply.getSupplement());
  2342. this.updateSelective(entity);
  2343. //保存材料
  2344. if (null != apply.getFileDown() && null != apply.getFileDown().getFile_id()) {
  2345. attachmentService.deleteByBusiness(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_COMMERCE_SUPPLEMENT, id);
  2346. attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_COMMERCE_SUPPLEMENT, id, apply.getFileDown().getFile_id());
  2347. }
  2348. //保存咨询列表
  2349. String dateTime = DateUtil.getTimeString(new Date());
  2350. List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = apply.getConsultationList();
  2351. if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
  2352. Iterator<IndustrialLandSupplyConsultation> it = industrialLandSupplyConsultationList.iterator();
  2353. while (it.hasNext()) {
  2354. if (CommonUtils.isNull(it.next().getConsultation())) {
  2355. it.remove();
  2356. }
  2357. }
  2358. for (IndustrialLandSupplyConsultation industrialLandSupplyConsultation : industrialLandSupplyConsultationList) {
  2359. industrialLandSupplyConsultation.setIndustrial_land_supply_id(id + "");
  2360. if (industrialLandSupplyConsultation.getId() != null) {
  2361. IndustrialLandSupplyConsultation industrialLandSupplyConsultation1 = industrialLandSupplyConsultationService.findById(industrialLandSupplyConsultation.getId());
  2362. //如果问的问题没变则保留id等信息 不然作为新的处理
  2363. if (Objects.equals(industrialLandSupplyConsultation1.getConsultation(), industrialLandSupplyConsultation.getConsultation())) {
  2364. BeanUtils.copyProperties(industrialLandSupplyConsultation1, industrialLandSupplyConsultation);
  2365. }
  2366. }
  2367. if (CommonUtils.isNull(industrialLandSupplyConsultation.getConsultation_time())) {
  2368. industrialLandSupplyConsultation.setConsultation_time(dateTime);
  2369. }
  2370. }
  2371. IndustrialLandSupplyConsultation query = new IndustrialLandSupplyConsultation();
  2372. query.setIndustrial_land_supply_id(id + "");
  2373. industrialLandSupplyConsultationService.deleteByWhere(query);
  2374. if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
  2375. industrialLandSupplyConsultationService.saveList(industrialLandSupplyConsultationList);
  2376. }
  2377. }
  2378. //直接提交申请,添加流程信息
  2379. pass(id, null);
  2380. return id;
  2381. }
  2382. /**
  2383. * @Author: huZhiHao
  2384. * @Description: 保存
  2385. * @Date: 2020/3/7
  2386. * @Params: [apply, status]
  2387. * @Return: void
  2388. **/
  2389. @Transactional
  2390. public void updateAttachment(LandSupplyApprovalDto approval) {
  2391. IndustrialLandSupplyDetail industrialLandSupplyDetail = new IndustrialLandSupplyDetail();
  2392. industrialLandSupplyDetail.setId(approval.getApply_id());
  2393. //保存材料
  2394. if (Objects.equals(approval.getType(), "1")) {
  2395. //商务领导审核附件
  2396. if (null != approval.getFileDown() && null != approval.getFileDown().getFile_id()) {
  2397. attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_COMMERCE_LEADER, approval.getApply_id(), approval.getFileDown().getFile_id());
  2398. }
  2399. industrialLandSupplyDetail.setCommerce_leader_pre_approve_comment(approval.getApproval_comment());
  2400. if (approval.getStatus().equals(Constant.ApproveButtonStatus.APPROVED)) {
  2401. //通过
  2402. industrialLandSupplyDetail.setCommerce_leader_pre_approve_operate("通过");
  2403. } else if (approval.getStatus().equals(Constant.ApproveButtonStatus.REJECT)) {
  2404. //退回
  2405. industrialLandSupplyDetail.setCommerce_leader_pre_approve_operate("退回");
  2406. } else if (approval.getStatus().equals(Constant.ApproveButtonStatus.NOTAPPROVED)) {
  2407. //不通过
  2408. industrialLandSupplyDetail.setCommerce_leader_pre_approve_operate("不通过");
  2409. }
  2410. } else if (Objects.equals(approval.getType(), "2")) {
  2411. //管委会领导审核附件
  2412. if (null != approval.getFileDown() && null != approval.getFileDown().getFile_id()) {
  2413. attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_MANAGEMENT_COMMITTEE_LEADER, approval.getApply_id(), approval.getFileDown().getFile_id());
  2414. }
  2415. if (null != approval.getCountersign_file() && null != approval.getCountersign_file().getFile_id()) {
  2416. attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_MANAGEMENT_COMMITTEE_LEADER_COUNTERSIGN, approval.getApply_id(), approval.getCountersign_file().getFile_id());
  2417. }
  2418. industrialLandSupplyDetail.setCommittee_leader_pre_approve_comment(approval.getApproval_comment());
  2419. industrialLandSupplyDetail.setCountersign_comment(approval.getCountersign_comment());
  2420. if (approval.getStatus().equals(Constant.ApproveButtonStatus.APPROVED)) {
  2421. //通过
  2422. industrialLandSupplyDetail.setCommittee_leader_pre_approve_operate("通过");
  2423. } else if (approval.getStatus().equals(Constant.ApproveButtonStatus.REJECT)) {
  2424. //退回
  2425. industrialLandSupplyDetail.setCommittee_leader_pre_approve_operate("退回");
  2426. } else if (approval.getStatus().equals(Constant.ApproveButtonStatus.NOTAPPROVED)) {
  2427. //不通过
  2428. industrialLandSupplyDetail.setCommittee_leader_pre_approve_operate("不通过");
  2429. }
  2430. } else if (Objects.equals(approval.getType(), "3")) {
  2431. //管委会领导审核附件
  2432. if (null != approval.getFileDown() && null != approval.getFileDown().getFile_id()) {
  2433. attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_APPROVE, approval.getApply_id(), approval.getFileDown().getFile_id());
  2434. }
  2435. industrialLandSupplyDetail.setLand_supply_comment(approval.getApproval_comment());
  2436. if (approval.getStatus().equals(Constant.ApproveButtonStatus.APPROVED)) {
  2437. //通过
  2438. industrialLandSupplyDetail.setLand_supply_result("通过");
  2439. } else if (approval.getStatus().equals(Constant.ApproveButtonStatus.REJECT)) {
  2440. //退回
  2441. industrialLandSupplyDetail.setLand_supply_result("退回");
  2442. } else if (approval.getStatus().equals(Constant.ApproveButtonStatus.NOTAPPROVED)) {
  2443. //不通过
  2444. industrialLandSupplyDetail.setLand_supply_result("不通过");
  2445. }
  2446. } else if (Objects.equals(approval.getType(), "4")) {
  2447. //管委会领导审核附件
  2448. if (null != approval.getFileDown() && null != approval.getFileDown().getFile_id()) {
  2449. attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_FINAL, approval.getApply_id(), approval.getFileDown().getFile_id());
  2450. }
  2451. industrialLandSupplyDetail.setFinal_comment(approval.getApproval_comment());
  2452. if (approval.getStatus().equals(Constant.ApproveButtonStatus.APPROVED)) {
  2453. //通过
  2454. industrialLandSupplyDetail.setFinal_result("通过");
  2455. } else if (approval.getStatus().equals(Constant.ApproveButtonStatus.REJECT)) {
  2456. //退回
  2457. industrialLandSupplyDetail.setFinal_result("退回");
  2458. } else if (approval.getStatus().equals(Constant.ApproveButtonStatus.NOTAPPROVED)) {
  2459. //不通过
  2460. industrialLandSupplyDetail.setFinal_result("不通过");
  2461. }
  2462. }
  2463. this.updateSelective(industrialLandSupplyDetail);
  2464. }
  2465. @Transactional
  2466. public Integer distribute(IndustrialLandSupplyDetail apply) {
  2467. Integer id = apply.getId();
  2468. //保存分发列表
  2469. String dateTime = DateUtil.getTimeString(new Date());
  2470. List<IndustrialLandSupplyDistribution> industrialLandSupplyDistributionList = apply.getDistributionList();
  2471. if (!CollectionUtils.isEmpty(industrialLandSupplyDistributionList)) {
  2472. Iterator<IndustrialLandSupplyDistribution> it = industrialLandSupplyDistributionList.iterator();
  2473. // Map<String, String> map = new HashMap<>();
  2474. while (it.hasNext()) {
  2475. if (CommonUtils.isNull(it.next().getDistribution_file().getFile_id())) {
  2476. it.remove();
  2477. }
  2478. }
  2479. // IndustrialLandSupplyDistribution query = new IndustrialLandSupplyDistribution();
  2480. // query.setIndustrial_land_supply_id(id + "");
  2481. // industrialLandSupplyDistributionService.deleteByWhere(query);
  2482. //
  2483. // for (IndustrialLandSupplyDistribution industrialLandSupplyDistribution : industrialLandSupplyDistributionList) {
  2484. // map.put(industrialLandSupplyDistribution.getDepartment_id(), null);
  2485. // }
  2486. //
  2487. // List<IndustrialLandSupplyDistribution> industrialLandSupplyDistributions = new ArrayList<>();
  2488. // Iterator<Map.Entry<String, String>> itm = map.entrySet().iterator();
  2489. // while (itm.hasNext()) {
  2490. // String key = itm.next().getKey();
  2491. // IndustrialLandSupplyDistribution entity = new IndustrialLandSupplyDistribution();
  2492. // entity.setIndustrial_land_supply_id(id + "");
  2493. // if (CommonUtils.isNull(entity.getDistribute_time())) {
  2494. // entity.setDistribute_time(dateTime);
  2495. // }
  2496. // List<FileDown> fileDownList = new ArrayList<>();
  2497. // for (IndustrialLandSupplyDistribution industrialLandSupplyDistribution : industrialLandSupplyDistributionList) {
  2498. // if (Objects.equals(key, industrialLandSupplyDistribution.getDepartment_id())) {
  2499. // FileDown fileDown = new FileDown();
  2500. // fileDown.setFile_id(industrialLandSupplyDistribution.getDistribution_file().getFile_id());
  2501. // fileDownList.add(fileDown);
  2502. // }
  2503. // }
  2504. // entity.setDistribution_file_list(fileDownList);
  2505. // industrialLandSupplyDistributions.add(entity);
  2506. // }
  2507. //
  2508. // for (IndustrialLandSupplyDistribution industrialLandSupplyDistribution : industrialLandSupplyDistributions) {
  2509. //
  2510. // industrialLandSupplyDistributionService.saveSelective(industrialLandSupplyDistribution);
  2511. // //保存材料
  2512. // List<FileDown> fileDownList = industrialLandSupplyDistribution.getDistribution_file_list();
  2513. // if (!CollectionUtils.isEmpty(fileDownList)) {
  2514. // for (FileDown fileDown : fileDownList) {
  2515. // if (null != fileDown && null != fileDown.getFile_id()) {
  2516. // attachmentService.deleteByBusiness(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE, industrialLandSupplyDistribution.getId());
  2517. // attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE, industrialLandSupplyDistribution.getId(), fileDown.getFile_id());
  2518. // }
  2519. // }
  2520. // }
  2521. // }
  2522. for (IndustrialLandSupplyDistribution industrialLandSupplyDistribution : industrialLandSupplyDistributionList) {
  2523. industrialLandSupplyDistribution.setIndustrial_land_supply_id(id + "");
  2524. if (CommonUtils.isNull(industrialLandSupplyDistribution.getDistribute_time())) {
  2525. industrialLandSupplyDistribution.setDistribute_time(dateTime);
  2526. }
  2527. industrialLandSupplyDistributionService.saveSelective(industrialLandSupplyDistribution);
  2528. //保存材料
  2529. if (null != industrialLandSupplyDistribution.getDistribution_file() && null != industrialLandSupplyDistribution.getDistribution_file().getFile_id()) {
  2530. attachmentService.deleteByBusiness(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE, industrialLandSupplyDistribution.getId());
  2531. attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE, industrialLandSupplyDistribution.getId(), industrialLandSupplyDistribution.getDistribution_file().getFile_id());
  2532. }
  2533. }
  2534. }
  2535. //直接提交申请,添加流程信息
  2536. pass(id, null);
  2537. return id;
  2538. }
  2539. public List<FileDown> getAllDepartmentFile(String id) {
  2540. List<FileDown> fileDownList = new ArrayList<>();
  2541. List<Attachment> attachments = new ArrayList<>();
  2542. IndustrialLandSupplyDistribution industrialLandSupplyDistribution = new IndustrialLandSupplyDistribution();
  2543. industrialLandSupplyDistribution.setIndustrial_land_supply_id(id);
  2544. industrialLandSupplyDistribution.setDepartment_id("0");
  2545. industrialLandSupplyDistribution.setDel_flag(false);
  2546. List<IndustrialLandSupplyDistribution> industrialLandSupplyDistributionList = industrialLandSupplyDistributionService.findListByWhere(industrialLandSupplyDistribution);
  2547. if (!CollectionUtils.isEmpty(industrialLandSupplyDistributionList)) {
  2548. for (IndustrialLandSupplyDistribution landSupplyDistribution : industrialLandSupplyDistributionList) {
  2549. attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE, landSupplyDistribution.getId(), null);
  2550. if (null != attachments && attachments.size() > 0) {
  2551. FileDown fileDown = new FileDown(attachments.get(0).getId(), attachments.get(0).getFile_name(), attachments.get(0).getFile_url(), attachments.get(0).getDownload_uri());
  2552. fileDownList.add(fileDown);
  2553. }
  2554. }
  2555. return fileDownList;
  2556. }
  2557. return fileDownList;
  2558. }
  2559. @Transactional
  2560. public void distributeFeedback(List<IndustrialLandSupplyDistribution> industrialLandSupplyDistributionList) {
  2561. for (IndustrialLandSupplyDistribution industrialLandSupplyDistribution : industrialLandSupplyDistributionList) {
  2562. industrialLandSupplyDistributionService.updateSelective(industrialLandSupplyDistribution);
  2563. FileDown file = industrialLandSupplyDistribution.getFeedback_file();
  2564. //保存材料
  2565. if (null != file && null != file.getFile_id()) {
  2566. attachmentService.deleteByBusiness(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE_FEEDBACK, industrialLandSupplyDistribution.getId());
  2567. attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE_FEEDBACK, industrialLandSupplyDistribution.getId(), file.getFile_id());
  2568. }
  2569. }
  2570. IndustrialLandSupplyDistribution industrialLandSupplyDistribution = industrialLandSupplyDistributionService.findById(industrialLandSupplyDistributionList.get(0).getId());
  2571. this.pass(Integer.valueOf(industrialLandSupplyDistribution.getIndustrial_land_supply_id()), null);
  2572. }
  2573. @Transactional
  2574. public void distributeSummary(IndustrialLandSupplyDetail industrialLandSupplyDetail) {
  2575. IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
  2576. entity.setId(industrialLandSupplyDetail.getId());
  2577. entity.setJoint_trial(industrialLandSupplyDetail.getJoint_trial());
  2578. if (industrialLandSupplyDetail.getJoint_trial()) {
  2579. entity.setJoint_trial_comment(industrialLandSupplyDetail.getJoint_trial_comment());
  2580. entity.setJoint_trial_result(industrialLandSupplyDetail.getJoint_trial_result());
  2581. }
  2582. entity.setDistribution_summary(industrialLandSupplyDetail.getDistribution_summary());
  2583. this.updateSelective(entity);
  2584. //保存材料
  2585. if (null != industrialLandSupplyDetail.getDistribution_summary_file() && null != industrialLandSupplyDetail.getDistribution_summary_file().getFile_id()) {
  2586. attachmentService.deleteByBusiness(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE_SUMMARY, industrialLandSupplyDetail.getId());
  2587. attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE_SUMMARY, industrialLandSupplyDetail.getId(), industrialLandSupplyDetail.getDistribution_summary_file().getFile_id());
  2588. }
  2589. if (industrialLandSupplyDetail.getJoint_trial()) {
  2590. if (null != industrialLandSupplyDetail.getJoint_trial_file() && null != industrialLandSupplyDetail.getJoint_trial_file().getFile_id()) {
  2591. attachmentService.deleteByBusiness(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_JOINT_TRIAL, industrialLandSupplyDetail.getId());
  2592. attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_JOINT_TRIAL, industrialLandSupplyDetail.getId(), industrialLandSupplyDetail.getJoint_trial_file().getFile_id());
  2593. }
  2594. }
  2595. this.pass(industrialLandSupplyDetail.getId(), null);
  2596. }
  2597. @Transactional
  2598. public void gsFeedback(IndustrialLandSupplyDetail industrialLandSupplyDetail) {
  2599. IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
  2600. entity.setId(industrialLandSupplyDetail.getId());
  2601. entity.setGs_feedback(industrialLandSupplyDetail.getGs_feedback());
  2602. this.updateSelective(entity);
  2603. //保存材料
  2604. if (null != industrialLandSupplyDetail.getFileDown() && null != industrialLandSupplyDetail.getFileDown().getFile_id()) {
  2605. attachmentService.deleteByBusiness(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_GS, industrialLandSupplyDetail.getId());
  2606. attachmentService.updateAttachment(Constant.Attachment.INDUSTRIAL_LAND_SUPPLY_GS, industrialLandSupplyDetail.getId(), industrialLandSupplyDetail.getFileDown().getFile_id());
  2607. }
  2608. // this.pass(industrialLandSupplyDetail.getId(), null);
  2609. }
  2610. public void exportCountersignWord(int id, HttpServletResponse response) throws IOException {
  2611. IndustrialLandSupplyDetail entity = this.findById(id);
  2612. ExportWord ew = new ExportWord();
  2613. XWPFDocument document = ew.createXWPFDocument(6, 2);
  2614. List<List<Object>> list = new ArrayList<List<Object>>();
  2615. String title = entity.getTitle();
  2616. String content = entity.getContent_text();
  2617. String location = entity.getLocation();
  2618. String consultationSummary = entity.getConsultation_summary_text();
  2619. List<Object> tempList = new ArrayList<Object>();
  2620. tempList.add("项目标题");
  2621. tempList.add(title == null ? "" : title);
  2622. list.add(tempList);
  2623. tempList = new ArrayList<Object>();
  2624. tempList.add("项目内容");
  2625. tempList.add(content == null ? "" : content);
  2626. list.add(tempList);
  2627. tempList = new ArrayList<Object>();
  2628. tempList.add("用地信息");
  2629. tempList.add(location == null ? "" : location);
  2630. list.add(tempList);
  2631. tempList = new ArrayList<Object>();
  2632. tempList.add("部门意见\r" +
  2633. "(商务汇总意见)");
  2634. tempList.add(consultationSummary == null ? "" : consultationSummary);
  2635. list.add(tempList);
  2636. tempList = new ArrayList<Object>();
  2637. tempList.add("领导批示和会签意见");
  2638. tempList.add("");
  2639. list.add(tempList);
  2640. tempList = new ArrayList<Object>();
  2641. tempList.add("日期");
  2642. String time = DateUtil.getCurrentDateString("yyyy-MM-yy");
  2643. tempList.add(time);
  2644. list.add(tempList);
  2645. Map<String, Object> dataList = new HashMap<String, Object>();
  2646. dataList.put("TITLE", "苏州国家高新区产业用地预审办文单");
  2647. dataList.put("TABLEDATA", list);
  2648. response.reset();
  2649. response.setContentType("application/octet-stream; charset=utf-8");
  2650. response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode("苏州国家高新区产业用地预审办文单" + "-" + time + ".docx", "UTF-8"));
  2651. ew.exportCheckWord(dataList, document, response);
  2652. }
  2653. }