From 39639160312db7a8d8e47892244ed01499f51f1f Mon Sep 17 00:00:00 2001 From: jianjun Date: Sun, 26 Dec 2021 18:43:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B2=E6=8E=89=E9=82=A3=E4=B8=AA=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ShiBeiScreenCollServiceImpl.java | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java index 02e4df412b..0f738cb679 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java @@ -110,7 +110,21 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService { } while (deleteNum != NumConstant.ZERO); } if (!CollectionUtils.isEmpty(formDTO.getDataList())) { - screenPartyUserRankDataDao.batchInsertPartyUserRankData(formDTO.getDataList(), customerId); + List list = new ArrayList<>(); + formDTO.getDataList().forEach(item -> { + if (StringUtils.isEmpty(item.getGridId())) { + log.warn("gridId is null,userId:{}", item.getUserId()); + return; + } + list.add(item); + if (list.size() == NumConstant.ONE_HUNDRED) { + screenPartyUserRankDataDao.batchInsertPartyUserRankData(list, customerId); + list.clear(); + } + }); + if (list.size() > NumConstant.ZERO) { + screenPartyUserRankDataDao.batchInsertPartyUserRankData(list, customerId); + } } } @@ -134,7 +148,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService { @Transactional(rollbackFor = Exception.class) public void insertPartyBranchData(PartyBranchDataListFormDTO formDTO, String customerId) { if (StringUtils.isEmpty(formDTO.getMonthId()) || formDTO.getMonthId().length() != NumConstant.SIX) { - throw new RenException("monthId格式应为: yyyyMM,当前传入:"+formDTO.getMonthId()); + throw new RenException("monthId格式应为: yyyyMM,当前传入:" + formDTO.getMonthId()); } if (formDTO.getIsFirst()) { int deleteNum; @@ -152,7 +166,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService { @Transactional(rollbackFor = Exception.class) public void insertOrgRankData(OrgRankDataListFormDTO formDTO, String customerId) { if (StringUtils.isEmpty(formDTO.getMonthId()) || formDTO.getMonthId().length() != NumConstant.SIX) { - throw new RenException("monthId格式应为: yyyyMM,当前传入:"+formDTO.getMonthId()); + throw new RenException("monthId格式应为: yyyyMM,当前传入:" + formDTO.getMonthId()); } if (formDTO.getIsFirst()) { int deleteNum; @@ -170,7 +184,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService { @Transactional(rollbackFor = Exception.class) public void insertGovernRankData(GovernRankDataListFormDTO formDTO, String customerId) { if (StringUtils.isEmpty(formDTO.getMonthId()) || formDTO.getMonthId().length() != NumConstant.SIX) { - throw new RenException("monthId格式应为: yyyyMM,当前传入:"+formDTO.getMonthId()); + throw new RenException("monthId格式应为: yyyyMM,当前传入:" + formDTO.getMonthId()); } if (formDTO.getIsFirst()) { int deleteNum; @@ -261,7 +275,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService { @Transactional(rollbackFor = Exception.class) public void insertIndexDataMonthly(IndexDataListMonthlyFormDTO formDTO, String customerId) { if (StringUtils.isEmpty(formDTO.getMonthId()) || formDTO.getMonthId().length() != NumConstant.SIX) { - throw new RenException("monthId格式应为: yyyyMM,当前传入:"+formDTO.getMonthId()); + throw new RenException("monthId格式应为: yyyyMM,当前传入:" + formDTO.getMonthId()); } if (formDTO.getIsFirst()) { int deleteNum; @@ -359,7 +373,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService { @Transactional(rollbackFor = Exception.class) public void insertUserJoin(UserJoinListFormDTO formDTO, String customerId) { if (StringUtils.isEmpty(formDTO.getMonthId()) || formDTO.getMonthId().length() != NumConstant.SIX) { - throw new RenException("monthId格式应为: yyyyMM,当前传入:"+formDTO.getMonthId()); + throw new RenException("monthId格式应为: yyyyMM,当前传入:" + formDTO.getMonthId()); } if (formDTO.getIsFirst()) { int deleteNum; @@ -377,7 +391,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService { /*String[] lastMonth = this.lastMonthDate(); // 获取上个月的基本数据 String moneth = lastMonth[NumConstant.ZERO] + lastMonth[NumConstant.ONE];*/ - String monthId= DateUtils.getBeforeNMonthByMonth(1,formDTO.getMonthId()); + String monthId = DateUtils.getBeforeNMonthByMonth(1, formDTO.getMonthId()); List lastMonthJoinList = screenUserJoinDao.selectLastMonthScreenUserJoinList(customerId, monthId, orgIds); @@ -386,7 +400,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService { List curMonthJoinEntityList = new ArrayList<>(); // 增加率计算 if (null != lastMonthJoinList && lastMonthJoinList.size() > NumConstant.ZERO) { - log.info("当前传入的monthId="+formDTO.getMonthId()+";数据集合长度="+formDTO.getDataList()+";当前monthId的上月已有数据集合长度="+lastMonthJoinList.size()); + log.info("当前传入的monthId=" + formDTO.getMonthId() + ";数据集合长度=" + formDTO.getDataList() + ";当前monthId的上月已有数据集合长度=" + lastMonthJoinList.size()); // 存在上个月的数据 (本月-上月)/上月 *100 for (int i = NumConstant.ZERO; i < formDTO.getDataList().size(); i++) { for (int j = NumConstant.ZERO; j < lastMonthJoinList.size(); j++) { @@ -403,7 +417,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService { } } } else { - log.info("当前传入的monthId="+formDTO.getMonthId()+";数据集合长度="+formDTO.getDataList()+";当前monthId上月不存在数据。"); + log.info("当前传入的monthId=" + formDTO.getMonthId() + ";数据集合长度=" + formDTO.getDataList() + ";当前monthId上月不存在数据。"); // 计算增长率后的 待新增数据 BigDecimal zero = new BigDecimal(NumConstant.ZERO); // 不存在上个月的数据 @@ -428,7 +442,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService { @Transactional(rollbackFor = Exception.class) public Integer initBizOrg(CustomerBizOrgFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); - List entityList = screenCustomerAgencyDao.selectListAgencyInfo(formDTO.getCustomerId(),null,null); + List entityList = screenCustomerAgencyDao.selectListAgencyInfo(formDTO.getCustomerId(), null, null); List list = new ArrayList<>(); if (CollectionUtils.isEmpty(entityList)) { return 0;