Browse Source

网格员数据分析上报接口调整

dev_shibei_match
sunyuchao 4 years ago
parent
commit
c85e554b91
  1. 12
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadDataFormDTO.java
  2. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java
  3. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java
  4. 9
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DatsStatsDao.xml

12
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> 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】

15
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<CustomerAgencyDTO> agencyList = screenCustomerAgencyService.getByCustomerId(formDTO.getCustomerId());
//2.数据准备
//2-1.查询当前客户index库组织信息供数据封装使用
List<CustomerAgencyDTO> agencyList = screenCustomerAgencyService.getByCustomerId(customerId);
//2-2.查询客户所属父客户信息
CustomerRelationDTO crm = customerService.getByCustomerId(customerId);
if (null == crm) {
throw new RenException(String.format("未查询到子客户所属父客户信息,子客户Id->%s", customerId));
}
//3.分批处理上传数据
List<List<GmUploadDataFormDTO.DataList>> 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 {

2
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);

9
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
</delete>
@ -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 @@
</foreach>
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),

Loading…
Cancel
Save