| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840 |
- package cn.com.goldenwater.dcproj.service.impl.homepage;
- import cn.com.goldenwater.dcproj.constValue.AdCodeLabel;
- import cn.com.goldenwater.dcproj.constValue.BisInspEnum;
- import cn.com.goldenwater.dcproj.constValue.BisInspTypeEnum;
- import cn.com.goldenwater.dcproj.dao.BisInspAllObjDao;
- import cn.com.goldenwater.dcproj.dao.BisInspAllRlationPersDao;
- import cn.com.goldenwater.dcproj.dao.BisInspPblmDao;
- import cn.com.goldenwater.dcproj.dao.PersPositionDao;
- import cn.com.goldenwater.dcproj.dto.*;
- import cn.com.goldenwater.dcproj.model.BisInspPblm;
- import cn.com.goldenwater.dcproj.model.DuchaObj;
- import cn.com.goldenwater.dcproj.model.ObjPerson;
- import cn.com.goldenwater.dcproj.param.IndexParam;
- import cn.com.goldenwater.dcproj.param.IndexParamPage;
- import cn.com.goldenwater.dcproj.param.IndexPblmParam;
- import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
- import cn.com.goldenwater.dcproj.service.PcIndexService;
- import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
- import cn.com.goldenwater.dcproj.utils.EnumUtil;
- import cn.com.goldenwater.dcproj.utils.InspUtils;
- import com.github.pagehelper.PageHelper;
- import com.github.pagehelper.PageInfo;
- import org.apache.commons.lang3.StringUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import org.springframework.transaction.annotation.Transactional;
- import java.text.SimpleDateFormat;
- import java.time.LocalDate;
- import java.time.LocalDateTime;
- import java.time.format.DateTimeFormatter;
- import java.time.temporal.TemporalAdjusters;
- import java.util.*;
- @Service
- @Transactional
- public class PcIndexServiceImpl implements PcIndexService {
- @Autowired
- private BisInspPblmDao inspPblmDao;
- @Autowired
- private BisInspAllObjDao inspAllObjDao;
- @Autowired
- private BisInspAllRlationPersDao bisInspAllRlationPersDao;
- @Autowired
- private PersPositionDao persPositionDao;
- @Autowired
- private OlBisInspOrgService inspOrgService;
- @Override
- public Map<String, String> timeCount(String orgId) {
- LocalDateTime time = LocalDateTime.now();
- DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
- //获取天
- String dayDesc = dtf2.format(time);
- BisInspPblm bisInspPblm = new BisInspPblm();
- bisInspPblm.setProvince(inspOrgService.getProvince(orgId));
- bisInspPblm.setFindTime(dayDesc);
- int total = inspPblmDao.selectCount(bisInspPblm);
- bisInspPblm.setFindTime(null);
- Map<String, String> params = new HashMap<>();
- params.put("day", total + "");
- dtf2 = DateTimeFormatter.ofPattern("yyyy-MM");
- String monthDesc = dtf2.format(time);
- bisInspPblm.setMonthTime(monthDesc);
- total = inspPblmDao.selectCount(bisInspPblm);
- bisInspPblm.setMonthTime(null);
- params.put("month", total + "");
- //获取一周内数据
- //改为周一到当前时间
- String weekTme = LocalDate.now().minusDays(LocalDate.now().getDayOfWeek().getValue() - 1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
- bisInspPblm.setStartTime(weekTme);
- total = inspPblmDao.selectCount(bisInspPblm);
- params.put("week", total + "");
- return params;
- }
- @Override
- public List<DcTypeDto> countGroup(IndexParam indexParam) {
- indexParam.setOrgIds(InspUtils.setOrgIds(indexParam.getOrgIds()));
- List<DcTypeDto> list = inspAllObjDao.countGroup(getIndexParam(indexParam));
- Map<String,DcTypeDto> map = this.convertToTree(list);
- return new ArrayList<DcTypeDto>(map.values());
- }
- private Map<String,DcTypeDto> convertToTree(List<DcTypeDto> list){
- Map<String,DcTypeDto> map = new TreeMap<>(String::compareTo);
- for (DcTypeDto dcTypeDto : list) {
- BisInspTypeEnum typeEnum = EnumUtil.getBisInspTypeEnum(dcTypeDto.getObjType());
- if (typeEnum == null) {
- DcTypeDto otherDto = null;
- if (map.keySet().contains("其他类")) {
- otherDto = map.get("其他类");
- } else {
- otherDto = new DcTypeDto();
- otherDto.setTotal("0");
- otherDto.setName("其他类");
- otherDto.setLevel("1");
- otherDto.setChildren(new ArrayList<>());
- map.put("其他类",otherDto);
- }
- otherDto.setTotal(Long.valueOf(otherDto.getTotal())+ Long.valueOf(dcTypeDto.getTotal()) + "");
- otherDto.getChildren().add(dcTypeDto);
- } else {
- if (!map.containsKey(typeEnum.getParentCode())) {
- DcTypeDto dto = new DcTypeDto();
- dto.setLevel("1");
- List<DcTypeDto> child = new ArrayList<>();
- child.add(dcTypeDto);
- dto.setChildren(child);
- dto.setName(typeEnum.getParentName());
- dto.setTotal(dcTypeDto.getTotal());
- map.put(typeEnum.getParentCode(),dto);
- } else {
- DcTypeDto dto = map.get(typeEnum.getParentCode());
- dto.setTotal(Long.valueOf(dto.getTotal())+Long.valueOf(dcTypeDto.getTotal()) + "");
- dto.getChildren().add(dcTypeDto);
- }
- }
- }
- return map;
- }
- @Override
- public List<DcTypeDto> countPerson(IndexParam indexParam) {
- indexParam.setOrgIds(InspUtils.setOrgIds(indexParam.getOrgIds()));
- Map<String,DcTypeDto> map = this.convertToTree(inspAllObjDao.countPerson(getIndexParam(indexParam)));
- return new ArrayList<DcTypeDto>(map.values());
- }
- @Override
- public List<DcTypeDto> countDucha(IndexParam indexParam) {
- indexParam.setOrgIds(InspUtils.setOrgIds(indexParam.getOrgIds()));
- List<DcTypeDto> list = inspAllObjDao.countDcByType(getIndexParam(indexParam));
- Map<String,DcTypeDto> map = this.convertToTree(list);
- return new ArrayList<DcTypeDto>(map.values());
- }
- @Override
- public List<DcTypeDto> countPblmByType(IndexParam indexParam) {
- indexParam.setOrgIds(InspUtils.setOrgIds(indexParam.getOrgIds()));
- List<DcTypeDto> typeDtoList = inspAllObjDao.countPblmByType(getIndexParam(indexParam));
- Map<String,DcTypeDto> map = this.convertToTree(typeDtoList);
- return new ArrayList<DcTypeDto>(map.values());
- }
- private List<DcTypeDto> getTypeDto(List<DcTypeDto> typeDtoList) {
- for (DcTypeDto typeDto : typeDtoList) {
- String name = typeDto.getName();
- if (BisInspEnum.REVER.getDesc().equals(name)) {
- typeDto.setObjType(BisInspEnum.REVER.getValue());
- }
- if (BisInspEnum.VILL.getDesc().equals(name)) {
- typeDto.setObjType(BisInspEnum.VILL.getValue());
- }
- if (BisInspEnum.TRACK.getDesc().equals(name)) {
- typeDto.setObjType(BisInspEnum.TRACK.getValue());
- }
- if (BisInspEnum.EMPWT.getDesc().equals(name)) {
- typeDto.setObjType(BisInspEnum.EMPWT.getValue());
- }
- if (BisInspEnum.EMPWTRUN.getDesc().equals(name)) {
- typeDto.setObjType(BisInspEnum.EMPWTRUN.getValue());
- }
- if (BisInspEnum.GRW.getDesc().equals(name)) {
- typeDto.setObjType(BisInspEnum.GRW.getValue());
- }
- if (BisInspEnum.WAGA.getDesc().equals(name)) {
- typeDto.setObjType(BisInspEnum.WAGA.getValue());
- }
- }
- //省级只保留 小水库和人饮
- for (int i = typeDtoList.size() - 1; i >= 0; i--) {
- String objType = typeDtoList.get(i).getObjType();
- if (!objType.equalsIgnoreCase(BisInspEnum.VILL.getValue()) && !objType.equalsIgnoreCase(BisInspEnum.REVER.getValue())
- ) {
- typeDtoList.remove(i);
- }
- }
- return typeDtoList;
- }
- @Override
- public List<DcTypeDto> countPlanByOrgOrType(String type, String orgId) {
- IndexParam indexParam = new IndexParam();
- if ("pType".equals(type)) {
- return inspAllObjDao.countObjByType(getIndexParam(indexParam));
- }
- return inspAllObjDao.countObjByOrg(getIndexParam(indexParam));
- }
- @Override
- public List<DcTypeDto> countPlan(IndexParam indexParam) {
- indexParam.setOrgIds(InspUtils.setOrgIds(indexParam.getOrgIds()));
- return inspAllObjDao.countObjbyParam(getIndexParam(indexParam));
- }
- @Override
- public List<DcTypeDto> countPlanByPro(IndexParam indexParam) {
- indexParam.setOrgIds(InspUtils.setOrgIds(indexParam.getOrgIds()));
- return inspAllObjDao.countPlanByPro(getIndexParam(indexParam));
- }
- @Override
- public List<DcTypeDto> countPblm(IndexParam indexParam) {
- indexParam.setOrgIds(InspUtils.setOrgIds(indexParam.getOrgIds()));
- List<DcTypeDto> typeDtoList = inspAllObjDao.countPblmbyParam(getIndexParam(indexParam));
- for (DcTypeDto typeDto : typeDtoList) {
- indexParam.setpTypes(typeDto.getObjType());
- List<DcPblmDto> pblmDtoList = inspAllObjDao.countPblmByObjType(getIndexParam(indexParam));
- typeDto.setPblmDtoList(pblmDtoList);
- }
- Map<String,DcTypeDto> map = this.convertToTree(typeDtoList);
- return new ArrayList<DcTypeDto>(map.values());
- }
- @Override
- public List<DcTypeDto> countGroupByPro(IndexParam indexParam) {
- indexParam.setOrgIds(InspUtils.setOrgIds(indexParam.getOrgIds()));
- return inspAllObjDao.countGroupByPro(getIndexParam(indexParam));
- }
- @Override
- public List<DcTypeDto> countPersonByPro(IndexParam indexParam) {
- indexParam.setOrgIds(InspUtils.setOrgIds(indexParam.getOrgIds()));
- return inspAllObjDao.countPersonByPro(getIndexParam(indexParam));
- }
- @Override
- public List<DcPblmDto> countPblmByPro(IndexParam indexParam) {
- indexParam.setOrgIds(InspUtils.setOrgIds(indexParam.getOrgIds()));
- List<DcPblmDto> typeDtoList = inspAllObjDao.countPblmbyPro(getIndexParam(indexParam));
- List<String> pblmDtoList = new ArrayList<>();
- List<DcPblmDto> typeDtoes = new ArrayList<>();
- for (DcPblmDto pblmDto : typeDtoList) {
- if (!pblmDtoList.contains(pblmDto.getName())) {
- pblmDtoList.add(pblmDto.getName());
- }
- }
- for (String str : pblmDtoList) {
- DcPblmDto dto = new DcPblmDto();
- dto.setName(str);
- int total = 0;
- List<DcPblmDto> dtoList = new ArrayList<>();
- for (DcPblmDto pblmDto : typeDtoList) {
- if (pblmDto.getName().equals(str)) {
- dto.setAdCode(pblmDto.getAdCode());
- total += pblmDto.getTotal();
- dtoList.add(pblmDto);
- }
- }
- dto.setPblmDtoList(dtoList);
- dto.setTotal(total);
- typeDtoes.add(dto);
- }
- return typeDtoes;
- }
- @Override
- public PersOnlineDto countPersOnline(IndexParam indexParam) {
- if (StringUtils.isBlank(indexParam.getEndTime())) {
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- Calendar calendar = Calendar.getInstance();
- indexParam.setEndTime(sdf.format(calendar.getTime()));
- calendar.set(Calendar.HOUR, calendar.get(Calendar.HOUR) - 2);
- indexParam.setStartTime(sdf.format(calendar.getTime()));
- }
- int ret = bisInspAllRlationPersDao.selectCountOnlinePers(indexParam.getStartTime(), indexParam.getEndTime(), indexParam.getOrgId());
- int retgroup = persPositionDao.countGroupOnline(indexParam.getStartTime(), indexParam.getEndTime(), indexParam.getOrgId());
- PersOnlineDto pers = new PersOnlineDto();
- pers.setCountGroup(retgroup);
- pers.setCountPers(ret);
- return pers;
- }
- @Override
- public List<CountTime> countPblmByTime(IndexPblmParam indexPblmParam) {
- if (!StringUtils.isEmpty(indexPblmParam.getOrgIds())) {
- indexPblmParam.setOrgIds(InspUtils.setOrgIds(indexPblmParam.getOrgIds()));
- }
- if (!StringUtils.isEmpty(indexPblmParam.getAdCode())) {
- Map<String, Object> map = AdLevelUtil.SubAd(indexPblmParam.getAdCode());
- indexPblmParam.setAdCode(String.valueOf(map.get("subAd")));
- }
- if (!StringUtils.isEmpty(indexPblmParam.getType())) {
- indexPblmParam.setType(InspUtils.setOrgIds(indexPblmParam.getType()));
- }
- List<CountTime> list = new ArrayList<>();
- indexPblmParam = getIndexPblmParam(indexPblmParam);
- if (!"".equals(indexPblmParam.getPblmState()) && "inc".equals(indexPblmParam.getPblmState())) {
- switch (indexPblmParam.getDtype()) {
- case "day":
- DateTimeFormatter dtfDay = DateTimeFormatter.ofPattern("yyyy-MM-dd");
- LocalDate dttm = LocalDate.parse(indexPblmParam.getEttm(), dtfDay);
- if (StringUtils.isEmpty(indexPblmParam.getSttm())) {
- indexPblmParam.setSttm(dttm.minusDays(6).format(dtfDay));
- }
- indexPblmParam.setSeltime(dttm.minusDays(6).format(dtfDay));
- list.addAll(inspPblmDao.countPblmIncByDay(indexPblmParam));
- break;
- case "week":
- int currWeekCount = 0;
- int oneWeekCount = 0;
- int twoWeekCount = 0;
- int tWeekCount = 0;
- int fWeekCount = 0;
- DateTimeFormatter dtfWeek = DateTimeFormatter.ofPattern("yyyy-MM-dd");
- LocalDate dtWeek = LocalDate.parse(indexPblmParam.getEttm(), dtfWeek);
- if (StringUtils.isEmpty(indexPblmParam.getSttm())) {
- indexPblmParam.setSttm(dtWeek.minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
- currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setSttm(dtWeek.minusWeeks(1).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
- indexPblmParam.setEttm(dtWeek.minusWeeks(1).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
- oneWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setSttm(dtWeek.minusWeeks(2).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
- indexPblmParam.setEttm(dtWeek.minusWeeks(2).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
- twoWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setSttm(dtWeek.minusWeeks(3).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
- indexPblmParam.setEttm(dtWeek.minusWeeks(3).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
- tWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setSttm(dtWeek.minusWeeks(4).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
- indexPblmParam.setEttm(dtWeek.minusWeeks(4).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
- fWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- } else {
- String sttm = indexPblmParam.getSttm();
- if (dtWeek.minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek).compareTo(sttm) <= 0) {
- currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- } else if (dtWeek.minusWeeks(1).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek).compareTo(sttm) <= 0) {
- indexPblmParam.setSttm(dtWeek.minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
- currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setSttm(sttm);
- indexPblmParam.setEttm(dtWeek.minusWeeks(1).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
- oneWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- } else if (dtWeek.minusWeeks(2).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek).compareTo(sttm) <= 0) {
- indexPblmParam.setSttm(dtWeek.minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
- currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setSttm(dtWeek.minusWeeks(1).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
- indexPblmParam.setEttm(dtWeek.minusWeeks(1).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
- oneWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setSttm(sttm);
- indexPblmParam.setEttm(dtWeek.minusWeeks(2).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
- twoWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- } else if (dtWeek.minusWeeks(3).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek).compareTo(sttm) <= 0) {
- indexPblmParam.setSttm(dtWeek.minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
- currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setSttm(dtWeek.minusWeeks(1).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
- indexPblmParam.setEttm(dtWeek.minusWeeks(1).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
- oneWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setSttm(dtWeek.minusWeeks(2).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
- indexPblmParam.setEttm(dtWeek.minusWeeks(2).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
- twoWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setSttm(sttm);
- indexPblmParam.setEttm(dtWeek.minusWeeks(3).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
- tWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- } else if (dtWeek.minusWeeks(4).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek).compareTo(sttm) <= 0) {
- indexPblmParam.setSttm(dtWeek.minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
- currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setSttm(dtWeek.minusWeeks(1).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
- indexPblmParam.setEttm(dtWeek.minusWeeks(1).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
- oneWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setSttm(dtWeek.minusWeeks(2).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
- indexPblmParam.setEttm(dtWeek.minusWeeks(2).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
- twoWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setSttm(dtWeek.minusWeeks(3).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
- indexPblmParam.setEttm(dtWeek.minusWeeks(3).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
- tWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setSttm(sttm);
- indexPblmParam.setEttm(dtWeek.minusWeeks(4).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
- fWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- } else {
- indexPblmParam.setSttm(dtWeek.minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
- currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setSttm(dtWeek.minusWeeks(1).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
- indexPblmParam.setEttm(dtWeek.minusWeeks(1).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
- oneWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setSttm(dtWeek.minusWeeks(2).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
- indexPblmParam.setEttm(dtWeek.minusWeeks(2).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
- twoWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setSttm(dtWeek.minusWeeks(3).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
- indexPblmParam.setEttm(dtWeek.minusWeeks(3).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
- tWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setSttm(dtWeek.minusWeeks(4).minusDays(dtWeek.getDayOfWeek().getValue() - 1).format(dtfWeek));
- indexPblmParam.setEttm(dtWeek.minusWeeks(4).minusDays(dtWeek.getDayOfWeek().getValue() - 1).plusDays(6).format(dtfWeek));
- fWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- }
- }
- CountTime currCount = new CountTime();
- currCount.setName("本周");
- currCount.setValue(currWeekCount);
- CountTime oneCount = new CountTime();
- oneCount.setName("前1周");
- oneCount.setValue(oneWeekCount);
- CountTime twoCount = new CountTime();
- twoCount.setName("前2周");
- twoCount.setValue(twoWeekCount);
- CountTime threeCount = new CountTime();
- threeCount.setName("前3周");
- threeCount.setValue(tWeekCount);
- CountTime fourCount = new CountTime();
- fourCount.setName("前4周");
- fourCount.setValue(fWeekCount);
- list.add(fourCount);
- list.add(threeCount);
- list.add(twoCount);
- list.add(oneCount);
- list.add(currCount);
- break;
- case "month":
- DateTimeFormatter dtfMon = DateTimeFormatter.ofPattern("yyyy-MM-dd");
- LocalDate dtMon = LocalDate.parse(indexPblmParam.getEttm(), dtfMon);
- if (StringUtils.isEmpty(indexPblmParam.getSttm())) {
- indexPblmParam.setSttm(dtMon.minusMonths(4).format(dtfMon));
- }
- indexPblmParam.setSeltime(dtMon.minusMonths(4).format(dtfMon));
- list.addAll(inspPblmDao.countPblmIncByMonth(indexPblmParam));
- break;
- }
- } else if (!"".equals(indexPblmParam.getPblmState()) && "total".equals(indexPblmParam.getPblmState())) {
- switch (indexPblmParam.getDtype()) {
- case "day":
- int day1 = 0;
- int day2 = 0;
- int day3 = 0;
- int day4 = 0;
- int day5 = 0;
- int day6 = 0;
- int day7 = 0;
- CountTime time1 = new CountTime();
- CountTime time2 = new CountTime();
- CountTime time3 = new CountTime();
- CountTime time4 = new CountTime();
- CountTime time5 = new CountTime();
- CountTime time6 = new CountTime();
- CountTime time7 = new CountTime();
- DateTimeFormatter dtfDay = DateTimeFormatter.ofPattern("yyyy-MM-dd");
- LocalDate dttm = LocalDate.parse(indexPblmParam.getEttm(), dtfDay);
- time7.setName(String.valueOf(dttm.getDayOfMonth()));
- time6.setName(String.valueOf(dttm.minusDays(1).getDayOfMonth()));
- time5.setName(String.valueOf(dttm.minusDays(2).getDayOfMonth()));
- time4.setName(String.valueOf(dttm.minusDays(3).getDayOfMonth()));
- time3.setName(String.valueOf(dttm.minusDays(4).getDayOfMonth()));
- time2.setName(String.valueOf(dttm.minusDays(5).getDayOfMonth()));
- time1.setName(String.valueOf(dttm.minusDays(6).getDayOfMonth()));
- if (StringUtils.isEmpty(indexPblmParam.getSttm())) {
- day7 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(1).format(dtfDay));
- day6 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(2).format(dtfDay));
- day5 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(3).format(dtfDay));
- day4 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(4).format(dtfDay));
- day3 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(5).format(dtfDay));
- day2 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(6).format(dtfDay));
- day1 = inspPblmDao.countPblmByTime(indexPblmParam);
- } else {
- String sttm = indexPblmParam.getSttm();
- if (sttm.compareTo(dttm.minusDays(1).format(dtfDay)) >= 0) {
- day7 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(1).format(dtfDay));
- day6 = inspPblmDao.countPblmByTime(indexPblmParam);
- } else if (sttm.compareTo(dttm.minusDays(2).format(dtfDay)) >= 0) {
- day7 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(1).format(dtfDay));
- day6 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(2).format(dtfDay));
- day5 = inspPblmDao.countPblmByTime(indexPblmParam);
- } else if (sttm.compareTo(dttm.minusDays(3).format(dtfDay)) >= 0) {
- day7 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(1).format(dtfDay));
- day6 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(2).format(dtfDay));
- day5 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(3).format(dtfDay));
- day4 = inspPblmDao.countPblmByTime(indexPblmParam);
- } else if (sttm.compareTo(dttm.minusDays(4).format(dtfDay)) >= 0) {
- day7 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(1).format(dtfDay));
- day6 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(2).format(dtfDay));
- day5 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(3).format(dtfDay));
- day4 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(4).format(dtfDay));
- day3 = inspPblmDao.countPblmByTime(indexPblmParam);
- } else if (sttm.compareTo(dttm.minusDays(5).format(dtfDay)) >= 0) {
- day7 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(1).format(dtfDay));
- day6 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(2).format(dtfDay));
- day5 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(3).format(dtfDay));
- day4 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(4).format(dtfDay));
- day3 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(5).format(dtfDay));
- day2 = inspPblmDao.countPblmByTime(indexPblmParam);
- } else if (sttm.compareTo(dttm.minusDays(6).format(dtfDay)) >= 0) {
- day7 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(1).format(dtfDay));
- day6 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(2).format(dtfDay));
- day5 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(3).format(dtfDay));
- day4 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(4).format(dtfDay));
- day3 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(5).format(dtfDay));
- day2 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(6).format(dtfDay));
- day1 = inspPblmDao.countPblmByTime(indexPblmParam);
- } else {
- day7 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(1).format(dtfDay));
- day6 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(2).format(dtfDay));
- day5 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(3).format(dtfDay));
- day4 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(4).format(dtfDay));
- day3 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(5).format(dtfDay));
- day2 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(dttm.minusDays(6).format(dtfDay));
- day1 = inspPblmDao.countPblmByTime(indexPblmParam);
- }
- }
- time7.setValue(day7);
- time6.setValue(day6);
- time5.setValue(day5);
- time4.setValue(day4);
- time3.setValue(day3);
- time2.setValue(day2);
- time1.setValue(day1);
- list.add(time1);
- list.add(time2);
- list.add(time3);
- list.add(time4);
- list.add(time5);
- list.add(time6);
- list.add(time7);
- break;
- case "week":
- int currWeekCount = 0;
- int oneWeekCount = 0;
- int twoWeekCount = 0;
- int tWeekCount = 0;
- int fWeekCount = 0;
- DateTimeFormatter dtfWeek = DateTimeFormatter.ofPattern("yyyy-MM-dd");
- LocalDate wktm = LocalDate.parse(indexPblmParam.getEttm(), dtfWeek);
- if (StringUtils.isEmpty(indexPblmParam.getSttm())) {
- //本周
- currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- //上周日
- indexPblmParam.setEttm(wktm.minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
- oneWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- //前两周
- indexPblmParam.setEttm(wktm.minusWeeks(1).minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
- twoWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- //前三周
- indexPblmParam.setEttm(wktm.minusWeeks(2).minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
- tWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- //前四周
- indexPblmParam.setEttm(wktm.minusWeeks(3).minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
- fWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- } else {
- String sttm = indexPblmParam.getSttm();
- if (sttm.compareTo(wktm.minusDays(wktm.getDayOfWeek().getValue() - 1).format(dtfWeek)) >= 0) {
- //与本周一比较
- currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- } else if (sttm.compareTo(wktm.minusWeeks(1).minusDays(wktm.getDayOfWeek().getValue() - 1).format(dtfWeek)) >= 0) {
- //与上周一比较
- currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(wktm.minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
- oneWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- } else if (sttm.compareTo(wktm.minusWeeks(2).minusDays(wktm.getDayOfWeek().getValue() - 1).format(dtfWeek)) >= 0) {
- //与前两周
- currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(wktm.minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
- oneWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(wktm.minusWeeks(1).minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
- twoWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- } else if (sttm.compareTo(wktm.minusWeeks(3).minusDays(wktm.getDayOfWeek().getValue() - 1).format(dtfWeek)) >= 0) {
- //前三周
- currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(wktm.minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
- oneWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(wktm.minusWeeks(1).minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
- twoWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(wktm.minusWeeks(2).minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
- tWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- } else {
- //前四周
- currWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(wktm.minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
- oneWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(wktm.minusWeeks(1).minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
- twoWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(wktm.minusWeeks(2).minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
- tWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(wktm.minusWeeks(3).minusDays(wktm.getDayOfWeek().getValue()).format(dtfWeek));
- fWeekCount = inspPblmDao.countPblmByTime(indexPblmParam);
- }
- }
- CountTime currCount = new CountTime();
- currCount.setName("本周");
- currCount.setValue(currWeekCount);
- CountTime oneCount = new CountTime();
- oneCount.setName("前1周");
- oneCount.setValue(oneWeekCount);
- CountTime twoCount = new CountTime();
- twoCount.setName("前2周");
- twoCount.setValue(twoWeekCount);
- CountTime threeCount = new CountTime();
- threeCount.setName("前3周");
- threeCount.setValue(tWeekCount);
- CountTime fourCount = new CountTime();
- fourCount.setName("前4周");
- fourCount.setValue(fWeekCount);
- list.add(fourCount);
- list.add(threeCount);
- list.add(twoCount);
- list.add(oneCount);
- list.add(currCount);
- break;
- case "month":
- int mon1 = 0;
- int mon2 = 0;
- int mon3 = 0;
- int mon4 = 0;
- int mon5 = 0;
- CountTime monTime1 = new CountTime();
- CountTime monTime2 = new CountTime();
- CountTime monTime3 = new CountTime();
- CountTime monTime4 = new CountTime();
- CountTime monTime5 = new CountTime();
- DateTimeFormatter dtfMonth = DateTimeFormatter.ofPattern("yyyy-MM-dd");
- LocalDate montm = LocalDate.parse(indexPblmParam.getEttm(), dtfMonth);
- if (StringUtils.isEmpty(indexPblmParam.getSttm())) {
- mon5 = inspPblmDao.countPblmByTime(indexPblmParam);
- //获取上月最后一天
- indexPblmParam.setEttm(montm.minusMonths(1).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
- mon4 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(montm.minusMonths(2).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
- mon3 = inspPblmDao.countPblmByTime(indexPblmParam);
- monTime3.setName(String.valueOf(montm.minusMonths(2).getMonthValue()));
- monTime3.setValue(mon3);
- indexPblmParam.setEttm(montm.minusMonths(3).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
- mon2 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(montm.minusMonths(4).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
- mon1 = inspPblmDao.countPblmByTime(indexPblmParam);
- } else {
- String sttm = indexPblmParam.getSttm();
- if (sttm.compareTo(montm.with(TemporalAdjusters.firstDayOfMonth()).format(dtfMonth)) >= 0) {
- //大于本月第一天
- mon5 = inspPblmDao.countPblmByTime(indexPblmParam);
- } else if (sttm.compareTo(montm.minusMonths(1).with(TemporalAdjusters.firstDayOfMonth()).format(dtfMonth)) >= 0) {
- //大于上月第一天
- mon5 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(montm.minusMonths(1).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
- mon4 = inspPblmDao.countPblmByTime(indexPblmParam);
- } else if (sttm.compareTo(montm.minusMonths(2).with(TemporalAdjusters.firstDayOfMonth()).format(dtfMonth)) >= 0) {
- //大于上上月第一天
- mon5 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(montm.minusMonths(1).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
- mon4 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(montm.minusMonths(2).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
- mon3 = inspPblmDao.countPblmByTime(indexPblmParam);
- } else if (sttm.compareTo(montm.minusMonths(3).with(TemporalAdjusters.firstDayOfMonth()).format(dtfMonth)) >= 0) {
- //大于上上上月第一天
- mon5 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(montm.minusMonths(1).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
- mon4 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(montm.minusMonths(2).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
- mon3 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(montm.minusMonths(3).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
- mon2 = inspPblmDao.countPblmByTime(indexPblmParam);
- } else {
- mon5 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(montm.minusMonths(1).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
- mon4 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(montm.minusMonths(2).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
- mon3 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(montm.minusMonths(3).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
- mon2 = inspPblmDao.countPblmByTime(indexPblmParam);
- indexPblmParam.setEttm(montm.minusMonths(4).with(TemporalAdjusters.lastDayOfMonth()).format(dtfMonth));
- mon1 = inspPblmDao.countPblmByTime(indexPblmParam);
- }
- }
- monTime5.setName(String.valueOf(montm.getMonthValue()));
- monTime5.setValue(mon5);
- monTime4.setName(String.valueOf(montm.minusMonths(1).getMonthValue()));
- monTime4.setValue(mon4);
- monTime3.setName(String.valueOf(montm.minusMonths(2).getMonthValue()));
- monTime3.setValue(mon3);
- monTime2.setName(String.valueOf(montm.minusMonths(3).getMonthValue()));
- monTime2.setValue(mon2);
- monTime1.setName(String.valueOf(montm.minusMonths(4).getMonthValue()));
- monTime1.setValue(mon1);
- list.add(monTime1);
- list.add(monTime2);
- list.add(monTime3);
- list.add(monTime4);
- list.add(monTime5);
- break;
- }
- }
- return list;
- }
- @Override
- public PageInfo<ObjGroup> countGroupByAdCode(IndexParamPage indexParam) {
- PageHelper.startPage(indexParam.getPageNum(), indexParam.getPageSize());
- List<ObjGroup> objGroupList = inspAllObjDao.countGroupByAdCode(getIndexParamPage(indexParam));
- return new PageInfo<ObjGroup>(objGroupList);
- }
- @Override
- public PageInfo<ObjPerson> findPerByAdCode(IndexParamPage indexParamPage) {
- PageHelper.startPage(indexParamPage.getPageNum(), indexParamPage.getPageSize());
- List<ObjPerson> objGroupList = inspAllObjDao.findPerByAdCode(getIndexParamPage(indexParamPage));
- return new PageInfo<ObjPerson>(objGroupList);
- }
- @Override
- public PageInfo<DuchaObj> findObjByAdCode(IndexParamPage indexParamPage) {
- PageHelper.startPage(indexParamPage.getPageNum(), indexParamPage.getPageSize());
- List<DuchaObj> objGroupList = inspAllObjDao.findObjByAdCode(getIndexParamPage(indexParamPage));
- return new PageInfo<DuchaObj>(objGroupList);
- }
- @Override
- public PageInfo<BisInspPblm> findPblmByAdCode(IndexParamPage indexParamPage) {
- PageHelper.startPage(indexParamPage.getPageNum(), indexParamPage.getPageSize());
- List<BisInspPblm> objGroupList = inspAllObjDao.findPblmByAdCode(getIndexParamPage(indexParamPage));
- return new PageInfo<BisInspPblm>(objGroupList);
- }
- @Override
- public List<DcTypeDto> findGroupCountByAdCode(IndexParamPage indexParam) {
- List<DcTypeDto> objGroupCountList = inspAllObjDao.findGroupCountByAdCode(getIndexParamPage(indexParam));
- return objGroupCountList;
- }
- @Override
- public List<DcTypeDto> findPerCountByAdCode(IndexParamPage indexParamPage) {
- List<DcTypeDto> objGroupCountList = inspAllObjDao.findPerCountByAdCode(getIndexParamPage(indexParamPage));
- return objGroupCountList;
- }
- @Override
- public List<DcTypeDto> findObjCountByAdCode(IndexParamPage indexParamPage) {
- List<DcTypeDto> objGroupCountList = inspAllObjDao.findObjCountByAdCode(getIndexParamPage(indexParamPage));
- return objGroupCountList;
- }
- private IndexParam getIndexParam(IndexParam indexParam) {
- String province = indexParam.getProvince();
- if ("".equals(province)) {
- indexParam.setLength("2");
- indexParam.setOtherLength("0000000000");
- } else {
- int total = province.length();
- int length = province.replace(AdCodeLabel.START_PARENT_ADCODE, "").length() + 2;
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < total - length; i++) {
- buffer.append("0");
- }
- indexParam.setOtherLength(buffer.toString());
- indexParam.setLength(length + "");
- }
- indexParam.setProvince(province);
- return indexParam;
- }
- private IndexPblmParam getIndexPblmParam(IndexPblmParam pblmParam) {
- String province = pblmParam.getProvince();
- if ("".equals(province)) {
- pblmParam.setLength("2");
- pblmParam.setOtherLength("0000000000");
- } else {
- int total = province.length();
- int length = province.replace(AdCodeLabel.START_PARENT_ADCODE, "").length() + 2;
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < total - length; i++) {
- buffer.append("0");
- }
- pblmParam.setOtherLength(buffer.toString());
- pblmParam.setLength(length + "");
- }
- pblmParam.setProvince(province);
- return pblmParam;
- }
- private IndexParamPage getIndexParamPage(IndexParamPage indexParamPage) {
- String province = indexParamPage.getProvince();
- if ("".equals(province)) {
- indexParamPage.setLength("2");
- indexParamPage.setOtherLength("0000000000");
- } else {
- int total = province.length();
- int length = province.replace(AdCodeLabel.START_PARENT_ADCODE, "").length() + 2;
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < total - length; i++) {
- buffer.append("0");
- }
- indexParamPage.setOtherLength(buffer.toString());
- indexParamPage.setLength(length + "");
- }
- indexParamPage.setProvince(province);
- return indexParamPage;
- }
- @Override
- public List<DcTypeDto> findPblmCountByAdCode(IndexParamPage indexParamPage) {
- List<DcTypeDto> objGroupCountList = inspAllObjDao.findPblmCountByAdCode(getIndexParamPage(indexParamPage));
- return objGroupCountList;
- }
- }
|