package cn.com.goldenwater.dcproj.service.impl.system; import cn.com.goldenwater.dcproj.constValue.AdCodeLabel; import cn.com.goldenwater.dcproj.constValue.BisInspEnum; import cn.com.goldenwater.dcproj.constValue.SplitValue; import cn.com.goldenwater.dcproj.dao.*; import cn.com.goldenwater.dcproj.dto.*; import cn.com.goldenwater.dcproj.model.*; import cn.com.goldenwater.dcproj.param.*; import cn.com.goldenwater.dcproj.service.*; import cn.com.goldenwater.dcproj.service.impl.wdtst.BisInspWtdstTrackServiceImpl; import cn.com.goldenwater.dcproj.utils.AdLevelUtil; import cn.com.goldenwater.id.util.UuidUtil; import cn.com.goldenwater.target.CheckException; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.apache.commons.collections.map.HashedMap; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; import java.io.InputStream; import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.util.*; import static cn.com.goldenwater.dcproj.utils.impexcel.ImpUtil.XLS; /** * Created by 61618 on 2019/4/17. */ @Service @Transactional(rollbackFor = Exception.class) public class SupervisionPlanServiceImpl implements SupervisionPlanService { @Autowired private BisZhejiangVillRgstrService bisZhejiangVillRgstrService; @Autowired private AttJskejianFlkdisBaseDao jskejianFlkdisBaseDao; @Autowired private AttJskejianFlkdisRgstrDao jskejianFlkdisRgstrDao; @Autowired private AttJskejianWaterRgstrDao jskejianWaterRgstrDao; @Autowired private AttJskejianWaterBaseDao jskejianWaterBaseDao; @Autowired private AttJskejianEcofrdBaseDao jskejianEcofrdBaseDao; @Autowired private AttJskejianEcofrdRgstrDao jskejianEcofrdRgstrDao; @Autowired private AttWagaBaseDao attWagaBaseDao; @Autowired private SupervisionPlanDao supervisionPlanDao; @Autowired private BisNewCountryFeeService bisNewCountryFeeService; @Autowired private BisNewDcuserRelVillService bisNewDcuserRelVillService; @Autowired private BisNewWateruserInfoService bisNewWateruserInfoService; @Autowired private BisNewVillRgstrService bisNewVillRgstrService; @Autowired private BisInspAllObjDao bisInspAllObjDao; @Autowired private AttRsBaseDao attRsBaseDao; @Autowired private BisInspRsvrRgstrDao bisInspRsvrRgstrDao; @Autowired private BisInspVillRgstrDao bisInspVillRgstrDao; @Autowired private BisInspWtdstTrackDao bisInspWtdstTrackDao; @Autowired private AttEmpwtprjBaseDao attEmpwtprjBaseDao; @Autowired private BisInspKeyRegisterDao bisInspKeyRegisterDao; @Autowired private BisInspBaseDao bisInspBaseDao; @Autowired private BisInspGrwDao bisInspGrwDao; @Autowired private AttWagaRgstrDao attWagaRgstrDao; @Autowired private AttWagaBaseDao wagaBaseDao; @Autowired private BisInspBaseExtDao bisInspBaseExtDao; @Autowired private BisInspSafeExtManageDao bisInspSafeExtManageDao; @Autowired private BisInspObjFactory factory; @Autowired private BisInspPreListDao bisInspPreListDao; @Autowired private BisInspBaseViewDao bisInspBaseViewDao; @Autowired private BisInspBasePresExtDao bisInspBasePresExtDao; @Autowired BisInspRsvrProjectDao bisInspRsvrProjectDao; @Autowired BisInspRsvrBenefitsDao bisInspRsvrBenefitsDao;//水库效益发挥情况 @Autowired private BisInspPblmDao bisInspPblmDao; @Autowired private BisInspVlgdrinkProjManageDao bisInspVlgdrinkProjManageDao; @Autowired private BisInspProSourceProtectDao bisInspProSourceProtectDao; @Autowired private BisInspSecsurveyVlgDao bisInspSecsurveyVlgDao; @Autowired private BisInspVlgdrinkFacOperDao bisInspVlgdrinkFacOperDao; @Autowired private BisInspWateruserInfoDao bisInspWateruserInfoDao; @Autowired private BisInspManageResponsibilityDao bisInspManageResponsibilityDao; @Autowired private BisInspKeyRegisterSectionDao bisInspKeyRegisterSectionDao; @Autowired private BisInspKeyRegSecUnitDao bisInspKeyRegSecUnitDao; @Autowired private AttMampuInfoDao attMampuInfoDao; @Autowired private BisInspWagaMrsCiDao bisInspWagaMrsCiDao; @Autowired private BisInspWagaSafeManageDao bisInspWagaSafeManageDao; @Autowired private BisInspWagaDmamInfoDao bisInspWagaDmamInfoDao; @Autowired private BisInspWagaProenInfoDao bisInspWagaProenInfoDao; @Autowired private BisInspRsvrRgstrService bisInspRsvrRgstrService; @Autowired private AttWagaRgstrService attWagaRgstrService; @Autowired private BisInspGrwService bisInspGrwService; @Autowired private BisInspKeyRegisterService bisInspKeyRegisterService; @Autowired private BisInspVillRgstrService bisInspVillRgstrService; @Autowired private BisInspWtdstDao bisInspWtdstDao; @Autowired private BisInspWtdstTrackServiceImpl bisInspWtdstTrackServiceImpl; @Autowired private BisInspSelAreaDao bisInspSelAreaDao; @Autowired private BisInspAllRlationDao bisInspAllRlationDao; @Autowired private BisInspAllDao bisInspAllDao; @Autowired private AttRsBaseCrrctDao attRsBaseCrrctDao; //稽察项目基本信息表 @Autowired private TacAttPawpBaseDao tacAttPawpBaseDao; //稽察项目登记表 @Autowired private TacPawpRgstrDao tacPawpRgstrDao; //专业稽察工作底稿 @Autowired private TacPawpListDao tacPawpListDao; //查阅的资料目录 @Autowired private TacPawpDrmDao tacPawpDrmDao; //前期与设计基本情况表 @Autowired private TacPawpPdbstDao tacPawpPdbstDao; //建设管理基本情况表-项目法人责任制-TAC_PAWP_BSTOCM_PLPRS @Autowired private TacPawpBstocmPlprsDao tacPawpBstocmPlprsDao; //建设管理基本情况表-招标投标制-TAC_PAWP_BSTOCM_TSOPBFP @Autowired private TacPawpBstocmTsopbfpDao tacPawpBstocmTsopbfpDao; //建设管理基本情况表-招标投标制-标段-TAC_PAWP_BSTOCM_TSOPBFP_SCTN @Autowired private TacPawpBstocmTsopbfpSctnDao tacPawpBstocmTsopbfpSctnDao; //建设管理基本情况表-建设监理制-TAC_PAWP_BSTOCM_CPSS @Autowired private TacPawpBstocmCpssDao tacPawpBstocmCpssDao; //建设监理单位与标段关系表-TAC_PAWP_BSTOCM_SCTN @Autowired private TacPawpBstocmSctnDao tacPawpBstocmSctnDao; //建设管理基本情况表-合同管理制-TAC_PAWP_BSTOCM_CMS @Autowired private TacPawpBstocmCmsDao tacPawpBstocmCmsDao; //建设管理基本情况表-合同管理制-合同列表-TAC_PAWP_BSTOCM_CMS_PACT_LIST @Autowired private TacPawpBstocmCmsPactListDao tacPawpBstocmCmsPactListDao; //计划下达与执行基本情况表-TAC_PAWP_RAIOBIS @Autowired private TacPawpRaiobisDao tacPawpRaiobisDao; //资金使用与管理基本情况表-TAC_PAWP_BIOFUAM @Autowired private TacPawpBiofuamDao tacPawpBiofuamDao; //工程质量基本情况表--质量管理体制-TAC_PAWP_BITOPQ_QMS @Autowired private TacPawpBitopqQmsDao tacPawpBitopqQmsDao; //工程质量基本情况表--质量管理体制--体制列表-TAC_PAWP_BITOPQ_QMS_LIST //工程质量基本情况表--工程实体质量与验收-TAC_PAWP_BITOPQ_PEQAA @Autowired private TacPawpBitopqPeqaaDao tacPawpBitopqPeqaaDao; //工程安全基本情况表--项目法人-TAC_PAWP_BIOES_PE @Autowired private TacPawpBioesPeDao tacPawpBioesPeDao; //工程安全基本情况表--施工单位-TAC_PAWP_BIOES_RWUNIT @Autowired private TacPawpBioesRwunitDao tacPawpBioesRwunitDao; //稽察问题信息表-TAC_PBLM_INFO @Autowired private TacPawpBstocmCpssInfoDao tacPawpBstocmCpssInfoDao; @Autowired private AttFscBaseDao attFscBaseDao; @Autowired private BisInspFscRgstrDao bisInspFscRgstrDao; @Autowired private AttOtherBaseDao attOtherBaseDao; @Autowired private AttSdBaseDao sdBaseDao; @Autowired private BisInspOtherRgstrDao bisInspOtherRgstrDao; @Autowired private BisInspSdRgstrDao bisInspSdRgstrDao; @Autowired private BisInspSwhsRgstrDao swhsRgstrDao; //安全保障达标落实情况 @Autowired private BisInspSwhsRgstrSafetyDao swhsRgstrSafetyDao; //保护措施监管情况 @Autowired private BisInspSwhsRgstrMeasuresDao swhsRgstrMeasuresDao; //地级行政区应急备用水源建设情况 @Autowired private BisInspSwhsRgstrWaterDao swhsRgstrWaterDao; @Autowired private AttSwhsBaseDao swhsBaseDao; //取水用户 @Autowired private BisInspWiuRgstrDao wiuRgstrDao; //取水单位取用水情况 @Autowired private BisInspWiuRgstrIntInfoDao wiuRgstrIntInfoDao; //取水许可审批监管情况 @Autowired private BisInspWiuRgstrApprInfoDao wiuRgstrApprInfoDao; @Autowired private AttWiuBaseDao wiuBaseDao; @Autowired private BisInspOrgDao bisInspOrgDao; //行政区划取水量 @Autowired private BisInspWintRgstrDao wintRgstrDao; //行政区填报表 @Autowired private BisInspWintRgstrIntInfoDao wintRgstrIntInfoDao; @Autowired private AttAdXBaseDao attAdXBaseDao; @Autowired private BisInspSvwtAreaRgstrDao svwtAreaRgstrDao; @Autowired private BisInspSvwtAreaRgstrWseDao svwtAreaWseDao; @Autowired private BisInspSvwtAreaRgstrWswmDao svwtAreaWswmDao; @Autowired private BisInspSvwtWuntRgstrDao svwtWuntRgstrDao; @Autowired private BisInspSvwtWuntRgstrWuuswDao svwtWuntWuuswDao; @Autowired private BisInspSvwtWuntRgstrWsuswDao svwtWuntWsuswDao; @Autowired private AttWuntBaseDao wuntBaseDao; @Autowired private BisInspAllRlationPersDao bisInspAllRlationPersDao; @Autowired private AttGrwBaseDao grwBaseDao; @Autowired private OlBisInspOrgService inspOrgService; @Autowired private AttPrdCstrProjBaseDao attPrdCstrProjBaseDao; @Autowired private BisInspOprdCstrProjRgstrDao oprdCstrProjRgstrDao; @Autowired private BisInspRsmlRgstrDao bisInspRsmlRgstrDao; @Autowired private BisInspRsmlRgstrPresDao bisInspRsmlRgstrPresDao; @Autowired private BisInspRsmlRgstrProjectDao bisInspRsmlRgstrProjectDao; @Autowired private BisInspRsmlRgstrRunManageDao bisInspRsmlRgstrRunManageDao; @Autowired private BisInspRsraqgRgstrService bisInspRsraqgRgstrService; @Autowired private BisInspRsraqgRgstrCityService bisInspRsraqgRgstrCityService; @Autowired private BisInspRsraqgRgstrCountyService bisInspRsraqgRgstrCountyService; @Autowired private BisInspStndRgstrService bisInspStndRgstrService; @Autowired private BisZhejiangJgRgstrDao bisZhejiangJgRgstrDao; @Autowired private BisZhejiangJgRgstrService bisZhejiangJgRgstrService; @Autowired private BisInspRsfcoRgstrService bisInspRsfcoRgstrService; @Autowired private BisInspMfdpRgstrService bisInspMfdpRgstrService; @Autowired private BisInspRsfcoRgstrBaseDao bisInspRsfcoRgstrBaseDao; @Autowired private BisInspRsfcoRgstrFlliDao bisInspRsfcoRgstrFlliDao; @Autowired private BisInspRsfcoRgstrAoeparoDao bisInspRsfcoRgstrAoeparoDao; @Autowired private AttZhejiangJgBaseDao attZhejiangJgBaseDao; @Autowired private BisInspPlanYearService bisInspPlanYearService; /** * 根据用户信息与督查计划类型获取该用户可示可管理的单一机构的所有批次 * * @param persid * @param ptype * @return */ @Override public List getNodeByPersid(String persid, String ptype, String orgId) { BisInspAllRlationPersDto bisInspAllRlationPersDto = this.supervisionPlanDao.getPersInfo(persid); String orgIdStr = AdCodeLabel.START_PARENT_ADCODE + ptype + bisInspAllRlationPersDto.getOrgId(); if (ptype.length() == 2) { orgIdStr = "0" + ptype + bisInspAllRlationPersDto.getOrgId(); } if (ptype.length() == 3) { orgIdStr = ptype + bisInspAllRlationPersDto.getOrgId(); } return this.supervisionPlanDao.getNodeByOrgId(orgIdStr, orgId, inspOrgService.getProvince(orgId)); } /** * 获取督查组相关的对象、人员、区域信息(新) * * @param persid * @param inspYear * @param inspMnth * @param orgId * @return */ @Override public List getAllInfoByPersidAndOrgId(String persid, String inspYear, String inspMnth, String orgId, String yearPlanId) { String orgIdStr = "___" + orgId; //获取所有组 List persAllInfoDtoList = this.supervisionPlanDao.getAllInfoByPersidAndOrgId(persid, inspYear, inspMnth, orgIdStr, orgId, inspOrgService.getProvince(orgId), yearPlanId); if (persAllInfoDtoList.size() > 0) { for (PersAllInfoDto p : persAllInfoDtoList) { String province = inspOrgService.getProvince(p.getOrgId()); p.setPtype(String.valueOf(Integer.valueOf(p.getPtype()))); //获取人员 List persAllDtoList = this.supervisionPlanDao.getPersAllDtoList(p.getId(), p.getOrgId(), province); //获取督查对象 List persAllObjDtoList = this.supervisionPlanDao.getPersAllObjDtoList(p.getId(), p.getOrgId(), province); //获取分工区域 List persAllAreaDtoList = this.supervisionPlanDao.getPersAllAreaDtoList(p.getId(), p.getOrgId(), province); p.setPersAllDtoList(persAllDtoList); p.setPersAllObjDtoList(persAllObjDtoList); p.setPersAllAreaDtoList(persAllAreaDtoList); } } return persAllInfoDtoList; } /** * 查询不在该督查组下的水库 * * @param inGroupResParam 水库参数 * @return */ @Override public PageInfo getSupResByGroup(InGroupResParam inGroupResParam) { if (StringUtils.isNotBlank(inGroupResParam.getAdcd())) { String adCode = this.getAdCodeLike("1", inGroupResParam.getAdcd()); inGroupResParam.setAdcd(adCode); } PageHelper.startPage(inGroupResParam.getPageNum(), inGroupResParam.getPageSize()); List attGrwBaseList = this.supervisionPlanDao.getSupResByGroup(inGroupResParam); return new PageInfo<>(attGrwBaseList); } /** * 查询不在督查组督查范围内的督查对象(分页) * * @param inspObjParam 对象参数 * @return */ @Override public PageInfo getSupObjListNotInspGroupId(InspObjParam inspObjParam) { PageHelper.startPage(inspObjParam.getPageNum(), inspObjParam.getPageSize()); List resultList = getObjListNotGroupId(inspObjParam); return new PageInfo<>(resultList); } /** * 查询不在督查组督查范围内的督查对象 * * @param inspObjParam 对象参数 * @return */ @Override public List getObjListNotGroupId(InspObjParam inspObjParam) { // 保留原adCode String oldAdCode = inspObjParam.getAdCode(); String adCode = this.getAdCodeLike(inspObjParam.getObjType(), inspObjParam.getAdCode()); inspObjParam.setAdCode(adCode); BisInspEnum bisInspEnum = BisInspEnum.getEnumByType(inspObjParam.getObjType()); Optional.ofNullable(bisInspEnum).orElseThrow(() -> new CheckException("未找到与 objType:" + inspObjParam.getObjType() + " 相对应的督查项!")); switch (bisInspEnum) { case REVER: // 小水库或者 36类型 或者 小水库标准化 InGroupResParam inGroupReverResParam = inspObjParam2InGroupResParam(inspObjParam); inGroupReverResParam.setEngScal("'3','4', '5'"); return this.supervisionPlanDao.getSupResByGroup(inGroupReverResParam); case REVER2: case STND: case RSSFDR: case RSSFGD: case RSVRYN: // 小水库或者 36类型 或者 小水库标准化 InGroupResParam inGroupResParam = inspObjParam2InGroupResParam(inspObjParam); if (StringUtils.isBlank(inGroupResParam.getEngScal())) { inGroupResParam.setEngScal("'3','4', '5'"); } return this.supervisionPlanDao.getSupResByGroup(inGroupResParam); case RSML: case RSLKBK: case RSFCOQH: InGroupResParam rsmlParam = inspObjParam2InGroupResParam(inspObjParam); if (StringUtils.isBlank(rsmlParam.getEngScal())) { rsmlParam.setEngScal("'1', '2', '3'"); } return this.supervisionPlanDao.getSupResByGroup(rsmlParam); // return this.supervisionPlanDao.getSupResRsmlByGroup(inspObjParam2InGroupResParam(inspObjParam)); // case STND: // //小水库或者 36类型 或者 小水库标准化 // return this.supervisionPlanDao.getSupResStndByGroup(inspObjParam2InGroupResParam(inspObjParam)); case VILL: case VILLZHEJIANG: case VILL2020: case IRR: case RDWSP: case VILLGD: case VILL2021: case SVWTQH: case FJWTENF: adCode = "______000000"; if (StringUtils.isNotBlank(oldAdCode)) { adCode = oldAdCode.replace("00", ""); if (adCode.length() == 2) { adCode = adCode + "____000000"; } else if (adCode.length() == 4) { adCode = adCode + "__000000"; } else { adCode = adCode + "000000"; } } inspObjParam.setAdCode(adCode); inspObjParam.setAdGrad("'4'"); return supervisionPlanDao.getSupCwsListNotInspGroupId(inspObjParam); case QYMTEN: case XJVILL: adCode = "______000000"; if (StringUtils.isNotBlank(oldAdCode)) { adCode = oldAdCode.replace("00", ""); if (adCode.length() == 2) { adCode = adCode + "____000000"; } else if (adCode.length() == 4) { adCode = adCode + "__000000"; } else { adCode = adCode + "000000"; } } inspObjParam.setAdCode(adCode); inspObjParam.setAdGrad("'3'"); return supervisionPlanDao.getSupCwsListNotInspGroupId(inspObjParam); case VILLQH: adCode = "______000000"; if (StringUtils.isNotBlank(oldAdCode)) { adCode = oldAdCode.replace("00", ""); if (adCode.length() == 2) { adCode = adCode + "____000000"; } else if (adCode.length() == 4) { adCode = adCode + "__000000"; } else { adCode = adCode + "000000"; } } inspObjParam.setAdCode(adCode); inspObjParam.setAdGrad("'3','4'"); return supervisionPlanDao.getSupCwsListNotInspGroupId(inspObjParam); case TRACK: return supervisionPlanDao.getSupWtdListNotInspGroupId(inspObjParam.getInspGroupId(), inspObjParam.getProvince(), inspObjParam.getObjType(), inspObjParam.getWtdstType() , inspObjParam.getWtdstNm(), inspObjParam.getWtdstState(), adCode, inspObjParam.getNm(), inspObjParam.getOrderBy(), inspObjParam.getYear(), inspObjParam.getPrjState()); case EMPWT: case KEYSAFQH: case KEYCHKQH: //重点工程建设 return supervisionPlanDao.getSupEmpListNotInspGroupId(inspObjParam.getInspGroupId(), inspObjParam.getObjType(), inspObjParam.getNm(), adCode, "2", inspObjParam.getOrderBy(), inspObjParam.getOrgId(), inspObjParam.getProvince()); case EMPWTRUN: //重点工程运行 return supervisionPlanDao.getSupEmpListNotInspGroupId(inspObjParam.getInspGroupId(), inspObjParam.getObjType(), inspObjParam.getNm(), adCode, "1", inspObjParam.getOrderBy(), inspObjParam.getOrgId(), inspObjParam.getProvince()); case GRW: return supervisionPlanDao.getSupGrwListNotInspGroupId(inspObjParam.getInspGroupId(), inspObjParam.getObjType(), inspObjParam.getNm(), adCode, inspObjParam.getOrderBy(), inspObjParam.getSttp(), inspObjParam.getGateType(), inspObjParam.getOrgId(), inspObjParam.getProvince()); case WAGA://水闸 case WAGAJS: return supervisionPlanDao.getSupWagaListNotInspGroupId(inspObjParam); case PAWP://稽察项目 return supervisionPlanDao.getSupPawpListNotInspGroupId(inspObjParam); case FSC: return supervisionPlanDao.getSupFscListNotInspGroupId(inspObjParam); case OTHER: return supervisionPlanDao.getSupOtherListNotInspGroupId(inspObjParam); case SD: return supervisionPlanDao.getSupSdListNotInspGroupId(inspObjParam); case WIU: case WIUJS: return supervisionPlanDao.getSupWiuListNotInspGroupId(inspObjParam); case SWHS: return supervisionPlanDao.getSupSwhsListNotInspGroupId(inspObjParam); case WUNT: return supervisionPlanDao.getWuntListNotInspGroupId(inspObjParam); case PRD: case PRDQH: return supervisionPlanDao.getPrdListNotInspGroupId(inspObjParam); case JSFL: return supervisionPlanDao.getJSFLListNotInspGroupId(inspObjParam); case JSWA: return supervisionPlanDao.getJSWAListNotInspGroupId(inspObjParam); case ECOFRD: return supervisionPlanDao.getEcofrdListNotInspGroupId(inspObjParam); case RSFCO: return supervisionPlanDao.getRsBaseListNotInspGroupId(inspObjParam); case RSRAQG: // 23 return supervisionPlanDao.getAdBaseListNotInspGroupId(inspObjParam); case BIS_ZHEJIANG_JG_RGSTR: //获取不在督查组中的对象 return supervisionPlanDao.getNotSuperviseGroupObj(inspObjParam); case MFDP: return supervisionPlanDao.getSupMfdpListNotInspGroupId(inspObjParam.getInspGroupId(), inspObjParam.getProvince(), inspObjParam.getObjType(), inspObjParam.getAdName() , adCode, inspObjParam.getNm(), inspObjParam.getOrderBy()); case SAP: return supervisionPlanDao.getSapBaseListNotInspGroupId(inspObjParam); case EFP: // 不需要加adCode inspObjParam.setAdCode(null); return supervisionPlanDao.getEfpBaseListNotInspGroupId(inspObjParam); case WINTU: // 31.取用水督查 return supervisionPlanDao.getWintuBaseListNotInspGroupId(inspObjParam); case CITY: inspObjParam.setAdGrad("'4'"); return supervisionPlanDao.getAdXBaseListNotInspGroupId(inspObjParam); case WRM: case SVWT: case WTGOV: case WRM2021: case FJQA: case SDQA: inspObjParam.setAdGrad("'3','4'"); return supervisionPlanDao.getAdXBaseListNotInspGroupId(inspObjParam); case CHMCLS: inspObjParam.setAdGrad("'2','3','4'"); return supervisionPlanDao.getAdXBaseListNotInspGroupId(inspObjParam); case MFDPQH: if (StringUtils.isBlank(inspObjParam.getAdGrad())) { inspObjParam.setAdGrad("'3','4','5','6'"); } return supervisionPlanDao.getAdXBaseListNotInspGroupId(inspObjParam); case WTUNT: case WTCRR: // 33.节约用水 AND 054.节水载体复核表 return supervisionPlanDao.getWtuntBaseListNotInspGroupId(inspObjParam); case WRWS: // 53.市级 水资源管理及节水管理复核 return supervisionPlanDao.getAdBaseMunicipalLevelListNotInspGroupIds(inspObjParam); case WRWX: // 56.县级 水资源管理及节水管理复核 return supervisionPlanDao.getAdBaseCountyLevelListNotInspGroupIds(inspObjParam); case WTGT: case WTGTH: // 55.取水许可管理复核表登记 // 57.取水许可管理复核表登记 return supervisionPlanDao.getWtgtBaseListNotInspGroupId(inspObjParam); // case RSSFDR: // case RSSFGD: // return supervisionPlanDao.getRsListNotInGroup(inspObjParam); case SAMRMP: return supervisionPlanDao.getSamListNotInGroup(inspObjParam); case CDEP: return supervisionPlanDao.getSupCdepListNotInspGroupId(inspObjParam); case BID: return supervisionPlanDao.getSupBidListNotInspGroupId(inspObjParam); case RLRW: return supervisionPlanDao.getSupRlrwListNotInspGroupId(inspObjParam); case DRDMP: // 69 return supervisionPlanDao.getSupDrdmpListNotInspGroupId(inspObjParam); case GROW: return supervisionPlanDao.getSupGrowListNotInspGroupId(inspObjParam); case FUND: return supervisionPlanDao.getSupFundListNotInspGroupId(inspObjParam); case WIUQH: // 72 return supervisionPlanDao.getSupWiuqhListNotInspGroupId(inspObjParam); case SAFETY: // 74 return supervisionPlanDao.getSafetyListNotInspGroupId(inspObjParam); case YNDEP: // 75 return supervisionPlanDao.getYndepListNotInspGroupId(inspObjParam); case DPGM: // 76 return supervisionPlanDao.getDpgmListNotInspGroupId(inspObjParam); case RVGM: // 77 return supervisionPlanDao.getRvgmListNotInspGroupId(inspObjParam); case WTPRJ: // 78 return supervisionPlanDao.getWtprjListNotInspGroupId(inspObjParam); case UNWT: // 78 return supervisionPlanDao.getUnwtListNotInspGroupId(inspObjParam); case FLOODQH: // 78 return supervisionPlanDao.getFloodqhListNotInspGroupId(inspObjParam); case DSTFLDQH: // 78 return supervisionPlanDao.getDstfldqhListNotInspGroupId(inspObjParam); case HYST: return supervisionPlanDao.getAddAxListNotInspGroupId(inspObjParam); case STSTN: return supervisionPlanDao.getStstnListNotInspGroupId(inspObjParam); case GNRL: return supervisionPlanDao.getGnrlListNotInspGroupId(inspObjParam); case SWHSJS: return supervisionPlanDao.getSwhsjsListNotInspGroupId(inspObjParam); case RSVRSD: return supervisionPlanDao.getRsvrSdListNotInspGroupId(inspObjParam); case HYSTP: return supervisionPlanDao.getXsdyhglListNotInspGroupId(inspObjParam); case RDWPGD: return supervisionPlanDao.getRdwpGdListNotInspGroupId(inspObjParam); case JSPWIU: return supervisionPlanDao.getJsPwiuListNotInspGroupId(inspObjParam); case FJPJLGL: return supervisionPlanDao.getFpjlglListNotInspGroupId(inspObjParam); case FJPJMGDP: return supervisionPlanDao.getFjpjmgdpListNotInspGroupId(inspObjParam); case FJACCP: return supervisionPlanDao.getFjaccpListNotInspGroupId(inspObjParam); case FJSDU: return supervisionPlanDao.getFjsduListNotInspGroupId(inspObjParam); case FJPJCSU: return supervisionPlanDao.getFjpjcsuListNotInspGroupId(inspObjParam); case JSPWIU2024: return supervisionPlanDao.getJsPwiu2024ListNotInspGroupId(inspObjParam); case FJGNRL: return supervisionPlanDao.getFjgnrlListNotInspGroupId(inspObjParam); case ANZE: inspObjParam.setBusinessType("1"); return supervisionPlanDao.getFillListNotInspGroupId(inspObjParam); case SIXME: inspObjParam.setBusinessType("2"); return supervisionPlanDao.getFillListNotInspGroupId(inspObjParam); default: throw new CheckException("未找到与 objType:" + inspObjParam.getObjType() + " 相对应的督查项!"); } } /** * 拼接 AD_CODE * * @param objType pType * @param ad AD_CODE * @return */ public String getAdCodeLike(String objType, String ad) { if (StringUtils.isBlank(ad)) { return ""; } // 获取行政划区字段名 String eName = "AD_CODE"; if ("1".equals(objType) || "22".equals(objType) || "24".equals(objType) || "80".equals(objType) || BisInspEnum.RSFCO.getValue().equals(objType)) { eName = "ADM_DIV"; } else if ("3".equals(objType)) { eName = "LOC_AD"; } else if ("5".equals(objType)) { eName = "ADCD"; } String adCode; // 如果有多个行政区划编码,要根据逗号分隔截取 if (ad.contains(SplitValue.DOUHAO_SPLIT)) { StringBuilder stringBuffer = new StringBuilder(); String[] split = ad.split(SplitValue.DOUHAO_SPLIT); // 拼接sql,对多个截取后的行政区划进行模糊查询 for (String s : split) { String subAd = AdLevelUtil.SubAd(s).get("subAd").toString(); stringBuffer.append(subAd) .append("%' OR ") .append(eName) .append(" LIKE '"); } //将最后的“ OR ADM_DIV LIKE ” 截掉 String subAds = stringBuffer.substring(0, stringBuffer.length() - 18); adCode = "(" + eName + " LIKE '" + subAds + ")"; } else { String subAd = AdLevelUtil.SubAd(ad).get("subAd").toString(); adCode = eName + " LIKE '" + subAd + "%' "; } return adCode; } /** * InspObjParam 转换 InGroupResParam * * @param inspObjParam * @return */ private InGroupResParam inspObjParam2InGroupResParam(InspObjParam inspObjParam) { InGroupResParam resParam = new InGroupResParam(); resParam.setAdcd(inspObjParam.getAdCode()); resParam.setAdnm(inspObjParam.getAdName()); resParam.setEngScal(inspObjParam.getEngScal()); resParam.setGroupId(inspObjParam.getInspGroupId()); resParam.setRsName(inspObjParam.getNm()); resParam.setOrderBy(inspObjParam.getOrderBy()); resParam.setState(inspObjParam.getState()); resParam.setPageSize(inspObjParam.getPageSize()); resParam.setPageNum(inspObjParam.getPageNum()); resParam.setProvince(inspObjParam.getProvince()); resParam.setpType(inspObjParam.getObjType()); resParam.setHstInsp(inspObjParam.getHstInsp()); resParam.setIsBack(inspObjParam.getIsBack()); resParam.setIsSupn(inspObjParam.getIsSupn()); resParam.setIsTask(inspObjParam.getIsTask()); return resParam; } @Override public SupInsertResult insertSupervisionObj(PersAllInfoDto persAllInfoDto) { SupInsertResult supInsertResult = new SupInsertResult(); String province = inspOrgService.getProvince(persAllInfoDto.getOrgId()); //修改督查组名称 if (StringUtils.isNotBlank(persAllInfoDto.getNm()) || StringUtils.isNotBlank(persAllInfoDto.getSttm()) || StringUtils.isNotBlank(persAllInfoDto.getEntm()) || StringUtils.isNotBlank(persAllInfoDto.getInspTask())) { BisInspAllDto bisInspAllDto = new BisInspAllDto(); bisInspAllDto.setId(persAllInfoDto.getId()); bisInspAllDto.setPid(persAllInfoDto.getPid()); bisInspAllDto.setPnm(persAllInfoDto.getNm()); bisInspAllDto.setPsn(persAllInfoDto.getPsn()); bisInspAllDto.setOrgId(persAllInfoDto.getOrgId()); bisInspAllDto.setInspTask(persAllInfoDto.getInspTask()); bisInspAllDto.setSttm(persAllInfoDto.getSttm()); bisInspAllDto.setEntm(persAllInfoDto.getEntm()); bisInspAllDto.setInspYear(persAllInfoDto.getInspYear()); bisInspAllDto.setInspMnth(persAllInfoDto.getInspMnth()); bisInspAllDto.setInspTask(persAllInfoDto.getInspTask()); this.supervisionPlanDao.updateNode(bisInspAllDto); } //添加督查组人员 if (persAllInfoDto.getPersAllDtoList() != null && persAllInfoDto.getPersAllDtoList().size() > 0) { for (PersAllDto pers : persAllInfoDto.getPersAllDtoList()) { this.supervisionPlanDao.insertPers(persAllInfoDto.getId(), pers.getGuid(), pers.getPersType(), persAllInfoDto.getOrgId(), persAllInfoDto.getProvince(), String.valueOf(Integer.parseInt(persAllInfoDto.getId().substring(0, 3)))); } } // 添加督查对象 if (persAllInfoDto.getPersAllObjDtoList() != null && persAllInfoDto.getPersAllObjDtoList().size() > 0) { OlBisInspOrg inspOrg = inspOrgService.get(persAllInfoDto.getOrgId()); String adCode = inspOrg.getRlcode(); for (PersAllObjDto persObj : persAllInfoDto.getPersAllObjDtoList()) { String type = persObj.getPtype(); if (type.length() == 1) { type = "00" + type; } else if (type.length() == 2) { type = "0" + type; } // 去重判断 跟据 基础表ID、组ID、PTYPE 判NullPointerException断是否重复 BisInspAllObjParam inspAllObjParam = new BisInspAllObjParam(); inspAllObjParam.setId(persAllInfoDto.getId()); inspAllObjParam.setCode(persObj.getCode()); inspAllObjParam.setPtype(persObj.getPtype()); List inspAllObjDaoList = bisInspAllObjDao.findList(inspAllObjParam); if (inspAllObjDaoList != null && !inspAllObjDaoList.isEmpty()) { if (!BisInspEnum.TRACK.getRlation().equalsIgnoreCase(type)) { continue; } } // 添加督查对象 BisInspAllObj bisInspAllObj = addObj(persAllInfoDto, persObj, adCode, province, type); // 添加登记表 // HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); BisInspObjStrategy strategy = factory.createStrategy(persObj.getPtype()); strategy.insertObj(bisInspAllObj, persAllInfoDto.getPersid()); } } //添加分工区域 if (persAllInfoDto.getPersAllAreaDtoList() != null && persAllInfoDto.getPersAllAreaDtoList().size() > 0) { for (PersAllAreaDto pad : persAllInfoDto.getPersAllAreaDtoList()) { String uuid = UuidUtil.uuid(); this.supervisionPlanDao.insertSupArea(uuid, persAllInfoDto.getId(), pad.getAdCode(), pad.getAdName(), persAllInfoDto.getOrgId(), province); } } supInsertResult.setId(persAllInfoDto.getId()); supInsertResult.setNm(persAllInfoDto.getNm()); supInsertResult.setPersCount(persAllInfoDto.getPersAllDtoList().size()); supInsertResult.setObjCount(persAllInfoDto.getPersAllObjDtoList().size()); supInsertResult.setAreaCount(persAllInfoDto.getPersAllAreaDtoList().size()); return supInsertResult; } /** * 添加对象表 BIS_INSP_ALL_OBJ * * @param persAllInfoDto * @param persObj * @param adCode 行政区划 * @param province 省级行政区划 * @param type 督查类别 * @return BisInspAllObj */ private BisInspAllObj addObj(PersAllInfoDto persAllInfoDto, PersAllObjDto persObj, String adCode, String province, String type) { BisInspAllObj bisInspAllObj = new BisInspAllObj(); bisInspAllObj.setObjId(UuidUtil.uuid()); bisInspAllObj.setPtype(persObj.getPtype()); bisInspAllObj.setCode(persObj.getCode()); bisInspAllObj.setId(persAllInfoDto.getId()); bisInspAllObj.setNm(persObj.getName()); bisInspAllObj.setProvince(province); bisInspAllObj.setPersId(persAllInfoDto.getPersid()); // 增加 是否省属 属性 1是2否 bisInspAllObj.setProvincial(persObj.getObjProvincial()); // 查询经纬度 // 30 超标洪水防御 没有省级划分,所以无法获取经纬度 if (!BisInspEnum.EFP.getRlation().equals(type)) { LgtdAndLttd lgtdAndLttd = this.supervisionPlanDao.getLgtdAndLttd(persObj.getCode(), type); Optional.ofNullable(lgtdAndLttd).ifPresent(ld -> { bisInspAllObj.setLgtd(ld.getLgtd()); bisInspAllObj.setLttd(ld.getLttd()); bisInspAllObj.setLgtdpc(ld.getLgtdPc()); bisInspAllObj.setLttdpc(ld.getLttdPc()); }); } // 判断是否是全国数据 if (!adCode.startsWith(AdCodeLabel.START_PARENT_ADCODE)) { bisInspAllObj.setAdCode(adCode); bisInspAllObj.setOrgId(persAllInfoDto.getOrgId()); } // 添加督查对象 this.bisInspAllObjDao.insert(bisInspAllObj); return bisInspAllObj; } /** * 督查组人员分配角色 * * @param objIdDto * @return */ @Override public int assignmentRole(ObjIdDto objIdDto) { int i = 0; String province = inspOrgService.getProvince(objIdDto.getOrgId()); ObjIdDto persAllDto = this.supervisionPlanDao.getPers(objIdDto.getId(), objIdDto.getGuid()); if (persAllDto != null) {//组里存在该人员 if ("1".equals(objIdDto.getPersType())) {//如果添加组长,将组里其他组长设为组员 this.supervisionPlanDao.updateTeamLeader(objIdDto.getId()); } //已经在组里,修改人员类型 i += this.supervisionPlanDao.updatePersType(objIdDto.getId(), objIdDto.getGuid(), objIdDto.getPersType()); } else { if ("1".equals(objIdDto.getPersType())) { this.supervisionPlanDao.updateTeamLeader(objIdDto.getId()); } //不在组里 执行添加 this.supervisionPlanDao.insertPers(objIdDto.getId(), objIdDto.getGuid(), objIdDto.getPersType(), objIdDto.getOrgId(), province, String.valueOf(Integer.parseInt(objIdDto.getId().substring(0, 3)))); } return i; } /** * 获取人员类型 * * @param persid * @return */ @Override public List getPersType(String persid, String orgId, String yearId) { // if(StringUtils.isBlank(inspOrgService.getProvince(orgId))) { // return this.supervisionPlanDao.getPersTypeByPersid(persid, orgId, inspOrgService.getProvince(orgId)); // } if (StringUtils.isBlank(yearId)) { return this.supervisionPlanDao.getPersTypeByPersidOrg(persid, inspOrgService.getProvince(orgId)); } else { //根据年度计划返回督查类型 BisInspPlanYear bisInspPlanYear = bisInspPlanYearService.get(yearId); PersTypeDto persTypeDto = new PersTypeDto(bisInspPlanYear.getObjType(), bisInspPlanYear.getObjName()); List list = new ArrayList<>(); list.add(persTypeDto); return list; } } /** * 获取人员类型(根据接收单位) * * @param persid * @return */ @Override public List getPersTypeByPersid(String persid, String orgId) { return this.supervisionPlanDao.getPersTypeByPersid(persid, orgId, inspOrgService.getProvince(orgId)); } /** * 清空督查对象 * * @param objType * @param id */ @Override public void cleanObjData(String objType, String id) { if (StringUtils.isBlank(id) || StringUtils.isBlank(objType)) { return; } BisInspPblmParam bisInspPblmParam = new BisInspPblmParam(); bisInspPblmParam.setRegid(id); bisInspPblmParam.setObjType(objType); this.bisInspPblmDao.deleteBy(bisInspPblmParam);//删除问题 if ("1".equals(objType) || "36".equals(objType)) {//水库 BisInspBaseViewParam p = new BisInspBaseViewParam(); p.setRgstrId(id); //获取走访情况 BisInspBaseView bisInspBaseView = this.bisInspBaseViewDao.getBy(p); if (bisInspBaseView != null) { //删除走访人员情况 this.bisInspPreListDao.deleteByViewId(bisInspBaseView.getViewId()); } this.bisInspBaseViewDao.deleteBy(p);//删除水库走访情况 BisInspSafeExtManageParam bisInspSafeExtManageParam = new BisInspSafeExtManageParam(); bisInspSafeExtManageParam.setRgstrId(id); this.bisInspSafeExtManageDao.deleteBy(bisInspSafeExtManageParam);//删除水库安全运行管理情况 BisInspBaseExtParam bisInspBaseExtParam = new BisInspBaseExtParam(); bisInspBaseExtParam.setRgstrId(id); this.bisInspBaseExtDao.deleteBy(bisInspBaseExtParam);//删除水库“三项基本要求”落实情况 BisInspBasePresExtParam bisInspBasePresExt = new BisInspBasePresExtParam(); bisInspBasePresExt.setRgstrId(id); this.bisInspBasePresExtDao.deleteBy(bisInspBasePresExt);//删除水库“三个责任人”落实情况 BisInspRsvrProjectParam bisInspRsvrProjectParam = new BisInspRsvrProjectParam();//水库工程实体情况 bisInspRsvrProjectParam.setRgstrId(id); bisInspRsvrProjectDao.deleteBy(bisInspRsvrProjectParam); BisInspRsvrBenefitsParam bisInspRsvrBenefitsParam = new BisInspRsvrBenefitsParam();//水库效益发挥情况 bisInspRsvrBenefitsParam.setRgstrId(id); bisInspRsvrBenefitsDao.deleteBy(bisInspRsvrBenefitsParam); BisInspRsvrRgstr bisInspRsvrRgstr = this.bisInspRsvrRgstrDao.get(id); this.bisInspRsvrRgstrDao.delete(id);//删除水库登记表 if (bisInspRsvrRgstr != null) { bisInspAllObjDao.delete(bisInspRsvrRgstr.getObjId());//删除对象名录表 AttRsBaseCrrctParam attRsBaseCrrctParam = new AttRsBaseCrrctParam(); attRsBaseCrrctParam.setObjId(bisInspRsvrRgstr.getObjId()); attRsBaseCrrctDao.deleteBy(attRsBaseCrrctParam); } } else if (BisInspEnum.VILL2020.getValue().equals(objType)) { BisNewVillRgstr villRgstr = bisNewVillRgstrService.get(id); bisNewVillRgstrService.delete(id); BisNewDcuserRelVillParam newDcuserRelVillParam = new BisNewDcuserRelVillParam(); newDcuserRelVillParam.setRegstrId(villRgstr.getId()); bisNewDcuserRelVillService.deleteBy(newDcuserRelVillParam); BisNewWateruserInfoParam newWateruserInfoParam = new BisNewWateruserInfoParam(); newWateruserInfoParam.setRegstrId(villRgstr.getId()); bisNewWateruserInfoService.deleteBy(newWateruserInfoParam); BisNewCountryFeeParam newCountryFeeParam = new BisNewCountryFeeParam(); newCountryFeeParam.setRegstrId(villRgstr.getId()); bisNewCountryFeeService.deleteBy(newCountryFeeParam); } else if (BisInspEnum.VILL.getValue().equals(objType)) {//人饮 BisInspVlgdrinkProjManageParam bisInspVlgdrinkProjManageParam = new BisInspVlgdrinkProjManageParam(); bisInspVlgdrinkProjManageParam.setEngId(id); this.bisInspVlgdrinkProjManageDao.deleteBy(bisInspVlgdrinkProjManageParam);//删除农村饮水工程运行管理情况表 BisInspProSourceProtectParam bisInspProSourceProtectParam = new BisInspProSourceProtectParam(); bisInspProSourceProtectParam.setEngId(id); this.bisInspProSourceProtectDao.deleteBy(bisInspProSourceProtectParam);//删除千人以上供水工程水源地保护登记表 BisInspSecsurveyVlgParam bisInspSecsurveyVlgParam = new BisInspSecsurveyVlgParam(); bisInspSecsurveyVlgParam.setEngId(id); this.bisInspSecsurveyVlgDao.deleteBy(bisInspSecsurveyVlgParam);//删除暗访调研行政村登记表 BisInspVlgdrinkFacOperParam bisInspVlgdrinkFacOperParam = new BisInspVlgdrinkFacOperParam(); bisInspVlgdrinkFacOperParam.setEngId(id); this.bisInspVlgdrinkFacOperDao.deleteBy(bisInspVlgdrinkFacOperParam);//删除村内农村饮水工程设施运行维护情况表 BisInspWateruserInfoParam bisInspWateruserInfoParam = new BisInspWateruserInfoParam(); bisInspWateruserInfoParam.setEngId(id); this.bisInspWateruserInfoDao.deleteBy(bisInspWateruserInfoParam);//删除农村饮水用水户登记表 BisInspManageResponsibilityParam bisInspManageResponsibilityParam = new BisInspManageResponsibilityParam(); bisInspManageResponsibilityParam.setEngId(id); this.bisInspManageResponsibilityDao.deleteBy(bisInspManageResponsibilityParam); BisInspVillRgstr bisInspVillRgstr = this.bisInspVillRgstrDao.get(id); this.bisInspVillRgstrDao.delete(id);//删除登记表 if (bisInspVillRgstr != null) { this.bisInspAllObjDao.delete(bisInspVillRgstr.getObjId());//删除督查对象 } } else if (BisInspEnum.TRACK.getValue().equals(objType)) {//水毁 BisInspWtdstTrack bisInspWtdstTrack = this.bisInspWtdstTrackDao.get(id); this.bisInspWtdstTrackDao.delete(id);//删除登记表 if (bisInspWtdstTrack != null) { this.bisInspAllObjDao.delete(bisInspWtdstTrack.getObjId());//删除督查对象 } } else if (BisInspEnum.EMPWT.getValue().equals(objType)) {//水利工程建设 BisInspKeyRegisterSectionParam bisInspKeyRegisterSectionParam = new BisInspKeyRegisterSectionParam(); bisInspKeyRegisterSectionParam.setRegId(id); //获取172重点水利项目登记表标段基本信息 List bisInspKeyRegisterSectionList = this.bisInspKeyRegisterSectionDao.findList(bisInspKeyRegisterSectionParam); if (bisInspKeyRegisterSectionList.size() > 0) { for (BisInspKeyRegisterSection b : bisInspKeyRegisterSectionList) { BisInspKeyRegSecUnitParam bisInspKeyRegSecUnitParam = new BisInspKeyRegSecUnitParam(); bisInspKeyRegSecUnitParam.setSecId(b.getId()); //删除172重点水利项目标段责任单位 this.bisInspKeyRegSecUnitDao.deleteBy(bisInspKeyRegSecUnitParam); } } //删除172重点水利项目登记表标段 this.bisInspKeyRegisterSectionDao.deleteBy(bisInspKeyRegisterSectionParam); this.attMampuInfoDao.deleteByRegId(id);//删除管理单位信息表 BisInspKeyRegister bisInspKeyRegister = this.bisInspKeyRegisterDao.get(id); this.bisInspKeyRegisterDao.delete(id);//删除登记表 if (bisInspKeyRegister != null) { this.bisInspAllObjDao.delete(bisInspKeyRegister.getObjId());//删除督查对象 } } else if (BisInspEnum.GRW.getValue().equals(objType)) {//地下水 BisInspGrwParam bisInspGrwParam = new BisInspGrwParam(); bisInspGrwParam.setId(id); BisInspGrw bisInspGrw = this.bisInspGrwDao.getBy(bisInspGrwParam); this.bisInspGrwDao.delete(id);//删除登记表 if (bisInspGrw != null) { //删除督查对象 this.bisInspAllObjDao.delete(bisInspGrw.getObjId()); } } else if (BisInspEnum.WAGA.getValue().equals(objType)) {//水闸 BisInspWagaMrsCiParam bisInspWagaMrsCi = new BisInspWagaMrsCiParam(); bisInspWagaMrsCi.setRgstrId(id); //删除水闸督查管理责任体系建设和落实情况 this.bisInspWagaMrsCiDao.deleteBy(bisInspWagaMrsCi); BisInspWagaSafeManageParam bisInspWagaSafeManage = new BisInspWagaSafeManageParam(); bisInspWagaSafeManage.setRgstrId(id); //删除水闸督查安全管理情况 this.bisInspWagaSafeManageDao.deleteBy(bisInspWagaSafeManage); BisInspWagaDmamInfoParam bisInspWagaDmamInfoParam = new BisInspWagaDmamInfoParam(); bisInspWagaDmamInfoParam.setRgstrId(id); //删除水闸督查日常管理和维修养护情况 this.bisInspWagaDmamInfoDao.deleteBy(bisInspWagaDmamInfoParam); BisInspWagaProenInfoParam bisInspWagaProenInfoParam = new BisInspWagaProenInfoParam(); bisInspWagaProenInfoParam.setRgstrId(id); //删除水闸督查工程实体情况 this.bisInspWagaProenInfoDao.deleteBy(bisInspWagaProenInfoParam); AttWagaRgstr attWagaRgstr = this.attWagaRgstrDao.get(id); //删除登记表 this.attWagaRgstrDao.delete(id); if (attWagaRgstr != null) { //删除督查对象 this.bisInspAllObjDao.delete(attWagaRgstr.getObjId()); } } else if (BisInspEnum.EMPWTRUN.getValue().equals(objType)) {//水利工程运行 BisInspKeyRegisterSectionParam bisInspKeyRegisterSectionParam = new BisInspKeyRegisterSectionParam(); bisInspKeyRegisterSectionParam.setRegId(id); //获取172重点水利项目登记表标段基本信息 List bisInspKeyRegisterSectionList = this.bisInspKeyRegisterSectionDao.findList(bisInspKeyRegisterSectionParam); if (bisInspKeyRegisterSectionList.size() > 0) { for (BisInspKeyRegisterSection b : bisInspKeyRegisterSectionList) { BisInspKeyRegSecUnitParam bisInspKeyRegSecUnitParam = new BisInspKeyRegSecUnitParam(); bisInspKeyRegSecUnitParam.setSecId(b.getId()); //删除172重点水利项目标段责任单位 this.bisInspKeyRegSecUnitDao.deleteBy(bisInspKeyRegSecUnitParam); } } //删除172重点水利项目登记表标段 this.bisInspKeyRegisterSectionDao.deleteBy(bisInspKeyRegisterSectionParam); this.attMampuInfoDao.deleteByRegId(id);//删除管理单位信息表 BisInspKeyRegister bisInspKeyRegister = this.bisInspKeyRegisterDao.get(id); this.bisInspKeyRegisterDao.delete(id);//删除登记表 if (bisInspKeyRegister != null) { this.bisInspAllObjDao.delete(bisInspKeyRegister.getObjId());//删除督查对象 } } else if (BisInspEnum.PAWP.getValue().equals(objType)) { //删除专业稽察工作底稿 TacPawpListParam listParam = new TacPawpListParam(); listParam.setRgstrId(id); List l = tacPawpListDao.findList(listParam); for (TacPawpList t : l) { //删除查阅的资料目录 TacPawpDrmParam drmParam = new TacPawpDrmParam(); drmParam.setListId(t.getId()); tacPawpDrmDao.deleteBy(drmParam); } tacPawpListDao.deleteBy(listParam); //删除前期与设计基本情况表 TacPawpPdbstParam pdbstParam = new TacPawpPdbstParam(); pdbstParam.setRgstrId(id); tacPawpPdbstDao.deleteBy(pdbstParam); //删除建设管理基本情况表-项目法人责任制-TAC_PAWP_BSTOCM_PLPRS TacPawpBstocmPlprsParam bstocmPlprsParam = new TacPawpBstocmPlprsParam(); bstocmPlprsParam.setRgstrId(id); tacPawpBstocmPlprsDao.deleteBy(bstocmPlprsParam); //删除建设管理基本情况表-招标投标制-TAC_PAWP_BSTOCM_TSOPBFP TacPawpBstocmTsopbfpParam bstocmTsopbfpParam = new TacPawpBstocmTsopbfpParam(); bstocmTsopbfpParam.setRgstrId(id); List bstocmTsopbfps = tacPawpBstocmTsopbfpDao.findList(bstocmTsopbfpParam); for (TacPawpBstocmTsopbfp t : bstocmTsopbfps ) { //删除建设管理基本情况表-招标投标制-标段-TAC_PAWP_BSTOCM_TSOPBFP_SCTN TacPawpBstocmTsopbfpSctnParam bstocmTsopbfpSctnParam = new TacPawpBstocmTsopbfpSctnParam(); bstocmTsopbfpSctnParam.setTsopbfpId(t.getId()); tacPawpBstocmTsopbfpSctnDao.deleteBy(bstocmTsopbfpSctnParam); //删除建设监理单位与标段关系表-TAC_PAWP_BSTOCM_SCTN TacPawpBstocmSctnParam bstocmSctnParam = new TacPawpBstocmSctnParam(); bstocmSctnParam.setSctnId(t.getId()); tacPawpBstocmSctnDao.deleteBy(bstocmSctnParam); } tacPawpBstocmTsopbfpDao.deleteBy(bstocmTsopbfpParam); //删除建设管理基本情况表-建设监理制-TAC_PAWP_BSTOCM_CPSS TacPawpBstocmCpssInfoParam tacPawpBstocmCpssInfoParam = new TacPawpBstocmCpssInfoParam(); tacPawpBstocmCpssInfoParam.setRgstrId(id); List pawpBstocmCpsses = tacPawpBstocmCpssInfoDao.findList(tacPawpBstocmCpssInfoParam); for (TacPawpBstocmCpssInfo pawpBstocmCpssInfo : pawpBstocmCpsses) { TacPawpBstocmCpssParam bstocmCpssParam = new TacPawpBstocmCpssParam(); bstocmCpssParam.setCpssId(pawpBstocmCpssInfo.getId()); tacPawpBstocmCpssDao.deleteBy(bstocmCpssParam); } tacPawpBstocmCpssInfoDao.deleteBy(tacPawpBstocmCpssInfoParam); //删除建设管理基本情况表-合同管理制-TAC_PAWP_BSTOCM_CMS TacPawpBstocmCmsParam bstocmCmsParam = new TacPawpBstocmCmsParam(); bstocmCmsParam.setRgstrId(id); List bstocmCms = tacPawpBstocmCmsDao.findList(bstocmCmsParam); for (TacPawpBstocmCms t : bstocmCms ) { //删除建设管理基本情况表-合同管理制-合同列表-TAC_PAWP_BSTOCM_CMS_PACT_LIST TacPawpBstocmCmsPactListParam bstocmCmsPactListParam = new TacPawpBstocmCmsPactListParam(); bstocmCmsPactListParam.setCmsId(t.getId()); tacPawpBstocmCmsPactListDao.deleteBy(bstocmCmsPactListParam); } tacPawpBstocmCmsDao.deleteBy(bstocmCmsParam); //删除计划下达与执行基本情况表-TAC_PAWP_RAIOBIS TacPawpRaiobisParam raiobisParam = new TacPawpRaiobisParam(); raiobisParam.setRgstrId(id); tacPawpRaiobisDao.deleteBy(raiobisParam); //删除资金使用与管理基本情况表-TAC_PAWP_BIOFUAM TacPawpBiofuamParam biofuamParam = new TacPawpBiofuamParam(); biofuamParam.setRgstrId(id); tacPawpBiofuamDao.deleteBy(biofuamParam); //删除工程质量基本情况表--质量管理体制-TAC_PAWP_BITOPQ_QMS TacPawpBitopqQmsParam bitopqQmsParam = new TacPawpBitopqQmsParam(); bitopqQmsParam.setRgstrId(id); tacPawpBitopqQmsDao.deleteBy(bitopqQmsParam); //删除工程质量基本情况表--工程实体质量与验收-TAC_PAWP_BITOPQ_PEQAA TacPawpBitopqPeqaaParam bitopqPeqaaParam = new TacPawpBitopqPeqaaParam(); bitopqPeqaaParam.setRgstrId(id); tacPawpBitopqPeqaaDao.deleteBy(bitopqPeqaaParam); //删除工程安全基本情况表--项目法人-TAC_PAWP_BIOES_PE TacPawpBioesPeParam bioesPeParam = new TacPawpBioesPeParam(); bioesPeParam.setRgstrId(id); tacPawpBioesPeDao.deleteBy(bioesPeParam); //删除工程安全基本情况表--施工单位-TAC_PAWP_BIOES_RWUNIT TacPawpBioesRwunitParam bioesRwunitParam = new TacPawpBioesRwunitParam(); bioesRwunitParam.setRgstrId(id); tacPawpBioesRwunitDao.deleteBy(bioesRwunitParam); //稽察项目登记表 TacPawpRgstr tacPawpRgstr = tacPawpRgstrDao.get(id); //删除稽察项目登记表 tacPawpRgstrDao.delete(id); if (tacPawpRgstr != null) { //删除稽察项目相关问题 //删除督查对象 this.bisInspAllObjDao.delete(tacPawpRgstr.getObjId()); } } else if (BisInspEnum.FSC.getValue().equals(objType)) { BisInspFscRgstr rgstr = bisInspFscRgstrDao.get(id); bisInspFscRgstrDao.delete(id); if (rgstr != null) { this.bisInspAllObjDao.delete(rgstr.getObjId()); } } else if (BisInspEnum.OTHER.getValue().equals(objType)) { BisInspOtherRgstr rgstr = bisInspOtherRgstrDao.get(id); bisInspOtherRgstrDao.delete(id); if (rgstr != null) { this.bisInspAllObjDao.delete(rgstr.getObjId()); } } else if (BisInspEnum.SD.getValue().equals(objType)) { BisInspSdRgstr rgstr = bisInspSdRgstrDao.get(id); bisInspSdRgstrDao.delete(id); if (rgstr != null) { this.bisInspAllObjDao.delete(rgstr.getObjId()); } } else if (BisInspEnum.WIU.getValue().equals(objType)) { //删除取水单位取用水情况 BisInspWiuRgstrIntInfoParam param = new BisInspWiuRgstrIntInfoParam(); param.setRgstrId(id); wiuRgstrIntInfoDao.deleteBy(param); //删除取水许可审批监管情况 BisInspWiuRgstrApprInfoParam apprInfoParam = new BisInspWiuRgstrApprInfoParam(); apprInfoParam.setRgstrId(id); wiuRgstrApprInfoDao.deleteBy(apprInfoParam); BisInspWiuRgstr rgstr = wiuRgstrDao.get(id); wiuRgstrDao.delete(id); if (rgstr != null) { this.bisInspAllObjDao.delete(rgstr.getObjId()); } } else if (BisInspEnum.SWHS.getValue().equals(objType)) { //删除安全保障达标落实情况表 BisInspSwhsRgstrSafetyParam safetyParam = new BisInspSwhsRgstrSafetyParam(); safetyParam.setRgstrId(id); swhsRgstrSafetyDao.deleteBy(safetyParam); //删除保护措施监管情况 BisInspSwhsRgstrMeasuresParam measuresParam = new BisInspSwhsRgstrMeasuresParam(); measuresParam.setId(id); swhsRgstrMeasuresDao.deleteBy(measuresParam); //删除地级行政区应急备用水源建设情况表 BisInspSwhsRgstrWaterParam waterParam = new BisInspSwhsRgstrWaterParam(); waterParam.setRgstrId(id); swhsRgstrWaterDao.deleteBy(waterParam); BisInspSwhsRgstr rgstr = swhsRgstrDao.get(id); swhsRgstrDao.delete(id); if (rgstr != null) { this.bisInspAllObjDao.delete(rgstr.getObjId()); } } else if (BisInspEnum.CITY.getValue().equals(objType)) { BisInspWintRgstrIntInfoParam intInfoParam = new BisInspWintRgstrIntInfoParam(); intInfoParam.setRgstrId(id); wintRgstrIntInfoDao.deleteBy(intInfoParam); BisInspWintRgstr rgstr = wintRgstrDao.get(id); wintRgstrDao.delete(id); if (rgstr != null) { this.bisInspAllObjDao.delete(rgstr.getObjId()); } } else if (BisInspEnum.SVWT.getValue().equals(objType)) { BisInspSvwtAreaRgstrWswmParam wswmParam = new BisInspSvwtAreaRgstrWswmParam(); wswmParam.setRgstrId(id); svwtAreaWswmDao.deleteBy(wswmParam); BisInspSvwtAreaRgstrWseParam wseParam = new BisInspSvwtAreaRgstrWseParam(); wseParam.setRgstrId(id); svwtAreaWseDao.deleteBy(wseParam); BisInspSvwtAreaRgstr rgstr = svwtAreaRgstrDao.get(id); if (rgstr != null) { this.bisInspAllObjDao.delete(rgstr.getObjId()); } } else if (BisInspEnum.WUNT.getValue().equalsIgnoreCase(objType)) { BisInspSvwtWuntRgstrWuuswParam wuuswParam = new BisInspSvwtWuntRgstrWuuswParam(); wuuswParam.setRgstrId(id); svwtWuntWuuswDao.deleteBy(wuuswParam); BisInspSvwtWuntRgstrWsuswParam wsuswParam = new BisInspSvwtWuntRgstrWsuswParam(); wsuswParam.setRgstrId(id); svwtWuntWsuswDao.deleteBy(wsuswParam); BisInspSvwtWuntRgstr rgstr = svwtWuntRgstrDao.get(id); if (rgstr != null) { this.bisInspAllObjDao.delete(rgstr.getObjId()); } } else if (BisInspEnum.PRD.getValue().equals(objType)) { BisInspOprdCstrProjRgstr rgstr = oprdCstrProjRgstrDao.get(id); oprdCstrProjRgstrDao.delete(id); if (rgstr != null) { this.bisInspAllObjDao.delete(rgstr.getObjId()); } } else if (BisInspEnum.JSFL.getValue().equals(objType)) { AttJskejianFlkdisRgstr rgstr = jskejianFlkdisRgstrDao.get(id); jskejianFlkdisRgstrDao.delete(id); if (rgstr != null) { this.bisInspAllObjDao.delete(rgstr.getObjId()); } } else if (BisInspEnum.JSWA.getValue().equals(objType)) { AttJskejianWaterRgstr rgstr = jskejianWaterRgstrDao.get(id); jskejianWaterRgstrDao.delete(id); if (rgstr != null) { this.bisInspAllObjDao.delete(rgstr.getObjId()); } } else if (BisInspEnum.ECOFRD.getValue().equals(objType)) { AttJskejianEcofrdRgstr rgstr = jskejianEcofrdRgstrDao.get(id); jskejianEcofrdRgstrDao.delete(id); if (rgstr != null) { this.bisInspAllObjDao.delete(rgstr.getObjId()); } } else if (BisInspEnum.RSML.getValue().equals(objType)) { //三个责任人 BisInspRsmlRgstrPresParam presParam = new BisInspRsmlRgstrPresParam(); presParam.setRgstrId(id); bisInspRsmlRgstrPresDao.deleteBy(presParam); //运行管理 BisInspRsmlRgstrRunManageParam runManageParam = new BisInspRsmlRgstrRunManageParam(); runManageParam.setRgstrId(id); bisInspRsmlRgstrRunManageDao.deleteBy(runManageParam); //实体责任 BisInspRsmlRgstrProjectParam projectParam = new BisInspRsmlRgstrProjectParam(); projectParam.setRgstrId(id); bisInspRsmlRgstrProjectDao.deleteBy(projectParam); BisInspRsmlRgstr rgstr = bisInspRsmlRgstrDao.get(id); bisInspRsmlRgstrDao.delete(id); if (rgstr != null) { this.bisInspAllObjDao.delete(rgstr.getObjId()); } } else if (BisInspEnum.RSFCO.getValue().equals(objType)) { BisInspRsfcoRgstrBaseParam baseParam = new BisInspRsfcoRgstrBaseParam(); baseParam.setRgstrId(id); bisInspRsfcoRgstrBaseDao.deleteBy(baseParam); BisInspRsfcoRgstrFlliParam flliParam = new BisInspRsfcoRgstrFlliParam(); flliParam.setRgstrId(id); bisInspRsfcoRgstrFlliDao.deleteBy(flliParam); BisInspRsfcoRgstrAoeparoParam aoeparoParam = new BisInspRsfcoRgstrAoeparoParam(); aoeparoParam.setRgstrId(id); bisInspRsfcoRgstrAoeparoDao.deleteBy(aoeparoParam); this.bisInspRsfcoRgstrService.delete(id);//删除水库登记表 } else if (BisInspEnum.MFDP.getValue().equals(objType)) { bisInspMfdpRgstrService.delete(id); } } /** * 获取督查组相关的对象、人员、区域信息 * * @param persid * @param ptype * @param id * @return */ @Override public List getAllInfoByPersid(String persid, String ptype, String id, String orgId) { ptype = "00" + ptype; String province = inspOrgService.getProvince(orgId); List persAllInfoDtoList = this.supervisionPlanDao.getAllInfoByPersid(persid, ptype, id, orgId, province); if (persAllInfoDtoList.size() > 0) { for (PersAllInfoDto p : persAllInfoDtoList) { List persAllDtoList = this.supervisionPlanDao.getPersAllDtoList(p.getId(), orgId, province); List persAllObjDtoList = this.supervisionPlanDao.getPersAllObjDtoListByType(p.getId(), ptype, orgId, province); List persAllAreaDtoList = this.supervisionPlanDao.getPersAllAreaDtoList(p.getId(), orgId, province); p.setPersAllDtoList(persAllDtoList); p.setPersAllObjDtoList(persAllObjDtoList); p.setPersAllAreaDtoList(persAllAreaDtoList); } } return persAllInfoDtoList; } /** * 添加督查小组,不存在批次时同时添加批次 * * @param groupInfoDto * @return */ @Override public String insertGroupInfo(GroupInfoDto groupInfoDto) { if (groupInfoDto.getPtype().length() == 1) {//将类型拼成类似于001这种格式 groupInfoDto.setPtype("00" + groupInfoDto.getPtype()); } String province = inspOrgService.getProvince(groupInfoDto.getOrgId()); if (groupInfoDto.getPtype().length() == 2) {//将类型拼成类似于001这种格式 groupInfoDto.setPtype("0" + groupInfoDto.getPtype()); } AllNodeDto nameDto = this.supervisionPlanDao.getNodeById(groupInfoDto.getPtype() + groupInfoDto.getOrgId()); if (nameDto == null) { BisInspOrg bisInspOrg = bisInspOrgDao.get(groupInfoDto.getOrgId()); BisInspAllNodeDto bisInspAllNodeDto = new BisInspAllNodeDto(); String groupId = groupInfoDto.getPtype() + groupInfoDto.getOrgId(); bisInspAllNodeDto.setId(groupId); bisInspAllNodeDto.setPnm(bisInspOrg.getOrgNm()); String pid = groupInfoDto.getPtype(); bisInspAllNodeDto.setPid(pid); bisInspAllNodeDto.setSttm(groupInfoDto.getSttm()); bisInspAllNodeDto.setEntm(groupInfoDto.getEntm()); bisInspAllNodeDto.setInspYear(groupInfoDto.getInspYear()); bisInspAllNodeDto.setProvince(province); bisInspAllNodeDto.setInspMnth(groupInfoDto.getInspMnth()); String intm = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); bisInspAllNodeDto.setIntm(intm); this.supervisionPlanDao.insertNode(bisInspAllNodeDto);//新建批次 } String id = groupInfoDto.getPtype() + groupInfoDto.getOrgId() + "___"; //查询是否存在批次insertGroupInfo ObjectNameDto objectNameDto = this.supervisionPlanDao.getNodeBy(id, groupInfoDto.getInspYear(), groupInfoDto.getInspMnth(), groupInfoDto.getOrgId(), province); if (objectNameDto == null) {//如果为空,新建批次 BisInspAllNodeDto bisInspAllNodeDto = new BisInspAllNodeDto(); String groupId = groupInfoDto.getPtype() + groupInfoDto.getOrgId() + "0" + groupInfoDto.getInspMnth(); BisInspAll max = bisInspAllDao.getMaxOne(groupInfoDto.getPtype() + groupInfoDto.getOrgId(), null); if (null != max) { Long upOne = NumberUtils.toLong(max.getId()); groupId = String.format("%0" + max.getId().length() + "d", (upOne + 1)); } bisInspAllNodeDto.setId(groupId); bisInspAllNodeDto.setPnm(groupInfoDto.getInspYear() + "年" + groupInfoDto.getInspMnth() + "月督查"); String pid = groupInfoDto.getPtype() + groupInfoDto.getOrgId(); bisInspAllNodeDto.setPid(pid); bisInspAllNodeDto.setSttm(groupInfoDto.getSttm()); bisInspAllNodeDto.setEntm(groupInfoDto.getEntm()); bisInspAllNodeDto.setInspYear(groupInfoDto.getInspYear()); bisInspAllNodeDto.setInspMnth(groupInfoDto.getInspMnth()); bisInspAllNodeDto.setOrgId(groupInfoDto.getOrgId()); bisInspAllNodeDto.setProvince(province); bisInspAllNodeDto.setInspType(groupInfoDto.getPtype()); String intm = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); bisInspAllNodeDto.setIntm(intm); this.supervisionPlanDao.insertNode(bisInspAllNodeDto);//新建批次 String gid = groupId + "001"; bisInspAllNodeDto.setId(gid); bisInspAllNodeDto.setPnm(groupInfoDto.getName()); bisInspAllNodeDto.setPid(groupId); bisInspAllNodeDto.setInspTask(groupInfoDto.getInspTask()); bisInspAllNodeDto.setProvince(province); this.supervisionPlanDao.insertNode(bisInspAllNodeDto);//新建组 return gid; } else {//如果存在批次 String newGroupId = ""; ObjIdDto objIdDto = this.supervisionPlanDao.getMaxGroupId(objectNameDto.getId(), objectNameDto.getOrgId(), province);//获取最新组id if (objIdDto.getId() != null) {//如果该批次下有组,则组id加1 String rtId = objIdDto.getId().substring(objIdDto.getId().length() - 1, objIdDto.getId().length()); int i = Integer.parseInt(rtId) + 1; newGroupId = String.valueOf(i); if ("10".equals(newGroupId)) {//新建组id末尾为10的时候进行截取处理 String sid = objIdDto.getId().substring(objIdDto.getId().length() - 2, objIdDto.getId().length() - 1); int j = Integer.parseInt(sid) + 1; String ss = String.valueOf(j); newGroupId = objIdDto.getId().substring(0, objIdDto.getId().length() - 2) + ss + "0"; } else { newGroupId = objIdDto.getId().substring(0, objIdDto.getId().length() - 1) + newGroupId; } } else {//如果该批次下没有组,则组id后三位为001 newGroupId = objectNameDto.getId() + "001"; } BisInspAllNodeDto bisInspAllNodeDto = new BisInspAllNodeDto(); bisInspAllNodeDto.setId(newGroupId); bisInspAllNodeDto.setPnm(groupInfoDto.getName()); bisInspAllNodeDto.setPid(objectNameDto.getId()); bisInspAllNodeDto.setSttm(groupInfoDto.getSttm()); bisInspAllNodeDto.setEntm(groupInfoDto.getEntm()); bisInspAllNodeDto.setInspType(groupInfoDto.getPtype()); bisInspAllNodeDto.setOrgId(groupInfoDto.getOrgId()); bisInspAllNodeDto.setInspYear(groupInfoDto.getInspYear()); bisInspAllNodeDto.setInspMnth(groupInfoDto.getInspMnth()); bisInspAllNodeDto.setProvince(province); String intm = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); bisInspAllNodeDto.setIntm(intm); bisInspAllNodeDto.setInspTask(groupInfoDto.getInspTask()); this.supervisionPlanDao.insertNode(bisInspAllNodeDto);//新建组 return newGroupId; } } /** * 根据id修改节点 * * @param bisInspAllDto */ @Override public void updateNode(BisInspAllDto bisInspAllDto) { this.supervisionPlanDao.updateNode(bisInspAllDto); } /** * 清空督查对象(根据obj_id) * * @param objType * @param objId */ @Override public void cleanObjDataByObjId(String objType, String objId) { BisInspObjStrategy strategy = factory.createStrategy(objType); if (strategy != null) { strategy.cleanObjData(objId); } // 删除问题 BisInspPblmParam bisInspPblmParam = new BisInspPblmParam(); bisInspPblmParam.setObjId(objId); bisInspPblmParam.setObjType(BisInspEnum.WRWS.getValue()); bisInspPblmDao.deleteBy(bisInspPblmParam); // 删除对象名录表 BisInspAllObjParam bisInspAllObjParam = new BisInspAllObjParam(); bisInspAllObjParam.setObjId(objId); bisInspAllObjDao.deleteBy(bisInspAllObjParam); } @Override public void cleanObjDataByObjIds(String objType, List objIds) { BisInspObjStrategy strategy = factory.createStrategy(objType); if (strategy != null) { for (String objId : objIds) { strategy.cleanObjData(objId); // 删除问题 BisInspPblmParam bisInspPblmParam = new BisInspPblmParam(); bisInspPblmParam.setObjId(objId); bisInspPblmParam.setObjType(BisInspEnum.WRWS.getValue()); bisInspPblmDao.deleteBy(bisInspPblmParam); // 删除对象名录表 BisInspAllObjParam bisInspAllObjParam = new BisInspAllObjParam(); bisInspAllObjParam.setObjId(objId); bisInspAllObjDao.deleteBy(bisInspAllObjParam); } } } /** * 清空督查组信息 * * @param groupId */ @Override public void cleanGroupInfo(String groupId, String orgId) { BisInspAllObjParam bisInspObjParam = new BisInspAllObjParam(); bisInspObjParam.setId(groupId); //根据组id获取objid bisInspObjParam.setOrgId(orgId); List bisInspAllObjList = this.bisInspAllObjDao.findList(bisInspObjParam); if (bisInspAllObjList.size() > 0) { for (BisInspAllObj bisInspAllObj : bisInspAllObjList) { //根据objid删除登记表等数据 cleanObjDataByObjId(String.valueOf(Integer.parseInt(groupId.substring(0, 3))), bisInspAllObj.getObjId()); } } BisInspSelAreaParam bisInspSelAreaParam = new BisInspSelAreaParam(); bisInspSelAreaParam.setId(groupId); //删除督查区域 this.bisInspSelAreaDao.deleteBy(bisInspSelAreaParam); BisInspAllRlationParam bisInspAllRlationParam = new BisInspAllRlationParam(); bisInspAllRlationParam.setId(groupId); //删除督查人员 this.bisInspAllRlationDao.deleteBy(bisInspAllRlationParam); //删除组 this.bisInspAllDao.delete(groupId); //删除上一级 BisInspAllParam bisInspAllParam = new BisInspAllParam(); bisInspAllParam.setPid(groupId.substring(0, groupId.length() - 3)); List bisInspAlls = this.bisInspAllDao.findList(bisInspAllParam); if (bisInspAlls == null || bisInspAlls.size() == 0) { this.bisInspAllDao.delete(groupId.substring(0, groupId.length() - 3)); } } /** * 复用督查组信息 * * @param allGroupInfoDto */ @Override public void copyGroupInfo(AllGroupInfoDto allGroupInfoDto) { //督查类型 String province = inspOrgService.getProvince(allGroupInfoDto.getOrgId()); if (allGroupInfoDto.getPtype().length() == 1) { allGroupInfoDto.setPtype("00" + allGroupInfoDto.getPtype()); } if (allGroupInfoDto.getPtype().length() == 2) { allGroupInfoDto.setPtype("0" + allGroupInfoDto.getPtype()); } String id = allGroupInfoDto.getPtype() + allGroupInfoDto.getOrgId() + "___"; //查询是否存在批次 ObjectNameDto objectNameDto = this.supervisionPlanDao.getNodeBy(id, allGroupInfoDto.getInspYear(), allGroupInfoDto.getInspMnth(), allGroupInfoDto.getOrgId(), province); if (objectNameDto == null) {//如果为空,新建批次 BisInspAllNodeDto bisInspAllNodeDto = new BisInspAllNodeDto(); String groupId = allGroupInfoDto.getPtype() + allGroupInfoDto.getOrgId() + "0" + allGroupInfoDto.getInspMnth(); bisInspAllNodeDto.setId(groupId); bisInspAllNodeDto.setPnm(allGroupInfoDto.getInspYear() + "年" + allGroupInfoDto.getInspMnth() + "月督查"); String pid = allGroupInfoDto.getPtype() + allGroupInfoDto.getOrgId(); bisInspAllNodeDto.setPid(pid); bisInspAllNodeDto.setInspYear(allGroupInfoDto.getInspYear()); bisInspAllNodeDto.setInspMnth(allGroupInfoDto.getInspMnth()); bisInspAllNodeDto.setSttm(allGroupInfoDto.getSttm()); bisInspAllNodeDto.setOrgId(allGroupInfoDto.getOrgId()); bisInspAllNodeDto.setEntm(allGroupInfoDto.getEntm()); bisInspAllNodeDto.setProvince(province); this.supervisionPlanDao.insertNode(bisInspAllNodeDto);//新建批次 String gid = groupId + "001"; bisInspAllNodeDto.setId(gid); bisInspAllNodeDto.setPnm("复用1组"); bisInspAllNodeDto.setPid(groupId); bisInspAllNodeDto.setProvince(province); this.supervisionPlanDao.insertNode(bisInspAllNodeDto);//新建组 //将人员和区域关联到新建组里 if (allGroupInfoDto.getPersAllDtoList().size() > 0) { for (PersAllDto persAllDto : allGroupInfoDto.getPersAllDtoList()) { //添加人员 this.supervisionPlanDao.insertPers(gid, persAllDto.getGuid(), persAllDto.getPersType(), allGroupInfoDto.getOrgId(), province, String.valueOf(Integer.parseInt(gid))); } } if (allGroupInfoDto.getPersAllAreaDtoList().size() > 0) { for (PersAllAreaDto persAllAreaDto : allGroupInfoDto.getPersAllAreaDtoList()) { //添加区域 String uuid = UuidUtil.uuid(); this.supervisionPlanDao.insertSupArea(uuid, gid, persAllAreaDto.getAdCode(), persAllAreaDto.getAdName(), allGroupInfoDto.getOrgId(), province); } } } else {//如果存在批次 String newGroupId = ""; ObjIdDto objIdDto = this.supervisionPlanDao.getMaxGroupId(objectNameDto.getId(), objectNameDto.getOrgId(), province);//获取最新组id if (objIdDto.getId() != null) {//如果该批次下有组,则组id加1 String rtId = objIdDto.getId().substring(objIdDto.getId().length() - 1, objIdDto.getId().length()); int i = Integer.parseInt(rtId) + 1; newGroupId = String.valueOf(i); if ("10".equals(newGroupId)) {//新建组id末尾为10的时候进行截取处理 String sid = objIdDto.getId().substring(objIdDto.getId().length() - 2, objIdDto.getId().length() - 1); int j = Integer.parseInt(sid) + 1; String ss = String.valueOf(j); newGroupId = objIdDto.getId().substring(0, objIdDto.getId().length() - 2) + ss + "0"; } else { newGroupId = objIdDto.getId().substring(0, objIdDto.getId().length() - 1) + newGroupId; } } else {//如果该批次下没有组,则组id后三位为001 newGroupId = objectNameDto.getId() + "001"; } BisInspAllNodeDto bisInspAllNodeDto = new BisInspAllNodeDto(); bisInspAllNodeDto.setId(newGroupId); bisInspAllNodeDto.setPnm("复用" + newGroupId.substring(newGroupId.length() - 1, newGroupId.length()) + "组"); bisInspAllNodeDto.setPid(objectNameDto.getId()); bisInspAllNodeDto.setOrgId(objectNameDto.getOrgId()); bisInspAllNodeDto.setInspYear(allGroupInfoDto.getInspYear()); bisInspAllNodeDto.setInspMnth(allGroupInfoDto.getInspMnth()); bisInspAllNodeDto.setSttm(allGroupInfoDto.getSttm()); bisInspAllNodeDto.setEntm(allGroupInfoDto.getEntm()); this.supervisionPlanDao.insertNode(bisInspAllNodeDto);//新建组 if (allGroupInfoDto.getPersAllDtoList().size() > 0) { for (PersAllDto persAllDto : allGroupInfoDto.getPersAllDtoList()) { //添加人员 this.supervisionPlanDao.insertPers(newGroupId, persAllDto.getGuid(), persAllDto.getPersType(), allGroupInfoDto.getOrgId(), province, String.valueOf(Integer.parseInt(newGroupId.substring(0, 3)))); } } if (allGroupInfoDto.getPersAllAreaDtoList().size() > 0) { for (PersAllAreaDto persAllAreaDto : allGroupInfoDto.getPersAllAreaDtoList()) { //添加区域 String uuid = UuidUtil.uuid(); this.supervisionPlanDao.insertSupArea(uuid, newGroupId, persAllAreaDto.getAdCode(), persAllAreaDto.getAdName(), objectNameDto.getOrgId(), province); } } } } @Override public List getPersAllAreaDtoList(String id, String orgId) { String province = inspOrgService.getProvince(orgId); List persAllAreaDtoList = this.supervisionPlanDao.getPersAllAreaDtoList(id, orgId, province); return persAllAreaDtoList; } @Override public Map importExcel(MultipartFile file, String persId, String orgId) { Map map = new HashedMap(); int success = 0; int fail = 0; Workbook wb = null; InputStream fis = null; List rowList = new ArrayList(); try { fis = file.getInputStream(); if (file.getOriginalFilename().endsWith(XLS)) { wb = new HSSFWorkbook(fis); } else { wb = new XSSFWorkbook(fis); } Sheet sheet = wb.getSheetAt(0); Row row = null; int lastRowNum = sheet.getPhysicalNumberOfRows(); for (int i = sheet.getFirstRowNum(); i < lastRowNum; i++) { row = sheet.getRow(i); if (row != null) { rowList.add(row); } } } catch (IOException e) { e.printStackTrace(); } finally { if (wb != null) { try { wb.close(); } catch (IOException e) { e.printStackTrace(); } } if (fis != null) { try { fis.close(); } catch (IOException e) { e.printStackTrace(); } } } List list = new ArrayList<>(); if (rowList.size() > 2) { Row row = null; for (int i = 2; i < rowList.size(); i++) { row = rowList.get(i); GroupInfoDto groupInfoDto = new GroupInfoDto(); for (int j = row.getFirstCellNum(); j < row.getPhysicalNumberOfCells(); j++) { Cell cell = row.getCell(j); if (cell == null) { continue; } if (j == 1) { groupInfoDto.setPtype(fomateType(cleanFomate(String.valueOf(cell)))); } if (j == 2) { groupInfoDto.setName(cleanFomate(String.valueOf(cell))); } if (j == 3) { Double db = cell.getNumericCellValue(); if (db != null) { groupInfoDto.setInspYear(String.valueOf(db.intValue())); } } if (j == 4) { Double db = cell.getNumericCellValue(); if (db != null) { groupInfoDto.setInspMnth(String.valueOf(db.intValue())); } } if (j == 5) { String areaNames = cleanFomate(String.valueOf(cell)); List persAllAreaDtoList = convertAreaNamesToDto(map, fail, areaNames); groupInfoDto.setPersAllAreaDtoList(persAllAreaDtoList); } if (j == 6) { String objNames = cleanFomate(String.valueOf(cell)); List persAllObjDtoLis = convertObjNamesToDto(map, fail, objNames, groupInfoDto.getPtype()); groupInfoDto.setPersAllObjDtoList(persAllObjDtoLis); } if (j == 7) { String persNames = cleanFomate(String.valueOf(cell)); List persList = convertPersIdsToDto(map, fail, persNames, "1"); groupInfoDto.setPersList(persList); } if (j == 8) { String persNames = cleanFomate(String.valueOf(cell)); List persList = convertPersIdsToDto(map, fail, persNames, "2"); groupInfoDto.setPersList(persList); } if (j == 9) { String persNames = cleanFomate(String.valueOf(cell)); List persList = convertPersIdsToDto(map, fail, persNames, "3"); groupInfoDto.setPersList(persList); } if (j == 10) { String persNames = cleanFomate(String.valueOf(cell)); List persList = convertPersIdsToDto(map, fail, persNames, "4"); groupInfoDto.setPersList(persList); } if (j == 11) { groupInfoDto.setSttm(cleanFomate(String.valueOf(cell)).replace("/", "-")); } if (j == 12) { groupInfoDto.setEntm(cleanFomate(String.valueOf(cell)).replace("/", "-")); } } if (StringUtils.isNotBlank(groupInfoDto.getPtype())) { list.add(groupInfoDto); } } } if (list.size() > 0) { for (GroupInfoDto groupInfoDto : list) { try { groupInfoDto.setOrgId(orgId); String groupId = insertGroupInfo(groupInfoDto); if (StringUtils.isBlank(groupId)) { fail++; if (map.get("false") == null) { List message = new ArrayList<>(); message.add(groupInfoDto.getName() + "添加失败"); map.put("false", message); } else { ((List) map.get("false")).add(groupInfoDto.getName() + "添加失败"); } } PersAllInfoDto persAllInfoDto = new PersAllInfoDto(); persAllInfoDto.setPersid(persId); persAllInfoDto.setId(groupId); persAllInfoDto.setPersAllAreaDtoList(groupInfoDto.getPersAllAreaDtoList() == null ? new ArrayList<>() : groupInfoDto.getPersAllAreaDtoList()); persAllInfoDto.setPersAllDtoList(groupInfoDto.getPersList() == null ? new ArrayList<>() : groupInfoDto.getPersList()); persAllInfoDto.setPersAllObjDtoList(groupInfoDto.getPersAllObjDtoList() == null ? new ArrayList<>() : groupInfoDto.getPersAllObjDtoList()); insertSupervisionObj(persAllInfoDto); success++; } catch (Exception e) { fail++; if (map.get("false") == null) { List message = new ArrayList<>(); message.add(groupInfoDto.getName() + "添加失败"); map.put("false", message); } else { ((List) map.get("false")).add(groupInfoDto.getName() + "添加失败"); } } } } map.put("success", success); map.put("fail", fail); return map; } @Override public Map getYearMonth(String id) { return this.supervisionPlanDao.getYearMonth(id); } private List convertObjNamesToDto(Map map, int fail, String objNames, String ptype) { List list = new ArrayList<>(); if (StringUtils.isBlank(objNames)) { return list; } if (objNames.contains(",")) { for (String objName : objNames.split(",")) { getObjDtoByName(objName, list, map, fail, ptype); } } else { getObjDtoByName(objNames, list, map, fail, ptype); } return list; } private void getObjDtoByName(String objName, List list, Map map, int fail, String ptype) { if (BisInspEnum.REVER.getValue().equals(ptype) || BisInspEnum.RSFCO.getValue().endsWith(ptype)) { AttRsBaseParam baseParam = new AttRsBaseParam(); baseParam.setRsName(objName); List baseList = attRsBaseDao.findList(baseParam); if (baseList.size() == 1) { PersAllObjDto objDto = new PersAllObjDto(); objDto.setCode(baseList.get(0).getRsCode()); objDto.setName(baseList.get(0).getRsName()); objDto.setPtype(ptype); list.add(objDto); } else if (baseList.size() == 0) { setFailMessage(map, fail, objName, "水库不存在"); } else if (baseList.size() > 1) { setFailMessage(map, fail, objName, "水库名称重复"); } } else if (BisInspEnum.VILL.getValue().equals(ptype) || BisInspEnum.CITY.getValue().equals(ptype) || BisInspEnum.SVWT.getValue().equals(ptype) || BisInspEnum.VILL2020.getValue().endsWith(ptype) || BisInspEnum.MFDP.getValue().endsWith(ptype) || BisInspEnum.IRR.getValue().endsWith(ptype)) { AttAdXBaseParam baseParam = new AttAdXBaseParam(); baseParam.setAdName(objName); baseParam.setAdGrad("3"); List baseList = attAdXBaseDao.findList(baseParam); if (baseList.size() == 1) { PersAllObjDto objDto = new PersAllObjDto(); objDto.setPtype(ptype); objDto.setCode(baseList.get(0).getAdCode()); objDto.setName(baseList.get(0).getAdName()); list.add(objDto); } else if (baseList.size() == 0) { setFailMessage(map, fail, objName, "地区不存在"); } else if (baseList.size() > 1) { setFailMessage(map, fail, objName, "地区重复"); } } else if (BisInspEnum.TRACK.getValue().equals(ptype)) { BisInspWtdstParam param = new BisInspWtdstParam(); param.setWtdstNm(objName); List baseList = bisInspWtdstDao.findList(param); if (baseList.size() == 1) { PersAllObjDto objDto = new PersAllObjDto(); objDto.setName(baseList.get(0).getWtdstNm()); objDto.setCode(baseList.get(0).getWtdstId()); objDto.setPtype(ptype); list.add(objDto); } else if (baseList.size() == 0) { setFailMessage(map, fail, objName, "工程不存在"); } else if (baseList.size() > 1) { setFailMessage(map, fail, objName, "工程重复"); } } else if (BisInspEnum.EMPWT.getValue().equals(ptype) || BisInspEnum.EMPWTRUN.getValue().equals(ptype)) { AttEmpwtprjBaseParam param = new AttEmpwtprjBaseParam(); param.setNm(objName); List baseList = attEmpwtprjBaseDao.findList(param); if (baseList.size() == 1) { PersAllObjDto objDto = new PersAllObjDto(); objDto.setPtype(ptype); objDto.setCode(baseList.get(0).getId()); objDto.setName(baseList.get(0).getNm()); list.add(objDto); } else if (baseList.size() == 0) { setFailMessage(map, fail, objName, "工程不存在"); } else if (baseList.size() > 1) { setFailMessage(map, fail, objName, "工程重复"); } } else if (BisInspEnum.GRW.getValue().equals(ptype)) { AttGrwBaseParam param = new AttGrwBaseParam(); param.setStnm(objName); List baseList = grwBaseDao.findList(param); if (baseList.size() == 1) { PersAllObjDto objDto = new PersAllObjDto(); objDto.setPtype(ptype); objDto.setName(baseList.get(0).getStnm()); objDto.setCode(baseList.get(0).getStcd()); list.add(objDto); } else if (baseList.size() == 0) { setFailMessage(map, fail, objName, "地下水不存在"); } else if (baseList.size() > 1) { setFailMessage(map, fail, objName, "地下水重复"); } } else if (BisInspEnum.WAGA.getValue().equals(ptype)) { AttWagaBaseParam param = new AttWagaBaseParam(); param.setGateName(objName); List baseList = attWagaBaseDao.findList(param); if (baseList.size() == 1) { PersAllObjDto objDto = new PersAllObjDto(); objDto.setPtype(ptype); objDto.setCode(baseList.get(0).getAdCode()); objDto.setName(baseList.get(0).getGateName()); list.add(objDto); } else if (baseList.size() == 0) { setFailMessage(map, fail, objName, "水闸不存在"); } else if (baseList.size() > 1) { setFailMessage(map, fail, objName, "水闸重复"); } } else if (BisInspEnum.PAWP.getValue().equals(ptype)) { TacAttPawpBaseParam param = new TacAttPawpBaseParam(); param.setName(objName); List baseList = tacAttPawpBaseDao.findList(param); if (baseList.size() == 1) { PersAllObjDto objDto = new PersAllObjDto(); objDto.setPtype(ptype); objDto.setCode(baseList.get(0).getId()); objDto.setName(baseList.get(0).getName()); list.add(objDto); } else if (baseList.size() == 0) { setFailMessage(map, fail, objName, "工程不存在"); } else if (baseList.size() > 1) { setFailMessage(map, fail, objName, "工程重复"); } } else if (BisInspEnum.FSC.getValue().equals(ptype)) { AttFscBaseParam param = new AttFscBaseParam(); param.setName(objName); List baseList = attFscBaseDao.findList(param); if (baseList.size() == 1) { PersAllObjDto objDto = new PersAllObjDto(); objDto.setPtype(ptype); objDto.setCode(baseList.get(0).getId()); objDto.setName(baseList.get(0).getName()); list.add(objDto); } else if (baseList.size() == 0) { setFailMessage(map, fail, objName, "工程不存在"); } else if (baseList.size() > 1) { setFailMessage(map, fail, objName, "工程重复"); } } else if (BisInspEnum.OTHER.getValue().equals(ptype)) { AttOtherBaseParam param = new AttOtherBaseParam(); param.setName(objName); List baseList = attOtherBaseDao.findList(param); if (baseList.size() == 1) { PersAllObjDto objDto = new PersAllObjDto(); objDto.setPtype(ptype); objDto.setCode(baseList.get(0).getId()); objDto.setName(baseList.get(0).getName()); list.add(objDto); } else if (baseList.size() == 0) { setFailMessage(map, fail, objName, "工程不存在"); } else if (baseList.size() > 1) { setFailMessage(map, fail, objName, "工程重复"); } } else if (BisInspEnum.SD.getValue().equals(ptype)) { AttSdBaseParam param = new AttSdBaseParam(); param.setSdName(objName); List baseList = sdBaseDao.findList(param); if (baseList.size() == 1) { PersAllObjDto objDto = new PersAllObjDto(); objDto.setPtype(ptype); objDto.setCode(baseList.get(0).getId()); objDto.setName(baseList.get(0).getSdName()); list.add(objDto); } else if (baseList.size() == 0) { setFailMessage(map, fail, objName, "淤地坝不存在"); } else if (baseList.size() > 1) { setFailMessage(map, fail, objName, "淤地坝重复"); } } else if (BisInspEnum.WIU.getValue().equals(ptype)) { AttWiuBaseParam param = new AttWiuBaseParam(); param.setName(objName); List baseList = wiuBaseDao.findList(param); if (baseList.size() == 1) { PersAllObjDto objDto = new PersAllObjDto(); objDto.setPtype(ptype); objDto.setCode(baseList.get(0).getId()); objDto.setName(baseList.get(0).getName()); list.add(objDto); } else if (baseList.size() == 0) { setFailMessage(map, fail, objName, "取水单位不存在"); } else if (baseList.size() > 1) { setFailMessage(map, fail, objName, "取水单位重复"); } } else if (BisInspEnum.SWHS.getValue().equals(ptype)) { AttSwhsBaseParam param = new AttSwhsBaseParam(); param.setSwhsName(objName); List baseList = swhsBaseDao.findList(param); if (baseList.size() == 1) { PersAllObjDto objDto = new PersAllObjDto(); objDto.setPtype(ptype); objDto.setCode(baseList.get(0).getId()); objDto.setName(baseList.get(0).getSwhsName()); list.add(objDto); } else if (baseList.size() == 0) { setFailMessage(map, fail, objName, "水源地不存在"); } else if (baseList.size() > 1) { setFailMessage(map, fail, objName, "水源地重复"); } } else if (BisInspEnum.WUNT.getValue().equals(ptype)) { AttWuntBaseParam param = new AttWuntBaseParam(); param.setUtName(objName); List baseList = wuntBaseDao.findList(param); if (baseList.size() == 1) { PersAllObjDto objDto = new PersAllObjDto(); objDto.setPtype(ptype); objDto.setCode(baseList.get(0).getId()); objDto.setName(baseList.get(0).getUtName()); list.add(objDto); } else if (baseList.size() == 0) { setFailMessage(map, fail, objName, "用水单位不存在"); } else if (baseList.size() > 1) { setFailMessage(map, fail, objName, "用水单位重复"); } } else if (BisInspEnum.PRD.getValue().equals(ptype)) { AttPrdCstrProjBaseParam param = new AttPrdCstrProjBaseParam(); param.setName(objName); List baseList = attPrdCstrProjBaseDao.findList(param); if (baseList.size() == 1) { PersAllObjDto objDto = new PersAllObjDto(); objDto.setPtype(ptype); objDto.setCode(baseList.get(0).getId()); objDto.setName(baseList.get(0).getName()); list.add(objDto); } else if (baseList.size() == 0) { setFailMessage(map, fail, objName, "水保工作核查不存在"); } else if (baseList.size() > 1) { setFailMessage(map, fail, objName, "水保工作核查重复"); } } else if (BisInspEnum.JSFL.getValue().equals(ptype)) { AttJskejianFlkdisBaseParam param = new AttJskejianFlkdisBaseParam(); param.setName(objName); List baseList = jskejianFlkdisBaseDao.findList(param); if (baseList.size() == 1) { PersAllObjDto objDto = new PersAllObjDto(); objDto.setPtype(ptype); objDto.setCode(baseList.get(0).getId()); objDto.setName(baseList.get(0).getName()); list.add(objDto); } else if (baseList.size() == 0) { setFailMessage(map, fail, objName, "河湖四乱核查不存在"); } else if (baseList.size() > 1) { setFailMessage(map, fail, objName, "河湖四乱核查重复"); } } else if (BisInspEnum.JSWA.getValue().equals(ptype)) { AttJskejianWaterBaseParam param = new AttJskejianWaterBaseParam(); param.setName(objName); List baseList = jskejianWaterBaseDao.findList(param); if (baseList.size() == 1) { PersAllObjDto objDto = new PersAllObjDto(); objDto.setPtype(ptype); objDto.setCode(baseList.get(0).getId()); objDto.setName(baseList.get(0).getName()); list.add(objDto); } else if (baseList.size() == 0) { setFailMessage(map, fail, objName, "非法采砂核查不存在"); } else if (baseList.size() > 1) { setFailMessage(map, fail, objName, "非法采砂核查重复"); } } } private void setFailMessage(Map map, int fail, String objName, String message) { fail++; if (map.get("false") == null) { List failList = new ArrayList<>(); failList.add(objName + message); map.put("false", failList); } else { ((List) map.get("false")).add(objName + message); } } private List convertAreaNamesToDto(Map map, int fail, String areaNames) { List list = new ArrayList<>(); if (StringUtils.isBlank(areaNames)) { return list; } if (areaNames.contains(SplitValue.DOUHAO_SPLIT)) { for (String areaName : areaNames.split(SplitValue.DOUHAO_SPLIT)) { AttAdXBaseParam param = new AttAdXBaseParam(); param.setAdName(areaName); param.setAdFcode("000000000000"); List adXBases = attAdXBaseDao.findList(param); if (adXBases.size() == 1) { PersAllAreaDto persAllAreaDto = new PersAllAreaDto(); persAllAreaDto.setAdCode(adXBases.get(0).getAdCode()); persAllAreaDto.setAdName(adXBases.get(0).getAdName()); list.add(persAllAreaDto); } else if (adXBases.size() == 0) { fail++; if (map.get("false") == null) { List failList = new ArrayList<>(); failList.add(areaName + "地区查找失败"); map.put("false", failList); } else { ((List) map.get("false")).add(areaName + "地区查找失败"); } } else if (adXBases.size() > 1) { fail++; if (map.get("false") == null) { List failList = new ArrayList<>(); failList.add(areaName + "地区重复"); map.put("false", failList); } else { ((List) map.get("false")).add(areaName + "地区重复"); } } } } else { AttAdXBaseParam param = new AttAdXBaseParam(); param.setAdName(areaNames); param.setAdFcode("000000000000"); List adXBases = attAdXBaseDao.findList(param); if (adXBases.size() == 1) { PersAllAreaDto persAllAreaDto = new PersAllAreaDto(); persAllAreaDto.setAdCode(adXBases.get(0).getAdCode()); persAllAreaDto.setAdName(adXBases.get(0).getAdName()); list.add(persAllAreaDto); } else if (adXBases.size() == 0) { fail++; if (map.get("false") == null) { List failList = new ArrayList<>(); failList.add(areaNames + "地区查找失败"); map.put("false", failList); } else { ((List) map.get("false")).add(areaNames + "地区查找失败"); } } else if (adXBases.size() > 1) { fail++; if (map.get("false") == null) { List failList = new ArrayList<>(); failList.add(areaNames + "地区重复"); map.put("false", failList); } else { ((List) map.get("false")).add(areaNames + "地区重复"); } } } return list; } private List convertPersIdsToDto(Map map, int fail, String persNames, String persType) { List list = new ArrayList<>(); if (StringUtils.isBlank(persNames)) { return list; } if (persNames.contains(SplitValue.DOUHAO_SPLIT)) { for (String persName : persNames.split(SplitValue.DOUHAO_SPLIT)) { BisInspAllRlationPersParam persParam = new BisInspAllRlationPersParam(); if (persName.contains(SplitValue.HENG_SPLIT)) { persParam.setPersName(persName.split(SplitValue.HENG_SPLIT)[0]); persParam.setMobilenumb(persName.split(SplitValue.HENG_SPLIT)[1]); } else { persParam.setPersName(persName); } List pers = bisInspAllRlationPersDao.findList(persParam); if (pers.size() == 1) { PersAllDto dto = new PersAllDto(); dto.setGuid(pers.get(0).getGuid()); dto.setPersName(pers.get(0).getPersName()); dto.setPersType(persType); list.add(dto); } else if (pers.size() == 0) { fail++; if (map.get("false") == null) { List failList = new ArrayList<>(); failList.add(persName + "人员查找失败"); map.put("false", failList); } else { ((List) map.get("false")).add(persName + "人员查找失败"); } } else if (pers.size() > 1) { fail++; if (map.get("false") == null) { List failList = new ArrayList<>(); failList.add(persName + "姓名重复,无法确定唯一"); map.put("false", failList); } else { ((List) map.get("false")).add(persName + "姓名重复,无法确定唯一"); } } } } else { BisInspAllRlationPersParam persParam = new BisInspAllRlationPersParam(); persParam.setPersName(persNames); List pers = bisInspAllRlationPersDao.findList(persParam); if (pers.size() == 1) { PersAllDto dto = new PersAllDto(); dto.setGuid(pers.get(0).getGuid()); dto.setPersName(pers.get(0).getPersName()); dto.setPersType(persType); list.add(dto); } else if (pers.size() == 0) { fail++; if (map.get("false") == null) { List failList = new ArrayList<>(); failList.add(persNames + "查找失败"); map.put("false", failList); } else { ((List) map.get("false")).add(persNames + "查找失败"); } } else if (pers.size() > 1) { fail++; if (map.get("false") == null) { List failList = new ArrayList<>(); failList.add(persNames + "姓名重复,无法确定唯一"); map.put("false", failList); } else { ((List) map.get("false")).add(persNames + "姓名重复,无法确定唯一"); } } } return list; } private String fomateType(String field) { if ("小水库".equals(field)) { return "1"; } if ("人饮".equals(field)) { return "2"; } if ("水毁".equals(field)) { return "3"; } if ("工程建设".equals(field)) { return "4"; } if ("地下水".equals(field)) { return "5"; } if ("水闸".equals(field)) { return "6"; } if ("工程运行".equals(field)) { return "7"; } if ("特定飞检".equals(field)) { return "9"; } if ("其他检查".equals(field)) { return "10"; } if ("淤地坝".equals(field)) { return "11"; } if ("取水口".equals(field)) { return "12"; } if ("水源地".equals(field)) { return "13"; } if ("分水及管控".equals(field)) { return "14"; } if ("节水管理".equals(field)) { return "15"; } if ("用水单位".equals(field)) { return "16"; } return ""; } private String cleanFomate(String field) { if (StringUtils.isBlank(field)) { return ""; } String result = field; result = result.replace(" ", ""); result = result.replace(",", ","); return result; } @Override public void insertByYearMonth(BisInspYearAllDto bisInspYearAllDto) { //获取督查类型及机构信息,增加下级节点 注意:关联年度任务ID //插入批次 BisInspAll bisInspAll = new BisInspAll(); //根据父id查询最大的子id String setId = bisInspYearAllDto.getPtype() + bisInspYearAllDto.getOrgId() + "001"; BisInspAll max = bisInspAllDao.getMaxOne(bisInspYearAllDto.getPtype() + bisInspYearAllDto.getOrgId(), setId); if (null != max) { Long upOne = NumberUtils.toLong(max.getId()); String newId = String.format("%0" + max.getId().length() + "d", (upOne + 1)); bisInspAll.setId(newId); } else { bisInspAll.setId(setId); } bisInspAll.setPid(bisInspYearAllDto.getPtype() + bisInspYearAllDto.getOrgId()); bisInspAll.setSttm(bisInspYearAllDto.getStTm()); bisInspAll.setEntm(bisInspYearAllDto.getEnTm()); bisInspAll.setPnm(bisInspYearAllDto.getPname()); bisInspAll.setProvince(bisInspYearAllDto.getProvince()); bisInspAll.setOrgId(bisInspYearAllDto.getOrgId()); //根据批次id获取组id及节点信息,并设置时间 注意:关联年度任务ID String childPId = bisInspAll.getId(); String childId = childPId + "001"; //插入组 //组下插入人员 //组下插入行政区 //组下插入督查对象 } }