IndustrialLandSupplyDetailService.java 168 KB

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