From ae0901e107c3ec639391152392857fce680ca8f6 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 8 Jul 2021 09:45:50 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E9=9A=BE=E7=82=B9?= =?UTF-8?q?=E8=B5=8C=E7=82=B9=E5=88=97=E8=A1=A8=EF=BC=8C=E5=A4=84=E7=90=86?= =?UTF-8?q?=E6=AC=A1=E6=95=B0=E5=8F=96=E5=80=BC=E9=94=99=E8=AF=AF=EF=BC=8C?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=EF=BC=9AEVENT=5FHANDLED=5FCOUNT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/mapper/screen/ScreenDifficultyDataDao.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenDifficultyDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenDifficultyDataDao.xml index 7f30a13cac..4e03b4d2a3 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenDifficultyDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenDifficultyDataDao.xml @@ -14,7 +14,7 @@ diff.EVENT_IMG_URL AS imgUrl, IFNULL(diff.EVENT_CATEGORY_NAME,'') AS categoryName, diff.EVENT_RE_ORG AS handleDepts, - diff.EVENT_RE_ORG AS handleCount + diff.EVENT_HANDLED_COUNT AS handleCount FROM screen_difficulty_data diff WHERE @@ -63,7 +63,7 @@ diff.EVENT_IMG_URL AS imgUrl, IFNULL(diff.EVENT_CATEGORY_NAME,'') AS categoryName, diff.EVENT_RE_ORG AS handleDepts, - diff.EVENT_RE_ORG AS handleCount + diff.EVENT_HANDLED_COUNT AS handleCount FROM screen_difficulty_data diff left join screen_customer_grid scg From 15dfbea777456c51d3ed556a43fccc0f445b30cd Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 8 Jul 2021 11:27:56 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E5=85=88=E9=94=8B=E6=A8=A1=E8=8C=83?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9=EF=BC=9A=E5=8F=AA=E6=9C=89?= =?UTF-8?q?=E5=85=A5=E5=8F=82=E4=B8=BA370124=E6=97=B6=EF=BC=8C=E5=86=99?= =?UTF-8?q?=E6=AD=BB=E6=9F=A5=E8=AF=A28=E5=90=84=E8=A1=97=E9=81=93?= =?UTF-8?q?=E7=9A=84=E5=B9=B3=E5=9D=87=E6=95=B0=EF=BC=8C=E5=85=B6=E4=BD=99?= =?UTF-8?q?=E7=9A=84=E5=85=A8=E9=83=A8=E6=8C=89=E7=85=A7agencyId=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/dto/form/FineExampleFormDTO.java | 13 ++++- .../screen/PartyMemberLeadController.java | 3 +- .../screen/ScreenPioneerDataDao.java | 7 +-- .../impl/PartyMemberLeadServiceImpl.java | 57 +++++++++---------- .../mapper/screen/ScreenPioneerDataDao.xml | 14 +---- 5 files changed, 45 insertions(+), 49 deletions(-) diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/FineExampleFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/FineExampleFormDTO.java index 542c2e5b48..b5aeaf83ee 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/FineExampleFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/FineExampleFormDTO.java @@ -3,7 +3,6 @@ package com.epmet.evaluationindex.screen.dto.form; import lombok.Data; import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; import java.io.Serializable; /** @@ -22,4 +21,16 @@ public class FineExampleFormDTO implements Serializable { */ @NotBlank(message = "机关ID不能为空",groups = {FineExample.class}) private String agencyId; + + /** + * 目前只有平阴在传,默认赋值:370124,跟随8个街道变化 + */ + private String areaCode; + + /** + * 当前token中的客户id + */ + @NotBlank(message = "token中的customerId不能为空",groups = {FineExample.class}) + private String customerId; + } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java index bbd0039e71..f5615c15bd 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java @@ -30,7 +30,8 @@ public class PartyMemberLeadController { * @date 2020/8/20 1:56 下午 */ @PostMapping("fineexample") - public Result fineExample(@RequestBody FineExampleFormDTO fineExampleFormDTO){ + public Result fineExample(@RequestHeader("CustomerId") String customerId,@RequestBody FineExampleFormDTO fineExampleFormDTO){ + fineExampleFormDTO.setCustomerId(customerId); ValidatorUtils.validateEntity(fineExampleFormDTO, FineExampleFormDTO.FineExample.class); return new Result().ok(partyMemberLeadService.fineExample(fineExampleFormDTO)); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPioneerDataDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPioneerDataDao.java index 5bc3077e85..0983d7c047 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPioneerDataDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPioneerDataDao.java @@ -21,8 +21,6 @@ import com.epmet.evaluationindex.screen.dto.result.FineExampleResultDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; -import java.util.List; - /** * 党建引领-先锋模范数据 * @@ -43,12 +41,11 @@ public interface ScreenPioneerDataDao{ /** * @Description 根据地区码查询先锋模范 * @param areaCode - * @param customerId - * @param customerIds - 子级客户列表 + * @param dataEndTime 默认是昨天yyyyMMdd * @return com.epmet.evaluationindex.screen.dto.result.FineExampleResultDTO * @author wangc * @date 2021.02.24 15:39 */ - FineExampleResultDTO selectFineExampleByAreaCode(@Param("areaCode")String areaCode,@Param("customerId")String customerId,@Param("list") List customerIds); + FineExampleResultDTO selectFineExampleByAreaCode(@Param("areaCode") String areaCode, @Param("dataEndTime") String dataEndTime); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PartyMemberLeadServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PartyMemberLeadServiceImpl.java index 150bde5417..06979f8b65 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PartyMemberLeadServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PartyMemberLeadServiceImpl.java @@ -3,16 +3,13 @@ package com.epmet.datareport.service.evaluationindex.screen.impl; import com.alibaba.fastjson.JSON; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; -import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.utils.Result; import com.epmet.constant.DataSourceConstant; import com.epmet.datareport.dao.evaluationindex.screen.*; import com.epmet.datareport.service.evaluationindex.screen.AgencyService; import com.epmet.datareport.service.evaluationindex.screen.PartyMemberLeadService; import com.epmet.datareport.utils.DateUtils; import com.epmet.datareport.utils.ModuleConstant; -import com.epmet.dto.result.ScreenCustomerAgencyDTO; import com.epmet.evaluationindex.screen.constant.ScreenConstant; import com.epmet.evaluationindex.screen.dto.form.AgencyAndNumFormDTO; import com.epmet.evaluationindex.screen.dto.form.ContactMassLineChartFormDTO; @@ -62,41 +59,39 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService { private AgencyService screenCustomerAgencyService; /** - * @Description 1、先锋模范 * @param fineExampleFormDTO + * @Description 1、先锋模范 * @author zxc * @date 2020/8/20 1:56 下午 */ - @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) + @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override public FineExampleResultDTO fineExample(FineExampleFormDTO fineExampleFormDTO) { - ScreenCustomerAgencyDTO agencyInfo = customerAgencyDao.selectByAgencyId(fineExampleFormDTO.getAgencyId()); - if(null == agencyInfo) throw new RenException("未找到对应的机关"); - String customerId = agencyInfo.getCustomerId(); - String areaCode = agencyInfo.getAreaCode(); - - Result> crmResponse = operCrmOpenFeignClient.getAllSubCustomerIds(customerId); - List subCustomers; - if(null == crmResponse || !crmResponse.success()) - {subCustomers = null;} - else - {subCustomers = crmResponse.getData();} - FineExampleResultDTO fineExampleResultDTO; - if(CollectionUtils.isEmpty(subCustomers)) - fineExampleResultDTO = screenPioneerDataDao.selectFineExample(fineExampleFormDTO.getAgencyId()); - else - fineExampleResultDTO = screenPioneerDataDao.selectFineExampleByAreaCode(areaCode,customerId,subCustomers); - - if (null == fineExampleResultDTO) { - return new FineExampleResultDTO(); + FineExampleResultDTO fineExampleResultDTO; + if (StringUtils.isNotBlank(fineExampleFormDTO.getAreaCode())) { + //如果是平阴县的areaCode + if ("370124".equals(fineExampleFormDTO.getAreaCode())) { + String yesterDay = com.epmet.commons.tools.utils.DateUtils.getBeforeNDay(1); + // 只有平阴的需要汇聚 8个街道的数 + fineExampleResultDTO = screenPioneerDataDao.selectFineExampleByAreaCode(fineExampleFormDTO.getAreaCode(), yesterDay); + } else { + // 不是平阴的话,依然按照agencyId查询 + fineExampleResultDTO = screenPioneerDataDao.selectFineExample(fineExampleFormDTO.getAgencyId()); } - fineExampleResultDTO.setIssueRatio(this.getRatio(fineExampleResultDTO.getIssueRatioA())); - fineExampleResultDTO.setPublishIssueRatio(this.getRatio(fineExampleResultDTO.getPublishIssueRatioA())); - fineExampleResultDTO.setResolvedProjectRatio(this.getRatio(fineExampleResultDTO.getResolvedProjectRatioA())); - fineExampleResultDTO.setTopicRatio(this.getRatio(fineExampleResultDTO.getTopicRatioA())); - fineExampleResultDTO.setShiftProjectRatio(this.getRatio(fineExampleResultDTO.getShiftProjectRatioA())); - fineExampleResultDTO.setPlatJoinPartyRatio(this.getRatio(Double.valueOf(fineExampleResultDTO.getPlatJoinPartyRatio()))); - return fineExampleResultDTO; + } else { + //单客户直接按照agencyId查询 + fineExampleResultDTO = screenPioneerDataDao.selectFineExample(fineExampleFormDTO.getAgencyId()); + } + if (null == fineExampleResultDTO) { + return new FineExampleResultDTO(); + } + fineExampleResultDTO.setIssueRatio(this.getRatio(fineExampleResultDTO.getIssueRatioA())); + fineExampleResultDTO.setPublishIssueRatio(this.getRatio(fineExampleResultDTO.getPublishIssueRatioA())); + fineExampleResultDTO.setResolvedProjectRatio(this.getRatio(fineExampleResultDTO.getResolvedProjectRatioA())); + fineExampleResultDTO.setTopicRatio(this.getRatio(fineExampleResultDTO.getTopicRatioA())); + fineExampleResultDTO.setShiftProjectRatio(this.getRatio(fineExampleResultDTO.getShiftProjectRatioA())); + fineExampleResultDTO.setPlatJoinPartyRatio(this.getRatio(Double.valueOf(fineExampleResultDTO.getPlatJoinPartyRatio()))); + return fineExampleResultDTO; } /** diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml index 6534512f8a..259f50c80f 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml @@ -47,20 +47,12 @@ IFNULL(avg(data.PLAT_JOIN_PARTY_RATIO),0) AS platJoinPartyRatio FROM screen_pioneer_data data - LEFT JOIN screen_customer_agency agency - ON data.org_id = agency.agency_id + ON (data.org_id = agency.agency_id and agency.del_flag='0') WHERE data.del_flag = '0' - AND data.org_type = 'agency' - AND agency.area_code LIKE concat(#{areaCode},'%') - - - data.customer_id = #{subId} - - - ORDER BY data.data_end_time DESC - LIMIT 1 + and agency.PARENT_AREA_CODE=#{areaCode} + and data.DATA_END_TIME=#{dataEndTime} From f17479b3efdbf7c49d24a39ceaa494f2f962c475 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 8 Jul 2021 11:56:56 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E9=9A=BE=E7=82=B9?= =?UTF-8?q?=E8=B5=8C=E7=82=B9=E5=88=97=E8=A1=A8=EF=BC=8C=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E6=98=AF=E6=A0=B9=E6=8D=AEareaCode=E6=9F=A5=E8=AF=A2=EF=BC=8C?= =?UTF-8?q?=E9=99=90=E5=88=B6=E4=BD=8F=E7=8A=B6=E6=80=81=E4=B8=BA=E5=A4=84?= =?UTF-8?q?=E7=90=86=E4=B8=AD=EF=BC=9AEVENT=5FSTATUS=5FCODE=20in('pending'?= =?UTF-8?q?,'0'),=E5=B9=B6=E4=B8=94=E6=98=AF=E6=9D=A5=E6=BA=90=E4=BA=8E?= =?UTF-8?q?=E7=BD=91=E6=A0=BC=E7=9A=84=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/impl/GrassRootsGovernServiceImpl.java | 1 + .../main/resources/mapper/screen/ScreenDifficultyDataDao.xml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java index b74a777bd5..0cdb93a9c7 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java @@ -110,6 +110,7 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService { } PageHelper.startPage(NumConstant.ONE,param.getTopNum()); if (StringUtils.isNotEmpty(param.getAreaCode())){ + // 目前只有平阴大屏才会传areaCode,下面的sql限制住状态为:处理中 result = screenDifficultyDataDao.selectDifficultyByAreaCode(param.getAreaCode(),param.getType()); }else { result = screenDifficultyDataDao.selectDifficulty(param.getAgencyId(),param.getType()); diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenDifficultyDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenDifficultyDataDao.xml index 4e03b4d2a3..191cc4034a 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenDifficultyDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenDifficultyDataDao.xml @@ -70,6 +70,8 @@ on(diff.ORG_ID=scg.GRID_ID and scg.DEL_FLAG='0') WHERE diff.DEL_FLAG = '0' + and diff.orgType='grid' + and diff.EVENT_STATUS_CODE in('pending','0') AND scg.AREA_CODE like concat(#{areaCode},'%') ORDER BY (CASE #{type} From 2f384fb2b64986781fec9c040128d1a316750b35 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 8 Jul 2021 14:14:23 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E6=8B=BD=E4=B8=80=E6=8B=BDdev?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/service/org/impl/CustomerGridServiceImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java index eb59168f41..680c9892bb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java @@ -11,6 +11,7 @@ import com.epmet.dto.org.CustomerStaffGridDTO; import com.epmet.dto.org.GridInfoDTO; import com.epmet.entity.org.CustomerGridEntity; import com.epmet.service.org.CustomerGridService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Date; @@ -20,6 +21,9 @@ import java.util.List; @DataSource(DataSourceConstant.GOV_ORG) public class CustomerGridServiceImpl extends BaseServiceImpl implements CustomerGridService { + @Autowired + private CustomerGridDao customerGridDao; + @Override public List listGridsByCreateTime(Date start, Date end) { return baseDao.listGridsByCreateTime(start, end); From ddd9aec85ba02ed372f158c5e4d9e5f168a7ff4e Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 8 Jul 2021 14:28:20 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E5=B7=A1=E6=9F=A5stats=5Fstaff=5Fpatrol=5F?= =?UTF-8?q?record=5Fdaily=E8=A1=A8=E6=B7=BB=E5=8A=A0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../result/StatsStaffPatrolRecordDailyDTO.java | 10 ++++++++++ .../user/StatsStaffPatrolRecordDailyEntity.java | 16 +++++++++++++--- .../dto/StatsStaffPatrolRecordDailyDTO.java | 12 +++++++++++- .../StatsStaffPatrolRecordDailyEntity.java | 16 +++++++++++++--- ...16__alter_stats_staff_patrol_record_daily.sql | 4 ++++ 5 files changed, 51 insertions(+), 7 deletions(-) create mode 100644 epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.16__alter_stats_staff_patrol_record_daily.sql diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StatsStaffPatrolRecordDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StatsStaffPatrolRecordDailyDTO.java index ad8c156e77..4062043799 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StatsStaffPatrolRecordDailyDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StatsStaffPatrolRecordDailyDTO.java @@ -39,11 +39,21 @@ public class StatsStaffPatrolRecordDailyDTO implements Serializable { */ private String id; + /** + * 来源类型 external:外部,internal:内部 + */ + private String sourceType; + /** * 客户Id */ private String customerId; + /** + * 数据来源客户Id + */ + private String sourceCustomerId; + /** * 统计日期 关联日期dim表 */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/user/StatsStaffPatrolRecordDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/user/StatsStaffPatrolRecordDailyEntity.java index 9425887126..d0d3445589 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/user/StatsStaffPatrolRecordDailyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/user/StatsStaffPatrolRecordDailyEntity.java @@ -38,11 +38,21 @@ public class StatsStaffPatrolRecordDailyEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; - /** - * 客户Id - */ + /** + * 来源类型 external:外部,internal:内部 + */ + private String sourceType; + + /** + * 客户Id + */ private String customerId; + /** + * 数据来源客户Id + */ + private String sourceCustomerId; + /** * 统计日期 关联日期dim表 */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StatsStaffPatrolRecordDailyDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StatsStaffPatrolRecordDailyDTO.java index 43a8cdf336..dfbc170559 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StatsStaffPatrolRecordDailyDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StatsStaffPatrolRecordDailyDTO.java @@ -38,10 +38,20 @@ public class StatsStaffPatrolRecordDailyDTO implements Serializable { */ private String id; + /** + * 来源类型 external:外部,internal:内部 + */ + private String sourceType; + /** * 客户Id */ - private String customerId; + private String customerId; + + /** + * 数据来源客户Id + */ + private String sourceCustomerId; /** * 统计日期 关联日期dim表 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StatsStaffPatrolRecordDailyEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StatsStaffPatrolRecordDailyEntity.java index 2bb2e583e3..93edb74930 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StatsStaffPatrolRecordDailyEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StatsStaffPatrolRecordDailyEntity.java @@ -38,11 +38,21 @@ public class StatsStaffPatrolRecordDailyEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; - /** - * 客户Id - */ + /** + * 来源类型 external:外部,internal:内部 + */ + private String sourceType; + + /** + * 客户Id + */ private String customerId; + /** + * 数据来源客户Id + */ + private String sourceCustomerId; + /** * 统计日期 关联日期dim表 */ diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.16__alter_stats_staff_patrol_record_daily.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.16__alter_stats_staff_patrol_record_daily.sql new file mode 100644 index 0000000000..1aa5a6c45e --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.16__alter_stats_staff_patrol_record_daily.sql @@ -0,0 +1,4 @@ +ALTER TABLE `stats_staff_patrol_record_daily` +ADD COLUMN `SOURCE_TYPE` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'internal' COMMENT '来源类型 external:外部,internal:内部' AFTER `ID`, +ADD COLUMN `SOURCE_CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '数据来源客户Id' AFTER `CUSTOMER_ID`; + From a0a783cec7a592395b890ce25956c88d935d22e3 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 8 Jul 2021 15:01:18 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E7=BD=91=E6=A0=BC=E5=91=98=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E6=80=BB=E6=95=B0=E4=B8=8A=E6=8A=A5=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/crm/CustomerRelationDTO.java | 116 ++++++++++++++++++ .../dto/stats/form/GmUploadEventFormDTO.java | 12 +- .../epmet/dao/crm/CustomerRelationDao.java | 8 ++ .../epmet/service/crm/CustomerService.java | 7 ++ .../service/crm/impl/CustomerServiceImpl.java | 13 ++ .../service/impl/StatsUserServiceImpl.java | 29 +++-- .../mapper/crm/CustomerRelationDao.xml | 11 ++ .../main/resources/mapper/user/UserDao.xml | 7 ++ 8 files changed, 187 insertions(+), 16 deletions(-) create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/crm/CustomerRelationDTO.java diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/crm/CustomerRelationDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/crm/CustomerRelationDTO.java new file mode 100644 index 0000000000..3a2fa60edf --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/crm/CustomerRelationDTO.java @@ -0,0 +1,116 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.crm; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 客户关系表(01.14 add) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-02-03 + */ +@Data +public class CustomerRelationDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 父级客户id;如果是顶级客户,此列=0 + */ + private String parentCustomerId; + + /** + * 当前客户的所有父级客户id,以英文冒号隔开,如果是顶级客户,此列=0 + */ + private String pids; + + /** + * 当前客户类型取值: external:外部客户,internal:内部客户 + */ + private String customerType; + + /** + * 父级客户类型取值: external:外部客户,internal:内部客户;如果是顶级客户,此列=0 + */ + private String parentCustomerType; + + /** + * open,closed是否启用 + */ + private String status; + + /** + * 当前客户级别(社区级:community, +乡(镇、街道)级:street, +区县级: district, +市级: city +省级:province) + */ + private String level; + + /** + * 当前客户的地区编码,实际就是根组织的area_code + */ + private String areaCode; + + /** + * 删除标识0未删除1已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadEventFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadEventFormDTO.java index 13d689fc6a..d4ece8c8e5 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadEventFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadEventFormDTO.java @@ -18,12 +18,6 @@ public class GmUploadEventFormDTO implements Serializable { private static final long serialVersionUID = -9178779369245037701L; //为true时需要删除历史数据 private Boolean isFirst; - //客户Id - @NotBlank(message = "客户Id不能为空", groups = {UploadEvent.class}) - private String customerId; - //日维度Id - @NotBlank(message = "dateId不能为空", groups = {UploadEvent.class}) - private String dateId; //数据集合对象 @NotEmpty(message = "数据集合对象不能为空",groups = UploadEvent.class) private List dataList; @@ -31,8 +25,12 @@ public class GmUploadEventFormDTO implements Serializable { @Data public static class DataList{ - //客户Id 【dim_customer.id】 + //来源类型 external:外部,internal:内部 + private String sourceType; + //客户Id 【dim_customer.id】[接口传入的是来源数据的客户Id] private String customerId; + //数据来源客户Id + private String parentCustomerId; //机关Id 【dim_agency.id】 private String agencyId; //日维度Id 【dim_date.id】 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerRelationDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerRelationDao.java index 11ec9c119c..db7fab8791 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerRelationDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerRelationDao.java @@ -18,6 +18,7 @@ package com.epmet.dao.crm; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.crm.CustomerRelationDTO; import com.epmet.dto.indexcal.CustomerSubInfoDTO; import com.epmet.entity.crm.CustomerRelationEntity; import org.apache.ibatis.annotations.Mapper; @@ -51,4 +52,11 @@ public interface CustomerRelationDao extends BaseDao { * @date 2021/3/23 上午10:21 */ List selectSubCustomer(@Param("customerId") String customerId); + + /** + * @Description 查询客户所属父客户信息 + * @author sun + */ + CustomerRelationDTO selectByCustomerId(@Param("customerId") String customerId); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerService.java index dbc2cc03f9..d6f9e8e2d3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerService.java @@ -1,5 +1,6 @@ package com.epmet.service.crm; +import com.epmet.dto.crm.CustomerRelationDTO; import com.epmet.entity.crm.CustomerEntity; import java.util.Date; @@ -10,4 +11,10 @@ public interface CustomerService { List listValidCustomersByCreateTime(Date createTimeFrom, Date createTimeTo); List listValidCustomersByUpdatedTime(Date updatedTime, Date initTime); + + /** + * @Description 查询客户所属父客户信息 + * @author sun + */ + CustomerRelationDTO getByCustomerId(String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerServiceImpl.java index 056df4e50e..84598562ca 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerServiceImpl.java @@ -3,6 +3,8 @@ package com.epmet.service.crm.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.crm.CustomerDao; +import com.epmet.dao.crm.CustomerRelationDao; +import com.epmet.dto.crm.CustomerRelationDTO; import com.epmet.entity.crm.CustomerEntity; import com.epmet.service.crm.CustomerService; import org.springframework.beans.factory.annotation.Autowired; @@ -17,6 +19,8 @@ public class CustomerServiceImpl implements CustomerService { @Autowired private CustomerDao customerDao; + @Autowired + private CustomerRelationDao customerRelationDao; @Override public List listValidCustomersByCreateTime(Date createTimeFrom, Date createTimeTo) { @@ -27,4 +31,13 @@ public class CustomerServiceImpl implements CustomerService { public List listValidCustomersByUpdatedTime(Date startTime, Date endTime) { return customerDao.listValidCustomersByUpdateTime(startTime, endTime); } + + /** + * @Description 查询客户所属父客户信息 + * @author sun + */ + @Override + public CustomerRelationDTO getByCustomerId(String customerId) { + return customerRelationDao.selectByCustomerId(customerId); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java index ee68d5dbe7..7ba72ee7ef 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java @@ -3,16 +3,19 @@ package com.epmet.service.impl; import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.ProjectConstant; import com.epmet.dao.stats.DataStatsDao; import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.StatsFormDTO; +import com.epmet.dto.crm.CustomerRelationDTO; import com.epmet.dto.stats.form.GmUploadDataFormDTO; import com.epmet.dto.stats.form.GmUploadEventFormDTO; import com.epmet.dto.stats.user.result.UserStatisticalData; import com.epmet.service.StatsUserService; +import com.epmet.service.crm.CustomerService; import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService; import com.epmet.service.stats.DimAgencyService; import com.epmet.service.stats.DimCustomerService; @@ -26,6 +29,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.util.Calendar; @@ -60,6 +64,8 @@ public class StatsUserServiceImpl implements StatsUserService { private ScreenCustomerAgencyService screenCustomerAgencyService; @Autowired private DataStatsDao dataStatsDao; + @Autowired + private CustomerService customerService; /** @@ -149,18 +155,20 @@ public class StatsUserServiceImpl implements StatsUserService { * @author sun */ @Override + @Transactional(rollbackFor = Exception.class) public void gmUploadEvent(GmUploadEventFormDTO formDTO) { - //1.判断是否批量删除历史数据 - if (formDTO.getIsFirst()) { - int deleteNum; - do { - deleteNum = userService.delGmUploadEvent(formDTO.getCustomerId(), formDTO.getDateId()); - } while (deleteNum > NumConstant.ZERO); + //1.数据上报只涉及数据库部分数据,其他数据都是计算出来的,所以不存在删除历史数据,有就更新没有就新增 + String customerId = formDTO.getDataList().get(0).getCustomerId(); + + //2.数据准备 + //2-1.查询当前客户index库组织信息供数据封装使用 + List agencyList = screenCustomerAgencyService.getByCustomerId(customerId); + //2-2.查询客户所属父客户信息 + CustomerRelationDTO crm = customerService.getByCustomerId(customerId); + if (null == crm) { + throw new RenException(String.format("未查询到子客户所属父客户信息,子客户Id->%s", customerId)); } - //2.查询当前客户index库组织信息供数据封装使用 - List agencyList = screenCustomerAgencyService.getByCustomerId(formDTO.getCustomerId()); - //3.分批处理上传数据 List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); partition.forEach(p -> { @@ -175,6 +183,8 @@ public class StatsUserServiceImpl implements StatsUserService { } }); if (bl.get()) { + m.setSourceType("external"); + m.setParentCustomerId(crm.getParentCustomerId()); m.setGridPids(gridPids.toString()); m.setPatrolTotal(NumConstant.ZERO); m.setTotalTime(NumConstant.ZERO); @@ -197,6 +207,7 @@ public class StatsUserServiceImpl implements StatsUserService { * @author sun */ @Override + @Transactional(rollbackFor = Exception.class) public void gmUploadData(GmUploadDataFormDTO formDTO) { //1.判断是否批量删除历史数据 if (formDTO.getIsFirst()) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerRelationDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerRelationDao.xml index fad1ca0443..ba3cccf88b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerRelationDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerRelationDao.xml @@ -39,4 +39,15 @@ + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml index 4b5a6966f8..d0fc049555 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml @@ -641,7 +641,9 @@ INSERT INTO stats_staff_patrol_record_daily ( id, + source_type, customer_id, + source_customer_id, date_id, week_id, month_id, @@ -667,6 +669,8 @@ ( REPLACE(UUID(), '-', ''), + #{i.sourceType}, + #{i.parentCustomerId}, #{i.customerId}, #{i.dateId}, #{i.weekId}, @@ -692,6 +696,9 @@ ON DUPLICATE KEY UPDATE + source_type = values(source_type), + customer_id = values(customer_id), + source_customer_id = values(source_customer_id), report_project_count = values(report_project_count), updated_by = 'BASE_REPORT', updated_time = NOW() From e0c38361e6d76b0d770b963fb48ed9a7d2bfbccc Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 8 Jul 2021 15:10:35 +0800 Subject: [PATCH 7/9] =?UTF-8?q?fact=5Fgrid=5Fmember=5Fstatistics=5Fdaily?= =?UTF-8?q?=E8=A1=A8=E6=96=B0=E5=A2=9E=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FactGridMemberStatisticsDailyEntity.java | 16 +++++++++++++--- .../stats/FactGridMemberStatisticsDailyDTO.java | 16 +++++++++++++--- .../FactGridMemberStatisticsDailyEntity.java | 16 +++++++++++++--- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactGridMemberStatisticsDailyEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactGridMemberStatisticsDailyEntity.java index 63214c950a..dbcc2d5f26 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactGridMemberStatisticsDailyEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactGridMemberStatisticsDailyEntity.java @@ -53,11 +53,21 @@ public class FactGridMemberStatisticsDailyEntity extends BaseEpmetEntity { */ private String yearId; - /** - * 客户ID - */ + /** + * 来源类型 external:外部,internal:内部 + */ + private String sourceType; + + /** + * 客户Id + */ private String customerId; + /** + * 数据来源客户Id + */ + private String sourceCustomerId; + /** * 组织ID */ diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridMemberStatisticsDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridMemberStatisticsDailyDTO.java index 071d00753c..6beb42f54d 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridMemberStatisticsDailyDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridMemberStatisticsDailyDTO.java @@ -53,11 +53,21 @@ public class FactGridMemberStatisticsDailyDTO implements Serializable { */ private String yearId; - /** - * 客户ID - */ + /** + * 来源类型 external:外部,internal:内部 + */ + private String sourceType; + + /** + * 客户Id + */ private String customerId; + /** + * 数据来源客户Id + */ + private String sourceCustomerId; + /** * 组织ID */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridMemberStatisticsDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridMemberStatisticsDailyEntity.java index 76ff908449..27ac16cb34 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridMemberStatisticsDailyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridMemberStatisticsDailyEntity.java @@ -53,11 +53,21 @@ public class FactGridMemberStatisticsDailyEntity extends BaseEpmetEntity { */ private String yearId; - /** - * 客户ID - */ + /** + * 来源类型 external:外部,internal:内部 + */ + private String sourceType; + + /** + * 客户Id + */ private String customerId; + /** + * 数据来源客户Id + */ + private String sourceCustomerId; + /** * 组织ID */ From 742a030bc98f8e577dab27bae6c685dfe5c1bf23 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Thu, 8 Jul 2021 15:19:27 +0800 Subject: [PATCH 8/9] =?UTF-8?q?fact=5Fgrid=5Fmember=5Fstatistics=5Fdaily?= =?UTF-8?q?=E8=A1=A8=E6=B7=BB=E5=8A=A0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/FactGridMemberStatisticsDailyServiceImpl.java | 2 ++ .../db/migration/V0.0.21__grid_member_statistics.sql | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridMemberStatisticsDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridMemberStatisticsDailyServiceImpl.java index e7f436de06..08a2528e8e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridMemberStatisticsDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridMemberStatisticsDailyServiceImpl.java @@ -293,6 +293,8 @@ public class FactGridMemberStatisticsDailyServiceImpl extends BaseServiceImpl Date: Thu, 8 Jul 2021 15:48:44 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E7=BD=91=E6=A0=BC=E5=91=98=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=88=86=E6=9E=90=E4=B8=8A=E6=8A=A5=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/stats/form/GmUploadDataFormDTO.java | 12 +++++------- .../epmet/service/impl/StatsUserServiceImpl.java | 15 ++++++++++++--- .../java/com/epmet/service/user/UserService.java | 2 +- .../main/resources/mapper/stats/DatsStatsDao.xml | 9 ++++++++- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadDataFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadDataFormDTO.java index 34d9366054..576a4eb8a3 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadDataFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadDataFormDTO.java @@ -21,12 +21,6 @@ public class GmUploadDataFormDTO implements Serializable { * 为true时需要删除历史数据 */ private Boolean isFirst; - //客户Id - @NotBlank(message = "客户Id不能为空", groups = {UploadData.class}) - private String customerId; - //日维度Id - @NotBlank(message = "dateId不能为空", groups = {UploadData.class}) - private String dateId; //数据集合对象 @NotEmpty(message = "数据集合对象不能为空",groups = UploadData.class) private List dataList; @@ -34,8 +28,12 @@ public class GmUploadDataFormDTO implements Serializable { @Data public static class DataList{ - //客户Id 【dim_customer.id】 + //来源类型 external:外部,internal:内部 + private String sourceType; + //客户Id 【dim_customer.id】[接口传入的是来源数据的客户Id] private String customerId; + //数据来源客户Id + private String parentCustomerId; //机关Id 【dim_agency.id】 private String agencyId; //日维度Id 【dim_date.id】 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java index 7ba72ee7ef..26ba03ca2e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java @@ -209,16 +209,23 @@ public class StatsUserServiceImpl implements StatsUserService { @Override @Transactional(rollbackFor = Exception.class) public void gmUploadData(GmUploadDataFormDTO formDTO) { + String customerId = formDTO.getDataList().get(0).getCustomerId(); //1.判断是否批量删除历史数据 if (formDTO.getIsFirst()) { int deleteNum; do { - deleteNum = dataStatsDao.delGmUploadData(formDTO.getCustomerId(), formDTO.getDateId()); + deleteNum = dataStatsDao.delGmUploadData(customerId, formDTO.getDataList().get(0).getDateId()); } while (deleteNum > NumConstant.ZERO); } - //2.查询当前客户index库组织信息供数据封装使用 - List agencyList = screenCustomerAgencyService.getByCustomerId(formDTO.getCustomerId()); + //2.数据准备 + //2-1.查询当前客户index库组织信息供数据封装使用 + List agencyList = screenCustomerAgencyService.getByCustomerId(customerId); + //2-2.查询客户所属父客户信息 + CustomerRelationDTO crm = customerService.getByCustomerId(customerId); + if (null == crm) { + throw new RenException(String.format("未查询到子客户所属父客户信息,子客户Id->%s", customerId)); + } //3.分批处理上传数据 List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); @@ -236,6 +243,8 @@ public class StatsUserServiceImpl implements StatsUserService { } }); if (bl.get()) { + m.setSourceType("external"); + m.setParentCustomerId(crm.getParentCustomerId()); m.setPid(pid.toString()); m.setPids(pids.toString()); } else { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java index 129632a2c3..f45809be94 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java @@ -128,7 +128,7 @@ public interface UserService { /** * @Description 数据上报--网格员事件总数上报--按客户Id和dateId删除历史数据 - * @author sun + * @author sun [接口废弃,暂无使用] */ int delGmUploadEvent(String customerId, String dateId); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DatsStatsDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DatsStatsDao.xml index 65ea939f02..862f136e20 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DatsStatsDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DatsStatsDao.xml @@ -8,7 +8,7 @@ FROM fact_grid_member_statistics_daily WHERE - customer_id = #{customerId} + source_customer_id = #{customerId} AND date_id = #{dateId} LIMIT 1000 @@ -20,7 +20,9 @@ date_id, month_id, year_id, + source_type, customer_id, + source_customer_id, agency_id, grid_id, pid, @@ -53,6 +55,8 @@ #{i.dateId}, #{i.monthId}, #{i.yearId}, + #{i.sourceType}, + #{i.parentCustomerId}, #{i.customerId}, #{i.agencyId}, #{i.gridId}, @@ -82,6 +86,9 @@ ON DUPLICATE KEY UPDATE + source_type = values(source_type), + customer_id = values(customer_id), + source_customer_id = values(source_customer_id), project_count = values(project_count), issue_to_project_count = values(issue_to_project_count), closed_issue_count = values(closed_issue_count),