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),