/* package cn.com.goldenwater.dcproj.service.impl.rsvr; import cn.com.goldenwater.core.service.AbstractCrudService; 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.BisInspBaseService; import cn.com.goldenwater.dcproj.service.impl.keyreg.AttprjBaseServiceImpl; import cn.com.goldenwater.dcproj.service.impl.vill.AttEngDikeServiceImpl; import cn.com.goldenwater.dcproj.utils.AMapUtil; import cn.com.goldenwater.dcproj.utils.AdLevelUtil; import cn.com.goldenwater.dcproj.utils.GeoUtil; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import net.sf.json.JSONObject; import org.apache.commons.collections.map.HashedMap; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.text.DecimalFormat; import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; */ /** * @author lhc * @date 2019-2-20 *//* @Service @Transactional(rollbackFor = Exception.class) public class BisInspBaseServiceImpl extends AbstractCrudService implements BisInspBaseService { @Autowired private BisInspBaseDao bisInspBaseDao; @Autowired private AttEmpwtprjBaseServiceImpl attEmpwtprjBaseService; @Autowired private TacInspYearBatchGroupPersDao groupPersDao; @Autowired private BisInspAllRlationPersDao rlationPersDao; @Autowired private TacInspYearBatchGroupDao groupDao; @Autowired private TacInspYearBatchAreaDao tacInspYearBatchAreaDao; @Autowired private TacWorkerBDao workerBDao; @Autowired private TacAttPawpBaseDao tacAttPawpBaseDao; @Autowired private TacPawpRgstrDao tacPawpRgstrDao; @Autowired private TacInspYearBatchObjDao tacInspYearBatchObjDao; public BisInspBaseServiceImpl(BisInspBaseDao bisInspBaseDao) { super(bisInspBaseDao); this.bisInspBaseDao = bisInspBaseDao; } @Override public PageInfo getCatalog(BisInspParam bisInspParam) { String type = bisInspParam.getType()==null?"":bisInspParam.getType(); bisInspParam.setAddvcd(AdLevelUtil.getAddvcd(bisInspParam.getAddvcd())); if ("RSVR".equals(type)) { return getPageRsvrList(bisInspParam); } else if (type.equals("CWS")) { return getPageCwsList(bisInspParam); } else if (type.equals("WTDST")) { return getPageWtdstList(bisInspParam); } else if (type.equals("WS")) { return getPageWrWsList(bisInspParam); } else { return null; } } @Override public PageInfo getPageRsvrList(BisInspParam bisInspParam) { bisInspParam.setAddvcd(AdLevelUtil.getAddvcd(bisInspParam.getAddvcd())); PageHelper.startPage(bisInspParam.getPageNum(), bisInspParam.getPageSize()); List bisInspBaseDtos = getRsvrList(bisInspParam); PageInfo page = new PageInfo(bisInspBaseDtos); return page; } @Override public PageInfo getPageCwsList(BisInspParam bisInspParam) { bisInspParam.setAddvcd(AdLevelUtil.getAddvcd(bisInspParam.getAddvcd())); PageHelper.startPage(bisInspParam.getPageNum(), bisInspParam.getPageSize()); List bisInspBaseDtos = getCwsList(bisInspParam); PageInfo page = new PageInfo(bisInspBaseDtos); return page; } @Override public PageInfo getPageWtdstList(BisInspParam bisInspParam) { bisInspParam.setAddvcd(AdLevelUtil.getAddvcd(bisInspParam.getAddvcd())); PageHelper.startPage(bisInspParam.getPageNum(), bisInspParam.getPageSize()); List bisInspBaseDtos = getWtdstList(bisInspParam); PageInfo page = new PageInfo(bisInspBaseDtos); return page; } @Override public List getBaseList(BisInspParam bisInspParam) { String type = bisInspParam.getType()==null?"":bisInspParam.getType(); bisInspParam.setAddvcd(AdLevelUtil.getAddvcd(bisInspParam.getAddvcd())); if (type.equals("RSVR")) { return getRsvrList(bisInspParam); } else if (type.equals("CWS")) { return getCwsList(bisInspParam); } else if (type.equals("WTDST")) { return getWtdstList(bisInspParam); } else if (type.equals("groundwater")) { return getGrwList(bisInspParam); } else if (type.equalsIgnoreCase("empwt")) { return getEmpwtprjList(bisInspParam); } else if (type.equalsIgnoreCase("sluice")) { //水闸 return getWagaList(bisInspParam); } else if (type.equalsIgnoreCase("wain")) { //取水口 return getWainList(bisInspParam); } else if (type.equalsIgnoreCase("stbprp")) { //水文站 return getStbprpList(bisInspParam); } else if (type.equalsIgnoreCase("swhs")) { //地表水水源地 return getSwhsList(bisInspParam); } else if (type.equalsIgnoreCase("sd")) {//淤地坝 return getSdList(bisInspParam); } else if (type.equalsIgnoreCase("keyswyhs")) { //重点水源地 return getSwhsList(bisInspParam); } else if (type.equalsIgnoreCase("wiu")) { return getWiuList(bisInspParam); } else if (type.equalsIgnoreCase("city")) { return getCityList(bisInspParam); } else if (type.equalsIgnoreCase("svwt")) { return getSvwtList(bisInspParam); } else if (type.equalsIgnoreCase("wunt")){ return getWuntList(bisInspParam); }else if (type.equalsIgnoreCase("prd")){ return getPrdtList(bisInspParam); }else if (type.equalsIgnoreCase("jsfl")){ return getJsfltList(bisInspParam); }else if (type.equalsIgnoreCase("jswa")){ return getJswatList(bisInspParam); } else if (type.equalsIgnoreCase("rsml")) { bisInspParam.setObjType("22"); return getRsvrList(bisInspParam); } else { return null; } } private List getJswatList(BisInspParam bisInspParam) { return this.bisInspBaseDao.getJswatList(bisInspParam); } private List getJsfltList(BisInspParam bisInspParam) { return this.bisInspBaseDao.getJsfltList(bisInspParam); } private List getPrdtList(BisInspParam bisInspParam) { return this.bisInspBaseDao.getPrdList(bisInspParam); } private List getWuntList(BisInspParam bisInspParam) { return this.bisInspBaseDao.getWuntList(bisInspParam); } private List getSvwtList(BisInspParam bisInspParam) { return this.bisInspBaseDao.getSvwtList(bisInspParam); } private List getCityList(BisInspParam bisInspParam) { return this.bisInspBaseDao.getCityList(bisInspParam); } private List getWiuList(BisInspParam bisInspParam) { return this.bisInspBaseDao.getWiuList(bisInspParam); } @Override public AttEngDto getBaseListTop3(BisInspParam bisInspParam) { AttEngDto attEngDto = new AttEngDto(); attEngDto.setRsvrList(getRsvrListTop3(bisInspParam));//水库 attEngDto.setCwsList(getCwsListTop3(bisInspParam));//农饮 attEngDto.setWtdstList(getWtdstListTop3(bisInspParam));//水毁 attEngDto.setAdXList(getAdXListTop3(bisInspParam));//村 attEngDto.setWsList(getWsListTop3(bisInspParam));//水源地 attEngDto.setEmpwtConList(getEmpwtConListTop3(bisInspParam));//172工程建设 attEngDto.setEmpwtRunList(getEmpwtRunListTop3(bisInspParam));//172工程运行 attEngDto.setGrwList(getGrwListTop3(bisInspParam));//地下水 attEngDto.setWagaList(getWagaListTop3(bisInspParam));//水闸 attEngDto.setWainList(getWainListTop3(bisInspParam));//取水口 attEngDto.setStbprpList(getStbprpListTop3(bisInspParam));//水位站 attEngDto.setSwhsList(getSwhsListTop3(bisInspParam));//地表水源地 attEngDto.setSdList(getSdListTop3(bisInspParam)); attEngDto.setWiuList(getWiuListTop3(bisInspParam)); bisInspParam.setNote("new"); attEngDto.setKeySwhsList(getSwhsListTop3(bisInspParam)); attEngDto.setCityList(getCityListTop3(bisInspParam)); attEngDto.setSvwtList(getSvwtListTop3(bisInspParam)); attEngDto.setWuntList(getWuntListTop3(bisInspParam)); attEngDto.setWintLicList(getWintLicListTop3(bisInspParam)); attEngDto.setPrdList(getPrdListTop3(bisInspParam)); attEngDto.setJsflList(getJsflListTop3(bisInspParam)); attEngDto.setJswaList(getJswaListTop3(bisInspParam)); return attEngDto; } private List getJswaListTop3(BisInspParam bisInspParam) { return this.bisInspBaseDao.getJswaListTop3(bisInspParam); } private List getJsflListTop3(BisInspParam bisInspParam) { return this.bisInspBaseDao.getJsflListTop3(bisInspParam); } private List getPrdListTop3(BisInspParam bisInspParam) { return this.bisInspBaseDao.getPrdListTop3(bisInspParam); } private List getWintLicListTop3(BisInspParam bisInspParam){ return this.bisInspBaseDao.getWintLicListTop3(bisInspParam); } private List getWuntListTop3(BisInspParam bisInspParam) { return this.bisInspBaseDao.getWuntListTop3(bisInspParam); } private List getSvwtListTop3(BisInspParam bisInspParam) { return this.bisInspBaseDao.getSvwtListTop3(bisInspParam); } private List getCityListTop3(BisInspParam bisInspParam) { return this.bisInspBaseDao.getCityListTop3(bisInspParam); } private List getWiuListTop3(BisInspParam bisInspParam) { return this.bisInspBaseDao.getWiuListTop3(bisInspParam); } private List getSdListTop3(BisInspParam bisInspParam) { return this.bisInspBaseDao.getSdListTop3(bisInspParam); } private List getSwhsListTop3(BisInspParam bisInspParam) { return this.bisInspBaseDao.getSwhsListTop3(bisInspParam); } private List getStbprpListTop3(BisInspParam bisInspParam) { return this.bisInspBaseDao.getStbprpListTop3(bisInspParam); } private List getWainListTop3(BisInspParam bisInspParam) { return this.bisInspBaseDao.getWainListTop3(bisInspParam); } private List getWagaListTop3(BisInspParam bisInspParam) { return this.bisInspBaseDao.getWagaListTop3(bisInspParam); } private List getGrwListTop3(BisInspParam bisInspParam) { return this.bisInspBaseDao.getGrwListTop3(bisInspParam); } private List getEmpwtConListTop3(BisInspParam bisInspParam) { return this.bisInspBaseDao.getEmpwtConListTop3(bisInspParam); } private List getEmpwtRunListTop3(BisInspParam bisInspParam) { return this.bisInspBaseDao.getEmpwtRunListTop3(bisInspParam); } private List getWsListTop3(BisInspParam bisInspParam) { return this.bisInspBaseDao.getWsListTop3(bisInspParam); } private List getAdXListTop3(BisInspParam bisInspParam) { return this.bisInspBaseDao.getAdXListTop3(bisInspParam); } @Override public AttRsBaseDto getRsvrByCode(String code,String province) { return bisInspBaseDao.getRsvrByCode(code,province); } @Override public AttPrdCstrProjBase getPrdByCode(String code) { return bisInspBaseDao.getPrdByCode(code); } @Override public AttJskejianFlkdisBase getJSFLByCode(String code) { return bisInspBaseDao.getJSFLByCode(code); } @Override public AttJskejianWaterBase getJswaByCode(String code) { return bisInspBaseDao.getJswaByCode(code); } @Override public PageInfo getPagePrdList(BisInspParam bisInspParam) { bisInspParam.setAddvcd(AdLevelUtil.getAddvcd(bisInspParam.getAddvcd())); PageHelper.startPage(bisInspParam.getPageNum(), bisInspParam.getPageSize()); List bisInspBaseDtos = getPrdtList(bisInspParam); PageInfo page = new PageInfo(bisInspBaseDtos); return page; } @Override public PageInfo getPageJsflList(BisInspParam bisInspParam) { bisInspParam.setAddvcd(AdLevelUtil.getAddvcd(bisInspParam.getAddvcd())); PageHelper.startPage(bisInspParam.getPageNum(), bisInspParam.getPageSize()); List bisInspBaseDtos = getJsfltList(bisInspParam); PageInfo page = new PageInfo(bisInspBaseDtos); return page; } @Override public PageInfo getPageJswaList(BisInspParam bisInspParam) { bisInspParam.setAddvcd(AdLevelUtil.getAddvcd(bisInspParam.getAddvcd())); PageHelper.startPage(bisInspParam.getPageNum(), bisInspParam.getPageSize()); List bisInspBaseDtos = getJswatList(bisInspParam); PageInfo page = new PageInfo(bisInspBaseDtos); return page; } @Override public AttScnsrBaseDto getScnsrByCode(String code) { return bisInspBaseDao.getScnsrByCode(code); } @Override public AttEngCwsDto getCwsByCode(String code) { return bisInspBaseDao.getCwsByCode(code); } @Override public BisInspWtdstDto getWtdstByCode(String code) { return bisInspBaseDao.getWtdstByCode(code); } @Override public List getInspPlan(String userid,String province) { List bisInspPlanDtos = bisInspBaseDao.getInspPlanCount(userid,province); Boolean isGly = false; for (int i = 0; i < bisInspPlanDtos.size(); i++) { if (bisInspPlanDtos.get(i).getPlnaId().length() <= 3) { isGly = true; } } List result = new ArrayList<>(); if (isGly) { result.addAll(bisInspBaseDao.getInspGlPlan(userid,province)); } else { result.addAll(bisInspBaseDao.getInspPlan(userid,province)); } TacWorkerBParam param = new TacWorkerBParam(); param.setLoginId(userid); if (workerBDao.findList(param).size() > 0) { //根据id查询 String persType = rlationPersDao.get(userid).getPersType(); TacInspYearBatchGroupParam groupParam = new TacInspYearBatchGroupParam(); if (!"1".equals(persType)) { groupParam.setPersId(userid); } List groupList = groupDao.getGroupListApp(groupParam); if (groupList.size() > 0) { groupList.forEach(group -> { TacInspYearBatchAreaParam areaParam = new TacInspYearBatchAreaParam(); areaParam.setGroupId(group.getId()); List areaList = tacInspYearBatchAreaDao.findList(areaParam); BisInspPlanDto dto = new BisInspPlanDto(); dto.setPlnaId(group.getId()); dto.setPrsnTitle(group.getGroupNm().toString()); dto.setPtype("8"); if (areaList.size() > 0) { StringBuffer area = new StringBuffer(""); areaList.forEach(tacInspYearBatchArea -> { area.append(tacInspYearBatchArea.getAdName()).append(","); }); if (area.indexOf(",") > 0){ dto.setPrsnTitle(area.substring(0,area.length() - 1)); } } result.add(dto); }); } } return result; } @Override public List getGroupPerson(String groupID, String persName,String province) { return bisInspBaseDao.getGroupPerson(groupID, persName,province); } @Override public List getGroupPersonV2(String groupID, String persName, String orgId) { return bisInspBaseDao.getGroupPersonV2(groupID, persName, orgId); } @Override public List getPersonGroup(String userid) { return bisInspBaseDao.getPersonGroup(userid); } @Override public List getGroupByPersId(String persid,String province) { return bisInspBaseDao.getGroupByPersId(persid,province); } @Override public List getListRsvrList(BisInspParam bisInspParam) { bisInspParam.setAddvcd(AdLevelUtil.getAddvcd(bisInspParam.getAddvcd())); List bisInspBaseDtos = getRsvrList(bisInspParam); return bisInspBaseDtos; } @Override public List getListCwsList(BisInspParam bisInspParam) { bisInspParam.setAddvcd(AdLevelUtil.getAddvcd(bisInspParam.getAddvcd())); List bisInspBaseDtos = getCwsList(bisInspParam); return bisInspBaseDtos; } @Override public int exchangeCoordinate(String type) { int i = 0; if ("ATT_RS_BASE".equals(type)) { List attRsBaseList = this.bisInspBaseDao.exchangeCoordinate(); if (attRsBaseList.size() > 0) { for (AttRsBase attRsBase : attRsBaseList) { if (attRsBase.getCenterX() != null && attRsBase.getCenterY() != null) { Map map = GeoUtil.wgs84togcj02(Double.parseDouble(attRsBase.getCenterX()), Double.parseDouble(attRsBase.getCenterY())); i += this.bisInspBaseDao.updateCoordinate(attRsBase.getRsCode(), map.get("lon"), map.get("lat")); } } } } if ("ATT_AD_X_BASE".equals(type)) { List attRsBaseList = this.bisInspBaseDao.exchangeCoordinate(); if (attRsBaseList.size() > 0) { for (AttRsBase attRsBase : attRsBaseList) { if (attRsBase.getCenterX() != null && attRsBase.getCenterY() != null) { Map map = GeoUtil.wgs84togcj02(Double.parseDouble(attRsBase.getCenterX()), Double.parseDouble(attRsBase.getCenterY())); i += this.bisInspBaseDao.updateCoordinate(attRsBase.getRsCode(), map.get("lon"), map.get("lat")); } } } } if ("BIS_INSP_WTDST".equals(type)) { List bisInspBases = this.bisInspBaseDao.exchangeWtdstCoordinate(); if (bisInspBases.size() > 0) { for (AttRsBase attRsBase : bisInspBases) { if (attRsBase.getCenterX() != null && attRsBase.getCenterY() != null) { Map map = GeoUtil.wgs84togcj02(Double.parseDouble(attRsBase.getCenterX()), Double.parseDouble(attRsBase.getCenterY())); i += this.bisInspBaseDao.updateWtdstCoordinate(attRsBase.getRsCode(), map.get("lon"), map.get("lat")); } } } } if ("ATT_CWS_BASE".equals(type)) { List bisInspBases = this.bisInspBaseDao.exchangeCwsCoordinate(); if (bisInspBases.size() > 0) { int j = 0; DecimalFormat df = new DecimalFormat("0.0000000000"); for (AttRsBase attRsBase : bisInspBases) { if (attRsBase.getCenterX() != null && attRsBase.getCenterY() != null) { j++; Map map = GeoUtil.wgs84togcj02(Double.parseDouble(attRsBase.getCenterX()), Double.parseDouble(attRsBase.getCenterY())); try { this.bisInspBaseDao.updateCwsCoordinate(attRsBase.getRsCode(), Double.parseDouble(df.format(map.get("lon"))), Double.parseDouble(df.format(map.get("lat")))); } catch (Exception e) { continue; } } } } } if ("ATT_GRW_BASE".equals(type)) { List bisInspBases = this.bisInspBaseDao.exchangeGrwCoordinate(); if (bisInspBases.size() > 0) { int j = 0; DecimalFormat df = new DecimalFormat("0.0000000000"); for (AttRsBase attRsBase : bisInspBases) { if (attRsBase.getCenterX() != null && attRsBase.getCenterY() != null) { j++; Map map = GeoUtil.wgs84togcj02(Double.parseDouble(attRsBase.getCenterX()), Double.parseDouble(attRsBase.getCenterY())); try { this.bisInspBaseDao.updateGrwCoordinate(attRsBase.getRsCode(), Double.parseDouble(df.format(map.get("lon"))), Double.parseDouble(df.format(map.get("lat")))); } catch (Exception e) { continue; } } } } } if ("ATT_WAGA_BASE".equals(type)) { List bisInspBases = this.bisInspBaseDao.exchangeWagaCoordinate(); if (bisInspBases.size() > 0) { int j = 0; DecimalFormat df = new DecimalFormat("0.0000000000"); for (AttRsBase attRsBase : bisInspBases) { if (attRsBase.getCenterX() != null && attRsBase.getCenterY() != null) { j++; Map map = GeoUtil.wgs84togcj02(Double.parseDouble(attRsBase.getCenterX()), Double.parseDouble(attRsBase.getCenterY())); try { this.bisInspBaseDao.updateWagaCoordinate(attRsBase.getRsCode(), Double.parseDouble(df.format(map.get("lon"))), Double.parseDouble(df.format(map.get("lat")))); } catch (Exception e) { continue; } } } } } if ("ATT_WAIN_BASE".equals(type)) { List bisInspBases = this.bisInspBaseDao.exchangeWainCoordinate(); if (bisInspBases.size() > 0) { int j = 0; DecimalFormat df = new DecimalFormat("0.0000000000"); for (AttRsBase attRsBase : bisInspBases) { if (attRsBase.getCenterX() != null && attRsBase.getCenterY() != null) { j++; Map map = GeoUtil.wgs84togcj02(Double.parseDouble(attRsBase.getCenterX()), Double.parseDouble(attRsBase.getCenterY())); try { this.bisInspBaseDao.updateWainCoordinate(attRsBase.getRsCode(), Double.parseDouble(df.format(map.get("lon"))), Double.parseDouble(df.format(map.get("lat")))); } catch (Exception e) { continue; } } } } } if ("ST_STBPRP_B".equals(type)) { List bisInspBases = this.bisInspBaseDao.exchangeStbprpCoordinate(); if (bisInspBases.size() > 0) { int j = 0; DecimalFormat df = new DecimalFormat("0.0000000000"); for (AttRsBase attRsBase : bisInspBases) { if (attRsBase.getCenterX() != null && attRsBase.getCenterY() != null) { j++; Map map = GeoUtil.wgs84togcj02(Double.parseDouble(attRsBase.getCenterX()), Double.parseDouble(attRsBase.getCenterY())); try { this.bisInspBaseDao.updateStbprpCoordinate(attRsBase.getRsCode(), Double.parseDouble(df.format(map.get("lon"))), Double.parseDouble(df.format(map.get("lat")))); } catch (Exception e) { continue; } } } } } if ("ATT_SWHS_BASE".equals(type)) { List bisInspBases = this.bisInspBaseDao.exchangeSwhsCoordinate(); if (bisInspBases.size() > 0) { int j = 0; DecimalFormat df = new DecimalFormat("0.0000000000"); for (AttRsBase attRsBase : bisInspBases) { if (attRsBase.getCenterX() != null && attRsBase.getCenterY() != null) { j++; Map map = GeoUtil.wgs84togcj02(Double.parseDouble(attRsBase.getCenterX()), Double.parseDouble(attRsBase.getCenterY())); try { this.bisInspBaseDao.updateSwhsCoordinate(attRsBase.getRsCode(), Double.parseDouble(df.format(map.get("lon"))), Double.parseDouble(df.format(map.get("lat")))); } catch (Exception e) { continue; } } } } } if ("ATT_WAGA_BASE.AD_CODE".equals(type)) { List bisInspBases = this.bisInspBaseDao.getWagaAdName(); if (bisInspBases.size() > 0) { int j = 0; for (AttRsBase attRsBase : bisInspBases) { j++; AttRsBase ar = this.bisInspBaseDao.getAdCode(attRsBase.getAdFullName()); this.bisInspBaseDao.updateWagaAdCode(attRsBase.getRsCode(), ar.getAdmDiv()); } } } return 1; } @Override public WrWsB getWrWsByCode(String code) { WrWsB wrWsB = new WrWsB(); wrWsB = this.bisInspBaseDao.getWrGwsByCode(code);//查询地下水源地表 if (wrWsB == null) {//如果查询结果为空,再查询地表水源地 wrWsB = this.bisInspBaseDao.getWrSwsByCode(code); } return wrWsB; } @Override public PageInfo getPageWrWsList(BisInspParam bisInspParam) { PageHelper.startPage(bisInspParam.getPageNum(), bisInspParam.getPageSize()); List bisInspBaseDtos = getWrWsList(bisInspParam); PageInfo page = new PageInfo(bisInspBaseDtos); return page; } @Override public List getWrWsList(BisInspParam bisInspParam) { Map map = AdLevelUtil.SubAd(bisInspParam.getAddvcd()); bisInspParam.setAddvcd(map.get(SplitValue.SUBAD).toString()); return this.bisInspBaseDao.getWrWsList(bisInspParam); } @Override public List getAdXList(BisInspParam bisInspParam) { bisInspParam.setAddvcd(AdLevelUtil.getAddvcd(bisInspParam.getAddvcd())); return this.bisInspBaseDao.getAdXList(bisInspParam); } @Override public PageInfo getPageAdXList(BisInspParam bisInspParam) { bisInspParam.setAddvcd(AdLevelUtil.getAddvcd(bisInspParam.getAddvcd())); PageHelper.startPage(bisInspParam.getPageNum(), bisInspParam.getPageSize()); List bisInspBaseDtos = getAdXList(bisInspParam); PageInfo page = new PageInfo(bisInspBaseDtos); return page; } @Override public AttAdXBase getAdXByCode(String code) { return this.bisInspBaseDao.getAdXByCode(code); } @Override public List getProCountByType() { return this.bisInspBaseDao.getProCountByType(); } @Override public List getSchCountByType() { List proCountList = new ArrayList<>(); ProCount p1 = this.bisInspBaseDao.getSchCountByRs(); ProCount p2 = this.bisInspBaseDao.getSchCountByVill(); ProCount p3 = this.bisInspBaseDao.getSchCountByWtd(); if (p1 != null) { proCountList.add(p1); } if (p2 != null) { proCountList.add(p2); } if (p3 != null) { proCountList.add(p3); } return proCountList; } @Override public List getProCountByAd() { return this.bisInspBaseDao.getProCountByAd(); } @Override public List getAdXBaseList(BisInspParam bisInspParam) { bisInspParam.setAddvcd(AdLevelUtil.getAddvcd(bisInspParam.getAddvcd())); return this.bisInspBaseDao.getAdXBaseList(bisInspParam); } @Override public List getInspByPersid(String persid) { return this.bisInspBaseDao.getInspByPersid(persid); } @Override public List getInspByPid(String pid) { return this.bisInspBaseDao.getInspByPid(pid); } @Override public List getRsvrList(BisInspParam bisInspParam) { if(StringUtils.isNotBlank(bisInspParam.getEngScal()) && (bisInspParam.getEngScal().contains("4")|| bisInspParam.getEngScal().contains("5"))){ bisInspParam.setType("RSVR"); } return bisInspBaseDao.getRsvrList(bisInspParam); } public List getGrwList(BisInspParam bisInspParam) { return bisInspBaseDao.getGrwList(bisInspParam); } public List getWagaList(BisInspParam bisInspParam) { return bisInspBaseDao.getWagaList(bisInspParam); } public List getWainList(BisInspParam bisInspParam) { return bisInspBaseDao.getWainList(bisInspParam); } public List getStbprpList(BisInspParam bisInspParam) { return bisInspBaseDao.getStbprpList(bisInspParam); } public List getSwhsList(BisInspParam bisInspParam) { return bisInspBaseDao.getSwhsList(bisInspParam); } public List getEmpwtprjList(BisInspParam bisInspParam) { return bisInspBaseDao.getEmpwtprjList(bisInspParam); } @Override public List getSdList(BisInspParam bisInspParam) { return bisInspBaseDao.getSdList(bisInspParam); } @Override public List getCwsList(BisInspParam bisInspParam) { return bisInspBaseDao.getCwsList(bisInspParam); } @Override public List getWtdstList(BisInspParam bisInspParam) { return bisInspBaseDao.getWtdstList(bisInspParam); } public List getRsvrListTop3(BisInspParam bisInspParam) { return bisInspBaseDao.getRsvrListTop3(bisInspParam); } public List getCwsListTop3(BisInspParam bisInspParam) { return bisInspBaseDao.getCwsListTop3(bisInspParam); } public List getWtdstListTop3(BisInspParam bisInspParam) { return bisInspBaseDao.getWtdstListTop3(bisInspParam); } @Override public AllObjDto findAllObj(FindAllObjDto findAllObjDto) { AllObjDto allObjDto = new AllObjDto(); allObjDto.setAttPersBaseList(this.findAllPers(findAllObjDto)); allObjDto.setAttPersRsList(this.findAllRs(findAllObjDto)); allObjDto.setAttPersWtdstList(this.findAllWtdst(findAllObjDto)); allObjDto.setAttCwsBaseList(this.findAllCws(findAllObjDto)); allObjDto.setAttGrwBaseList(this.findAllGrw(findAllObjDto)); allObjDto.setAttEmpwtprjBasePageInfo(this.findAllEmpwtprj(findAllObjDto)); return allObjDto; } @Override public AttGrwBase getGroundWaterByCode(String code) { return this.bisInspBaseDao.getGroundWaterByCode(code); } @Override public AttEmpwtprjBase getEmpwtprjListByCode(String code) { return attEmpwtprjBaseService.get(code); } @Override public AttWagaBase getSluiceByCode(String code) { return this.bisInspBaseDao.getSluiceByCode(code); } @Autowired private BisInspAllDao bisInspAllDao; @Override public List findAreas() { return bisInspAllDao.findAreas(); } @Override public List getGroupByPidAndPersid(String pid, String persid,String province) { return this.bisInspBaseDao.getGroupByPidAndPersid(pid, persid, province); } @Override public List getByPersid(String userid, String pid,String province) { List resultList = new ArrayList<>(); List clearRepeatList = new ArrayList<>(); Map map = new HashedMap(); if ("0".equals(pid)) {//获取类型 List list = this.bisInspBaseDao.getPersType(userid,province); TacInspYearBatchGroupPersParam persParam = new TacInspYearBatchGroupPersParam(); persParam.setPersId(userid); persParam.setProvince(province); List groupPersList = groupPersDao.findPersList(persParam); Map resultMap = list.stream().collect(Collectors.toMap(BisInspPlanDto::getPtype, Function.identity())); if (groupPersList.size() > 0) { if (!resultMap.containsKey(BisInspEnum.PAWP.getValue())) { BisInspPlanDto dto = new BisInspPlanDto(); dto.setPlnaId(BisInspEnum.PAWP.getRlation()); dto.setPtype(BisInspEnum.PAWP.getValue()); dto.setPrsnTitle("稽察工作"); resultMap.put(BisInspEnum.PAWP.getValue(), dto); List result = new ArrayList<>(resultMap.values()); Collections.sort(result, new Comparator() { @Override public int compare(BisInspPlanDto o1, BisInspPlanDto o2) { return o1.getPtype().compareTo(o2.getPtype()); } }); return result; } } else { if (resultMap.containsKey(BisInspEnum.PAWP.getValue())) { list.remove(resultMap.get(BisInspEnum.PAWP.getValue())); } } return list; } else { if (pid.startsWith(BisInspEnum.PAWP.getRlation())) { TacInspYearBatchGroupPersParam param = new TacInspYearBatchGroupPersParam(); String persType = rlationPersDao.get(userid).getPersType(); param.setProvince(province); if (!"1".equals(persType)) { param.setPersId(userid); } if (pid.length() == 3) { //查询年度 List list = groupPersDao.getYearList(param); return list; } if (pid.length() == 7) { param.setYear(Long.valueOf(pid.substring(3))); List list = groupPersDao.getBatchList(param); return list; } if (pid.length() >= 8) { TacInspYearBatchGroupParam groupParam = new TacInspYearBatchGroupParam(); if (!"1".equals(persType)) { groupParam.setPersId(userid); } String year = pid.substring(3,7); String batch = pid.substring(7); groupParam.setYear(Long.valueOf(year)); groupParam.setBatch(Long.valueOf(batch)); groupParam.setProvince(province); List list = new ArrayList<>(); List groupList = groupDao.getGroupListApp(groupParam); if (groupList.size() > 0) { groupList.forEach(group -> { TacInspYearBatchAreaParam areaParam = new TacInspYearBatchAreaParam(); areaParam.setGroupId(group.getId()); areaParam.setProvince(province); List areaList = tacInspYearBatchAreaDao.findList(areaParam); BisInspPlanDto dto = new BisInspPlanDto(); dto.setPlnaId(group.getId()); dto.setPrsnTitle(group.getGroupNm().toString()); dto.setPtype("8"); if (areaList.size() > 0) { StringBuffer area = new StringBuffer(""); areaList.forEach(tacInspYearBatchArea -> { area.append(tacInspYearBatchArea.getAdName()).append(","); }); if (area.indexOf(",") > 0){ dto.setPrsnTitle(area.substring(0,area.length() - 1)); } } list.add(dto); }); } return list; } } List bisInspPlanDtoList = this.bisInspBaseDao.getAllNodeByPersid(userid, pid,province);//001,001041 if (bisInspPlanDtoList.size() > 0) { for (BisInspPlanDto bis : bisInspPlanDtoList) { if (pid.length() == 3) {//如果查机构 if (bis.getPlnaId().length() == 3) {//取到类型时 查询下级 List list = this.bisInspBaseDao.getDept(bis.getPlnaId(), pid, 6,province); resultList.addAll(list); } else if (bis.getPlnaId().length() == 6) {//取到机构时候,直接放到结果集 if (pid.substring(0, 3).equals(bis.getPlnaId().substring(0, 3))) { resultList.add(bis); } } else if (bis.getPlnaId().length() == 9) {//取到批次或者组时候,向上查询 List list = this.bisInspBaseDao.getDeptByGroup(userid, pid,province); resultList.addAll(list); } else if (bis.getPlnaId().length() == 12) {//取到批次或者组时候,向上查询 List list = this.bisInspBaseDao.getDeptByGroup(userid, pid,province); resultList.addAll(list); } } if (pid.length() == 6) {//如果查批次001041,001 if (bis.getPlnaId().length() == 3) {//取到类型时 查询所有批次 List list = this.bisInspBaseDao.getDept(bis.getPlnaId(), pid, 9,province); resultList.addAll(list); } else if (bis.getPlnaId().length() == 6) {//取到机构时候,查询下级008041 List list = this.bisInspBaseDao.getDept(bis.getPlnaId(), pid, 9,province); resultList.addAll(list); } else if (bis.getPlnaId().length() == 9) {//取到批次的时候,直接放入结果集 if (pid.substring(0, 6).equals(bis.getPlnaId().substring(0, 6))) { resultList.add(bis); } } else if (bis.getPlnaId().length() == 12) {//取到组时候,向上查询 List list = this.bisInspBaseDao.getBatchByGroup(userid, pid,province); resultList.addAll(list); } } if (pid.length() == 9) {//如果查组 if (bis.getPlnaId().length() == 3) {//取到类型时 查询所有组 List list = this.bisInspBaseDao.getDept(bis.getPlnaId(), pid, 12,province); resultList.addAll(list); } else if (bis.getPlnaId().length() == 6) {//取到机构时候,查询下级 List list = this.bisInspBaseDao.getDept(bis.getPlnaId(), pid, 12,province); resultList.addAll(list); } else if (bis.getPlnaId().length() == 9) {//取到批次的时候,查询下级 List list = this.bisInspBaseDao.getDept(bis.getPlnaId(), pid, 12,province); resultList.addAll(list); } else if (bis.getPlnaId().length() == 12) {//取到组时候,放入结果集 if (pid.substring(0, 9).equals(bis.getPlnaId().substring(0, 9))) { resultList.add(bis); } } } } //去重 for (BisInspPlanDto b : resultList) { map.put(b.getPlnaId(), b); } for (Map.Entry entry : map.entrySet()) { clearRepeatList.add((BisInspPlanDto) entry.getValue()); } if (clearRepeatList.size() > 0 && pid.length() == 9) {//组按id排序 Collections.sort(clearRepeatList, new Comparator() { @Override public int compare(BisInspPlanDto o1, BisInspPlanDto o2) { return o2.getPlnaId().compareTo(o1.getPlnaId()); } }); } if (clearRepeatList.size() > 0 && pid.length() == 6) {//查月份升序 Collections.sort(clearRepeatList, new Comparator() { @Override public int compare(BisInspPlanDto o1, BisInspPlanDto o2) { return o1.getPlnaId().compareTo(o2.getPlnaId()); } }); } if (pid.length() == 3 && clearRepeatList.size() > 0) {//机构排序 Collections.sort(clearRepeatList, new Comparator() { @Override public int compare(BisInspPlanDto o1, BisInspPlanDto o2) { //督查办排在第一位 if (o2.getPrsnTitle().indexOf("督查办") > -1) { return 1; } return o1.getPlnaId().compareTo(o2.getPlnaId()); } }); } } } return clearRepeatList; } @Override public void changeAdCode(String province) { List attGrwBaseList = this.bisInspBaseDao.getAllGrw(province); if (attGrwBaseList.size() > 0) { int i = 0; for (AttGrwBase attGrwBase : attGrwBaseList) { if (attGrwBase != null) { i++; String geocode = AMapUtil.geocode(attGrwBase.getStlc()); com.alibaba.fastjson.JSONObject jsStr = com.alibaba.fastjson.JSONObject.parseObject(geocode); List geocodes = (List) jsStr.get("geocodes"); if (geocodes.size() > 0) { Object o = geocodes.get(0); JSONObject json = JSONObject.fromObject(o); String district = json.getString("formatted_address"); String adcode = json.getString("adcode"); if (district.length() > 2) { this.bisInspBaseDao.updateCodeAndName(district, adcode + "000000", attGrwBase.getStcd()); } else { this.bisInspBaseDao.updateCode(adcode + "000000", attGrwBase.getStcd()); System.out.println(i); } } } } } } @Override public PageInfo getPageEmpwtList(BisInspParam bisInspParam) { if (StringUtils.isNotBlank(bisInspParam.getAddvcd())) { Map map = AdLevelUtil.SubAd(bisInspParam.getAddvcd()); bisInspParam.setAddvcd(map.get(SplitValue.SUBAD).toString()); } PageHelper.startPage(bisInspParam.getPageNum(), bisInspParam.getPageSize()); List empwtprjList = bisInspBaseDao.getEmpwtprjList(bisInspParam); PageInfo page = new PageInfo(empwtprjList); return page; } @Override public PageInfo getPageGrwList(BisInspParam bisInspParam) { if (StringUtils.isNotBlank(bisInspParam.getAddvcd())) { Map map = AdLevelUtil.SubAd(bisInspParam.getAddvcd()); bisInspParam.setAddvcd(map.get(SplitValue.SUBAD).toString()); } PageHelper.startPage(bisInspParam.getPageNum(), bisInspParam.getPageSize()); List grwList = bisInspBaseDao.getGrwList(bisInspParam); PageInfo page = new PageInfo(grwList); return page; } @Override public PageInfo getPageWagaList(BisInspParam bisInspParam) { if (StringUtils.isNotBlank(bisInspParam.getAddvcd())) { Map map = AdLevelUtil.SubAd(bisInspParam.getAddvcd()); bisInspParam.setAddvcd(map.get(SplitValue.SUBAD).toString()); } PageHelper.startPage(bisInspParam.getPageNum(), bisInspParam.getPageSize()); List wagaList = bisInspBaseDao.getWagaList(bisInspParam); PageInfo page = new PageInfo(wagaList); return page; } @Override public List getGroupPersonByPersId(String persid, String persName,String province) { return this.bisInspBaseDao.getGroupPersonByPersId(persid, persName,province); } @Override public PageInfo getPageWainList(BisInspParam bisInspParam) { bisInspParam.setAddvcd(AdLevelUtil.getAddvcd(bisInspParam.getAddvcd())); PageHelper.startPage(bisInspParam.getPageNum(), bisInspParam.getPageSize()); List bisInspBaseDtos = getWainList(bisInspParam); PageInfo page = new PageInfo(bisInspBaseDtos); return page; } @Override public PageInfo getPageWintList(BisInspParam bisInspParam) { bisInspParam.setAddvcd(AdLevelUtil.getAddvcd(bisInspParam.getAddvcd())); PageHelper.startPage(bisInspParam.getPageNum(), bisInspParam.getPageSize()); List bisInspBaseDtos = getWintLicList(bisInspParam); PageInfo page = new PageInfo(bisInspBaseDtos); return page; } private List getWintLicList(BisInspParam bisInspParam) { return bisInspBaseDao.getWintLicList(bisInspParam); } @Override public PageInfo getPageStbprpList(BisInspParam bisInspParam) { bisInspParam.setAddvcd(AdLevelUtil.getAddvcd(bisInspParam.getAddvcd())); PageHelper.startPage(bisInspParam.getPageNum(), bisInspParam.getPageSize()); List bisInspBaseDtos = getStbprpList(bisInspParam); PageInfo page = new PageInfo(bisInspBaseDtos); return page; } @Override public PageInfo getPageSwhsList(BisInspParam bisInspParam) { bisInspParam.setAddvcd(AdLevelUtil.getAddvcd(bisInspParam.getAddvcd())); PageHelper.startPage(bisInspParam.getPageNum(), bisInspParam.getPageSize()); List bisInspBaseDtos = getSwhsList(bisInspParam); PageInfo page = new PageInfo(bisInspBaseDtos); return page; } @Override public PageInfo getPageSdList(BisInspParam bisInspParam) { bisInspParam.setAddvcd(AdLevelUtil.getAddvcd(bisInspParam.getAddvcd())); PageHelper.startPage(bisInspParam.getPageNum(), bisInspParam.getPageSize()); List list = getSdList(bisInspParam); PageInfo pageInfo = new PageInfo(list); return pageInfo; } @Override public PageInfo getPageWiuList(BisInspParam bisInspParam) { bisInspParam.setAddvcd(AdLevelUtil.getAddvcd(bisInspParam.getAddvcd())); PageHelper.startPage(bisInspParam.getPageNum(), bisInspParam.getPageSize()); List list = getWiuList(bisInspParam); PageInfo pageInfo = new PageInfo(list); return pageInfo; } @Override public PageInfo getPageWuntList(BisInspParam bisInspParam) { bisInspParam.setAddvcd(AdLevelUtil.getAddvcd(bisInspParam.getAddvcd())); PageHelper.startPage(bisInspParam.getPageNum(), bisInspParam.getPageSize()); List bisInspBaseDtos = getWuntList(bisInspParam); PageInfo page = new PageInfo(bisInspBaseDtos); return page; } @Override public PageInfo getPageSvwtList(BisInspParam bisInspParam) { bisInspParam.setAddvcd(AdLevelUtil.getAddvcd(bisInspParam.getAddvcd())); PageHelper.startPage(bisInspParam.getPageNum(), bisInspParam.getPageSize()); List bisInspBaseDtos = getSvwtList(bisInspParam); PageInfo page = new PageInfo(bisInspBaseDtos); return page; } //农饮工程 public PageInfo findAllCws(FindAllObjDto findAllObjDto) { PageHelper.startPage(findAllObjDto.getPageNum(), findAllObjDto.getPageSize()); List list = bisInspBaseDao.findAllCws(findAllObjDto); PageInfo page = new PageInfo(list); return page; } //农饮工程 public PageInfo findAllGrw(FindAllObjDto findAllObjDto) { PageHelper.startPage(findAllObjDto.getPageNum(), findAllObjDto.getPageSize()); List list = bisInspBaseDao.findAllGrw(findAllObjDto); PageInfo page = new PageInfo(list); return page; } //172重点水利工程 public PageInfo findAllEmpwtprj(FindAllObjDto findAllObjDto) { PageHelper.startPage(findAllObjDto.getPageNum(), findAllObjDto.getPageSize()); List list = bisInspBaseDao.findAllEmpwtprj(findAllObjDto); PageInfo page = new PageInfo(list); return page; } //水库 public PageInfo findAllRs(FindAllObjDto findAllObjDto) { PageHelper.startPage(findAllObjDto.getPageNum(), findAllObjDto.getPageSize()); List list = bisInspBaseDao.findAllRs(findAllObjDto); PageInfo page = new PageInfo(list); return page; } //人员 public PageInfo findAllPers(FindAllObjDto findAllObjDto) { PageHelper.startPage(findAllObjDto.getPageNum(), findAllObjDto.getPageSize()); List list = bisInspBaseDao.findAllPers(findAllObjDto); PageInfo page = new PageInfo(list); return page; } //水毁 public PageInfo findAllWtdst(FindAllObjDto findAllObjDto) { PageHelper.startPage(findAllObjDto.getPageNum(), findAllObjDto.getPageSize()); List list = bisInspBaseDao.findAllWtdst(findAllObjDto); PageInfo page = new PageInfo(list); return page; } @Override public PageInfo getPageCityList(BisInspParam bisInspParam) { bisInspParam.setAddvcd(AdLevelUtil.getAddvcd(bisInspParam.getAddvcd())); PageHelper.startPage(bisInspParam.getPageNum(), bisInspParam.getPageSize()); List list = getCityList(bisInspParam); PageInfo pageInfo = new PageInfo(list); return pageInfo; } @Override public int updateBaseInfoName(String fromName, String toName, String type) { if (StringUtils.isBlank(fromName) || StringUtils.isBlank(toName)) { return 0; } if (BisInspEnum.PAWP.getValue().equals(type)) { TacAttPawpBaseParam baseParam = new TacAttPawpBaseParam(); baseParam.setName(fromName); List baseList = tacAttPawpBaseDao.findList(baseParam); if (baseList.size() >= 0) { baseList.forEach(tacAttPawpBase -> { if (fromName.equalsIgnoreCase(tacAttPawpBase.getName())){ tacAttPawpBase.setName(toName); tacAttPawpBaseDao.update(tacAttPawpBase); } }); } TacInspYearBatchObjParam objParam = new TacInspYearBatchObjParam(); objParam.setOjbNm(fromName); List objList = tacInspYearBatchObjDao.findList(objParam); if (objList.size() > 0) { objList.forEach(tacInspYearBatchObj -> { tacInspYearBatchObj.setOjbNm(toName); tacInspYearBatchObjDao.update(tacInspYearBatchObj); }); } TacPawpRgstrParam rgstrParam = new TacPawpRgstrParam(); rgstrParam.setName(fromName); List rgstrList = tacPawpRgstrDao.findList(rgstrParam); if (rgstrList.size() > 0) { rgstrList.forEach(tacPawpRgstr -> { if (fromName.equalsIgnoreCase(tacPawpRgstr.getName())){ tacPawpRgstr.setName(toName); tacPawpRgstrDao.update(tacPawpRgstr); } }); } } return 0; } } */