diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java index d2bfc0253e..79e5e624d8 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java @@ -7,6 +7,7 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dataaggre.dto.epmetuser.form.OpenStaffDetailFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.GridMemberStatsFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.OpenStaffDetailFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.PatrolDateListFormDTO; 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-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/GrassRootsGovernServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java index 5510d056c5..4663545b5d 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/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 49e4aadd05..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,38 @@ 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()))); + } 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/ScreenDifficultyDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenDifficultyDataDao.xml index 7f30a13cac..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 @@ -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,13 +63,15 @@ 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 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} 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 db8c7ba349..109b0e8fe1 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 @@ -49,20 +49,12 @@ DATA_END_TIME as dataEndTime 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} 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/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-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-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-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/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index 5ddc845786..3001b4eb2c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -945,6 +945,12 @@ public class DemoController { return new Result(); } + @PostMapping("extractFactGridMemberDaily") + public Result extractFactGridMemberDaily(@RequestBody ExtractFactGridGovernDailyFromDTO fromDTO){ + factGridMemberStatisticsDailyService.extractGridMemberStatisticsDaily(fromDTO.getCustomerId(), fromDTO.getDateId()); + return new Result(); + } + /** * @return com.epmet.commons.tools.utils.Result @@ -963,12 +969,6 @@ public class DemoController { return new Result(); } - @PostMapping("extractFactGridMemberDaily") - public Result extractFactGridMemberDaily(@RequestBody ExtractFactGridGovernDailyFromDTO fromDTO){ - factGridMemberStatisticsDailyService.extractGridMemberStatisticsDaily(fromDTO.getCustomerId(), fromDTO.getDateId()); - return new Result(); - } - @Autowired private CustomerAgencyService customerAgencyService; @Autowired 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/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 */ 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-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/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 NumConstant.ZERO); - } + //1.数据上报只涉及数据库部分数据,其他数据都是计算出来的,所以不存在删除历史数据,有就更新没有就新增 + String customerId = formDTO.getDataList().get(0).getCustomerId(); - //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); @@ -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,17 +207,25 @@ public class StatsUserServiceImpl implements StatsUserService { * @author sun */ @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); @@ -225,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/org/impl/CustomerGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java index d21e91cb36..3c2ac0206f 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); 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/db/migration/V0.0.21__grid_member_statistics.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.21__grid_member_statistics.sql index c8c90b5370..7fbadf02ed 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.21__grid_member_statistics.sql +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.21__grid_member_statistics.sql @@ -39,3 +39,9 @@ ALTER TABLE `epmet_data_statistical`.`fact_grid_member_statistics_daily` ALTER TABLE `epmet_data_statistical`.`fact_origin_project_main_daily` ADD COLUMN `PROJECT_CREATOR` varchar(32) NULL COMMENT '项目创建人(议题转项目或立项人)' AFTER `IS_SATISFIED`; + +#fact_grid_member_statistics_daily 表添加字段 +ALTER TABLE `fact_grid_member_statistics_daily` + MODIFY COLUMN `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据归属客户ID【例:孔村上报数据属于平阴的】' AFTER `YEAR_ID`, + ADD COLUMN `SOURCE_TYPE` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'internal' COMMENT '来源类型 external:外部,internal:内部' AFTER `YEAR_ID`, + ADD COLUMN `SOURCE_CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '数据来源客户Id' AFTER `CUSTOMER_ID`; \ No newline at end of file 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/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), 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() 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`; +