IndustrialLandSupplyDetailService.java 140 KB

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