48f214ef7638056ed9aebf15ce564d580a08acb9.svn-base 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772
  1. package cn.com.goldenwater.dcproj.service.impl.tac;
  2. import cn.com.goldenwater.dcproj.constValue.JinChaEnum;
  3. import cn.com.goldenwater.dcproj.constValue.SplitValue;
  4. import cn.com.goldenwater.dcproj.dao.*;
  5. import cn.com.goldenwater.dcproj.dto.TacPawpRgstrDto;
  6. import cn.com.goldenwater.dcproj.model.*;
  7. import cn.com.goldenwater.dcproj.param.*;
  8. import cn.com.goldenwater.dcproj.service.GwComFileService;
  9. import cn.com.goldenwater.core.service.AbstractCrudService;
  10. import cn.com.goldenwater.dcproj.service.TacPawpRgstrService;
  11. import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
  12. import cn.com.goldenwater.dcproj.utils.GeoUtil;
  13. import cn.com.goldenwater.dcproj.utils.InspUtils;
  14. import cn.com.goldenwater.id.util.UuidUtil;
  15. import com.github.pagehelper.PageHelper;
  16. import com.github.pagehelper.PageInfo;
  17. import org.apache.commons.io.FileUtils;
  18. import org.apache.commons.lang3.StringUtils;
  19. import org.springframework.beans.factory.annotation.Autowired;
  20. import org.springframework.beans.factory.annotation.Value;
  21. import org.springframework.data.redis.core.RedisTemplate;
  22. import org.springframework.stereotype.Service;
  23. import org.springframework.transaction.annotation.Transactional;
  24. import java.io.File;
  25. import java.util.Date;
  26. import java.util.HashMap;
  27. import java.util.List;
  28. import java.util.Map;
  29. import java.util.concurrent.TimeUnit;
  30. /**
  31. * @author lune
  32. * @date 2019-6-19
  33. */
  34. @Service
  35. @Transactional(rollbackFor = Exception.class)
  36. public class TacPawpRgstrServiceImpl extends AbstractCrudService<TacPawpRgstr, TacPawpRgstrParam> implements TacPawpRgstrService {
  37. @Autowired
  38. private TacPawpRgstrDao tacPawpRgstrDao;
  39. @Autowired
  40. private TacProvincePlanTaskDao tacProvincePlanTaskDao;
  41. public TacPawpRgstrServiceImpl(TacPawpRgstrDao tacPawpRgstrDao) {
  42. super(tacPawpRgstrDao);
  43. this.tacPawpRgstrDao = tacPawpRgstrDao;
  44. }
  45. /**
  46. * app获取稽察项目督查项目列表
  47. *
  48. * @param typeParam
  49. * @return
  50. */
  51. @Override
  52. public PageInfo<TacPawpRgstrDto> findPageWagaPage(TypeParam typeParam) {
  53. if (StringUtils.isNotBlank(typeParam.getAdCode())) {
  54. typeParam.setAdCode(String.valueOf(AdLevelUtil.SubAd(typeParam.getAdCode()).get(SplitValue.SUBAD)));
  55. }
  56. PageHelper.startPage(typeParam);
  57. List<TacPawpRgstrDto> list = tacPawpRgstrDao.findPawpPage(typeParam);
  58. PageInfo<TacPawpRgstrDto> pageInfo = new PageInfo(list);
  59. return pageInfo;
  60. }
  61. @Autowired
  62. TacPawpListDao tacPawpListDao;
  63. @Autowired
  64. private TacPawpPdbstDao tacPawpPdbstDao;
  65. @Autowired
  66. private TacPawpRaiobisDao tacPawpRaiobisDao;
  67. @Autowired
  68. private TacPawpBstocmPlprsDao tacPawpBstocmPlprsDao;
  69. @Autowired
  70. private TacPawpBitopqQmsDao tacPawpBitopqQmsDao;
  71. @Autowired
  72. private TacPawpBioesPeDao tacPawpBioesPeDao;
  73. @Autowired
  74. private TacPawpBiofuamDao tacPawpBiofuamDao;
  75. @Autowired
  76. private TacPblmInfoDao tacPblmInfoDao;
  77. @Autowired
  78. private TacPawpDrmDao tacPawpDrmDao;
  79. @Autowired
  80. private TacPawpBioesRwunitDao tacPawpBioesRwunitDao;
  81. @Autowired
  82. private TacPawpBitopqPeqaaDao tacPawpBitopqPeqaaDao;
  83. @Autowired
  84. private TacPawpUnitSctnDao tacPawpUnitSctnDao;
  85. @Autowired
  86. private TacPblmSubjectDao tacPblmSubjectDao;
  87. @Autowired
  88. private TacWordBaseDao tacWordBaseDao;
  89. @Value("${jc.baseinfo.word.path}")
  90. private String docxPath;
  91. @Override
  92. public TacPawpRgstr createZhuliData(String persId, String regstrId, String type, TacPawpRgstr pawpRgstr, String regstrId_zhuli, String state) {
  93. //复制稽察项目基本信息的word文档
  94. TacWordBaseParam wordBaseParam = new TacWordBaseParam();
  95. wordBaseParam.setType("10" + type);
  96. wordBaseParam.setBizId(regstrId);
  97. TacWordBase wordBase = tacWordBaseDao.getBy(wordBaseParam);
  98. if (wordBase != null) {
  99. String filePath = wordBase.getFilePath();
  100. String oldPath = docxPath + filePath;
  101. String newId = UuidUtil.uuid();
  102. String newfilePath = filePath.replace(regstrId, regstrId_zhuli);
  103. String newPath = oldPath.replace(regstrId, regstrId_zhuli);
  104. File newFile = new File(newPath);
  105. File oldFile = new File(oldPath);
  106. try {
  107. FileUtils.copyFile(oldFile, newFile);
  108. } catch (Exception e) {
  109. e.printStackTrace();
  110. }
  111. wordBase.setId(newId);
  112. wordBase.setBizId(regstrId_zhuli);
  113. wordBase.setFilePath(newfilePath);
  114. wordBase.setIntm(new Date());
  115. wordBase.setUptm(new Date());
  116. tacWordBaseDao.insert(wordBase);
  117. }
  118. //复制稽察项目单位及标段信息
  119. addUnitSctn(regstrId, regstrId_zhuli);
  120. //添加问题
  121. addParam(regstrId, type, "", regstrId_zhuli, pawpRgstr.getProvince());
  122. //创建附件1-附件6
  123. if (JinChaEnum.TACPAWPPDBST.getKey().equals(type) || StringUtils.isBlank(type)) {
  124. TacPawpPdbstParam pawpPdbstParam = new TacPawpPdbstParam();
  125. pawpPdbstParam.setRgstrId(regstrId);
  126. TacPawpPdbst tacPawpPdbst = tacPawpPdbstDao.getBy(pawpPdbstParam);
  127. //附件1
  128. if (tacPawpPdbst != null) {
  129. tacPawpPdbst.setId(UuidUtil.uuid());
  130. tacPawpPdbst.setPersId(persId);
  131. tacPawpPdbst.setRgstrId(regstrId_zhuli);
  132. tacPawpPdbstDao.insert(tacPawpPdbst);
  133. }
  134. pawpRgstr.setPdbstStat(state);//StateEnum.SUBMIT_ZHUANJIA.getKey()
  135. }
  136. //附件2
  137. if (JinChaEnum.TacPawpBstocmTsopbfp.getKey().equals(type) || StringUtils.isBlank(type)) {
  138. addBstocm(regstrId, regstrId_zhuli, persId);
  139. pawpRgstr.setBstocmTsopbfpStat(state);
  140. }
  141. //附件3
  142. if (JinChaEnum.TacPawpRaiobis.getKey().equals(type) || StringUtils.isBlank(type)) {
  143. addRaiobis(regstrId, regstrId_zhuli, persId);
  144. pawpRgstr.setRaiobisStat(state);
  145. }
  146. //附件4
  147. if (JinChaEnum.TacPawpBstocmCms.getKey().equals(type) || StringUtils.isBlank(type)) {
  148. addBiofuam(regstrId, regstrId_zhuli, persId);
  149. pawpRgstr.setBstocmCmsStat(state);
  150. }
  151. //附件5
  152. if (JinChaEnum.TacPawpBitopqPeqaa.getKey().equals(type) || StringUtils.isBlank(type)) {
  153. addBitopq(regstrId, regstrId_zhuli, persId);
  154. pawpRgstr.setBitopqPeqaaStat(state);
  155. }
  156. //附件6
  157. if (JinChaEnum.TacPawpBioesRwunit.getKey().equals(type) || StringUtils.isBlank(type)) {
  158. addBioes(regstrId, regstrId_zhuli, persId);
  159. pawpRgstr.setBioesRwunitStat(state);
  160. }
  161. if (state.equals(pawpRgstr.getPdbstStat()) && state.equals(pawpRgstr.getBstocmTsopbfpStat()) && state.equals(pawpRgstr.getRaiobisStat()) && state.equals(pawpRgstr.getBstocmCmsStat()) && state.equals(pawpRgstr.getBitopqPeqaaStat()) && state.equals(pawpRgstr.getBioesRwunitStat())) {
  162. pawpRgstr.setState(state);
  163. }
  164. return pawpRgstr;
  165. }
  166. public void delete(String regstrId_zhuli, String type, String province) {
  167. TacPblmInfoParam pblmInfoParam = new TacPblmInfoParam();
  168. pblmInfoParam.setRgstrId(regstrId_zhuli);
  169. pblmInfoParam.setListType(type);
  170. pblmInfoParam.setProvince(province);
  171. List<TacPblmInfo> pblmInfoList = tacPblmInfoDao.findList(pblmInfoParam);
  172. if (pblmInfoList != null && !pblmInfoList.isEmpty()) {
  173. for (TacPblmInfo pblmInfo : pblmInfoList) {
  174. GwComFileParam fileParam = new GwComFileParam();
  175. fileParam.setBizId(pblmInfo.getId());
  176. gwComFileService.deleteBy(fileParam);
  177. }
  178. tacPblmInfoDao.deleteBy(pblmInfoParam);
  179. }
  180. }
  181. @Override
  182. public TacPawpRgstr rollbackControl(String regstrId_zhuli, String persId, String type, TacPawpRgstr pawpRgstr, String state) {
  183. //删除问题,附件
  184. delete(regstrId_zhuli, type, pawpRgstr.getProvince());
  185. //删除附件1-6
  186. //删除附件1
  187. if (JinChaEnum.TACPAWPPDBST.getKey().equals(type)) {
  188. TacPawpPdbstParam pawpPdbstParam = new TacPawpPdbstParam();
  189. pawpPdbstParam.setRgstrId(regstrId_zhuli);
  190. // pawpPdbstParam.setPersId(persId);
  191. tacPawpPdbstDao.deleteBy(pawpPdbstParam);
  192. pawpRgstr.setPdbstStat(state);
  193. }
  194. deleteUnitSctn(regstrId_zhuli);
  195. //附件2
  196. if (JinChaEnum.TacPawpBstocmTsopbfp.getKey().equals(type)) {
  197. TacPawpBstocmPlprsParam pawpBstocmPlprsParam = new TacPawpBstocmPlprsParam();
  198. pawpBstocmPlprsParam.setRgstrId(regstrId_zhuli);
  199. // pawpBstocmPlprsParam.setPersId(persId);
  200. tacPawpBstocmPlprsDao.deleteBy(pawpBstocmPlprsParam);
  201. TacPawpBstocmTsopbfpParam bstocmTsopbfpParam = new TacPawpBstocmTsopbfpParam();
  202. bstocmTsopbfpParam.setRgstrId(regstrId_zhuli);
  203. // bstocmTsopbfpParam.setPersId(persId);
  204. List<TacPawpBstocmTsopbfp> bstocmTsopbfpList = tacPawpBstocmTsopbfpDao.findList(bstocmTsopbfpParam);
  205. if (bstocmTsopbfpList != null && !bstocmTsopbfpList.isEmpty()) {
  206. tacPawpBstocmTsopbfpDao.deleteBy(bstocmTsopbfpParam);
  207. for (TacPawpBstocmTsopbfp bstocmTsopbfp : bstocmTsopbfpList) {
  208. TacPawpBstocmTsopbfpSctnParam bstocmTsopbfpSctnParam = new TacPawpBstocmTsopbfpSctnParam();
  209. bstocmTsopbfpSctnParam.setTsopbfpId(bstocmTsopbfp.getId());
  210. // bstocmTsopbfpSctnParam.setPersId(persId);
  211. tacPawpBstocmTsopbfpSctnDao.deleteBy(bstocmTsopbfpSctnParam);
  212. }
  213. }
  214. TacPawpBstocmCpssInfoParam bstocmCpssInfoParam = new TacPawpBstocmCpssInfoParam();
  215. bstocmCpssInfoParam.setRgstrId(regstrId_zhuli);
  216. // bstocmCpssInfoParam.setPersId(persId);
  217. List<TacPawpBstocmCpssInfo> bstocmCpssInfoList = pawpBstocmCpssInfoDao.findList(bstocmCpssInfoParam);
  218. if (bstocmCpssInfoList != null && !bstocmCpssInfoList.isEmpty()) {
  219. for (TacPawpBstocmCpssInfo bstocmCpssInfo : bstocmCpssInfoList) {
  220. TacPawpBstocmCpssParam pawpBstocmCpssParam = new TacPawpBstocmCpssParam();
  221. pawpBstocmCpssParam.setCpssId(bstocmCpssInfo.getId());
  222. // pawpBstocmCpssParam.setPersId(persId);
  223. pawpBstocmCpssDao.deleteBy(pawpBstocmCpssParam);
  224. }
  225. pawpBstocmCpssInfoDao.deleteBy(bstocmCpssInfoParam);
  226. }
  227. TacPawpBstocmCmsParam pawpBstocmCmsParam = new TacPawpBstocmCmsParam();
  228. pawpBstocmCmsParam.setRgstrId(regstrId_zhuli);
  229. // pawpBstocmCmsParam.setPersId(persId);
  230. List<TacPawpBstocmCms> pawpBstocmCmsList = pawpBstocmCmsDao.findList(pawpBstocmCmsParam);
  231. if (pawpBstocmCmsList != null && !pawpBstocmCmsList.isEmpty()) {
  232. for (TacPawpBstocmCms pawpBstocmCms : pawpBstocmCmsList) {
  233. TacPawpBstocmCmsPactListParam bstocmCmsPactListParam = new TacPawpBstocmCmsPactListParam();
  234. bstocmCmsPactListParam.setCmsId(pawpBstocmCms.getId());
  235. // bstocmCmsPactListParam.setPersId(persId);
  236. pawpBstocmCmsPactListDao.deleteBy(bstocmCmsPactListParam);
  237. pawpBstocmCmsDao.deleteBy(pawpBstocmCmsParam);
  238. }
  239. }
  240. pawpRgstr.setBstocmTsopbfpStat(state);
  241. }
  242. //附件3
  243. if (JinChaEnum.TacPawpRaiobis.getKey().equals(type)) {
  244. TacPawpRaiobisParam pawpRaiobisParam = new TacPawpRaiobisParam();
  245. pawpRaiobisParam.setRgstrId(regstrId_zhuli);
  246. // pawpRaiobisParam.setPersId(persId);
  247. tacPawpRaiobisDao.deleteBy(pawpRaiobisParam);
  248. pawpRgstr.setRaiobisStat(state);
  249. }
  250. //附件4
  251. if (JinChaEnum.TacPawpBstocmCms.getKey().equals(type)) {
  252. TacPawpBiofuamParam pawpBiofuamParam = new TacPawpBiofuamParam();
  253. pawpBiofuamParam.setRgstrId(regstrId_zhuli);
  254. // pawpBiofuamParam.setPersId(persId);
  255. tacPawpBiofuamDao.deleteBy(pawpBiofuamParam);
  256. pawpRgstr.setBstocmCmsStat(state);
  257. }
  258. //附件5
  259. if (JinChaEnum.TacPawpBitopqPeqaa.getKey().equals(type)) {
  260. TacPawpBitopqQmsParam pawpBitopqQmsParam = new TacPawpBitopqQmsParam();
  261. pawpBitopqQmsParam.setRgstrId(regstrId_zhuli);
  262. // pawpBitopqQmsParam.setPersId(persId);
  263. tacPawpBitopqQmsDao.deleteBy(pawpBitopqQmsParam);
  264. TacPawpBitopqPeqaaParam pawpBitopqPeqaaParam = new TacPawpBitopqPeqaaParam();
  265. pawpBitopqPeqaaParam.setRgstrId(regstrId_zhuli);
  266. // pawpBitopqPeqaaParam.setPersId(persId);
  267. List<TacPawpBitopqPeqaa> pawpBitopqPeqaaList = tacPawpBitopqPeqaaDao.findList(pawpBitopqPeqaaParam);
  268. if (pawpBitopqPeqaaList != null && !pawpBitopqPeqaaList.isEmpty()) {
  269. tacPawpBitopqPeqaaDao.deleteBy(pawpBitopqPeqaaParam);
  270. for (TacPawpBitopqPeqaa pawpBitopqPeqaa : pawpBitopqPeqaaList) {
  271. TacPawpBitopqPeqaaUnitParam bitopqPeqaaUnitParam = new TacPawpBitopqPeqaaUnitParam();
  272. bitopqPeqaaUnitParam.setPeqaaId(pawpBitopqPeqaa.getId());
  273. tacPawpBitopqPeqaaUnitDao.deleteBy(bitopqPeqaaUnitParam);
  274. }
  275. }
  276. pawpRgstr.setBitopqPeqaaStat(state);
  277. }
  278. //附件6
  279. if (JinChaEnum.TacPawpBioesRwunit.getKey().equals(type)) {
  280. TacPawpBioesPeParam pawpBioesPeParam = new TacPawpBioesPeParam();
  281. pawpBioesPeParam.setRgstrId(regstrId_zhuli);
  282. // pawpBioesPeParam.setPersId(persId);
  283. tacPawpBioesPeDao.deleteBy(pawpBioesPeParam);
  284. TacPawpBioesRwunitParam pawpBioesRwunitParam = new TacPawpBioesRwunitParam();
  285. pawpBioesRwunitParam.setRgstrId(regstrId_zhuli);
  286. // pawpBioesRwunitParam.setPersId(persId);
  287. tacPawpBioesRwunitDao.deleteBy(pawpBioesRwunitParam);
  288. pawpRgstr.setBioesRwunitStat(state);
  289. }
  290. //删除底稿
  291. TacWordBaseParam wordBaseParam = new TacWordBaseParam();
  292. wordBaseParam.setType("10" + type);
  293. wordBaseParam.setBizId(regstrId_zhuli);
  294. List<TacWordBase> wordBaseList = tacWordBaseDao.findList(wordBaseParam);
  295. if (wordBaseList != null && !wordBaseList.isEmpty()) {
  296. tacWordBaseDao.deleteBy(wordBaseParam);
  297. }
  298. pawpRgstr.setState(state);
  299. return pawpRgstr;
  300. }
  301. @Override
  302. public String findZhuli(String regstrId) {
  303. return tacPawpRgstrDao.findZhuli(regstrId);
  304. }
  305. @Autowired
  306. private TacPawpBstocmTsopbfpDao tacPawpBstocmTsopbfpDao;
  307. @Autowired
  308. private TacPawpBstocmTsopbfpSctnDao tacPawpBstocmTsopbfpSctnDao;
  309. @Autowired
  310. private TacPawpBstocmCpssInfoDao pawpBstocmCpssInfoDao;
  311. @Autowired
  312. private TacPawpBstocmCpssDao pawpBstocmCpssDao;
  313. @Autowired
  314. private TacPawpBstocmCmsDao pawpBstocmCmsDao;
  315. @Autowired
  316. private TacPawpBstocmCmsPactListDao pawpBstocmCmsPactListDao;
  317. //添加附件2
  318. private void addBstocm(String regstrId, String newRegstrId, String persId) {
  319. TacPawpBstocmPlprsParam pawpBstocmPlprsParam = new TacPawpBstocmPlprsParam();
  320. pawpBstocmPlprsParam.setRgstrId(regstrId);
  321. List<TacPawpBstocmPlprs> pawpBstocmPlprsList = tacPawpBstocmPlprsDao.findList(pawpBstocmPlprsParam);
  322. if (pawpBstocmPlprsList != null && !pawpBstocmPlprsList.isEmpty()) {
  323. for (TacPawpBstocmPlprs pawpBstocmPlprs : pawpBstocmPlprsList) {
  324. pawpBstocmPlprs.setId(UuidUtil.uuid());
  325. pawpBstocmPlprs.setPersId(persId);
  326. pawpBstocmPlprs.setUptm(new Date());
  327. pawpBstocmPlprs.setRgstrId(newRegstrId);
  328. tacPawpBstocmPlprsDao.insert(pawpBstocmPlprs);
  329. }
  330. }
  331. TacPawpBstocmTsopbfpParam bstocmTsopbfpParam = new TacPawpBstocmTsopbfpParam();
  332. bstocmTsopbfpParam.setRgstrId(regstrId);
  333. List<TacPawpBstocmTsopbfp> bstocmTsopbfpList = tacPawpBstocmTsopbfpDao.findList(bstocmTsopbfpParam);
  334. if (bstocmTsopbfpList != null && !bstocmTsopbfpList.isEmpty()) {
  335. for (TacPawpBstocmTsopbfp bstocmTsopbfp : bstocmTsopbfpList) {
  336. bstocmTsopbfp.setRgstrId(newRegstrId);
  337. bstocmTsopbfp.setPersId(persId);
  338. String pbftId = UuidUtil.uuid();
  339. String oldId = bstocmTsopbfp.getId();
  340. bstocmTsopbfp.setUptm(new Date());
  341. bstocmTsopbfp.setId(pbftId);
  342. tacPawpBstocmTsopbfpDao.insert(bstocmTsopbfp);
  343. TacPawpBstocmTsopbfpSctnParam bstocmTsopbfpSctnParam = new TacPawpBstocmTsopbfpSctnParam();
  344. bstocmTsopbfpSctnParam.setTsopbfpId(oldId);
  345. List<TacPawpBstocmTsopbfpSctn> bstocmTsopbfpSctnList = tacPawpBstocmTsopbfpSctnDao.findList(bstocmTsopbfpSctnParam);
  346. if (bstocmTsopbfpSctnList != null && !bstocmTsopbfpSctnList.isEmpty()) {
  347. for (TacPawpBstocmTsopbfpSctn bstocmTsopbfpSctn : bstocmTsopbfpSctnList) {
  348. bstocmTsopbfpSctn.setId(UuidUtil.uuid());
  349. bstocmTsopbfpSctn.setPersId(persId);
  350. bstocmTsopbfpSctn.setUptm(new Date());
  351. bstocmTsopbfpSctn.setTsopbfpId(pbftId);
  352. tacPawpBstocmTsopbfpSctnDao.insert(bstocmTsopbfpSctn);
  353. }
  354. }
  355. }
  356. }
  357. TacPawpBstocmCpssInfoParam bstocmCpssInfoParam = new TacPawpBstocmCpssInfoParam();
  358. bstocmCpssInfoParam.setRgstrId(regstrId);
  359. TacPawpBstocmCpssInfo bstocmCpssInfo = pawpBstocmCpssInfoDao.getBy(bstocmCpssInfoParam);
  360. if (bstocmCpssInfo != null) {
  361. bstocmCpssInfo.setPersId(persId);
  362. String oId = bstocmCpssInfo.getId();
  363. bstocmCpssInfo.setRgstrId(newRegstrId);
  364. String cpssInfoId = UuidUtil.uuid();
  365. bstocmCpssInfo.setUptm(new Date());
  366. bstocmCpssInfo.setId(cpssInfoId);
  367. pawpBstocmCpssInfoDao.insert(bstocmCpssInfo);
  368. TacPawpBstocmCpssParam pawpBstocmCpssParam = new TacPawpBstocmCpssParam();
  369. pawpBstocmCpssParam.setCpssId(oId);
  370. List<TacPawpBstocmCpss> bstocmCpssList = pawpBstocmCpssDao.findList(pawpBstocmCpssParam);
  371. if (bstocmCpssList != null && !bstocmCpssList.isEmpty()) {
  372. for (TacPawpBstocmCpss bstocmCpss : bstocmCpssList) {
  373. bstocmCpss.setCpssId(cpssInfoId);
  374. bstocmCpss.setId(UuidUtil.uuid());
  375. bstocmCpss.setUptm(new Date());
  376. bstocmCpss.setPersId(persId);
  377. pawpBstocmCpssDao.insert(bstocmCpss);
  378. }
  379. }
  380. }
  381. TacPawpBstocmCmsParam pawpBstocmCmsParam = new TacPawpBstocmCmsParam();
  382. pawpBstocmCmsParam.setRgstrId(regstrId);
  383. List<TacPawpBstocmCms> pawpBstocmCmsList = pawpBstocmCmsDao.findList(pawpBstocmCmsParam);
  384. if (pawpBstocmCmsList != null && !pawpBstocmCmsList.isEmpty()) {
  385. for (TacPawpBstocmCms pawpBstocmCms : pawpBstocmCmsList) {
  386. String cmsId = pawpBstocmCms.getId();
  387. pawpBstocmCms.setRgstrId(newRegstrId);
  388. pawpBstocmCms.setPersId(persId);
  389. String bstocmCmsId = UuidUtil.uuid();
  390. pawpBstocmCms.setUptm(new Date());
  391. pawpBstocmCms.setId(bstocmCmsId);
  392. pawpBstocmCmsDao.insert(pawpBstocmCms);
  393. TacPawpBstocmCmsPactListParam bstocmCmsPactListParam = new TacPawpBstocmCmsPactListParam();
  394. bstocmCmsPactListParam.setCmsId(cmsId);
  395. List<TacPawpBstocmCmsPactList> bstocmCmsPactLists = pawpBstocmCmsPactListDao.findList(bstocmCmsPactListParam);
  396. if (bstocmCmsPactLists != null && !bstocmCmsPactLists.isEmpty()) {
  397. for (TacPawpBstocmCmsPactList bstocmCmsPactList : bstocmCmsPactLists) {
  398. bstocmCmsPactList.setCmsId(bstocmCmsId);
  399. bstocmCmsPactList.setPersId(persId);
  400. bstocmCmsPactList.setUptm(new Date());
  401. bstocmCmsPactList.setId(UuidUtil.uuid());
  402. pawpBstocmCmsPactListDao.insert(bstocmCmsPactList);
  403. }
  404. }
  405. }
  406. }
  407. }
  408. //添加附件3
  409. private void addRaiobis(String regstrId, String newRegstrId, String persId) {
  410. TacPawpRaiobisParam pawpRaiobisParam = new TacPawpRaiobisParam();
  411. pawpRaiobisParam.setRgstrId(regstrId);
  412. List<TacPawpRaiobis> pawpRaiobisList = tacPawpRaiobisDao.findList(pawpRaiobisParam);
  413. if (pawpRaiobisList != null && !pawpRaiobisList.isEmpty()) {
  414. for (TacPawpRaiobis pawpRaiobis : pawpRaiobisList) {
  415. pawpRaiobis.setId(UuidUtil.uuid());
  416. pawpRaiobis.setUptm(new Date());
  417. pawpRaiobis.setRgstrId(newRegstrId);
  418. pawpRaiobis.setPersId(persId);
  419. tacPawpRaiobisDao.insert(pawpRaiobis);
  420. }
  421. }
  422. }
  423. //添加附件4
  424. private void addBiofuam(String regstrId, String newRegstrId, String persId) {
  425. TacPawpBiofuamParam pawpBiofuamParam = new TacPawpBiofuamParam();
  426. pawpBiofuamParam.setRgstrId(regstrId);
  427. List<TacPawpBiofuam> tacPawpBiofuamList = tacPawpBiofuamDao.findList(pawpBiofuamParam);
  428. if (tacPawpBiofuamList != null && !tacPawpBiofuamList.isEmpty()) {
  429. for (TacPawpBiofuam tacPawpBiofuam : tacPawpBiofuamList) {
  430. tacPawpBiofuam.setRgstrId(newRegstrId);
  431. tacPawpBiofuam.setPersId(persId);
  432. tacPawpBiofuam.setUptm(new Date());
  433. tacPawpBiofuam.setId(UuidUtil.uuid());
  434. tacPawpBiofuamDao.insert(tacPawpBiofuam);
  435. }
  436. }
  437. }
  438. @Autowired
  439. private TacPawpBitopqPeqaaUnitDao tacPawpBitopqPeqaaUnitDao;
  440. //附件5添加
  441. private void addBitopq(String regstrId, String newRegstrId, String persId) {
  442. TacPawpBitopqQmsParam pawpBitopqQmsParam = new TacPawpBitopqQmsParam();
  443. pawpBitopqQmsParam.setRgstrId(regstrId);
  444. List<TacPawpBitopqQms> pawpBitopqQmsDaoList = tacPawpBitopqQmsDao.findList(pawpBitopqQmsParam);
  445. if (pawpBitopqQmsDaoList != null && !pawpBitopqQmsDaoList.isEmpty()) {
  446. for (TacPawpBitopqQms pawpBitopqQms : pawpBitopqQmsDaoList) {
  447. pawpBitopqQms.setId(UuidUtil.uuid());
  448. pawpBitopqQms.setUptm(new Date());
  449. pawpBitopqQms.setRgstrId(newRegstrId);
  450. pawpBitopqQms.setPersId(persId);
  451. tacPawpBitopqQmsDao.insert(pawpBitopqQms);
  452. }
  453. }
  454. TacPawpBitopqPeqaaParam pawpBitopqPeqaaParam = new TacPawpBitopqPeqaaParam();
  455. pawpBitopqPeqaaParam.setRgstrId(regstrId);
  456. List<TacPawpBitopqPeqaa> pawpBitopqPeqaaList = tacPawpBitopqPeqaaDao.findList(pawpBitopqPeqaaParam);
  457. if (pawpBitopqPeqaaList != null && !pawpBitopqPeqaaList.isEmpty()) {
  458. for (TacPawpBitopqPeqaa pawpBitopqPeqaa : pawpBitopqPeqaaList) {
  459. String peqaaId = pawpBitopqPeqaa.getId();
  460. pawpBitopqPeqaa.setRgstrId(newRegstrId);
  461. String newPeqaaId = UuidUtil.uuid();
  462. pawpBitopqPeqaa.setId(newPeqaaId);
  463. pawpBitopqPeqaa.setUptm(new Date());
  464. pawpBitopqPeqaa.setPersId(persId);
  465. tacPawpBitopqPeqaaDao.insert(pawpBitopqPeqaa);
  466. TacPawpBitopqPeqaaUnitParam bitopqPeqaaUnitParam = new TacPawpBitopqPeqaaUnitParam();
  467. bitopqPeqaaUnitParam.setPeqaaId(peqaaId);
  468. List<TacPawpBitopqPeqaaUnit> bitopqPeqaaUnitList = tacPawpBitopqPeqaaUnitDao.findList(bitopqPeqaaUnitParam);
  469. if (bitopqPeqaaUnitList != null && !bitopqPeqaaUnitList.isEmpty()) {
  470. for (TacPawpBitopqPeqaaUnit bitopqPeqaaUnit : bitopqPeqaaUnitList) {
  471. bitopqPeqaaUnit.setPeqaaId(newPeqaaId);
  472. bitopqPeqaaUnit.setPersId(persId);
  473. bitopqPeqaaUnit.setUptm(new Date());
  474. bitopqPeqaaUnit.setId(UuidUtil.uuid());
  475. tacPawpBitopqPeqaaUnitDao.insert(bitopqPeqaaUnit);
  476. }
  477. }
  478. }
  479. }
  480. }
  481. //附件6添加
  482. private void addBioes(String regstrId, String newRegstrId, String persId) {
  483. TacPawpBioesPeParam pawpBioesPeParam = new TacPawpBioesPeParam();
  484. pawpBioesPeParam.setRgstrId(regstrId);
  485. List<TacPawpBioesPe> pawpBioesPeList = tacPawpBioesPeDao.findList(pawpBioesPeParam);
  486. if (pawpBioesPeList != null && !pawpBioesPeList.isEmpty()) {
  487. for (TacPawpBioesPe pawpBioesPe : pawpBioesPeList) {
  488. pawpBioesPe.setId(UuidUtil.uuid());
  489. pawpBioesPe.setRgstrId(newRegstrId);
  490. pawpBioesPe.setUptm(new Date());
  491. pawpBioesPe.setPersId(persId);
  492. tacPawpBioesPeDao.insert(pawpBioesPe);
  493. }
  494. }
  495. TacPawpBioesRwunitParam pawpBioesRwunitParam = new TacPawpBioesRwunitParam();
  496. pawpBioesRwunitParam.setRgstrId(regstrId);
  497. List<TacPawpBioesRwunit> pawpBioesRwunitList = tacPawpBioesRwunitDao.findList(pawpBioesRwunitParam);
  498. if (pawpBioesRwunitList != null && !pawpBioesRwunitList.isEmpty()) {
  499. for (TacPawpBioesRwunit bioesRwunit : pawpBioesRwunitList) {
  500. bioesRwunit.setPersId(persId);
  501. bioesRwunit.setRgstrId(newRegstrId);
  502. bioesRwunit.setUptm(new Date());
  503. bioesRwunit.setId(UuidUtil.uuid());
  504. tacPawpBioesRwunitDao.insert(bioesRwunit);
  505. }
  506. }
  507. }
  508. //添加资料目录
  509. private void addPawDrm(String listId, String newListId, String persId) {
  510. TacPawpDrmParam tacPawpDrmParam = new TacPawpDrmParam();
  511. tacPawpDrmParam.setListId(listId);
  512. List<TacPawpDrm> pawpDrmList = tacPawpDrmDao.findList(tacPawpDrmParam);
  513. if (pawpDrmList != null && !pawpDrmList.isEmpty()) {
  514. for (TacPawpDrm pawpDrm : pawpDrmList) {
  515. pawpDrm.setId(UuidUtil.uuid());
  516. pawpDrm.setListId(newListId);
  517. pawpDrm.setPersId(persId);
  518. pawpDrm.setUptm(new Date());
  519. tacPawpDrmDao.insert(pawpDrm);
  520. }
  521. }
  522. }
  523. @Autowired
  524. private GwComFileService gwComFileService;
  525. private void deleteUnitSctn(String newRegstrId) {
  526. TacPawpUnitSctnParam tacPawpUnitSctnParam = new TacPawpUnitSctnParam();
  527. tacPawpUnitSctnParam.setRgstrId(newRegstrId);
  528. tacPawpUnitSctnDao.deleteBy(tacPawpUnitSctnParam);
  529. }
  530. @Override
  531. public void addUnitSctn(String regstrId, String newRegstrId) {
  532. TacPawpUnitSctnParam tacPawpUnitSctnParam = new TacPawpUnitSctnParam();
  533. tacPawpUnitSctnParam.setRgstrId(newRegstrId);
  534. List<TacPawpUnitSctn> unitSctnList = tacPawpUnitSctnDao.findList(tacPawpUnitSctnParam);
  535. if (unitSctnList != null && !unitSctnList.isEmpty()) {
  536. return;
  537. }
  538. tacPawpUnitSctnParam.setRgstrId(regstrId);
  539. unitSctnList = tacPawpUnitSctnDao.findList(tacPawpUnitSctnParam);
  540. if (unitSctnList != null && !unitSctnList.isEmpty()) {
  541. for (TacPawpUnitSctn unitSctn : unitSctnList) {
  542. String newId = UuidUtil.uuid();
  543. unitSctn.setId(newId);
  544. unitSctn.setRgstrId(newRegstrId);
  545. unitSctn.setIntm(new Date());
  546. unitSctn.setUptm(new Date());
  547. tacPawpUnitSctnDao.insert(unitSctn);
  548. }
  549. }
  550. }
  551. //添加问题
  552. private void addParam(String regstrId, String type, String listId, String newRegstrId, String province) {
  553. TacPblmInfoParam pblmInfoParam = new TacPblmInfoParam();
  554. pblmInfoParam.setRgstrId(newRegstrId);
  555. pblmInfoParam.setListType(type);
  556. pblmInfoParam.setProvince(province);
  557. synchronized (this) {
  558. List<TacPblmInfo> pblmInfoList = tacPblmInfoDao.findPblmList(pblmInfoParam);
  559. if (pblmInfoList != null && !pblmInfoList.isEmpty()) {
  560. return;
  561. }
  562. pblmInfoParam.setRgstrId(regstrId);
  563. pblmInfoList = tacPblmInfoDao.findPblmList(pblmInfoParam);
  564. if (pblmInfoList != null && !pblmInfoList.isEmpty()) {
  565. for (TacPblmInfo pblmInfo : pblmInfoList) {
  566. String pblmId = pblmInfo.getId();
  567. String newPblmId = UuidUtil.uuid();
  568. pblmInfo.setId(newPblmId);
  569. pblmInfo.setRgstrId(newRegstrId);
  570. pblmInfo.setListId(listId);
  571. pblmInfo.setUptm(new Date());
  572. tacPblmInfoDao.insert(pblmInfo);
  573. //添加附件
  574. List<GwComFile> comFileList = gwComFileService.findFileByBiz(pblmId);
  575. for (GwComFile comFile : comFileList) {
  576. comFile.setId(UuidUtil.uuid());
  577. comFile.setBizId(newPblmId);
  578. gwComFileService.insert(comFile);
  579. }
  580. //复制稽察问题相关责任主体列表
  581. TacPblmSubjectParam subjectParam = new TacPblmSubjectParam();
  582. subjectParam.setPblmId(pblmId);
  583. List<TacPblmSubject> subjectList = tacPblmSubjectDao.findList(subjectParam);
  584. if (subjectList != null && !subjectList.isEmpty()) {
  585. for (TacPblmSubject subJect : subjectList) {
  586. String newId = UuidUtil.uuid();
  587. subJect.setId(newId);
  588. subJect.setPblmId(newPblmId);
  589. tacPblmSubjectDao.insert(subJect);
  590. }
  591. }
  592. }
  593. }
  594. }
  595. }
  596. @Override
  597. public int insert(TacPawpRgstr tacPawpRgstr) {
  598. int ret = 0;
  599. if (tacPawpRgstr.getCenterX() != null && tacPawpRgstr.getGdX() == null) {
  600. Map<String, Double> map = GeoUtil.wgs84togcj02(tacPawpRgstr.getCenterX(), tacPawpRgstr.getCenterY());
  601. tacPawpRgstr.setGdX(map.get("lon"));
  602. tacPawpRgstr.setGdY(map.get("lat"));
  603. } else if (tacPawpRgstr.getCenterX() == null && tacPawpRgstr.getGdX() != null) {
  604. Map<String, Double> map = GeoUtil.gcj02towgs84(tacPawpRgstr.getGdX(), tacPawpRgstr.getGdY());
  605. tacPawpRgstr.setCenterX(map.get("lon"));
  606. tacPawpRgstr.setCenterY(map.get("lat"));
  607. }
  608. ret = tacPawpRgstrDao.insert(tacPawpRgstr);
  609. return ret;
  610. }
  611. @Override
  612. public int update(TacPawpRgstr tacPawpRgstr) {
  613. int ret = 0;
  614. if (tacPawpRgstr.getCenterX() != null && tacPawpRgstr.getGdX() == null) {
  615. Map<String, Double> map = GeoUtil.wgs84togcj02(tacPawpRgstr.getCenterX(), tacPawpRgstr.getCenterY());
  616. tacPawpRgstr.setGdX(map.get("lon"));
  617. tacPawpRgstr.setGdY(map.get("lat"));
  618. } else if (tacPawpRgstr.getCenterX() == null && tacPawpRgstr.getGdX() != null) {
  619. Map<String, Double> map = GeoUtil.gcj02towgs84(tacPawpRgstr.getGdX(), tacPawpRgstr.getGdY());
  620. tacPawpRgstr.setCenterX(map.get("lon"));
  621. tacPawpRgstr.setCenterY(map.get("lat"));
  622. }
  623. ret = tacPawpRgstrDao.update(tacPawpRgstr);
  624. return ret;
  625. }
  626. @Autowired
  627. private RedisTemplate redisTemplate;
  628. @Override
  629. public boolean suoding(String key) {
  630. Object input = redisTemplate.opsForValue().get(key);
  631. if (input != null) {
  632. return false;
  633. }
  634. redisTemplate.opsForValue().set(key, "1", 20, TimeUnit.SECONDS);
  635. return true;
  636. }
  637. @Override
  638. public void updateSubmit(TacPawpRgstr pawpRgstr, String type, String state) {
  639. if (JinChaEnum.TACPAWPPDBST.getKey().equals(type) || StringUtils.isBlank(type)) {
  640. pawpRgstr.setPdbstStat(state);//StateEnum.SUBMIT_ZHUANJIA.getKey()
  641. }
  642. //附件2
  643. if (JinChaEnum.TacPawpBstocmTsopbfp.getKey().equals(type) || StringUtils.isBlank(type)) {
  644. pawpRgstr.setBstocmTsopbfpStat(state);
  645. }
  646. //附件3
  647. if (JinChaEnum.TacPawpRaiobis.getKey().equals(type) || StringUtils.isBlank(type)) {
  648. pawpRgstr.setRaiobisStat(state);
  649. }
  650. //附件4
  651. if (JinChaEnum.TacPawpBstocmCms.getKey().equals(type) || StringUtils.isBlank(type)) {
  652. pawpRgstr.setBstocmCmsStat(state);
  653. }
  654. //附件5
  655. if (JinChaEnum.TacPawpBitopqPeqaa.getKey().equals(type) || StringUtils.isBlank(type)) {
  656. pawpRgstr.setBitopqPeqaaStat(state);
  657. }
  658. //附件6
  659. if (JinChaEnum.TacPawpBioesRwunit.getKey().equals(type) || StringUtils.isBlank(type)) {
  660. pawpRgstr.setBioesRwunitStat(state);
  661. }
  662. if (state.equals(pawpRgstr.getPdbstStat()) && state.equals(pawpRgstr.getBstocmTsopbfpStat()) && state.equals(pawpRgstr.getRaiobisStat()) && state.equals(pawpRgstr.getBstocmCmsStat()) && state.equals(pawpRgstr.getBitopqPeqaaStat()) && state.equals(pawpRgstr.getBioesRwunitStat())) {
  663. pawpRgstr.setState(state);
  664. }
  665. }
  666. @Override
  667. public Map<String, String> getState(String regstrId, String type) {
  668. TacPawpRgstr tacPawpRgstr = tacPawpRgstrDao.get(regstrId);
  669. //匹配新阶段 0-4为稽察项目问题的初始阶段,省份对应阶段下存在工程项目阶段记录值则
  670. Map<String, String> retMap = new HashMap<>();
  671. if (StringUtils.isNotBlank(tacPawpRgstr.getState())) {
  672. int stateType = Integer.parseInt(tacPawpRgstr.getState());
  673. if (stateType > 3) {
  674. retMap.put("state", stateType + "");
  675. if (StringUtils.isNotBlank(tacPawpRgstr.getTaskId())) {
  676. TacProvincePlanTask tacProvincePlanTask = tacProvincePlanTaskDao.get(tacPawpRgstr.getTaskId());
  677. retMap.put("stateName", tacProvincePlanTask.getNowStep());
  678. } else {
  679. retMap.put("stateName", getStateName(stateType));
  680. }
  681. return retMap;
  682. }
  683. }
  684. String state = InspUtils.getTypeState(type, tacPawpRgstr);
  685. if (StringUtils.isNotBlank(tacPawpRgstr.getTaskId()) && !tacPawpRgstr.getTaskId().equals("0")) {
  686. TacProvincePlanTask tacProvincePlanTask = tacProvincePlanTaskDao.get(tacPawpRgstr.getTaskId());
  687. if(null != tacProvincePlanTask){
  688. retMap.put("stateName", tacProvincePlanTask.getNowStep());
  689. }
  690. } else {
  691. if (StringUtils.isNotBlank(state)) {
  692. retMap.put("stateName", getStateName(Integer.parseInt(state)));
  693. } else {
  694. retMap.put("stateName", "");
  695. }
  696. }
  697. retMap.put("state", state);
  698. return retMap;
  699. }
  700. private String getStateName(int stateType) {
  701. String stateName;
  702. switch (stateType) {
  703. case 3:
  704. stateName = "(助理退回给专家)";
  705. break;
  706. case 4:
  707. stateName = "(专家提交到助理)";
  708. break;
  709. case 5:
  710. stateName = "(成果讨论阶段)";
  711. break;
  712. case 6:
  713. stateName = "(中心修改阶段)";
  714. break;
  715. case 7:
  716. stateName = "(司局修改阶段)";
  717. break;
  718. default:
  719. stateName = "";
  720. break;
  721. }
  722. return stateName;
  723. }
  724. }