package cn.com.goldenwater.dcproj.utils.export; import cn.com.goldenwater.dcproj.dao.AttAdBaseDao; import cn.com.goldenwater.dcproj.dao.AttAdXBaseDao; import cn.com.goldenwater.dcproj.dao.AttCwsBaseDao; import cn.com.goldenwater.dcproj.dto.BisInspRsvrRgstrPcDto; import cn.com.goldenwater.dcproj.dto.BisInspRsvrRgstrPcDtoVo; import cn.com.goldenwater.dcproj.dto.BisInspWtdstDetailDto; import cn.com.goldenwater.dcproj.model.*; import cn.com.goldenwater.dcproj.param.AttAdXBaseParam; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.*; import static cn.com.goldenwater.dcproj.utils.export.ExcelSkFieldLists.*; import static cn.com.goldenwater.dcproj.utils.export.FieldFormat.*; import static cn.com.goldenwater.dcproj.utils.export.FieldFormatDispatch.getFormatValue; import static cn.com.goldenwater.dcproj.utils.export.FieldFormatSkExp.*; /** * @ClassName ExcelFieldUtil * @Description 配置Excel数据字段 * @Author liyz * @Date 2019/3/13 9:58 * @Version 1.0 **/ @Component public class ExcelFieldUtil { @Autowired private AttAdBaseDao attAdBaseDao; @Autowired private AttAdXBaseDao attAdXBaseDao; @Autowired private AttCwsBaseDao attCwsBaseDao; /** * 1.暗访调研行政村统计表 * * @param list list * @return 数据集合 */ List> getBisInspSecsurveyVlgDataList(List list) { List> dataList = new ArrayList<>(); for (BisInspSecsurveyVlg bis : list) { Map map = new LinkedHashMap<>(); AttAdXBaseParam attAdXBaseParam = new AttAdXBaseParam(); if (bis.getVillageCode() != null && !"".equals(bis.getVillageCode())) { attAdXBaseParam.setAdCode(bis.getVillageCode()); AttAdXBase attAdXBase = attAdXBaseDao.getBy(attAdXBaseParam); if (attAdXBase != null) { map.put("adNm", formatCheckNull(attAdXBase.getAdFullName())); } else { map.put("adNm", formatCheckNull(bis.getAdNm())); } } else { map.put("adNm", formatCheckNull(bis.getAdNm())); } map.put("isPoverty", formatRadio(bis.getIsPoverty())); map.put("isFluexc", formatRadio(bis.getIsFluexc())); map.put("isMtarea", formatRadio(bis.getIsMtarea())); map.put("isCenwtSupply", formatRadio(bis.getIsCenwtSupply())); map.put("watersupplyPer", formatRate(bis.getWatersupplyPer())); map.put("visitDate", bis.getVisitDate()); dataList.add(map); } return dataList; } /** * 2.村内农村饮水工程设施运行维护情况表 * * @param list list * @return 数据集合 */ List> getBisInspVlgdrinkFacOperDataList(List list) { List> dataList = new ArrayList<>(); for (BisInspVlgdrinkFacOper bis : list) { Map map = new LinkedHashMap<>(); AttAdXBaseParam attAdXBaseParam = new AttAdXBaseParam(); attAdXBaseParam.setAdCode(bis.getAdCode()); AttAdXBase attAdXBase = attAdXBaseDao.getBy(attAdXBaseParam); if (attAdXBase != null) { // 行政村名(*县*乡镇*村) map.put("adnm", formatCheckNull(attAdXBase.getAdFullName())); } else { map.put("adnm", formatCheckNull(bis.getAdnm())); } // 是否需要设置管水员 map.put("isNdAdmin", formatIsAdmin(bis.getIsNdAdmin())); // 是否设置管水员 map.put("isAdmin", formatIsAdmin(bis.getIsAdmin())); // 管水员姓名 map.put("adminNm", formatCheckNull(bis.getAdminNm())); // 管水员年龄 map.put("adminAge", formatCheckNull(bis.getAdminAge())); // 管水员性质 map.put("adminPro", formateAdminPro(bis.getAdminPro())); // 管水员工资(元/年) map.put("salary", bis.getSalary()); // 运行维护费用(元/年) map.put("operFee", bis.getOperFee()); // 除水费收入外的运行维护费用来源 map.put("otherFeeOrg", formateOtherFeeOrg(bis.getOtherFeeOrg())); // 费用说明 map.put("feeCommons", bis.getFeeCommons()); // 暗访日期 map.put("visitDate", bis.getVisitDate()); dataList.add(map); } return dataList; } /** * 3.用水户情况表 * * @param list list * @return 数据集合 */ public List> getBisInspWateruserInfoDataList(List list) { List> dataList = new ArrayList<>(); for (BisInspWateruserInfo bis : list) { Map map = new LinkedHashMap<>(); // 调查地点(*县*乡镇*村) map.put("villageNm", formatCheckNull(bis.getVillageNm())); // 户主姓名 map.put("userNm", formatCheckNull(bis.getUserNm())); // 电话 map.put("telphone", formatCheckNull(bis.getTelphone())); // 对应工程名称 map.put("cwsName", formatCheckNull(bis.getCwsName())); // ------------------------------------------------------------------- // 水质 // ------------------------------------------------------------------- // 水质是否良好 map.put("isQualityGood", formatRadio(bis.getIsQualityGood())); // 是否存在问题 map.put("isQualityProblem", formatRadio(bis.getIsQualityProblem())); // 水量 // 是否供水入户 map.put("isSplyHome", formatRadio(bis.getIsSplyHome())); // 是否24小时供水 map.put("is24hSupply", formatRadio(bis.getIs24hSupply())); // 是否存在问题 map.put("isWaterProblem", formatRadio(bis.getWaterProblem())); // 水价收费 // 是否计量收费 map.put("isCalFee", formatRadio(bis.getIsCalFee())); // 是否存在问题 map.put("isFeeProblem", formatRadio(bis.getFeeProblem())); // 供水服务 // 是否存在问题 map.put("isSplyProblem", formatRadio(bis.getIsSplyProblem())); // 总体评价 map.put("evaluate", formatEvaluate(bis.getEvaluate())); // 暗访日期 map.put("visitDate", formatCheckNull(bis.getVisitDate())); dataList.add(map); } return dataList; } /** * 4.农村饮水工程运行管理情况表 * * @param list list * @return 数据集合 */ public List> getBisInspVlgdrinkProjManageDataList(List list) { List> dataList = new ArrayList<>(); for (BisInspVlgdrinkProjManage bis : list) { Map map = new LinkedHashMap<>(); // 省 市 县 String province = ""; String city = ""; String county = ""; String code = null; try { String cwsCode = bis.getCwsCode(); AttCwsBase attCwsBase = attCwsBaseDao.get(cwsCode); if (attCwsBase != null) { code = attCwsBase.getAddvcd(); } } catch (Exception e) { System.out.println("编码不正常呀"); } if (code != null) { province = attAdBaseDao.fingAdUp(code.substring(0, 2) + "0000000000").getAdName(); city = attAdBaseDao.fingAdUp(code.substring(0, 4) + "00000000").getAdName(); county = attAdBaseDao.fingAdUp(code.substring(0, 6) + "000000").getAdName(); } map.put("province", formatCheckNull(province)); map.put("city", formatCheckNull(city)); map.put("county", formatCheckNull(county)); // 工程名称 map.put("pjnm", formatCheckNull(bis.getPjnm())); // 所在地 map.put("villageNm", formatCheckNull(bis.getVillageNm())); // 建成年份 map.put("buildYear", formatCheckNull(bis.getBuildYear())); // 设计供水规模(m³/d) map.put("planSupplyScale", formatCheckNull(bis.getPlanSupplyScale())); // 实际供水规模(m³/d) map.put("supplyScale", formatCheckNull(bis.getSupplyScale())); // 覆盖人口(万人) map.put("personNum", formatCheckNull(bis.getPersonNum())); // 管网漏损率(%) map.put("pipeDamagePer", formatRate(bis.getPipeDamagePer())); // 工程类别 map.put("projectType", formatProjectType(bis.getProjectType())); // 是否24小时不间断供水 map.put("is24hSupply", formatBoo(bis.getIs24hSupply())); // 水质保障 // 净化设施设备 // 是否配备 map.put("isHavecleanEqui", formatBoo(bis.getIsHavecleanEqui())); // 是否正常运行 map.put("isCleanequiG", formatBoo(bis.getIsCleanequiG())); // 消毒设备 // 是否配备 map.put("isHavedisinfect", formatBoo(bis.getIsHavedisinfect())); // 消毒方式 map.put("disinfectType", formatDisinfectType(bis.getDisinfectType())); // 是否正常运行 map.put("isDisinfectGood", formatBoo(bis.getIsDisinfectGood())); // 水质检测报告 // 有无报告 map.put("isHavereport", formatExistRadio(bis.getIsHavereport())); // 是否达标 map.put("isQuailtyGood", formatBoo(bis.getIsQuailtyGood())); // 千吨万人水厂水质化验室 // 是否配备 map.put("isHaveLab", formatBoo(bis.getIsHaveLab())); // 是否开展日检 map.put("isDailyCheck", formatBoo(bis.getIsDailyCheck())); // 水质是否达标 map.put("isDailycheckGood", formatBoo(bis.getIsDailycheckGood())); // 运行管理 // 有无取水许可证 map.put("isInsLicence", formatExistRadio(bis.getIsInsLicence())); // 有无卫生许可证 map.put("isSanLicence", formatExistRadio(bis.getIsSanLicence())); // 自动化控制系统 // 是否配备 map.put("isAutosystem", formatBoo(bis.getIsAutosystem())); // 是否正常运行 map.put("isAutosysGood", formatBoo(bis.getIsAutosysGood())); // 视频安防系统 // 是否配备 map.put("isVideoSystem", formatBoo(bis.getIsVideoSystem())); // 是否正常运行 map.put("isVideosysGood", formatBoo(bis.getIsVideosysGood())); // 水费水价 // 执行水价(元/ m³) map.put("waterFee", formatCheckNull(bis.getWaterFee())); // 全成本(元/ m³) map.put("waterCost", formatCheckNull(bis.getWaterCost())); // 运行成本(元/ m³) map.put("operCost", formatCheckNull(bis.getOperCost())); // 水费回收率(%) map.put("feeRecyclePer", formatRate(bis.getFeeRecyclePer())); // 管理主体 map.put("manager", formatManager(bis.getManager())); // 是否配备供水服务热线电话 map.put("isHaveHotline", formatBoo(bis.getIsHaveHotline())); // 填报状态 map.put("status", formatStatus(bis.getStatus())); // 暗访日期 map.put("visitDate", formatCheckNull(bis.getVisitDate())); // 记录人员 map.put("recPers2", formatCheckNull(bis.getRecPers2())); // 记录人员电话 map.put("recPersTel", formatCheckNull(bis.getRecPersTel())); dataList.add(map); } return dataList; } /** * 5.千人以上供水工程水源地保护情况表 * * @param list list * @return 数据集合 */ public List> getBisInspProSourceProtectDataList(List list) { List> dataList = new ArrayList<>(); for (BisInspProSourceProtect bis : list) { Map map = new LinkedHashMap<>(); map.put("waterSourceNm", bis.getWaterSourceNm()); AttAdXBaseParam attAdXBaseParam = new AttAdXBaseParam(); if (bis.getAdCode() != null && !"".equals(bis.getAdCode())) { attAdXBaseParam.setAdCode(bis.getAdCode()); AttAdXBase attAdXBase = attAdXBaseDao.getBy(attAdXBaseParam); if (attAdXBase != null) { map.put("villageNm", formatCheckNull(attAdXBase.getAdFullName())); } else { map.put("villageNm", formatCheckNull(bis.getVillageNm())); } } else { map.put("villageNm", formatCheckNull(bis.getVillageNm())); } map.put("cwsCode", bis.getCwsCode()); map.put("planInsAmount", bis.getPlanInsAmount()); map.put("sourceType", formatSourceType(bis.getSourceType())); map.put("waterQuality", formatWaterQuality(bis.getWaterQuality())); map.put("isProtectArea", formatRadio(bis.getIsProtectArea())); map.put("isProtectMark", formatRadio(bis.getIsProtectMark())); map.put("isPollSource", formatRadio(bis.getIsPollSource())); map.put("isSpare", formatRadio(bis.getIsSpare())); map.put("visitDate", bis.getVisitDate()); dataList.add(map); } return dataList; } /** * 6.管理责任体系落实情况表 * * @param list 原始数据 * @return 封装好的数据 */ public List> getBisInspManageResponsibilityDataList(List list) { List> dataList = new ArrayList<>(); for (BisInspManageResponsibility bis : list) { Map map = new LinkedHashMap<>(); // 省 市 县 String province = ""; String city = ""; String county = ""; String code = bis.getAdCode(); if (code != null) { province = attAdBaseDao.fingAdUp(code.substring(0, 2) + "0000000000").getAdName(); city = attAdBaseDao.fingAdUp(code.substring(0, 4) + "00000000").getAdName(); county = attAdBaseDao.fingAdUp(code.substring(0, 6) + "000000").getAdName(); } map.put("province", formatCheckNull(province)); map.put("city", formatCheckNull(city)); map.put("county", formatCheckNull(county)); // 农村人口(万人) map.put("personAmount", formatCheckNull(bis.getPersonAmount())); // 集中供水率(%) map.put("focusSupplyPerc", formatRate(bis.getFocusSupplyPerc())); // 自来水普及率(%) map.put("waterSupplyPerc", formatRate(bis.getWaterSupplyPerc())); // 三个责任 // 地方人民政府主体责任是否明确 map.put("isGovRes", formatBoo(bis.getIsGovRes())); // 水利部门行业监管责任是否明确 map.put("isConRes", formatBoo(bis.getIsConRes())); // 供水单位运行管理责任是否到位 map.put("isDeptRes", formatBoo(bis.getIsDeptRes())); // 三项制度 // 是否建立县级运行管理机构 map.put("isCntyDept", formatBoo(bis.getIsCntyDept())); // 是否建立县级运行管理办法 map.put("isCntyFunc", formatBoo(bis.getIsCntyFunc())); // 是否落实县级运行管理经费 map.put("isCntyFee", formatBoo(bis.getIsCntyFee())); // 县级水质检测中心 // 是否正常开展水质巡检 map.put("isQuailtyChk", formatBoo(bis.getIsQuailtyChk())); // 2018年落实运行经费(万元) map.put("pracFee", formatCheckNull(bis.getPracFee())); // 暗访日期 map.put("visitDate", formatCheckNull(bis.getVisitDate())); // 县级水行政主管部门参加人员 map.put("accompany", formatCheckNull(bis.getAccompany())); // 暗访组(人) map.put("visitorIds", formatCheckNull(bis.getVisitorId())); // 记录人员 map.put("recPers2", formatCheckNull(bis.getRecPers2())); // 记录人员电话 map.put("recPersTel", formatCheckNull(bis.getRecPersTel())); // 填报状态 map.put("status", formatBaseStat(bis.getStatus())); dataList.add(map); } return dataList; } /** * 7.水毁修复项目暗访情况表 * * @param list list * @return 数据集合 */ public List> getBisInspWtdstDtoDataList(List list) { List> dataList = new ArrayList<>(); for (BisInspWtdstDetailDto bis : list) { Map map = new LinkedHashMap<>(); String province = ""; String city = ""; String county = ""; String code = bis.getLocAd(); if (code != null) { province = attAdBaseDao.fingAdUp(code.substring(0, 2) + "0000000000").getAdName(); city = attAdBaseDao.fingAdUp(code.substring(0, 4) + "00000000").getAdName(); county = attAdBaseDao.fingAdUp(code.substring(0, 6) + "000000").getAdName(); } map.put("province", formatCheckNull(province)); map.put("city", formatCheckNull(city)); map.put("county", formatCheckNull(county)); map.put("wtdstNm", bis.getWtdstNm()); map.put("locNm", bis.getLocNm()); map.put("wtdstType", bis.getWtdstType()); map.put("mangNm", bis.getMangNm()); map.put("loac", bis.getLoac()); map.put("disContent", bis.getDisContent()); map.put("wkstate", formatWkstate(bis.getWkstate())); map.put("planTm", bis.getPlanTm()); map.put("problmNum", bis.getProblmNum()); map.put("adNm", bis.getAdNm()); map.put("note", bis.getNote()); dataList.add(map); } return dataList; } /** * 8.小水库督查情况 * * @param list list * @return 数据集合 */ public List> getBisInspRsvrRgstrPcDtoDataList(List list) { List> dataList = new LinkedList<>(); for (BisInspRsvrRgstrPcDtoVo bis : list) { Map map = new LinkedHashMap<>(); BisInspRsvrRgstrPcDto bisInspRsvrRgstrPcDto = bis.getBisInspRsvrRgstrPcDto(); map.put("nm", formatCheckNull(bisInspRsvrRgstrPcDto.getNm())); map.put("rsCode", formatCheckNull(bisInspRsvrRgstrPcDto.getCode())); // 组长名称 map.put("groupLeader", formatCheckNull(bisInspRsvrRgstrPcDto.getGroupLeader())); // 组长电话 map.put("groupLeaderTel", formatCheckNull(bisInspRsvrRgstrPcDto.getGroupLeader())); // 联络员电话 map.put("liaisonManTel", formatCheckNull(bisInspRsvrRgstrPcDto.getLiaisonManTel())); // 联络员 map.put("liaisonMan", formatCheckNull(bisInspRsvrRgstrPcDto.getLiaisonMan())); AttRsBaseCrrct attRsBaseCrrct = bis.getAttRsBaseCrrct(); if (attRsBaseCrrct != null) { // 1 加入基础信息 // 水库位置 map.put("rsLoc", attRsBaseCrrct.getRsLoc() == null ? "" : attRsBaseCrrct.getRsLoc()); // 建成时间 map.put("compDate", formatCompDate(attRsBaseCrrct.getCompDate())); // 工程规模 map.put("engScal1", formatEngScal(attRsBaseCrrct.getEngScal())); // 总库容(万m³) map.put("totCap", attRsBaseCrrct.getTotCap() == null ? "" : attRsBaseCrrct.getTotCap()); //最大坝高(m) map.put("damSizeHig", attRsBaseCrrct.getDamSizeHig() == null ? "" : attRsBaseCrrct.getDamSizeHig()); //主坝坝型 map.put("damTypeStr1", formatDamType(attRsBaseCrrct.getDamTypeStr())); // 注册登记号 map.put("regCode", attRsBaseCrrct.getRegCode() == null ? "" : attRsBaseCrrct.getRegCode()); // 未注册 map.put("regCode2", ""); } else { AttRsBase attRsBase = bis.getAttRsBase(); // 所在地点 map.put("rsLoc", attRsBase.getRsLoc() == null ? "" : attRsBase.getRsLoc()); // 建成时间 map.put("compDate", formatCompDate(attRsBase.getCompDate())); // 工程规模 map.put("engScal1", formatEngScal(attRsBase.getEngScal())); // 总库容(万m³) map.put("totCap", attRsBase.getTotCap() == null ? "" : attRsBase.getTotCap()); //最大坝高(m) map.put("damSizeHig", attRsBase.getDamSizeHig() == null ? "" : attRsBase.getDamSizeHig()); //主坝坝型 map.put("damTypeStr1", formatDamType(attRsBase.getDamTypeStr())); // 注册登记号 map.put("regCode", attRsBase.getRegCode() == null ? "" : attRsBase.getRegCode()); // 未注册 map.put("regCode2", ""); } // 2.重点环节落实情况 BisInspBaseExt bisInspBaseExt = bis.getBisInspBaseExt(); map.put("emerPlanSameExta", formatEmerPlanSameExta(bisInspBaseExt.getEmerPlanSameExta())); map.put("emerPlanSameAppr", formatEmerPlanSameExta(bisInspBaseExt.getEmerPlanSameAppr())); map.put("emerPlanSameSpeed", formatEmerPlanSameExta(bisInspBaseExt.getEmerPlanSameSpeed())); map.put("emerPlanSameEme", formatEmerPlanSameExta(bisInspBaseExt.getEmerPlanSameEme())); map.put("schPlanSameExta", formatEmerPlanSameExta(bisInspBaseExt.getSchPlanSameExta())); map.put("schPlanSameAppr", formatEmerPlanSameExta(bisInspBaseExt.getSchPlanSameAppr())); map.put("schPlanSameSpeed", formatEmerPlanSameExta(bisInspBaseExt.getSchPlanSameSpeed())); map.put("rainForc", formatEmerPlanSameExta(bisInspBaseExt.getRainForc())); // 3.责任人落实情况 BisInspBasePresExt bisInspBasePresExt = bis.getBisInspBasePresExt(); // 是否有行政责任人 map.put("hasWiunWaoLegPers", formatEmerPlanSameExta(bisInspBasePresExt.getHasWiunWaoLegPers())); // 责任人名称 map.put("wiunWaoLegPers", bisInspBasePresExt.getWiunWaoLegPers() == null ? "" : bisInspBasePresExt.getWiunWaoLegPers()); // 责任人电话 map.put("wiunWaoLegPersTel", bisInspBasePresExt.getWiunWaoLegPersTel() == null ? "" : bisInspBasePresExt.getWiunWaoLegPersTel()); // 责任人职务 map.put("wiunWaoLegPersDuty", bisInspBasePresExt.getWiunWaoLegPersDuty() == null ? "" : bisInspBasePresExt.getWiunWaoLegPersDuty()); // 履职情况 map.put("wiunWaoLegPersResu", formatWiunWaoLegPersResu(bisInspBasePresExt.getWiunWaoLegPersResu())); // 是否有技术责任人 map.put("hasTechPers", formatEmerPlanSameExta(bisInspBasePresExt.getHasTechPers())); // 责任人名称 map.put("techPers", bisInspBasePresExt.getTechPers() == null ? "" : bisInspBasePresExt.getTechPers()); // 责任人电话 map.put("techPersTel", bisInspBasePresExt.getTechPersTel() == null ? "" : bisInspBasePresExt.getTechPersTel()); // 责任人职务 map.put("techPersDuty", bisInspBasePresExt.getTechPersDuty() == null ? "" : bisInspBasePresExt.getTechPersDuty()); // 履职情况 map.put("techPersResu", formatWiunWaoLegPersResu(bisInspBasePresExt.getTechPersResu())); // 是否有巡查责任人 map.put("hasPatrolPers", formatEmerPlanSameExta(bisInspBasePresExt.getHasPatrolPers())); // 责任人名称 map.put("patrolPers", bisInspBasePresExt.getPatrolPers() == null ? "" : bisInspBasePresExt.getPatrolPers()); // 责任人职务 map.put("patrolPersDuty", formatPatrolPersDuty(bisInspBasePresExt.getPatrolPersDuty())); // 巡查责任人履职情况 map.put("patrolPersResu", formatWiunWaoLegPersResu(bisInspBasePresExt.getPatrolPersResu())); // 管理机构 // 是否有专门管理机构 map.put("specialManage", formatEmerPlanSameExta(bisInspBasePresExt.getSpecialManage())); // 管理机构名称 map.put("manaOrg", formatCheckNull(bisInspBasePresExt.getManaOrg())); // 管理机构性质 map.put("orgProp", formatCheckNull(bisInspBasePresExt.getOrgProp())); // 管理机构经费来源 map.put("fundSour", formatCheckNull(bisInspBasePresExt.getFundSour())); // 管理机构经费每年数额 map.put("fundSourCount", bisInspBasePresExt.getFundSourCount() == null ? "" : bisInspBasePresExt.getFundSourCount()); //无管理机构是否有管护人员,1是,2否 map.put("noManHasPres", formatEmerPlanSameExta(bisInspBasePresExt.getNoManHasPres())); // 是否参加过培训 1是,2否 map.put("hasAttendTrain", formatEmerPlanSameExta(bisInspBasePresExt.getHasAttendTrain())); // 管护报酬(万元/年) map.put("patrolReward", bisInspBasePresExt.getPatrolReward() == null ? "" : bisInspBasePresExt.getPatrolReward()); // 经费来源 map.put("patrolFundSour", bisInspBasePresExt.getPatrolFundSour() == null ? "" : bisInspBasePresExt.getPatrolFundSour()); // 是否开展巡查 1是,2否 map.put("hasExtPatrol", formatEmerPlanSameExta(bisInspBasePresExt.getHasExtPatrol())); // 巡视频次 map.put("protalRate", bisInspBasePresExt.getProtalRate() == null ? "" : bisInspBasePresExt.getProtalRate()); // 巡视检查记录是否完整 1是,2否 map.put("isPatrolMsgComp", formatEmerPlanSameExta(bisInspBasePresExt.getIsPatrolMsgComp())); // 有险情是否即时报告 1是,2否 map.put("hasRepDangReal", formatEmerPlanSameExta(bisInspBasePresExt.getHasRepDangReal())); // 险情报告对象 map.put("dangReportObj", formatEmerPlanSameExta(bisInspBasePresExt.getDangReportObj())); // 是否有报告记录 1是,2否 map.put("hasReport", formatEmerPlanSameExta(bisInspBasePresExt.getHasReport())); // 是否知晓防洪限制水位 1是,2否 map.put("hasFlLowLimLev", formatEmerPlanSameExta(bisInspBasePresExt.getHasFlLowLimLev())); // 是否知晓安全应急(防汛)应急预案 1是,2否 map.put("hasKnowEmerPlanSame", formatEmerPlanSameExta(bisInspBasePresExt.getHasKnowEmerPlanSame())); // 4.水库工程实体和运行管理情况 BisInspSafeExtManage bisInspSafeExtManage = bis.getBisInspSafeExtManage(); // 安全总体评价 map.put("safeComment", formatSafeComment(bisInspSafeExtManage.getSafeComment())); // 是否正常蓄水运行 map.put("hasRetainRegular", formatRetainRegular(bisInspSafeExtManage.getRetainRegular())); // 有缺陷但能蓄水 map.put("noRetainRegular", formatKnowResManager(bisInspSafeExtManage.getNoRetainRegular())); //不具备正常蓄水条件 map.put("canNotRetainWater", formatHasRetainRegular(bisInspSafeExtManage.getHasRetainRegular())); // 挡水物 // 是否明显漏水 // 漏水是否影响安全 map.put("leakMakeSafe", formatEmerPlanSameExta(bisInspSafeExtManage.getLeakMakeSafe())); //是否有变形或不稳定情况 map.put("hasAstable", formatEmerPlanSameExta(bisInspSafeExtManage.getHasAstable())); // 泄洪建筑物运行状况 // 是否设置泄洪建筑物 map.put("hasSetMainFl", formatEmerPlanSameExta(bisInspSafeExtManage.getHasSetMainFl())); // 泄洪建筑物是否运行正常 map.put("isMainFlNormal", formatEmerPlanSameExta(bisInspSafeExtManage.getIsMainFlNormal())); // 放水建筑物运行情况 // 是否设置放水建筑物 map.put("hasSetPourFl", formatEmerPlanSameExta(bisInspSafeExtManage.getHasSetPourFl())); // 放水建筑物是否运行正常 map.put("pourFyIsNormal", formatPourFyIsNormal(bisInspSafeExtManage.getPourFyIsNormal())); // 是否设置防洪限制水位 HavFlLowLimLev map.put("havFlLowLimLev", formatEmerPlanSameExta(bisInspSafeExtManage.getHavFlLowLimLev())); // 超汛限水位运行 map.put("gtFlLowLimLev", formatEmerPlanSameExta(bisInspSafeExtManage.getFlLowLimLevNote())); // 是否注册登记 map.put("manageRegRelNote", formatEmerPlanSameExta(bisInspSafeExtManage.getManagePersNote())); // 注册信息真实 map.put("ifManageRegRel", formatEmerPlanSameExta(bisInspSafeExtManage.getIfManageRegRel())); // 安全鉴定 map.put("extDamSafeAppr", formatEmerPlanSameExta(bisInspSafeExtManage.getExtDamSafeAppr())); // 最近一次鉴定时间 // 是否有专门管理机构 map.put("hasSpeManage", formatEmerPlanSameExta(bisInspSafeExtManage.getHasSpeManage())); // 是否有管护人员 map.put("hasManagePers", formatEmerPlanSameExta(bisInspSafeExtManage.getHasManagePers())); // 是否有稳定经济来源 map.put("hasWdEmnic", formatEmerPlanSameExta(bisInspSafeExtManage.getHasWdEmnic())); // 正常运行 map.put("retainRegular", formatRetainRegular(bisInspSafeExtManage.getRetainRegular())); // 是否正常运行 map.put("dikeHasLeak", formatEmerPlanSameExta(bisInspSafeExtManage.getDikeHasLeak())); // 水库除险加固 // 是否进行除险加固 IfReinForce map.put("ifReinForce", formatEmerPlanSameExta(bisInspSafeExtManage.getIfReinForce())); // 实施情况 map.put("ifComplateAccAll", formatIfComplateAccAll(bisInspSafeExtManage.getIfComplateAcc())); // 公示情况 // 是否设置水库公示牌 map.put("ifDamWarnLogo", formatEmerPlanSameExta(bisInspSafeExtManage.getIfDamWarnLogo())); // 5 走访情况 List bisInspPreList = bis.getBisInspPreList(); // 走访人数 int viewPreNum = bisInspPreList.size(); // 走访人姓名 String viewPreName = ""; // 是否知晓水库管护人员 String knowResManager = ""; // 对管护责任人的评价 String managerComment = ""; for (BisInspPreList bipre : bisInspPreList) { // 多个人的名字合成一个字段 viewPreName += bipre.getViewPreName() + " "; knowResManager = bipre.getKnowResManager(); managerComment = bipre.getManagerComment(); } // 走访人数 map.put("viewPreNum", viewPreNum); // 走访人姓名 map.put("viewPreName", viewPreName); // 是否知晓水库管护人员 map.put("knowResManager", formatKnowResManager(knowResManager)); // 对管护责任人的评价 map.put("managerComment", formatManagerComment(managerComment)); // 省 市 县 HashMap hashMap = bis.getHashMap(); map.put("province", hashMap.get("province").toString()); map.put("city", hashMap.get("city").toString()); map.put("county", hashMap.get("county").toString()); dataList.add(map); } return dataList; } /** * 要填报的水库模板 */ public List> getBisInspRsvrRgstrPcDtoTemplate(List list) { List> dataList = new LinkedList<>(); for (BisInspRsvrRgstrPcDtoVo bis : list) { LinkedHashMap map = new LinkedHashMap<>(); //BisInspRsvrRgstrPcDto表 基础信息 填报的基础信息不是这个表,但是要同步到这个表 BisInspRsvrRgstrPcDto bisInspRsvrRgstrPcDto = bis.getBisInspRsvrRgstrPcDto(); // 督查组 map.put("groupName", formatCheckNull(bisInspRsvrRgstrPcDto.getUpGroupName())); // 督查状态 map.put("state", formatState(bisInspRsvrRgstrPcDto.getState())); // 1.基础信息 由两个表组成,如果AttRsBaseCrrct表无数据,则取AttRsBase表 AttRsBaseCrrct attRsBaseCrrct = bis.getAttRsBaseCrrct(); if (attRsBaseCrrct != null) { this.setMapValue(attRsBaseCrrct, baseCrrctKeysArray, map); } else { AttRsBase attRsBase = bis.getAttRsBase(); this.setMapValue(attRsBase, baseCrrctKeysArray, map); } // 放入行政区划 HashMap hashMap = bis.getHashMap(); String province = hashMap.get("province").toString(); String city = hashMap.get("city").toString(); String county = hashMap.get("county").toString(); map.put("adFullName", province + city + county); // 放入objId map.put("rgstrId", bisInspRsvrRgstrPcDto.getRgstrId()); // 2.重点环节落实情况 BisInspBaseExt bisInspBaseExt = bis.getBisInspBaseExt(); this.setMapValue(bisInspBaseExt, baseExtKeysArray, map); // 3.责任人落实情况 BisInspBasePresExt bisInspBasePresExt = bis.getBisInspBasePresExt(); this.setMapValue(bisInspBasePresExt, presExtKeysArray, map); // 4.水库工程实体和运行管理情况 BisInspSafeExtManage bisInspSafeExtManage = bis.getBisInspSafeExtManage(); this.setMapValue(bisInspSafeExtManage, safeExtManageKeysArray, map); // 5 走访情况 List bisInspPreList = bis.getBisInspPreList(); this.setMapValue(bisInspPreList, preListKeysArray, map); // 工程实体 BisInspRsvrProject bisInspRsvrProject = bis.getBisInspRsvrProject(); this.setMapValue(bisInspRsvrProject, safeExtManageKeysArray, map); // 6 效益发挥情况 BisInspRsvrBenefits bisInspRsvrBenefits = bis.getBisInspRsvrBenefits(); this.setMapValue(bisInspRsvrBenefits, benefitsArray, map); // diskRunInfo hasSetMainF 字段和 工程实体里的 挡水建筑物 重复,单独处理 map.put("diskRunInfo2", isShiFou(bisInspRsvrBenefits.getDiskRunInfo())); map.put("hasSetMainFl2", formatCheckNull(bisInspRsvrBenefits.getHasSetMainFl())); dataList.add(map); } return dataList; } /** * 用反射简化赋值流程,通过对象和属性名称给Map赋值 */ private void setMapValue(Object obj, String[] names, LinkedHashMap map) { if (obj == null) { for (String name : names) { map.put(name, ""); } return; } Method[] methods = obj.getClass().getMethods(); for (Method method : methods) { for (String name : names) { if (("get" + name).toLowerCase().equals(method.getName().toLowerCase())) { try { map.put(name, getFormatValue("sk", name, formatCheckNull(method.invoke(obj)), false)); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } } } }