package cn.com.goldenwater.dcproj.service.impl.tac; import cn.com.goldenwater.dcproj.constValue.JinChaEnum; import cn.com.goldenwater.dcproj.constValue.SplitValue; import cn.com.goldenwater.dcproj.dao.*; import cn.com.goldenwater.dcproj.dto.TacPawpRgstrDto; import cn.com.goldenwater.dcproj.model.*; import cn.com.goldenwater.dcproj.param.*; import cn.com.goldenwater.dcproj.service.GwComFileService; import cn.com.goldenwater.core.service.AbstractCrudService; import cn.com.goldenwater.dcproj.service.TacPawpRgstrService; import cn.com.goldenwater.dcproj.utils.AdLevelUtil; import cn.com.goldenwater.dcproj.utils.GeoUtil; import cn.com.goldenwater.dcproj.utils.InspUtils; import cn.com.goldenwater.id.util.UuidUtil; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.io.File; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; /** * @author lune * @date 2019-6-19 */ @Service @Transactional(rollbackFor = Exception.class) public class TacPawpRgstrServiceImpl extends AbstractCrudService implements TacPawpRgstrService { @Autowired private TacPawpRgstrDao tacPawpRgstrDao; @Autowired private TacProvincePlanTaskDao tacProvincePlanTaskDao; public TacPawpRgstrServiceImpl(TacPawpRgstrDao tacPawpRgstrDao) { super(tacPawpRgstrDao); this.tacPawpRgstrDao = tacPawpRgstrDao; } /** * app获取稽察项目督查项目列表 * * @param typeParam * @return */ @Override public PageInfo findPageWagaPage(TypeParam typeParam) { if (StringUtils.isNotBlank(typeParam.getAdCode())) { typeParam.setAdCode(String.valueOf(AdLevelUtil.SubAd(typeParam.getAdCode()).get(SplitValue.SUBAD))); } PageHelper.startPage(typeParam); List list = tacPawpRgstrDao.findPawpPage(typeParam); PageInfo pageInfo = new PageInfo(list); return pageInfo; } @Autowired TacPawpListDao tacPawpListDao; @Autowired private TacPawpPdbstDao tacPawpPdbstDao; @Autowired private TacPawpRaiobisDao tacPawpRaiobisDao; @Autowired private TacPawpBstocmPlprsDao tacPawpBstocmPlprsDao; @Autowired private TacPawpBitopqQmsDao tacPawpBitopqQmsDao; @Autowired private TacPawpBioesPeDao tacPawpBioesPeDao; @Autowired private TacPawpBiofuamDao tacPawpBiofuamDao; @Autowired private TacPblmInfoDao tacPblmInfoDao; @Autowired private TacPawpDrmDao tacPawpDrmDao; @Autowired private TacPawpBioesRwunitDao tacPawpBioesRwunitDao; @Autowired private TacPawpBitopqPeqaaDao tacPawpBitopqPeqaaDao; @Autowired private TacPawpUnitSctnDao tacPawpUnitSctnDao; @Autowired private TacPblmSubjectDao tacPblmSubjectDao; @Autowired private TacWordBaseDao tacWordBaseDao; @Value("${jc.baseinfo.word.path}") private String docxPath; @Override public TacPawpRgstr createZhuliData(String persId, String regstrId, String type, TacPawpRgstr pawpRgstr, String regstrId_zhuli, String state) { //复制稽察项目基本信息的word文档 TacWordBaseParam wordBaseParam = new TacWordBaseParam(); wordBaseParam.setType("10" + type); wordBaseParam.setBizId(regstrId); TacWordBase wordBase = tacWordBaseDao.getBy(wordBaseParam); if (wordBase != null) { String filePath = wordBase.getFilePath(); String oldPath = docxPath + filePath; String newId = UuidUtil.uuid(); String newfilePath = filePath.replace(regstrId, regstrId_zhuli); String newPath = oldPath.replace(regstrId, regstrId_zhuli); File newFile = new File(newPath); File oldFile = new File(oldPath); try { FileUtils.copyFile(oldFile, newFile); } catch (Exception e) { e.printStackTrace(); } wordBase.setId(newId); wordBase.setBizId(regstrId_zhuli); wordBase.setFilePath(newfilePath); wordBase.setIntm(new Date()); wordBase.setUptm(new Date()); tacWordBaseDao.insert(wordBase); } //复制稽察项目单位及标段信息 addUnitSctn(regstrId, regstrId_zhuli); //添加问题 addParam(regstrId, type, "", regstrId_zhuli, pawpRgstr.getProvince()); //创建附件1-附件6 if (JinChaEnum.TACPAWPPDBST.getKey().equals(type) || StringUtils.isBlank(type)) { TacPawpPdbstParam pawpPdbstParam = new TacPawpPdbstParam(); pawpPdbstParam.setRgstrId(regstrId); TacPawpPdbst tacPawpPdbst = tacPawpPdbstDao.getBy(pawpPdbstParam); //附件1 if (tacPawpPdbst != null) { tacPawpPdbst.setId(UuidUtil.uuid()); tacPawpPdbst.setPersId(persId); tacPawpPdbst.setRgstrId(regstrId_zhuli); tacPawpPdbstDao.insert(tacPawpPdbst); } pawpRgstr.setPdbstStat(state);//StateEnum.SUBMIT_ZHUANJIA.getKey() } //附件2 if (JinChaEnum.TacPawpBstocmTsopbfp.getKey().equals(type) || StringUtils.isBlank(type)) { addBstocm(regstrId, regstrId_zhuli, persId); pawpRgstr.setBstocmTsopbfpStat(state); } //附件3 if (JinChaEnum.TacPawpRaiobis.getKey().equals(type) || StringUtils.isBlank(type)) { addRaiobis(regstrId, regstrId_zhuli, persId); pawpRgstr.setRaiobisStat(state); } //附件4 if (JinChaEnum.TacPawpBstocmCms.getKey().equals(type) || StringUtils.isBlank(type)) { addBiofuam(regstrId, regstrId_zhuli, persId); pawpRgstr.setBstocmCmsStat(state); } //附件5 if (JinChaEnum.TacPawpBitopqPeqaa.getKey().equals(type) || StringUtils.isBlank(type)) { addBitopq(regstrId, regstrId_zhuli, persId); pawpRgstr.setBitopqPeqaaStat(state); } //附件6 if (JinChaEnum.TacPawpBioesRwunit.getKey().equals(type) || StringUtils.isBlank(type)) { addBioes(regstrId, regstrId_zhuli, persId); pawpRgstr.setBioesRwunitStat(state); } 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())) { pawpRgstr.setState(state); } return pawpRgstr; } public void delete(String regstrId_zhuli, String type, String province) { TacPblmInfoParam pblmInfoParam = new TacPblmInfoParam(); pblmInfoParam.setRgstrId(regstrId_zhuli); pblmInfoParam.setListType(type); pblmInfoParam.setProvince(province); List pblmInfoList = tacPblmInfoDao.findList(pblmInfoParam); if (pblmInfoList != null && !pblmInfoList.isEmpty()) { for (TacPblmInfo pblmInfo : pblmInfoList) { GwComFileParam fileParam = new GwComFileParam(); fileParam.setBizId(pblmInfo.getId()); gwComFileService.deleteBy(fileParam); } tacPblmInfoDao.deleteBy(pblmInfoParam); } } @Override public TacPawpRgstr rollbackControl(String regstrId_zhuli, String persId, String type, TacPawpRgstr pawpRgstr, String state) { //删除问题,附件 delete(regstrId_zhuli, type, pawpRgstr.getProvince()); //删除附件1-6 //删除附件1 if (JinChaEnum.TACPAWPPDBST.getKey().equals(type)) { TacPawpPdbstParam pawpPdbstParam = new TacPawpPdbstParam(); pawpPdbstParam.setRgstrId(regstrId_zhuli); // pawpPdbstParam.setPersId(persId); tacPawpPdbstDao.deleteBy(pawpPdbstParam); pawpRgstr.setPdbstStat(state); } deleteUnitSctn(regstrId_zhuli); //附件2 if (JinChaEnum.TacPawpBstocmTsopbfp.getKey().equals(type)) { TacPawpBstocmPlprsParam pawpBstocmPlprsParam = new TacPawpBstocmPlprsParam(); pawpBstocmPlprsParam.setRgstrId(regstrId_zhuli); // pawpBstocmPlprsParam.setPersId(persId); tacPawpBstocmPlprsDao.deleteBy(pawpBstocmPlprsParam); TacPawpBstocmTsopbfpParam bstocmTsopbfpParam = new TacPawpBstocmTsopbfpParam(); bstocmTsopbfpParam.setRgstrId(regstrId_zhuli); // bstocmTsopbfpParam.setPersId(persId); List bstocmTsopbfpList = tacPawpBstocmTsopbfpDao.findList(bstocmTsopbfpParam); if (bstocmTsopbfpList != null && !bstocmTsopbfpList.isEmpty()) { tacPawpBstocmTsopbfpDao.deleteBy(bstocmTsopbfpParam); for (TacPawpBstocmTsopbfp bstocmTsopbfp : bstocmTsopbfpList) { TacPawpBstocmTsopbfpSctnParam bstocmTsopbfpSctnParam = new TacPawpBstocmTsopbfpSctnParam(); bstocmTsopbfpSctnParam.setTsopbfpId(bstocmTsopbfp.getId()); // bstocmTsopbfpSctnParam.setPersId(persId); tacPawpBstocmTsopbfpSctnDao.deleteBy(bstocmTsopbfpSctnParam); } } TacPawpBstocmCpssInfoParam bstocmCpssInfoParam = new TacPawpBstocmCpssInfoParam(); bstocmCpssInfoParam.setRgstrId(regstrId_zhuli); // bstocmCpssInfoParam.setPersId(persId); List bstocmCpssInfoList = pawpBstocmCpssInfoDao.findList(bstocmCpssInfoParam); if (bstocmCpssInfoList != null && !bstocmCpssInfoList.isEmpty()) { for (TacPawpBstocmCpssInfo bstocmCpssInfo : bstocmCpssInfoList) { TacPawpBstocmCpssParam pawpBstocmCpssParam = new TacPawpBstocmCpssParam(); pawpBstocmCpssParam.setCpssId(bstocmCpssInfo.getId()); // pawpBstocmCpssParam.setPersId(persId); pawpBstocmCpssDao.deleteBy(pawpBstocmCpssParam); } pawpBstocmCpssInfoDao.deleteBy(bstocmCpssInfoParam); } TacPawpBstocmCmsParam pawpBstocmCmsParam = new TacPawpBstocmCmsParam(); pawpBstocmCmsParam.setRgstrId(regstrId_zhuli); // pawpBstocmCmsParam.setPersId(persId); List pawpBstocmCmsList = pawpBstocmCmsDao.findList(pawpBstocmCmsParam); if (pawpBstocmCmsList != null && !pawpBstocmCmsList.isEmpty()) { for (TacPawpBstocmCms pawpBstocmCms : pawpBstocmCmsList) { TacPawpBstocmCmsPactListParam bstocmCmsPactListParam = new TacPawpBstocmCmsPactListParam(); bstocmCmsPactListParam.setCmsId(pawpBstocmCms.getId()); // bstocmCmsPactListParam.setPersId(persId); pawpBstocmCmsPactListDao.deleteBy(bstocmCmsPactListParam); pawpBstocmCmsDao.deleteBy(pawpBstocmCmsParam); } } pawpRgstr.setBstocmTsopbfpStat(state); } //附件3 if (JinChaEnum.TacPawpRaiobis.getKey().equals(type)) { TacPawpRaiobisParam pawpRaiobisParam = new TacPawpRaiobisParam(); pawpRaiobisParam.setRgstrId(regstrId_zhuli); // pawpRaiobisParam.setPersId(persId); tacPawpRaiobisDao.deleteBy(pawpRaiobisParam); pawpRgstr.setRaiobisStat(state); } //附件4 if (JinChaEnum.TacPawpBstocmCms.getKey().equals(type)) { TacPawpBiofuamParam pawpBiofuamParam = new TacPawpBiofuamParam(); pawpBiofuamParam.setRgstrId(regstrId_zhuli); // pawpBiofuamParam.setPersId(persId); tacPawpBiofuamDao.deleteBy(pawpBiofuamParam); pawpRgstr.setBstocmCmsStat(state); } //附件5 if (JinChaEnum.TacPawpBitopqPeqaa.getKey().equals(type)) { TacPawpBitopqQmsParam pawpBitopqQmsParam = new TacPawpBitopqQmsParam(); pawpBitopqQmsParam.setRgstrId(regstrId_zhuli); // pawpBitopqQmsParam.setPersId(persId); tacPawpBitopqQmsDao.deleteBy(pawpBitopqQmsParam); TacPawpBitopqPeqaaParam pawpBitopqPeqaaParam = new TacPawpBitopqPeqaaParam(); pawpBitopqPeqaaParam.setRgstrId(regstrId_zhuli); // pawpBitopqPeqaaParam.setPersId(persId); List pawpBitopqPeqaaList = tacPawpBitopqPeqaaDao.findList(pawpBitopqPeqaaParam); if (pawpBitopqPeqaaList != null && !pawpBitopqPeqaaList.isEmpty()) { tacPawpBitopqPeqaaDao.deleteBy(pawpBitopqPeqaaParam); for (TacPawpBitopqPeqaa pawpBitopqPeqaa : pawpBitopqPeqaaList) { TacPawpBitopqPeqaaUnitParam bitopqPeqaaUnitParam = new TacPawpBitopqPeqaaUnitParam(); bitopqPeqaaUnitParam.setPeqaaId(pawpBitopqPeqaa.getId()); tacPawpBitopqPeqaaUnitDao.deleteBy(bitopqPeqaaUnitParam); } } pawpRgstr.setBitopqPeqaaStat(state); } //附件6 if (JinChaEnum.TacPawpBioesRwunit.getKey().equals(type)) { TacPawpBioesPeParam pawpBioesPeParam = new TacPawpBioesPeParam(); pawpBioesPeParam.setRgstrId(regstrId_zhuli); // pawpBioesPeParam.setPersId(persId); tacPawpBioesPeDao.deleteBy(pawpBioesPeParam); TacPawpBioesRwunitParam pawpBioesRwunitParam = new TacPawpBioesRwunitParam(); pawpBioesRwunitParam.setRgstrId(regstrId_zhuli); // pawpBioesRwunitParam.setPersId(persId); tacPawpBioesRwunitDao.deleteBy(pawpBioesRwunitParam); pawpRgstr.setBioesRwunitStat(state); } //删除底稿 TacWordBaseParam wordBaseParam = new TacWordBaseParam(); wordBaseParam.setType("10" + type); wordBaseParam.setBizId(regstrId_zhuli); List wordBaseList = tacWordBaseDao.findList(wordBaseParam); if (wordBaseList != null && !wordBaseList.isEmpty()) { tacWordBaseDao.deleteBy(wordBaseParam); } pawpRgstr.setState(state); return pawpRgstr; } @Override public String findZhuli(String regstrId) { return tacPawpRgstrDao.findZhuli(regstrId); } @Autowired private TacPawpBstocmTsopbfpDao tacPawpBstocmTsopbfpDao; @Autowired private TacPawpBstocmTsopbfpSctnDao tacPawpBstocmTsopbfpSctnDao; @Autowired private TacPawpBstocmCpssInfoDao pawpBstocmCpssInfoDao; @Autowired private TacPawpBstocmCpssDao pawpBstocmCpssDao; @Autowired private TacPawpBstocmCmsDao pawpBstocmCmsDao; @Autowired private TacPawpBstocmCmsPactListDao pawpBstocmCmsPactListDao; //添加附件2 private void addBstocm(String regstrId, String newRegstrId, String persId) { TacPawpBstocmPlprsParam pawpBstocmPlprsParam = new TacPawpBstocmPlprsParam(); pawpBstocmPlprsParam.setRgstrId(regstrId); List pawpBstocmPlprsList = tacPawpBstocmPlprsDao.findList(pawpBstocmPlprsParam); if (pawpBstocmPlprsList != null && !pawpBstocmPlprsList.isEmpty()) { for (TacPawpBstocmPlprs pawpBstocmPlprs : pawpBstocmPlprsList) { pawpBstocmPlprs.setId(UuidUtil.uuid()); pawpBstocmPlprs.setPersId(persId); pawpBstocmPlprs.setUptm(new Date()); pawpBstocmPlprs.setRgstrId(newRegstrId); tacPawpBstocmPlprsDao.insert(pawpBstocmPlprs); } } TacPawpBstocmTsopbfpParam bstocmTsopbfpParam = new TacPawpBstocmTsopbfpParam(); bstocmTsopbfpParam.setRgstrId(regstrId); List bstocmTsopbfpList = tacPawpBstocmTsopbfpDao.findList(bstocmTsopbfpParam); if (bstocmTsopbfpList != null && !bstocmTsopbfpList.isEmpty()) { for (TacPawpBstocmTsopbfp bstocmTsopbfp : bstocmTsopbfpList) { bstocmTsopbfp.setRgstrId(newRegstrId); bstocmTsopbfp.setPersId(persId); String pbftId = UuidUtil.uuid(); String oldId = bstocmTsopbfp.getId(); bstocmTsopbfp.setUptm(new Date()); bstocmTsopbfp.setId(pbftId); tacPawpBstocmTsopbfpDao.insert(bstocmTsopbfp); TacPawpBstocmTsopbfpSctnParam bstocmTsopbfpSctnParam = new TacPawpBstocmTsopbfpSctnParam(); bstocmTsopbfpSctnParam.setTsopbfpId(oldId); List bstocmTsopbfpSctnList = tacPawpBstocmTsopbfpSctnDao.findList(bstocmTsopbfpSctnParam); if (bstocmTsopbfpSctnList != null && !bstocmTsopbfpSctnList.isEmpty()) { for (TacPawpBstocmTsopbfpSctn bstocmTsopbfpSctn : bstocmTsopbfpSctnList) { bstocmTsopbfpSctn.setId(UuidUtil.uuid()); bstocmTsopbfpSctn.setPersId(persId); bstocmTsopbfpSctn.setUptm(new Date()); bstocmTsopbfpSctn.setTsopbfpId(pbftId); tacPawpBstocmTsopbfpSctnDao.insert(bstocmTsopbfpSctn); } } } } TacPawpBstocmCpssInfoParam bstocmCpssInfoParam = new TacPawpBstocmCpssInfoParam(); bstocmCpssInfoParam.setRgstrId(regstrId); TacPawpBstocmCpssInfo bstocmCpssInfo = pawpBstocmCpssInfoDao.getBy(bstocmCpssInfoParam); if (bstocmCpssInfo != null) { bstocmCpssInfo.setPersId(persId); String oId = bstocmCpssInfo.getId(); bstocmCpssInfo.setRgstrId(newRegstrId); String cpssInfoId = UuidUtil.uuid(); bstocmCpssInfo.setUptm(new Date()); bstocmCpssInfo.setId(cpssInfoId); pawpBstocmCpssInfoDao.insert(bstocmCpssInfo); TacPawpBstocmCpssParam pawpBstocmCpssParam = new TacPawpBstocmCpssParam(); pawpBstocmCpssParam.setCpssId(oId); List bstocmCpssList = pawpBstocmCpssDao.findList(pawpBstocmCpssParam); if (bstocmCpssList != null && !bstocmCpssList.isEmpty()) { for (TacPawpBstocmCpss bstocmCpss : bstocmCpssList) { bstocmCpss.setCpssId(cpssInfoId); bstocmCpss.setId(UuidUtil.uuid()); bstocmCpss.setUptm(new Date()); bstocmCpss.setPersId(persId); pawpBstocmCpssDao.insert(bstocmCpss); } } } TacPawpBstocmCmsParam pawpBstocmCmsParam = new TacPawpBstocmCmsParam(); pawpBstocmCmsParam.setRgstrId(regstrId); List pawpBstocmCmsList = pawpBstocmCmsDao.findList(pawpBstocmCmsParam); if (pawpBstocmCmsList != null && !pawpBstocmCmsList.isEmpty()) { for (TacPawpBstocmCms pawpBstocmCms : pawpBstocmCmsList) { String cmsId = pawpBstocmCms.getId(); pawpBstocmCms.setRgstrId(newRegstrId); pawpBstocmCms.setPersId(persId); String bstocmCmsId = UuidUtil.uuid(); pawpBstocmCms.setUptm(new Date()); pawpBstocmCms.setId(bstocmCmsId); pawpBstocmCmsDao.insert(pawpBstocmCms); TacPawpBstocmCmsPactListParam bstocmCmsPactListParam = new TacPawpBstocmCmsPactListParam(); bstocmCmsPactListParam.setCmsId(cmsId); List bstocmCmsPactLists = pawpBstocmCmsPactListDao.findList(bstocmCmsPactListParam); if (bstocmCmsPactLists != null && !bstocmCmsPactLists.isEmpty()) { for (TacPawpBstocmCmsPactList bstocmCmsPactList : bstocmCmsPactLists) { bstocmCmsPactList.setCmsId(bstocmCmsId); bstocmCmsPactList.setPersId(persId); bstocmCmsPactList.setUptm(new Date()); bstocmCmsPactList.setId(UuidUtil.uuid()); pawpBstocmCmsPactListDao.insert(bstocmCmsPactList); } } } } } //添加附件3 private void addRaiobis(String regstrId, String newRegstrId, String persId) { TacPawpRaiobisParam pawpRaiobisParam = new TacPawpRaiobisParam(); pawpRaiobisParam.setRgstrId(regstrId); List pawpRaiobisList = tacPawpRaiobisDao.findList(pawpRaiobisParam); if (pawpRaiobisList != null && !pawpRaiobisList.isEmpty()) { for (TacPawpRaiobis pawpRaiobis : pawpRaiobisList) { pawpRaiobis.setId(UuidUtil.uuid()); pawpRaiobis.setUptm(new Date()); pawpRaiobis.setRgstrId(newRegstrId); pawpRaiobis.setPersId(persId); tacPawpRaiobisDao.insert(pawpRaiobis); } } } //添加附件4 private void addBiofuam(String regstrId, String newRegstrId, String persId) { TacPawpBiofuamParam pawpBiofuamParam = new TacPawpBiofuamParam(); pawpBiofuamParam.setRgstrId(regstrId); List tacPawpBiofuamList = tacPawpBiofuamDao.findList(pawpBiofuamParam); if (tacPawpBiofuamList != null && !tacPawpBiofuamList.isEmpty()) { for (TacPawpBiofuam tacPawpBiofuam : tacPawpBiofuamList) { tacPawpBiofuam.setRgstrId(newRegstrId); tacPawpBiofuam.setPersId(persId); tacPawpBiofuam.setUptm(new Date()); tacPawpBiofuam.setId(UuidUtil.uuid()); tacPawpBiofuamDao.insert(tacPawpBiofuam); } } } @Autowired private TacPawpBitopqPeqaaUnitDao tacPawpBitopqPeqaaUnitDao; //附件5添加 private void addBitopq(String regstrId, String newRegstrId, String persId) { TacPawpBitopqQmsParam pawpBitopqQmsParam = new TacPawpBitopqQmsParam(); pawpBitopqQmsParam.setRgstrId(regstrId); List pawpBitopqQmsDaoList = tacPawpBitopqQmsDao.findList(pawpBitopqQmsParam); if (pawpBitopqQmsDaoList != null && !pawpBitopqQmsDaoList.isEmpty()) { for (TacPawpBitopqQms pawpBitopqQms : pawpBitopqQmsDaoList) { pawpBitopqQms.setId(UuidUtil.uuid()); pawpBitopqQms.setUptm(new Date()); pawpBitopqQms.setRgstrId(newRegstrId); pawpBitopqQms.setPersId(persId); tacPawpBitopqQmsDao.insert(pawpBitopqQms); } } TacPawpBitopqPeqaaParam pawpBitopqPeqaaParam = new TacPawpBitopqPeqaaParam(); pawpBitopqPeqaaParam.setRgstrId(regstrId); List pawpBitopqPeqaaList = tacPawpBitopqPeqaaDao.findList(pawpBitopqPeqaaParam); if (pawpBitopqPeqaaList != null && !pawpBitopqPeqaaList.isEmpty()) { for (TacPawpBitopqPeqaa pawpBitopqPeqaa : pawpBitopqPeqaaList) { String peqaaId = pawpBitopqPeqaa.getId(); pawpBitopqPeqaa.setRgstrId(newRegstrId); String newPeqaaId = UuidUtil.uuid(); pawpBitopqPeqaa.setId(newPeqaaId); pawpBitopqPeqaa.setUptm(new Date()); pawpBitopqPeqaa.setPersId(persId); tacPawpBitopqPeqaaDao.insert(pawpBitopqPeqaa); TacPawpBitopqPeqaaUnitParam bitopqPeqaaUnitParam = new TacPawpBitopqPeqaaUnitParam(); bitopqPeqaaUnitParam.setPeqaaId(peqaaId); List bitopqPeqaaUnitList = tacPawpBitopqPeqaaUnitDao.findList(bitopqPeqaaUnitParam); if (bitopqPeqaaUnitList != null && !bitopqPeqaaUnitList.isEmpty()) { for (TacPawpBitopqPeqaaUnit bitopqPeqaaUnit : bitopqPeqaaUnitList) { bitopqPeqaaUnit.setPeqaaId(newPeqaaId); bitopqPeqaaUnit.setPersId(persId); bitopqPeqaaUnit.setUptm(new Date()); bitopqPeqaaUnit.setId(UuidUtil.uuid()); tacPawpBitopqPeqaaUnitDao.insert(bitopqPeqaaUnit); } } } } } //附件6添加 private void addBioes(String regstrId, String newRegstrId, String persId) { TacPawpBioesPeParam pawpBioesPeParam = new TacPawpBioesPeParam(); pawpBioesPeParam.setRgstrId(regstrId); List pawpBioesPeList = tacPawpBioesPeDao.findList(pawpBioesPeParam); if (pawpBioesPeList != null && !pawpBioesPeList.isEmpty()) { for (TacPawpBioesPe pawpBioesPe : pawpBioesPeList) { pawpBioesPe.setId(UuidUtil.uuid()); pawpBioesPe.setRgstrId(newRegstrId); pawpBioesPe.setUptm(new Date()); pawpBioesPe.setPersId(persId); tacPawpBioesPeDao.insert(pawpBioesPe); } } TacPawpBioesRwunitParam pawpBioesRwunitParam = new TacPawpBioesRwunitParam(); pawpBioesRwunitParam.setRgstrId(regstrId); List pawpBioesRwunitList = tacPawpBioesRwunitDao.findList(pawpBioesRwunitParam); if (pawpBioesRwunitList != null && !pawpBioesRwunitList.isEmpty()) { for (TacPawpBioesRwunit bioesRwunit : pawpBioesRwunitList) { bioesRwunit.setPersId(persId); bioesRwunit.setRgstrId(newRegstrId); bioesRwunit.setUptm(new Date()); bioesRwunit.setId(UuidUtil.uuid()); tacPawpBioesRwunitDao.insert(bioesRwunit); } } } //添加资料目录 private void addPawDrm(String listId, String newListId, String persId) { TacPawpDrmParam tacPawpDrmParam = new TacPawpDrmParam(); tacPawpDrmParam.setListId(listId); List pawpDrmList = tacPawpDrmDao.findList(tacPawpDrmParam); if (pawpDrmList != null && !pawpDrmList.isEmpty()) { for (TacPawpDrm pawpDrm : pawpDrmList) { pawpDrm.setId(UuidUtil.uuid()); pawpDrm.setListId(newListId); pawpDrm.setPersId(persId); pawpDrm.setUptm(new Date()); tacPawpDrmDao.insert(pawpDrm); } } } @Autowired private GwComFileService gwComFileService; private void deleteUnitSctn(String newRegstrId) { TacPawpUnitSctnParam tacPawpUnitSctnParam = new TacPawpUnitSctnParam(); tacPawpUnitSctnParam.setRgstrId(newRegstrId); tacPawpUnitSctnDao.deleteBy(tacPawpUnitSctnParam); } @Override public void addUnitSctn(String regstrId, String newRegstrId) { TacPawpUnitSctnParam tacPawpUnitSctnParam = new TacPawpUnitSctnParam(); tacPawpUnitSctnParam.setRgstrId(newRegstrId); List unitSctnList = tacPawpUnitSctnDao.findList(tacPawpUnitSctnParam); if (unitSctnList != null && !unitSctnList.isEmpty()) { return; } tacPawpUnitSctnParam.setRgstrId(regstrId); unitSctnList = tacPawpUnitSctnDao.findList(tacPawpUnitSctnParam); if (unitSctnList != null && !unitSctnList.isEmpty()) { for (TacPawpUnitSctn unitSctn : unitSctnList) { String newId = UuidUtil.uuid(); unitSctn.setId(newId); unitSctn.setRgstrId(newRegstrId); unitSctn.setIntm(new Date()); unitSctn.setUptm(new Date()); tacPawpUnitSctnDao.insert(unitSctn); } } } //添加问题 private void addParam(String regstrId, String type, String listId, String newRegstrId, String province) { TacPblmInfoParam pblmInfoParam = new TacPblmInfoParam(); pblmInfoParam.setRgstrId(newRegstrId); pblmInfoParam.setListType(type); pblmInfoParam.setProvince(province); synchronized (this) { List pblmInfoList = tacPblmInfoDao.findPblmList(pblmInfoParam); if (pblmInfoList != null && !pblmInfoList.isEmpty()) { return; } pblmInfoParam.setRgstrId(regstrId); pblmInfoList = tacPblmInfoDao.findPblmList(pblmInfoParam); if (pblmInfoList != null && !pblmInfoList.isEmpty()) { for (TacPblmInfo pblmInfo : pblmInfoList) { String pblmId = pblmInfo.getId(); String newPblmId = UuidUtil.uuid(); pblmInfo.setId(newPblmId); pblmInfo.setRgstrId(newRegstrId); pblmInfo.setListId(listId); pblmInfo.setUptm(new Date()); tacPblmInfoDao.insert(pblmInfo); //添加附件 List comFileList = gwComFileService.findFileByBiz(pblmId); for (GwComFile comFile : comFileList) { comFile.setId(UuidUtil.uuid()); comFile.setBizId(newPblmId); gwComFileService.insert(comFile); } //复制稽察问题相关责任主体列表 TacPblmSubjectParam subjectParam = new TacPblmSubjectParam(); subjectParam.setPblmId(pblmId); List subjectList = tacPblmSubjectDao.findList(subjectParam); if (subjectList != null && !subjectList.isEmpty()) { for (TacPblmSubject subJect : subjectList) { String newId = UuidUtil.uuid(); subJect.setId(newId); subJect.setPblmId(newPblmId); tacPblmSubjectDao.insert(subJect); } } } } } } @Override public int insert(TacPawpRgstr tacPawpRgstr) { int ret = 0; if (tacPawpRgstr.getCenterX() != null && tacPawpRgstr.getGdX() == null) { Map map = GeoUtil.wgs84togcj02(tacPawpRgstr.getCenterX(), tacPawpRgstr.getCenterY()); tacPawpRgstr.setGdX(map.get("lon")); tacPawpRgstr.setGdY(map.get("lat")); } else if (tacPawpRgstr.getCenterX() == null && tacPawpRgstr.getGdX() != null) { Map map = GeoUtil.gcj02towgs84(tacPawpRgstr.getGdX(), tacPawpRgstr.getGdY()); tacPawpRgstr.setCenterX(map.get("lon")); tacPawpRgstr.setCenterY(map.get("lat")); } ret = tacPawpRgstrDao.insert(tacPawpRgstr); return ret; } @Override public int update(TacPawpRgstr tacPawpRgstr) { int ret = 0; if (tacPawpRgstr.getCenterX() != null && tacPawpRgstr.getGdX() == null) { Map map = GeoUtil.wgs84togcj02(tacPawpRgstr.getCenterX(), tacPawpRgstr.getCenterY()); tacPawpRgstr.setGdX(map.get("lon")); tacPawpRgstr.setGdY(map.get("lat")); } else if (tacPawpRgstr.getCenterX() == null && tacPawpRgstr.getGdX() != null) { Map map = GeoUtil.gcj02towgs84(tacPawpRgstr.getGdX(), tacPawpRgstr.getGdY()); tacPawpRgstr.setCenterX(map.get("lon")); tacPawpRgstr.setCenterY(map.get("lat")); } ret = tacPawpRgstrDao.update(tacPawpRgstr); return ret; } @Autowired private RedisTemplate redisTemplate; @Override public boolean suoding(String key) { Object input = redisTemplate.opsForValue().get(key); if (input != null) { return false; } redisTemplate.opsForValue().set(key, "1", 20, TimeUnit.SECONDS); return true; } @Override public void updateSubmit(TacPawpRgstr pawpRgstr, String type, String state) { if (JinChaEnum.TACPAWPPDBST.getKey().equals(type) || StringUtils.isBlank(type)) { pawpRgstr.setPdbstStat(state);//StateEnum.SUBMIT_ZHUANJIA.getKey() } //附件2 if (JinChaEnum.TacPawpBstocmTsopbfp.getKey().equals(type) || StringUtils.isBlank(type)) { pawpRgstr.setBstocmTsopbfpStat(state); } //附件3 if (JinChaEnum.TacPawpRaiobis.getKey().equals(type) || StringUtils.isBlank(type)) { pawpRgstr.setRaiobisStat(state); } //附件4 if (JinChaEnum.TacPawpBstocmCms.getKey().equals(type) || StringUtils.isBlank(type)) { pawpRgstr.setBstocmCmsStat(state); } //附件5 if (JinChaEnum.TacPawpBitopqPeqaa.getKey().equals(type) || StringUtils.isBlank(type)) { pawpRgstr.setBitopqPeqaaStat(state); } //附件6 if (JinChaEnum.TacPawpBioesRwunit.getKey().equals(type) || StringUtils.isBlank(type)) { pawpRgstr.setBioesRwunitStat(state); } 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())) { pawpRgstr.setState(state); } } @Override public Map getState(String regstrId, String type) { TacPawpRgstr tacPawpRgstr = tacPawpRgstrDao.get(regstrId); //匹配新阶段 0-4为稽察项目问题的初始阶段,省份对应阶段下存在工程项目阶段记录值则 Map retMap = new HashMap<>(); if (StringUtils.isNotBlank(tacPawpRgstr.getState())) { int stateType = Integer.parseInt(tacPawpRgstr.getState()); if (stateType > 3) { retMap.put("state", stateType + ""); if (StringUtils.isNotBlank(tacPawpRgstr.getTaskId())) { TacProvincePlanTask tacProvincePlanTask = tacProvincePlanTaskDao.get(tacPawpRgstr.getTaskId()); retMap.put("stateName", tacProvincePlanTask.getNowStep()); } else { retMap.put("stateName", getStateName(stateType)); } return retMap; } } String state = InspUtils.getTypeState(type, tacPawpRgstr); if (StringUtils.isNotBlank(tacPawpRgstr.getTaskId()) && !tacPawpRgstr.getTaskId().equals("0")) { TacProvincePlanTask tacProvincePlanTask = tacProvincePlanTaskDao.get(tacPawpRgstr.getTaskId()); if(null != tacProvincePlanTask){ retMap.put("stateName", tacProvincePlanTask.getNowStep()); } } else { if (StringUtils.isNotBlank(state)) { retMap.put("stateName", getStateName(Integer.parseInt(state))); } else { retMap.put("stateName", ""); } } retMap.put("state", state); return retMap; } private String getStateName(int stateType) { String stateName; switch (stateType) { case 3: stateName = "(助理退回给专家)"; break; case 4: stateName = "(专家提交到助理)"; break; case 5: stateName = "(成果讨论阶段)"; break; case 6: stateName = "(中心修改阶段)"; break; case 7: stateName = "(司局修改阶段)"; break; default: stateName = ""; break; } return stateName; } }