From 135c3e34b3ef2e82b7665ec23078507102e32f07 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 7 May 2021 13:35:21 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=B2=A1=E6=9C=89=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=97=B6=E4=B8=8D=E5=86=8D=E7=BB=A7=E7=BB=AD=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/impl/ScreenProjectProcessServiceImpl.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectProcessServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectProcessServiceImpl.java index a73ec71e5a..95206d2fd4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectProcessServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectProcessServiceImpl.java @@ -21,14 +21,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.evaluationindex.screen.ScreenProjectProcessAttachmentDao; import com.epmet.dao.evaluationindex.screen.ScreenProjectProcessDao; -import com.epmet.dto.screen.ScreenProjectProcessAttachmentDTO; import com.epmet.dto.screen.ScreenProjectProcessDTO; import com.epmet.dto.screen.form.ScreenProjectProcessFormDTO; import com.epmet.dto.screencoll.ScreenCollFormDTO; @@ -36,11 +35,11 @@ import com.epmet.entity.evaluationindex.screen.ScreenProjectProcessAttachmentEnt import com.epmet.entity.evaluationindex.screen.ScreenProjectProcessEntity; import com.epmet.service.evaluationindex.screen.ScreenProjectProcessAttachmentService; import com.epmet.service.evaluationindex.screen.ScreenProjectProcessService; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; import javax.annotation.Resource; import java.util.ArrayList; @@ -120,6 +119,9 @@ public class ScreenProjectProcessServiceImpl extends BaseServiceImpl param) { + if (CollectionUtils.isEmpty(param.getDataList())){ + return; + } if (param.getIsFirst()) { int affectedRows = baseDao.deleteByDateIdAndCustomerId(param.getCustomerId(), param.getDateId()); while (affectedRows > 0) { @@ -129,6 +131,9 @@ public class ScreenProjectProcessServiceImpl extends BaseServiceImpl processIdList = param.getDataList().stream().map(ScreenProjectProcessFormDTO :: getProcessId).collect(Collectors.toList()).stream().distinct() .collect(Collectors.toList()); + if (CollectionUtils.isEmpty(processIdList)){ + return; + } //删除旧数据 baseDao.deleteByProcessIds(param.getCustomerId(), processIdList); screenProjectProcessAttachmentDao.deleteByProcessIds(param.getCustomerId(), processIdList); From 276622a5e4bccb227d8de77fd171cebf7ff8a615 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 7 May 2021 15:15:22 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=82=E4=B8=8ENPE=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/PublicPartExtractServiceImpl.java | 1 - .../impl/ScreenUserJoinServiceImpl.java | 21 ++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java index 92bb8def5d..3b2baa00dd 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java @@ -196,7 +196,6 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { Map userCountMap = userCountList.stream().collect(Collectors.toMap(GridUserCountResultDTO::getOrgId, o -> o)); Set agencyIdSet = new HashSet<>(); if (!CollectionUtils.isEmpty(issueTotal)) { - log.error("抽取【公众参与-人均议题】,获取注册用户数为空,customerId:{}", formDTO.getCustomerId()); issueTotal.forEach(issue -> { String agencyId = issue.getAgencyId(); agencyIdSet.add(agencyId); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java index c6ca536993..8b58a474b5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java @@ -85,12 +85,19 @@ public class ScreenUserJoinServiceImpl extends BaseServiceImpl Date: Fri, 7 May 2021 17:12:47 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=9A=82=E6=97=B6=E8=BF=94=E5=9B=9E=20?= =?UTF-8?q?=E4=B8=80=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/screen/ScreenUserJoinDao.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml index 88ea0c6d44..5af47f5590 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml @@ -21,6 +21,8 @@ DEL_FLAG = '0' AND MONTH_ID = #{monthId} AND ORG_ID = #{agencyId} + order by CREATED_TIME DESC + LIMIT 1 @@ -74,4 +76,4 @@ AND ORG_ID = #{agencyId} AND MONTH_ID = ]]> #{monthId}*/ - \ No newline at end of file + From 8245dd3dfbe8f24c61c8fae4f97fee1a06fcaa03 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Sat, 8 May 2021 10:42:53 +0800 Subject: [PATCH 4/5] =?UTF-8?q?screen=5Findex=5Fdata=5Fmonthly=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=8F=92=E5=85=A5=E4=BB=A3=E7=A0=81=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../result/AgencyMonthCountResultDTO.java | 21 ++++++++++++ .../screen/ScreenCustomerAgencyDao.java | 9 +++++ .../screen/ScreenIndexDataMonthlyDao.java | 10 ++++++ .../impl/FactIndexCollectServiceImpl.java | 34 +++++++++++++++++++ .../screen/ScreenCustomerAgencyDao.xml | 7 ++++ .../screen/ScreenIndexDataMonthlyDao.xml | 15 ++++++++ 6 files changed, 96 insertions(+) create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/AgencyMonthCountResultDTO.java diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/AgencyMonthCountResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/AgencyMonthCountResultDTO.java new file mode 100644 index 0000000000..adb9da6284 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/AgencyMonthCountResultDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.extract.result; + +import com.epmet.commons.tools.constant.NumConstant; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/5/8 9:34 上午 + * @DESC + */ +@Data +public class AgencyMonthCountResultDTO implements Serializable { + + private static final long serialVersionUID = 3473299876562651080L; + + private String orgId; + + private Integer monthCount = NumConstant.ZERO; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index 6aa48bf445..d0cb1d1726 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.extract.form.PartyBaseInfoFormDTO; import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO; import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; +import com.epmet.dto.extract.result.AgencyMonthCountResultDTO; import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO; import com.epmet.dto.extract.result.OrgNameResultDTO; import com.epmet.dto.indexcollect.form.CustomerBizOrgFormDTO; @@ -204,4 +205,12 @@ public interface ScreenCustomerAgencyDao extends BaseDao selectAgencyByParentAreaCode(@Param("areaCode") String areaCode); + + /** + * @Description 根据客户ID查询客户下所有org【agency,grid,dept】 + * @Param customerId + * @author zxc + * @date 2021/5/8 9:03 上午 + */ + List selectAllOrgByCustomerId(@Param("customerId")String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java index ecb417b9b6..b484887e59 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java @@ -18,6 +18,7 @@ package com.epmet.dao.evaluationindex.screen; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.extract.result.AgencyMonthCountResultDTO; import com.epmet.dto.screencoll.form.IndexDataMonthlyFormDTO; import com.epmet.entity.evaluationindex.screen.ScreenIndexDataMonthlyEntity; import org.apache.ibatis.annotations.Mapper; @@ -81,6 +82,15 @@ public interface ScreenIndexDataMonthlyDao extends BaseDao selectMonthCountByOrgId(@Param("yearId") String yearId,@Param("orgIds")List orgIds); + /** * 批量删除月表数据 * 根据CUSTOMER_ID、MONTH_ID、ORG_TYPE进行查询,如果有数据,则先进行物理删除, 一次删除1000条 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java index 7df7c2920d..4e53c3db97 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java @@ -17,6 +17,7 @@ import com.epmet.dao.evaluationindex.indexcal.GridScoreDao; import com.epmet.dao.evaluationindex.indexcoll.*; import com.epmet.dao.evaluationindex.screen.*; import com.epmet.dto.ScreenCustomerGridDTO; +import com.epmet.dto.extract.result.AgencyMonthCountResultDTO; import com.epmet.dto.indexcal.AgencyScoreDTO; import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.dto.indexcal.DeptScoreDTO; @@ -851,8 +852,41 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { **/ private void insertIndexDataYear(String monthId, String customerId){ // 查询今年,上报了几个月的指数统计 + List orgIds = screenCustomerAgencyDao.selectAllOrgByCustomerId(customerId); + if (CollectionUtils.isEmpty(orgIds)){ + throw new RenException("客户下没有查到agencyId,gridId,deptId"); + } + List agencyMonthCount = screenIndexDataMonthlyDao.selectMonthCountByOrgId(getYearStr(monthId), orgIds); + if (!CollectionUtils.isEmpty(agencyMonthCount)){ + agencyMonthCount.forEach(a -> { + orgIds.forEach(o -> { + if (a.getOrgId().equals(o.getOrgId())){ + o.setMonthCount(a.getMonthCount()); + } + }); + }); + } Integer monthCount = screenIndexDataMonthlyDao.selectCountIndexDataMonthly(customerId, getYearStr(monthId)); List monthlyFormList = screenIndexDataMonthlyDao.selectListIndexDataMonthlyByYear(customerId, getYearStr(monthId), monthCount); + BigDecimal monthCountBd = new BigDecimal(monthCount); + monthlyFormList.forEach(m -> { + orgIds.forEach(o -> { + if (m.getOrgId().equals(o.getOrgId())){ + BigDecimal selfCount = new BigDecimal(o.getMonthCount()); + if (o.getMonthCount() == NumConstant.ZERO){ + m.setIndexTotal(monthCountBd.multiply(m.getIndexTotal())); + m.setPartyDevAblity(monthCountBd.multiply(m.getPartyDevAblity())); + m.setServiceAblity(monthCountBd.multiply(m.getServiceAblity())); + m.setGovernAblity(monthCountBd.multiply(m.getGovernAblity())); + }else { + m.setIndexTotal(monthCountBd.multiply(m.getIndexTotal()).divide(selfCount)); + m.setPartyDevAblity(monthCountBd.multiply(m.getPartyDevAblity()).divide(selfCount)); + m.setServiceAblity(monthCountBd.multiply(m.getServiceAblity()).divide(selfCount)); + m.setGovernAblity(monthCountBd.multiply(m.getGovernAblity()).divide(selfCount)); + } + } + }); + }); if (monthlyFormList.size() > NumConstant.ZERO){ int deleteNum; do { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml index 0d7434ba98..acb10f1bad 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml @@ -419,4 +419,11 @@ where sca.DEL_FLAG = '0' and sca.AREA_CODE= #{areaCode} + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml index 91ecd0a870..dff0d6bbc6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml @@ -96,6 +96,21 @@ ) monthCount + + + delete from screen_index_data_monthly where CUSTOMER_ID = #{customerId} AND MONTH_ID = #{monthId} AND ORG_TYPE = #{orgType} From 8afd91c97d9131b49224fbb7712441f89009da6e Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Sat, 8 May 2021 10:54:09 +0800 Subject: [PATCH 5/5] =?UTF-8?q?screen=5Findex=5Fdata=5Fmonthly=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/evaluationindex/indexcal/AgencyScoreDao.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml index f776956bf0..62c6226e07 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml @@ -162,16 +162,16 @@ fics.year_id AS yearId, ROUND(AVG( fics.score ),6) AS score, fics.customer_id AS customerId, - (SELECT AGENCY_ID FROM screen_customer_agency WHERE AREA_CODE = #{areaCode}) AS parentId + (SELECT AGENCY_ID FROM screen_customer_agency WHERE AREA_CODE = #{areaCode} AND DEL_FLAG = 0) AS parentId FROM fact_index_agency_score fics WHERE fics.del_flag = '0' AND fics.month_id = #{monthId} AND fics.index_code = #{indexCode} - AND fics.agency_id IN (SELECT AGENCY_ID FROM screen_customer_agency WHERE PARENT_AREA_CODE = #{areaCode}) + AND fics.agency_id IN (SELECT AGENCY_ID FROM screen_customer_agency WHERE PARENT_AREA_CODE = #{areaCode} AND DEL_FLAG = 0) GROUP BY agencyId) a - LEFT JOIN screen_customer_agency a2 ON a2.AGENCY_ID = a.parentId + LEFT JOIN screen_customer_agency a2 ON a2.AGENCY_ID = a.parentId AND a2.DEL_FLAG = 0 GROUP BY a2.AGENCY_ID