From c6bbaeec320d734987c3dbe70f78d28a88c5803c Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 6 Jul 2021 16:30:24 +0800 Subject: [PATCH 01/21] =?UTF-8?q?=E5=A2=9E=E5=8A=A0sync=5Fflag,0:=E4=B8=8D?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=88=B0=E6=8C=87=E6=A0=87=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/db/migration/V0.0.5__add_sync_flag.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.5__add_sync_flag.sql diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.5__add_sync_flag.sql b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.5__add_sync_flag.sql new file mode 100644 index 0000000000..f4133fe7ee --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.5__add_sync_flag.sql @@ -0,0 +1,3 @@ +alter table customer_agency add column SYNC_FLAG VARCHAR(1) not null default '1' comment '当前组织是否同步到统计库和指标库' AFTER AREA_CODE; +alter table customer_department add column SYNC_FLAG VARCHAR(1) not null default '1' comment '当前部门是否同步到统计库和指标库' AFTER AREA_CODE; +alter table customer_grid add column SYNC_FLAG VARCHAR(1) not null default '1' comment '当前网格是否同步到统计库和指标库' AFTER AREA_CODE; \ No newline at end of file From 37767d0dff0ff963add35c84299b53782028746b Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 7 Jul 2021 09:38:54 +0800 Subject: [PATCH 02/21] =?UTF-8?q?=E7=BD=91=E6=A0=BC=E5=91=98=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=B8=8A=E6=8A=A5=E6=8E=A5=E5=8F=A3=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/OpenStaffDetailFormDTO.java | 29 +++++++ .../result/OpenStaffDetailResultDTO.java | 28 +++++++ .../controller/EpmetUserController.java | 13 +++ .../dao/epmetuser/CustomerStaffDao.java | 9 ++- .../dao/govorg/CustomerStaffAgencyDao.java | 6 ++ .../service/epmetuser/EpmetUserService.java | 13 ++- .../epmetuser/impl/EpmetUserServiceImpl.java | 36 +++++++++ .../service/govorg/GovOrgService.java | 7 ++ .../govorg/impl/GovOrgServiceImpl.java | 10 +++ .../mapper/epmetuser/CustomerStaffDao.xml | 12 +++ .../mapper/govorg/CustomerStaffAgencyDao.xml | 14 ++++ .../dto/stats/form/GmUploadDataFormDTO.java | 81 +++++++++++++++++++ .../dto/stats/form/GmUploadEventFormDTO.java | 65 +++++++++++++++ .../epmet/controller/StatsUserController.java | 27 +++++++ .../com/epmet/service/StatsUserService.java | 16 ++++ .../service/impl/StatsUserServiceImpl.java | 24 ++++++ 16 files changed, 385 insertions(+), 5 deletions(-) create mode 100644 epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/OpenStaffDetailFormDTO.java create mode 100644 epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/OpenStaffDetailResultDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadDataFormDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadEventFormDTO.java diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/OpenStaffDetailFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/OpenStaffDetailFormDTO.java new file mode 100644 index 0000000000..4d3d81aebe --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/OpenStaffDetailFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dataaggre.dto.epmetuser.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 对外接口--查询工作人员基本信息-接口入参 + * @Auth sun + */ +@Data +public class OpenStaffDetailFormDTO implements Serializable { + + private static final long serialVersionUID = -3381286960911634231L; + /** + * 客户Id + */ + @NotBlank(message = "客户Id不能为空", groups = OpenStaffDetailFormDTO.Open.class) + private String customerId; + /** + * 手机号 + */ + @NotBlank(message = "手机号不能为空", groups = OpenStaffDetailFormDTO.Open.class) + private String mobile; + public interface Open extends CustomerClientShowGroup {} + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/OpenStaffDetailResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/OpenStaffDetailResultDTO.java new file mode 100644 index 0000000000..9707a14f67 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/OpenStaffDetailResultDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dataaggre.dto.epmetuser.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 对外接口--查询工作人员基本信息-接口返参 + * @Auth sun + */ +@Data +public class OpenStaffDetailResultDTO implements Serializable { + private static final long serialVersionUID = 7129564173128153335L; + + //工作人员用户id + private String staffId = ""; + //工作人员姓名 + private String staffName = ""; + //手机号 + private String mobile = ""; + //用户所属组织id + private String agencyId = ""; + //用户所属组织全路径名称 + private String agencyAllName = ""; + //客户Id + private String customerId = ""; + +} 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 bd535ae77c..96c3c20c02 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,9 +7,11 @@ 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.PatrolDateListFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.PatrolRecordListFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO; +import com.epmet.dataaggre.dto.epmetuser.result.OpenStaffDetailResultDTO; import com.epmet.dataaggre.dto.epmetuser.result.PatrolDateListResultDTO; import com.epmet.dataaggre.dto.epmetuser.result.PatrolRecordListResultDTO; import com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO; @@ -79,5 +81,16 @@ public class EpmetUserController { return new Result().ok(epmetUserService.patrolDateList(formDTO)); } + /** + * @Param formDTO + * @Description 对外接口--查询工作人员基本信息 + * @author sun + */ + @PostMapping("open-staffdetail") + public Result openStaffDetail(@RequestBody OpenStaffDetailFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, OpenStaffDetailFormDTO.Open.class); + return new Result().ok(epmetUserService.openStaffDetail(formDTO)); + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java index 9d3004c815..b3ca304972 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java @@ -18,8 +18,10 @@ package com.epmet.dataaggre.dao.epmetuser; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dataaggre.dto.epmetuser.CustomerStaffDTO; import com.epmet.dataaggre.entity.epmetuser.CustomerStaffEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 政府工作人员表 @@ -29,5 +31,10 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface CustomerStaffDao extends BaseDao { - + + /** + * @Description 按staffId查询基础信息 + * @author sun + */ + CustomerStaffDTO selectByMobile(@Param("customerId") String customerId, @Param("mobile") String mobile); } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffAgencyDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffAgencyDao.java index f8b58c698b..445e796c61 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffAgencyDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffAgencyDao.java @@ -18,6 +18,7 @@ package com.epmet.dataaggre.dao.govorg; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO; import com.epmet.dataaggre.dto.govorg.CustomerStaffAgencyDTO; import com.epmet.dataaggre.entity.govorg.CustomerStaffAgencyEntity; import org.apache.ibatis.annotations.Mapper; @@ -38,4 +39,9 @@ public interface CustomerStaffAgencyDao extends BaseDao staffGridRole(List forms, String staffName); + /** + * @Param formDTO + * @Description 对外接口--查询工作人员基本信息 + * @author sun + */ + OpenStaffDetailResultDTO openStaffDetail(OpenStaffDetailFormDTO formDTO); + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java index 175525d16d..2a5225832f 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java @@ -4,15 +4,19 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.dataaggre.constant.DataSourceConstant; +import com.epmet.dataaggre.dao.epmetuser.CustomerStaffDao; import com.epmet.dataaggre.dao.epmetuser.StaffPatrolRecordDao; import com.epmet.dataaggre.dao.epmetuser.StaffRoleDao; import com.epmet.dataaggre.dao.epmetuser.UserBaseInfoDao; +import com.epmet.dataaggre.dto.epmetuser.CustomerStaffDTO; import com.epmet.dataaggre.dto.epmetuser.StaffPatrolDetailDTO; import com.epmet.dataaggre.dto.epmetuser.StaffPatrolRecordDTO; +import com.epmet.dataaggre.dto.epmetuser.form.OpenStaffDetailFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.PatrolDateListFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.PatrolRecordListFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO; import com.epmet.dataaggre.dto.epmetuser.result.*; +import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO; import com.epmet.dataaggre.dto.govorg.CustomerGridDTO; import com.epmet.dataaggre.dto.govorg.result.GridStaffResultDTO; import com.epmet.dataaggre.service.epmetuser.EpmetUserService; @@ -49,6 +53,8 @@ public class EpmetUserServiceImpl implements EpmetUserService { private StaffPatrolRecordService staffPatrolRecordService; @Resource private StaffRoleDao staffRoleDao; + @Resource + private CustomerStaffDao customerStaffDao; /** * @Description 根据UserIds查询 @@ -247,5 +253,35 @@ public class EpmetUserServiceImpl implements EpmetUserService { return result; } + /** + * @Param formDTO + * @Description 对外接口--查询工作人员基本信息 + * @author sun + */ + @Override + public OpenStaffDetailResultDTO openStaffDetail(OpenStaffDetailFormDTO formDTO) { + OpenStaffDetailResultDTO resultDTO = new OpenStaffDetailResultDTO(); + //1.按staffId查询基础信息 + CustomerStaffDTO staffDTO = customerStaffDao.selectByMobile(formDTO.getCustomerId(), formDTO.getMobile()); + if (null == staffDTO) { + return resultDTO; + } + + //2.查询工作人员所属组织信息 + CustomerAgencyDTO agencyDTO = govOrgService.gridByAgencyId(formDTO.getCustomerId(), staffDTO.getUserId()); + + //3.封装数据并返回 + resultDTO.setCustomerId(formDTO.getCustomerId()); + if (null != agencyDTO) { + resultDTO.setAgencyId(agencyDTO.getId()); + resultDTO.setAgencyAllName(agencyDTO.getAllParentName()); + } + resultDTO.setStaffId(staffDTO.getUserId()); + resultDTO.setStaffName(staffDTO.getRealName()); + resultDTO.setMobile(formDTO.getMobile()); + + return resultDTO; + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java index 8008242d5f..caa795dc8f 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java @@ -1,5 +1,6 @@ package com.epmet.dataaggre.service.govorg; +import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO; import com.epmet.dataaggre.dto.govorg.CustomerGridDTO; import com.epmet.dataaggre.dto.govorg.form.NextAreaCodeFormDTO; import com.epmet.dataaggre.dto.govorg.result.*; @@ -59,4 +60,10 @@ public interface GovOrgService { * @author sun */ List selectGridStaffByGridIds(List gridIds, String staffName); + + /** + * @Description 查询工作人员所属组织信息 + * @author sun + */ + CustomerAgencyDTO gridByAgencyId(String customerId, String staffId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java index 29ed9208cf..41e4133c83 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java @@ -11,6 +11,7 @@ import com.epmet.dataaggre.dao.govorg.CustomerAgencyDao; import com.epmet.dataaggre.dao.govorg.CustomerGridDao; import com.epmet.dataaggre.dao.govorg.CustomerStaffAgencyDao; import com.epmet.dataaggre.dao.govorg.CustomerStaffGridDao; +import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO; import com.epmet.dataaggre.dto.govorg.CustomerGridDTO; import com.epmet.dataaggre.dto.govorg.CustomerStaffAgencyDTO; import com.epmet.dataaggre.dto.govorg.form.NextAreaCodeFormDTO; @@ -264,4 +265,13 @@ public class GovOrgServiceImpl implements GovOrgService { return result; } + /** + * @Description 查询工作人员所属组织信息 + * @author sun + */ + @Override + public CustomerAgencyDTO gridByAgencyId(String customerId, String staffId) { + return customerStaffAgencyDao.selectAgencyByStaffId(customerId, staffId); + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml index 43e15095e4..3b1b0c9db3 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml @@ -3,4 +3,16 @@ + + \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml index 50269ca116..763c06694b 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml @@ -16,4 +16,18 @@ AND user_id = #{userId} + + \ No newline at end of file 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 new file mode 100644 index 0000000000..7f6671dd83 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadDataFormDTO.java @@ -0,0 +1,81 @@ +package com.epmet.dto.stats.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * @Description 数据上报--网格员事件总数上报-接口入参 + * @Auth sun + */ +@Data +public class GmUploadDataFormDTO implements Serializable { + private static final long serialVersionUID = -9178779369245037701L; + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + //客户Id + private String customerId; + //日维度Id + private String dateId; + //数据集合对象 + @NotEmpty(message = "数据集合对象不能为空",groups = AgencyProjectForm.class) + private List dataList; + public interface AgencyProjectForm extends CustomerClientShowGroup {} + + @Data + public static class DataList{ + //客户Id 【dim_customer.id】 + private String customerId; + //机关Id 【dim_agency.id】 + private String agencyId; + //日维度Id 【dim_date.id】 + private String dateId; + //月维度Id 【dim_month.id】 + private String monthId; + //年维度Id 【dim_year.id】 + private String yearId; + //网格id + private String gridId; + //上级ID(网格所属Agency的上级组织Id) + private String pid; + //所有agencyId的上级组织ID(包含agencyId) + private String pids; + //工作人员id + private String staffId; + //工作人员姓名 + private String staffName; + //项目立项数,截止到当前dateId的总数 + private Integer projectCount; + //议题转项目数,截止到当前dateId的总数 + private Integer issueToProjectCount; + //议题关闭数,截止到当前dateId的总数 + private Integer closedIssueCount; + //项目响应数,截止到当前dateId的总数 + private Integer projectResponseCount; + //项目吹哨数,截止到当前dateId的总数 + private Integer projectTransferCount; + //项目结案数,dateId这一天的增量 + private Integer projectClosedCount; + //项目立项数,dateId这一天的增量 + private Integer projectIncr; + //议题转项目数,dateId这一天的增量 + private Integer issueToProjectIncr; + //议题关闭数,dateId这一天的增量 + private Integer closedIssueIncr; + //项目响应数,dateId这一天的增量 + private Integer projectResponseIncr; + //项目吹哨数,dateId这一天的增量 + private Integer projectTransferIncr; + //项目结案数,截止到当前dateId的总数 + private Integer projectClosedIncr; + + } + +} 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 new file mode 100644 index 0000000000..56eb2c059c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadEventFormDTO.java @@ -0,0 +1,65 @@ +package com.epmet.dto.stats.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * @Description 数据上报--网格员事件总数上报-接口入参 + * @Auth sun + */ +@Data +public class GmUploadEventFormDTO implements Serializable { + private static final long serialVersionUID = -9178779369245037701L; + //为true时需要删除历史数据 + private Boolean isFirst; + //客户Id + private String customerId; + //日维度Id + private String dateId; + //数据集合对象 + @NotEmpty(message = "数据集合对象不能为空",groups = AgencyProjectForm.class) + private List dataList; + public interface AgencyProjectForm extends CustomerClientShowGroup {} + + @Data + public static class DataList{ + //客户Id 【dim_customer.id】 + private String customerId; + //机关Id 【dim_agency.id】 + private String agencyId; + //日维度Id 【dim_date.id】 + private String dateId; + //周维度Id 【dim_week.id】 + private String weekId; + //月维度Id 【dim_month.id】 + private String monthId; + //季ID + private String quarterId; + //年维度Id 【dim_year.id】 + private String yearId; + //网格id + private String gridId; + //网格所有上级id + private String gridPids; + //产品这边工作人员用户id + private String staffId; + //巡查次数 + private Integer patrolTotal = 0; + //巡查时长 单位:秒 + private Integer totalTime = 0; + //事件数【立项项目数】 + private Integer reportProjectCount = 0; + //最新的巡查开始时间 + private String latestPatrolTime; + //最新的巡查状态 正在巡查中:patrolling;结束:end + private String latestPatrolStatus = "end"; + + } + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java index 9c521b770a..c46c98f64c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java @@ -1,9 +1,13 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.StatsFormDTO; +import com.epmet.dto.stats.form.GmUploadDataFormDTO; +import com.epmet.dto.stats.form.GmUploadEventFormDTO; import com.epmet.service.StatsUserService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -32,4 +36,27 @@ public class StatsUserController { statsUserService.partition(formDTO); return new Result(); } + + /** + * @Param formDTO + * @Description 数据上报--网格员事件总数上报 + * @author sun + */ + @PostMapping("gm-uploadevent") + public Result gmUploadEvent(@RequestBody GmUploadEventFormDTO formDTO) { + statsUserService.gmUploadEvent(formDTO); + return new Result(); + } + + /** + * @Param formDTO + * @Description 数据上报--网格员事件总数上报 + * @author sun + */ + @PostMapping("gm-uploaddata") + public Result gmUploadData(@RequestBody GmUploadDataFormDTO formDTO) { + statsUserService.gmUploadData(formDTO); + return new Result(); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsUserService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsUserService.java index db22288094..0e71cbd62f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsUserService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsUserService.java @@ -1,6 +1,8 @@ package com.epmet.service; import com.epmet.dto.StatsFormDTO; +import com.epmet.dto.stats.form.GmUploadDataFormDTO; +import com.epmet.dto.stats.form.GmUploadEventFormDTO; /** * @author wangc @@ -17,4 +19,18 @@ public interface StatsUserService { * @date 2020.06.28 14:38 **/ void partition(StatsFormDTO formDTO); + + /** + * @Param formDTO + * @Description 数据上报--网格员事件总数上报 + * @author sun + */ + void gmUploadEvent(GmUploadEventFormDTO formDTO); + + /** + * @Param formDTO + * @Description 数据上报--网格员事件总数上报 + * @author sun + */ + void gmUploadData(GmUploadDataFormDTO formDTO); } 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 0d35eede37..e9155fcaad 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 @@ -7,6 +7,8 @@ import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.ProjectConstant; import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.StatsFormDTO; +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.stats.DimAgencyService; @@ -130,4 +132,26 @@ public class StatsUserServiceImpl implements StatsUserService { log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, ModuleConstant.EXCEPTION_DING_INTERCEPTOR_PREFIX_GRID_USER_STATISTICAL, customerId, new Date().toString(), e.getMessage())); } } + + /** + * @Param formDTO + * @Description 数据上报--网格员事件总数上报 + * @author sun + */ + @Override + public void gmUploadEvent(GmUploadEventFormDTO formDTO) { + + } + + /** + * @Param formDTO + * @Description 数据上报--网格员事件总数上报 + * @author sun + */ + @Override + public void gmUploadData(GmUploadDataFormDTO formDTO) { + + } + + } From b097ef4ece563b32aef983cfeb7f0f5cdd04ecd4 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 7 Jul 2021 10:28:57 +0800 Subject: [PATCH 03/21] =?UTF-8?q?CUSTOMER=5FDEPARTMENT=E4=B8=8D=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/db/migration/V0.0.5__add_sync_flag.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.5__add_sync_flag.sql b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.5__add_sync_flag.sql index f4133fe7ee..1f511e8a14 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.5__add_sync_flag.sql +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.5__add_sync_flag.sql @@ -1,3 +1,2 @@ alter table customer_agency add column SYNC_FLAG VARCHAR(1) not null default '1' comment '当前组织是否同步到统计库和指标库' AFTER AREA_CODE; -alter table customer_department add column SYNC_FLAG VARCHAR(1) not null default '1' comment '当前部门是否同步到统计库和指标库' AFTER AREA_CODE; alter table customer_grid add column SYNC_FLAG VARCHAR(1) not null default '1' comment '当前网格是否同步到统计库和指标库' AFTER AREA_CODE; \ No newline at end of file From 064406760a682d594f4bfbee141de2c7b3834e00 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 7 Jul 2021 10:53:55 +0800 Subject: [PATCH 04/21] =?UTF-8?q?dim=E3=80=81screen=5Fagency=E7=BB=B4?= =?UTF-8?q?=E5=BA=A6=E6=B7=BB=E5=8A=A0SYNC=5FFLAG=3D'1';"syncorginfo"?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/extract/form/SyncOrgInfoFormDTO.java | 21 +++ .../com/epmet/controller/DemoController.java | 22 +++ .../screen/ScreenCustomerAgencyDao.java | 7 +- .../screen/ScreenCustomerGridDao.java | 2 + .../epmet/dao/org/StatsCustomerAgencyDao.java | 2 + .../entity/org/CustomerAgencyEntity.java | 5 + .../epmet/entity/org/CustomerGridEntity.java | 5 + .../screen/ScreenCustomerAgencyService.java | 23 ++- .../screen/ScreenCustomerGridService.java | 2 + .../impl/ScreenCustomerAgencyServiceImpl.java | 27 +++ .../impl/ScreenCustomerGridServiceImpl.java | 5 + .../service/org/CustomerAgencyService.java | 10 ++ .../service/org/CustomerGridService.java | 3 +- .../org/impl/CustomerAgencyServiceImpl.java | 156 ++++++++++++++++++ .../org/impl/CustomerGridServiceImpl.java | 17 +- .../screen/ScreenCustomerAgencyDao.xml | 33 ++++ .../screen/ScreenCustomerGridDao.xml | 15 ++ .../resources/mapper/org/CustomerGridDao.xml | 4 +- .../mapper/org/StatsCustomerAgencyDao.xml | 15 +- 19 files changed, 357 insertions(+), 17 deletions(-) create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/SyncOrgInfoFormDTO.java diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/SyncOrgInfoFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/SyncOrgInfoFormDTO.java new file mode 100644 index 0000000000..bd1e2034f9 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/SyncOrgInfoFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.extract.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2021/7/6 16:37 + */ +@Data +public class SyncOrgInfoFormDTO implements Serializable { + private static final long serialVersionUID = -3533276226280926966L; + @NotBlank(message = "孔村or榆山or锦水客户id不能为空") + private String fromCustomerId; + @NotBlank(message = "平阴客户id不能为空") + private String toCustomerId; +} 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 a5317f5ba2..bfb8bdc42d 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 @@ -6,6 +6,7 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.constant.DataSourceConstant; import com.epmet.constant.IndexCalConstant; import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyDao; @@ -22,6 +23,7 @@ import com.epmet.dto.StatsFormDTO; import com.epmet.dto.extract.form.ExtractFactGridGovernDailyFromDTO; import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.dto.extract.form.ExtractScreenFormDTO; +import com.epmet.dto.extract.form.SyncOrgInfoFormDTO; import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; @@ -42,6 +44,8 @@ import com.epmet.service.evaluationindex.extract.todata.*; import com.epmet.service.evaluationindex.extract.toscreen.*; import com.epmet.service.evaluationindex.indexcal.*; import com.epmet.service.evaluationindex.screen.*; +import com.epmet.service.org.CustomerAgencyService; +import com.epmet.service.org.CustomerGridService; import com.epmet.service.stats.DimAgencyService; import com.epmet.service.stats.DimCustomerPartymemberService; import lombok.extern.slf4j.Slf4j; @@ -936,4 +940,22 @@ public class DemoController { return new Result(); } + @Autowired + private CustomerAgencyService customerAgencyService; + @Autowired + private CustomerGridService customerGridService; + + + /** + * 将孔村、榆山、锦水3个街道的网格、组织插入到gov-org库的customer_grid、customer_agency + * + * @param formDTO + * @return Result + */ + @PostMapping("syncorginfo") + public Result syncOrgInfo(@RequestBody SyncOrgInfoFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + customerAgencyService.sysAgencyInfo(formDTO.getFromCustomerId(), formDTO.getToCustomerId()); + return new Result(); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index b0dedb0db5..ebe3ff3783 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java @@ -34,7 +34,6 @@ import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; -import java.util.Map; /** * 组织机构信息 @@ -231,4 +230,10 @@ public interface ScreenCustomerAgencyDao extends BaseDao selectByPid(@Param("customerId") String customerId, @Param("parentAgencyId")String parentAgencyId); + + List selectKcCommunity(String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java index 6aa2aacc1c..90875a233a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java @@ -216,4 +216,6 @@ public interface ScreenCustomerGridDao extends BaseDao * @date 2021/6/10 10:45 上午 */ List selectGridInfoList(@Param("customerId") String customerId, @Param("pids") String pids); + + List selectEntityByAgencyId(@Param("customerId") String customerId, @Param("parentAgencyId") String parentAgencyId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java index fc575d3024..5745ff7cca 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java @@ -69,4 +69,6 @@ public interface StatsCustomerAgencyDao extends BaseDao { * @return com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity */ CustomerAgencyEntity selectByDeptId(String deptId); + + CustomerAgencyEntity selecByAreaCode(@Param("customerId")String customerId, @Param("areaCode")String areaCode); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerAgencyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerAgencyEntity.java index 4fbb9bfb83..f521f0aa60 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerAgencyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerAgencyEntity.java @@ -108,4 +108,9 @@ public class CustomerAgencyEntity extends BaseEpmetEntity { * 社区 */ private String community; + + /** + * 是否同步到统计库和指标库,1同步。0不同步 + */ + private String syncFlag; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerGridEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerGridEntity.java index 6c01df7df8..dc760a4b5e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerGridEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerGridEntity.java @@ -79,4 +79,9 @@ public class CustomerGridEntity extends BaseEpmetEntity { * 所有上级组织ID */ private String pids; + + /** + * 是否同步到统计库和指标库,1同步。0不同步 + */ + private String syncFlag; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java index 86fbe9e336..5c303466aa 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java @@ -21,13 +21,11 @@ import com.epmet.dto.extract.form.PartyBaseInfoFormDTO; import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO; import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO; - -import java.util.List; - import com.epmet.dto.extract.result.OrgNameResultDTO; import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity; import com.epmet.entity.org.CustomerAgencyEntity; +import java.util.List; import java.util.Map; /** @@ -114,4 +112,23 @@ public interface ScreenCustomerAgencyService{ * @date 2021/5/24 9:42 上午 */ ScreenCustomerAgencyEntity selectTopAgency(String customerId); + + /** + * 获取当前客户下的跟组织 + * + * @param customerId + * @return com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity + */ + ScreenCustomerAgencyEntity getRootAgency(String customerId); + + List getByPid(String customerId, String parentAgencyId); + + /** + * 查询出孔村的社区 + * + * @param customerId + * @return com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity + */ + List selectKcCommunity(String customerId); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java index f2a40b11c0..358b102ea6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java @@ -109,4 +109,6 @@ public interface ScreenCustomerGridService extends BaseService selectGridInfoByCustomerId(String customerId); List selectGridInfoList(String customerId, String pids); + + List selectEntityByAgencyId(String customerId, String parentAgencyId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java index 96019615ea..17b22866c6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java @@ -267,5 +267,32 @@ public class ScreenCustomerAgencyServiceImpl implements ScreenCustomerAgencyServ return screenCustomerAgencyDao.selectTopAgency(customerId); } + /** + * 获取当前客户下的跟组织 + * + * @param customerId + * @return com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity + */ + @Override + public ScreenCustomerAgencyEntity getRootAgency(String customerId) { + return screenCustomerAgencyDao.selectRootAgency(customerId); + } + + @Override + public List getByPid(String customerId, String parentAgencyId) { + return screenCustomerAgencyDao.selectByPid(customerId,parentAgencyId); + } + + /** + * 查询出孔村的社区 + * + * @param customerId + * @return com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity + */ + @Override + public List selectKcCommunity(String customerId) { + return screenCustomerAgencyDao.selectKcCommunity(customerId); + } + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java index b012accfe0..11aa43e27b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java @@ -210,4 +210,9 @@ public class ScreenCustomerGridServiceImpl extends BaseServiceImpl selectGridInfoList(String customerId, String pids) { return baseDao.selectGridInfoList(customerId,pids); } + + @Override + public List selectEntityByAgencyId(String customerId, String parentAgencyId) { + return baseDao.selectEntityByAgencyId(customerId,parentAgencyId); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java index 0eb247471e..60991b69bf 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java @@ -48,4 +48,14 @@ public interface CustomerAgencyService { * @return com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity */ CustomerAgencyEntity getAgencyByDeptId(String deptId); + + /** + * 将孔村、榆山、锦水3个街道的组织插入到gov-org库的customer_agency + * + * @param fromCustomerId + * @param toCustomerId + * @return Result + */ + void sysAgencyInfo(String fromCustomerId, String toCustomerId); + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java index 2cdee8ccad..7ba6178809 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java @@ -1,5 +1,6 @@ package com.epmet.service.org; +import com.epmet.commons.mybatis.service.BaseService; import com.epmet.dto.group.AgencyDTO; import com.epmet.dto.group.result.AgencyGridTotalCountResultDTO; import com.epmet.dto.group.result.GridIdListByCustomerResultDTO; @@ -9,7 +10,7 @@ import com.epmet.entity.org.CustomerGridEntity; import java.util.Date; import java.util.List; -public interface CustomerGridService { +public interface CustomerGridService extends BaseService { /** * 根据创建时间,截取时间段内的网格 * @param start diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java index d603b6781c..a917038b1c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java @@ -1,15 +1,24 @@ package com.epmet.service.org.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.org.StatsCustomerAgencyDao; import com.epmet.dto.org.result.CustomerAreaCodeResultDTO; import com.epmet.dto.org.result.OrgStaffDTO; +import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity; +import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity; import com.epmet.entity.org.CustomerAgencyEntity; +import com.epmet.entity.org.CustomerGridEntity; +import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService; +import com.epmet.service.evaluationindex.screen.ScreenCustomerGridService; import com.epmet.service.org.CustomerAgencyService; +import com.epmet.service.org.CustomerGridService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; import java.util.ArrayList; import java.util.Date; @@ -21,6 +30,12 @@ public class CustomerAgencyServiceImpl implements CustomerAgencyService { @Autowired private StatsCustomerAgencyDao customerAgencyDao; + @Autowired + private ScreenCustomerAgencyService screenCustomerAgencyService; + @Autowired + private ScreenCustomerGridService screenCustomerGridService; + @Autowired + private CustomerGridService customerGridService; @Override public List listAgenciesByCreateTime(Date statsStartTime, Date statsEndTime) { @@ -103,4 +118,145 @@ public class CustomerAgencyServiceImpl implements CustomerAgencyService { public CustomerAgencyEntity getAgencyByDeptId(String deptId) { return customerAgencyDao.selectByDeptId(deptId); } + + /** + * 将孔村、榆山、锦水3个街道的组织插入到gov-org库的customer_agency + * + * @param fromCustomerId + * @param toCustomerId + * @return Result + */ + @Override + public void sysAgencyInfo(String fromCustomerId, String toCustomerId) { + // 1、查询出平阴县组织信息 + CustomerAgencyEntity pingYin = customerAgencyDao.selecByAreaCode(toCustomerId, "370124"); + // 2、查询出街道 + ScreenCustomerAgencyEntity street = screenCustomerAgencyService.getRootAgency(fromCustomerId); + CustomerAgencyEntity insertStreetEntity = new CustomerAgencyEntity(); + insertStreetEntity.setCustomerId(pingYin.getCustomerId()); + insertStreetEntity.setPid(pingYin.getId()); + if(!StringUtils.isEmpty(pingYin.getPids())){ + insertStreetEntity.setPids(pingYin.getPids().concat(StrConstant.COLON).concat(pingYin.getId())); + }else{ + insertStreetEntity.setPids(pingYin.getId()); + } + insertStreetEntity.setAllParentName(pingYin.getOrganizationName()); + insertStreetEntity.setOrganizationName(street.getAgencyName()); + insertStreetEntity.setLevel("street"); + insertStreetEntity.setAreaCode(street.getAreaCode()); + insertStreetEntity.setSyncFlag("0"); + insertStreetEntity.setTotalUser(0); + insertStreetEntity.setProvince("山东省"); + insertStreetEntity.setCity("济南市"); + insertStreetEntity.setDistrict(pingYin.getOrganizationName()); + insertStreetEntity.setStreet(street.getAgencyName()); + insertStreetEntity.setCommunity(StrConstant.EPMETY_STR); + insertStreetEntity.setParentAreaCode(pingYin.getAreaCode()); + insertStreetEntity.setId(street.getAgencyId()); + // 3、插入街道 + if (null == customerAgencyDao.selectById(insertStreetEntity.getId())) { + customerAgencyDao.insert(insertStreetEntity); + } else { + customerAgencyDao.updateById(insertStreetEntity); + } + // 3.1、街道的直属网格 + this.insertCustomerGrid(street.getCustomerId(),street.getAgencyId(),insertStreetEntity); + + if ("2fe0065f70ca0e23ce4c26fca5f1d933".equals(fromCustomerId)) { + List kcCommunityList = screenCustomerAgencyService.selectKcCommunity(fromCustomerId); + for(ScreenCustomerAgencyEntity kcCommunity:kcCommunityList){ + CustomerAgencyEntity insertCommunityEntity = new CustomerAgencyEntity(); + insertCommunityEntity.setCustomerId(pingYin.getCustomerId()); + insertCommunityEntity.setPid(insertStreetEntity.getId()); + insertCommunityEntity.setPids(insertStreetEntity.getPids().concat(StrConstant.COLON).concat(insertStreetEntity.getId())); + insertCommunityEntity.setAllParentName(insertStreetEntity.getAllParentName().concat(StrConstant.HYPHEN).concat(insertStreetEntity.getOrganizationName())); + insertCommunityEntity.setOrganizationName(kcCommunity.getAgencyName()); + insertCommunityEntity.setLevel("community"); + insertCommunityEntity.setAreaCode(kcCommunity.getAreaCode()); + insertCommunityEntity.setSyncFlag(NumConstant.ZERO_STR); + insertCommunityEntity.setTotalUser(NumConstant.ZERO); + insertCommunityEntity.setProvince("山东省"); + insertCommunityEntity.setCity("济南市"); + insertCommunityEntity.setDistrict(pingYin.getOrganizationName()); + insertCommunityEntity.setStreet(insertStreetEntity.getOrganizationName()); + insertCommunityEntity.setCommunity(kcCommunity.getAgencyName()); + insertCommunityEntity.setParentAreaCode(insertStreetEntity.getAreaCode()); + insertCommunityEntity.setId(kcCommunity.getAgencyId()); + CustomerAgencyEntity customerAgencyEntity=customerAgencyDao.selectById(insertCommunityEntity.getId()); + if(null==customerAgencyEntity){ + // 4、插入社区 + customerAgencyDao.insert(insertCommunityEntity); + }else{ + customerAgencyDao.updateById(insertCommunityEntity); + } + // 4.1插入社区下的直属网格 + this.insertCustomerGrid(kcCommunity.getCustomerId(),kcCommunity.getAgencyId(),insertCommunityEntity); + } + } else { + // 4、查询出社区 + List communityList = screenCustomerAgencyService.getByPid(fromCustomerId,street.getAgencyId()); + for(ScreenCustomerAgencyEntity community:communityList){ + CustomerAgencyEntity insertCommunityEntity = new CustomerAgencyEntity(); + insertCommunityEntity.setCustomerId(pingYin.getCustomerId()); + insertCommunityEntity.setPid(insertStreetEntity.getId()); + insertCommunityEntity.setPids(insertStreetEntity.getPids().concat(StrConstant.COLON).concat(insertStreetEntity.getId())); + insertCommunityEntity.setAllParentName(insertStreetEntity.getAllParentName().concat(StrConstant.HYPHEN).concat(insertStreetEntity.getOrganizationName())); + insertCommunityEntity.setOrganizationName(community.getAgencyName()); + insertCommunityEntity.setLevel("community"); + insertCommunityEntity.setAreaCode(community.getAreaCode()); + insertCommunityEntity.setSyncFlag(NumConstant.ZERO_STR); + insertCommunityEntity.setTotalUser(NumConstant.ZERO); + insertCommunityEntity.setProvince("山东省"); + insertCommunityEntity.setCity("济南市"); + insertCommunityEntity.setDistrict(pingYin.getOrganizationName()); + insertCommunityEntity.setStreet(insertStreetEntity.getOrganizationName()); + insertCommunityEntity.setCommunity(community.getAgencyName()); + insertCommunityEntity.setParentAreaCode(insertStreetEntity.getAreaCode()); + insertCommunityEntity.setId(community.getAgencyId()); + CustomerAgencyEntity customerAgencyEntity=customerAgencyDao.selectById(insertCommunityEntity.getId()); + if(null==customerAgencyEntity){ + customerAgencyDao.insert(insertCommunityEntity); + }else{ + customerAgencyDao.updateById(insertCommunityEntity); + } + // 4.1插入社区下的直属网格 + this.insertCustomerGrid(community.getCustomerId(),community.getAgencyId(),insertCommunityEntity); + } + + } + } + + /** + * @return void + * @param customerId 孔村、榆山、锦水的客户id + * @param agencyId 孔村、榆山、锦水的组织id + * @param parentCustomerEntity 在平阴客户里,网格所属组织信息 + * @author yinzuomei + * @description 将3个街道的网格,插入到gov-org.customer_grid库 + * @Date 2021/7/7 9:54 + **/ + private void insertCustomerGrid(String customerId, String agencyId, CustomerAgencyEntity parentCustomerEntity) { + List gridEntityList = screenCustomerGridService.selectEntityByAgencyId(customerId, agencyId); + for (ScreenCustomerGridEntity gridEntity : gridEntityList) { + CustomerGridEntity insertGrid = new CustomerGridEntity(); + insertGrid.setId(gridEntity.getGridId()); + insertGrid.setCustomerId(parentCustomerEntity.getCustomerId()); + insertGrid.setGridName(gridEntity.getGridName()); + insertGrid.setAreaCode(gridEntity.getAreaCode()); + insertGrid.setSyncFlag(NumConstant.ZERO_STR); + insertGrid.setManageDistrict(gridEntity.getGridName()); + insertGrid.setTotalUser(NumConstant.ZERO); + insertGrid.setPid(gridEntity.getParentAgencyId()); + if(StringUtils.isEmpty(parentCustomerEntity.getPids())){ + insertGrid.setPids(insertGrid.getPid()); + }else{ + insertGrid.setPids(parentCustomerEntity.getPids().concat(StrConstant.COLON).concat(insertGrid.getPid())); + } + if (null == customerGridService.selectById(insertGrid.getId())) { + customerGridService.insert(insertGrid); + } else { + customerGridService.updateById(insertGrid); + } + } + } } 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 fa8018e1e1..70e321f702 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 @@ -1,6 +1,7 @@ package com.epmet.service.org.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.org.CustomerGridDao; import com.epmet.dto.group.AgencyDTO; @@ -9,7 +10,6 @@ import com.epmet.dto.group.result.GridIdListByCustomerResultDTO; 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; @@ -17,14 +17,11 @@ import java.util.List; @Service @DataSource(DataSourceConstant.GOV_ORG) -public class CustomerGridServiceImpl implements CustomerGridService { - - @Autowired - private CustomerGridDao customerGridDao; +public class CustomerGridServiceImpl extends BaseServiceImpl implements CustomerGridService { @Override public List listGridsByCreateTime(Date start, Date end) { - return customerGridDao.listGridsByCreateTime(start, end); + return baseDao.listGridsByCreateTime(start, end); } /** @@ -34,7 +31,7 @@ public class CustomerGridServiceImpl implements CustomerGridService { */ @Override public List selectAgencyGridTotalCount(List community, String dateId) { - return customerGridDao.selectAgencyGridTotalCount(community,dateId); + return baseDao.selectAgencyGridTotalCount(community,dateId); } /** @@ -45,12 +42,12 @@ public class CustomerGridServiceImpl implements CustomerGridService { */ @Override public List getCustomerGridIdList(String customerId, String dateId) { - return customerGridDao.getCustomerGridIdList(customerId, dateId); + return baseDao.getCustomerGridIdList(customerId, dateId); } @Override public List listUpdatedGridsByUpdateTime(Date lastInitTime, Date now) { - return customerGridDao.listUpdatedGridsByUpdateTime(lastInitTime, now); + return baseDao.listUpdatedGridsByUpdateTime(lastInitTime, now); } /** @@ -62,6 +59,6 @@ public class CustomerGridServiceImpl implements CustomerGridService { **/ @Override public List queryGridInfoList(String customerId) { - return customerGridDao.selectListGridInfo(customerId); + return baseDao.selectListGridInfo(customerId); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml index b60f152f95..4640aeebe6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml @@ -452,4 +452,37 @@ DEL_FLAG = 0 AND CUSTOMER_ID = #{customerId} + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml index 0fca6febf5..3838261c45 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml @@ -386,4 +386,19 @@ AND cg.ALL_PARENT_IDS like concat(#{pids},'%') + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml index 7aa2bf3422..a35631c893 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml @@ -9,6 +9,7 @@ FROM customer_grid DEL_FLAG = 0 + AND SYNC_FLAG='1' AND CREATED_TIME >= #{start} @@ -65,7 +66,8 @@ pid, pids FROM customer_grid - WHERE UPDATED_TIME >= #{startTime} + WHERE SYNC_FLAG='1' + AND UPDATED_TIME >= #{startTime} AND UPDATED_TIME #{endTime} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml index cf3ce06acc..c0209242e6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml @@ -16,6 +16,7 @@ FROM customer_agency DEL_FLAG = 0 + AND SYNC_FLAG='1' AND CREATED_TIME >= #{statsStartTime} @@ -97,7 +98,8 @@ district, PARENT_AREA_CODE as parentAreaCode from customer_agency - where UPDATED_TIME >= #{startTime} + where SYNC_FLAG='1' + AND UPDATED_TIME >= #{startTime} and UPDATED_TIME #{endTime} @@ -191,4 +193,15 @@ AND cd.DEL_FLAG = '0' ) + + From f7fd7b1ed8f6a1ef47c9e6645d88673ee0037ee5 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 7 Jul 2021 13:07:32 +0800 Subject: [PATCH 05/21] bugfix --- .../org/impl/CustomerAgencyServiceImpl.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java index a917038b1c..66ea3b4b37 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java @@ -140,7 +140,11 @@ public class CustomerAgencyServiceImpl implements CustomerAgencyService { }else{ insertStreetEntity.setPids(pingYin.getId()); } - insertStreetEntity.setAllParentName(pingYin.getOrganizationName()); + if(org.apache.commons.lang3.StringUtils.isNotBlank(pingYin.getAllParentName())){ + insertStreetEntity.setAllParentName(pingYin.getAllParentName().concat(StrConstant.HYPHEN).concat(pingYin.getOrganizationName())); + }else { + insertStreetEntity.setAllParentName(pingYin.getOrganizationName()); + } insertStreetEntity.setOrganizationName(street.getAgencyName()); insertStreetEntity.setLevel("street"); insertStreetEntity.setAreaCode(street.getAreaCode()); @@ -153,6 +157,8 @@ public class CustomerAgencyServiceImpl implements CustomerAgencyService { insertStreetEntity.setCommunity(StrConstant.EPMETY_STR); insertStreetEntity.setParentAreaCode(pingYin.getAreaCode()); insertStreetEntity.setId(street.getAgencyId()); + insertStreetEntity.setCreatedBy("APP_USER"); + insertStreetEntity.setUpdatedBy("APP_USER"); // 3、插入街道 if (null == customerAgencyDao.selectById(insertStreetEntity.getId())) { customerAgencyDao.insert(insertStreetEntity); @@ -182,6 +188,8 @@ public class CustomerAgencyServiceImpl implements CustomerAgencyService { insertCommunityEntity.setCommunity(kcCommunity.getAgencyName()); insertCommunityEntity.setParentAreaCode(insertStreetEntity.getAreaCode()); insertCommunityEntity.setId(kcCommunity.getAgencyId()); + insertCommunityEntity.setCreatedBy("APP_USER"); + insertCommunityEntity.setUpdatedBy("APP_USER"); CustomerAgencyEntity customerAgencyEntity=customerAgencyDao.selectById(insertCommunityEntity.getId()); if(null==customerAgencyEntity){ // 4、插入社区 @@ -213,6 +221,8 @@ public class CustomerAgencyServiceImpl implements CustomerAgencyService { insertCommunityEntity.setCommunity(community.getAgencyName()); insertCommunityEntity.setParentAreaCode(insertStreetEntity.getAreaCode()); insertCommunityEntity.setId(community.getAgencyId()); + insertCommunityEntity.setCreatedBy("APP_USER"); + insertCommunityEntity.setUpdatedBy("APP_USER"); CustomerAgencyEntity customerAgencyEntity=customerAgencyDao.selectById(insertCommunityEntity.getId()); if(null==customerAgencyEntity){ customerAgencyDao.insert(insertCommunityEntity); @@ -247,6 +257,8 @@ public class CustomerAgencyServiceImpl implements CustomerAgencyService { insertGrid.setManageDistrict(gridEntity.getGridName()); insertGrid.setTotalUser(NumConstant.ZERO); insertGrid.setPid(gridEntity.getParentAgencyId()); + insertGrid.setCreatedBy("APP_USER"); + insertGrid.setUpdatedBy("APP_USER"); if(StringUtils.isEmpty(parentCustomerEntity.getPids())){ insertGrid.setPids(insertGrid.getPid()); }else{ From ad9592dd863d7ef854d9e2023db194345606d406 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 7 Jul 2021 15:41:30 +0800 Subject: [PATCH 06/21] =?UTF-8?q?=E7=BD=91=E6=A0=BC=E5=91=98=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=B8=8A=E6=8A=A5=E6=8E=A5=E5=8F=A3=E5=87=BA=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/stats/form/GmUploadDataFormDTO.java | 7 +- .../dto/stats/form/GmUploadEventFormDTO.java | 10 +- .../epmet/controller/StatsUserController.java | 4 +- .../screen/ScreenCustomerAgencyDao.java | 8 ++ .../com/epmet/dao/stats/DataStatsDao.java | 45 +++++++ .../main/java/com/epmet/dao/user/UserDao.java | 13 +++ .../com/epmet/service/StatsUserService.java | 2 +- .../screen/ScreenCustomerAgencyService.java | 7 ++ .../impl/ScreenCustomerAgencyServiceImpl.java | 9 ++ .../service/impl/StatsUserServiceImpl.java | 110 ++++++++++++++++-- .../com/epmet/service/user/UserService.java | 13 +++ .../service/user/impl/UserServiceImpl.java | 19 +++ .../screen/ScreenCustomerAgencyDao.xml | 18 +++ .../resources/mapper/stats/DatsStatsDao.xml | 101 ++++++++++++++++ .../main/resources/mapper/user/UserDao.xml | 71 +++++++++++ 15 files changed, 417 insertions(+), 20 deletions(-) create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DataStatsDao.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DatsStatsDao.xml 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 7f6671dd83..34d9366054 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 @@ -3,6 +3,7 @@ package com.epmet.dto.stats.form; import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; +import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotEmpty; import java.io.Serializable; import java.math.BigDecimal; @@ -21,13 +22,15 @@ public class GmUploadDataFormDTO implements Serializable { */ 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 = AgencyProjectForm.class) + @NotEmpty(message = "数据集合对象不能为空",groups = UploadData.class) private List dataList; - public interface AgencyProjectForm extends CustomerClientShowGroup {} + public interface UploadData extends CustomerClientShowGroup {} @Data public static class DataList{ 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 56eb2c059c..13d689fc6a 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 @@ -3,9 +3,9 @@ package com.epmet.dto.stats.form; import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; +import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotEmpty; import java.io.Serializable; -import java.math.BigDecimal; import java.util.Date; import java.util.List; @@ -19,13 +19,15 @@ public class GmUploadEventFormDTO implements Serializable { //为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 = AgencyProjectForm.class) + @NotEmpty(message = "数据集合对象不能为空",groups = UploadEvent.class) private List dataList; - public interface AgencyProjectForm extends CustomerClientShowGroup {} + public interface UploadEvent extends CustomerClientShowGroup {} @Data public static class DataList{ @@ -56,7 +58,7 @@ public class GmUploadEventFormDTO implements Serializable { //事件数【立项项目数】 private Integer reportProjectCount = 0; //最新的巡查开始时间 - private String latestPatrolTime; + private Date latestPatrolTime; //最新的巡查状态 正在巡查中:patrolling;结束:end private String latestPatrolStatus = "end"; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java index c46c98f64c..c42929f386 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java @@ -44,17 +44,19 @@ public class StatsUserController { */ @PostMapping("gm-uploadevent") public Result gmUploadEvent(@RequestBody GmUploadEventFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GmUploadEventFormDTO.UploadEvent.class); statsUserService.gmUploadEvent(formDTO); return new Result(); } /** * @Param formDTO - * @Description 数据上报--网格员事件总数上报 + * @Description 数据上报--网格员数据分析上报 * @author sun */ @PostMapping("gm-uploaddata") public Result gmUploadData(@RequestBody GmUploadDataFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GmUploadDataFormDTO.UploadData.class); statsUserService.gmUploadData(formDTO); return new Result(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index ebe3ff3783..e6155e982e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java @@ -18,6 +18,7 @@ package com.epmet.dao.evaluationindex.screen; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.extract.form.PartyBaseInfoFormDTO; import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO; import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; @@ -236,4 +237,11 @@ public interface ScreenCustomerAgencyDao extends BaseDao selectByPid(@Param("customerId") String customerId, @Param("parentAgencyId")String parentAgencyId); List selectKcCommunity(String customerId); + + /** + * @Description 查询客户index库组织信息供数据封装使用 + * @author sun + */ + List selectByCustomerId(@Param("customerId") String customerId); + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DataStatsDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DataStatsDao.java new file mode 100644 index 0000000000..8572bf2616 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DataStatsDao.java @@ -0,0 +1,45 @@ +/** + * 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.dao.stats; + +import com.epmet.dto.stats.form.GmUploadDataFormDTO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @Author sun + * @Description 数据统计服务 + */ +@Mapper +public interface DataStatsDao { + + /** + * @Description 数据上报--网格员数据分析上报--按客户Id和dateId删除历史数据 + * @author sun + */ + int delGmUploadData(String customerId, String dateId); + + /** + * @Description 数据上报--网格员数据分析上报--批量新增或修改数据 + * @author sun + */ + int saveOrUpGmUploadData(@Param("list") List list); + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java index dabacfd7da..88f3483641 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java @@ -3,6 +3,7 @@ package com.epmet.dao.user; import com.epmet.dto.extract.form.GridHeartedFormDTO; import com.epmet.dto.extract.result.UserPartyResultDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; +import com.epmet.dto.stats.form.GmUploadEventFormDTO; import com.epmet.dto.user.result.CommonTotalAndIncCountResultDTO; import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity; import org.apache.ibatis.annotations.Mapper; @@ -159,5 +160,17 @@ public interface UserDao { * @date 2021/6/8 5:21 下午 */ List selectStaffInfo(@Param("list") List staffUserIdList); + + /** + * @Description 数据上报--网格员事件总数上报--按客户Id和dateId删除历史数据 + * @author sun + */ + int delGmUploadEvent(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 数据上报--网格员事件总数上报--批量新增或修改数据 + * @author sun + */ + int saveOrUpGmUploadEvent(@Param("list") List list); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsUserService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsUserService.java index 0e71cbd62f..f09cf007a0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsUserService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsUserService.java @@ -29,7 +29,7 @@ public interface StatsUserService { /** * @Param formDTO - * @Description 数据上报--网格员事件总数上报 + * @Description 数据上报--网格员数据分析上报 * @author sun */ void gmUploadData(GmUploadDataFormDTO formDTO); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java index 5c303466aa..5ded177ae0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java @@ -17,6 +17,7 @@ package com.epmet.service.evaluationindex.screen; +import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.extract.form.PartyBaseInfoFormDTO; import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO; import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; @@ -131,4 +132,10 @@ public interface ScreenCustomerAgencyService{ */ List selectKcCommunity(String customerId); + /** + * @Description 查询客户index库组织信息供数据封装使用 + * @author sun + */ + List getByCustomerId(String customerId); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java index 17b22866c6..16ba642e62 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java @@ -25,6 +25,7 @@ import com.epmet.constant.OrgSourceTypeConstant; import com.epmet.constant.ScreenConstant; import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao; import com.epmet.dao.evaluationindex.screen.ScreenCustomerGridDao; +import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.extract.form.PartyBaseInfoFormDTO; import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO; import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; @@ -294,5 +295,13 @@ public class ScreenCustomerAgencyServiceImpl implements ScreenCustomerAgencyServ return screenCustomerAgencyDao.selectKcCommunity(customerId); } + /** + * @Description 查询客户index库组织信息供数据封装使用 + * @author sun + */ + @Override + public List getByCustomerId(String customerId) { + return screenCustomerAgencyDao.selectByCustomerId(customerId); + } } \ No newline at end of file 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 e9155fcaad..ee68d5dbe7 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 @@ -5,18 +5,22 @@ import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.constant.NumConstant; 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.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.evaluationindex.screen.ScreenCustomerAgencyService; import com.epmet.service.stats.DimAgencyService; import com.epmet.service.stats.DimCustomerService; import com.epmet.service.stats.user.UserStatisticalService; import com.epmet.service.user.UserService; import com.epmet.util.DimIdGenerator; import com.epmet.util.ModuleConstant; +import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -27,6 +31,7 @@ import org.springframework.util.CollectionUtils; import java.util.Calendar; import java.util.Date; import java.util.List; +import java.util.concurrent.atomic.AtomicReference; /** @@ -51,6 +56,11 @@ public class StatsUserServiceImpl implements StatsUserService { @Autowired private UserStatisticalService userStatisticalService; + @Autowired + private ScreenCustomerAgencyService screenCustomerAgencyService; + @Autowired + private DataStatsDao dataStatsDao; + /** * @param formDTO 如果目标日期为空,则自动计算为T-1天 @@ -61,9 +71,9 @@ public class StatsUserServiceImpl implements StatsUserService { **/ @Override public void partition(StatsFormDTO formDTO) { - if(StringUtils.isBlank(formDTO.getDate())){ + if (StringUtils.isBlank(formDTO.getDate())) { //如果定时任务没有指定参数,默认数据更新至t-1,包含t-1这一天内的数据 - formDTO.setDate(DateUtils.getBeforeNDay(1,DateUtils.DATE_PATTERN)); + formDTO.setDate(DateUtils.getBeforeNDay(1, DateUtils.DATE_PATTERN)); } int pageNo = NumConstant.ONE; @@ -93,15 +103,15 @@ public class StatsUserServiceImpl implements StatsUserService { } /** - * @Description 生成用户统计数据 * @param customerId 客户Id - * @param date 目标日期 + * @param date 目标日期 * @return + * @Description 生成用户统计数据 * @author wangc * @date 2020.06.28 14:40 - **/ - void generate(String customerId,Date date){ - log.info("customerId:"+customerId+";date:"+DateUtils.format(date,DateUtils.DATE_TIME_PATTERN)); + **/ + void generate(String customerId, Date date) { + log.info("customerId:" + customerId + ";date:" + DateUtils.format(date, DateUtils.DATE_TIME_PATTERN)); //1.初始化时间参数 Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); @@ -113,14 +123,14 @@ public class StatsUserServiceImpl implements StatsUserService { //2.初始化时间维度{"dateId":"20210325","monthId":"202103","quarterId":"2021Q1","weekId":"2021W13","yearId":"2021"} DimIdGenerator.DimIdBean timeDimension = DimIdGenerator.getDimIdBean(null == date ? calendar.getTime() : date); - log.info("timeDimension:"+ JSON.toJSONString(timeDimension)); + log.info("timeDimension:" + JSON.toJSONString(timeDimension)); //3.初始化机关维度 - List agencies = dimAgencyService.getAllAgency(customerId); + List agencies = dimAgencyService.getAllAgency(customerId); //4.计算机关统计数据、生成唯一性统计数据 try { UserStatisticalData agencyData = userService.traverseAgencyUser(agencies, date, timeDimension); userStatisticalService.insertUniquely(agencyData); - }catch(Exception e){ + } catch (Exception e) { log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, ModuleConstant.EXCEPTION_DING_INTERCEPTOR_PREFIX_AGENCY_USER_STATISTICAL, customerId, new Date().toString(), e.getMessage())); } @@ -128,7 +138,7 @@ public class StatsUserServiceImpl implements StatsUserService { try { UserStatisticalData gridData = userService.traverseGridUser(agencies, date, timeDimension); userStatisticalService.insertUniquely(gridData); - }catch(Exception e){ + } catch (Exception e) { log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, ModuleConstant.EXCEPTION_DING_INTERCEPTOR_PREFIX_GRID_USER_STATISTICAL, customerId, new Date().toString(), e.getMessage())); } } @@ -140,16 +150,92 @@ public class StatsUserServiceImpl implements StatsUserService { */ @Override public void gmUploadEvent(GmUploadEventFormDTO formDTO) { + //1.判断是否批量删除历史数据 + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = userService.delGmUploadEvent(formDTO.getCustomerId(), formDTO.getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + + //2.查询当前客户index库组织信息供数据封装使用 + List agencyList = screenCustomerAgencyService.getByCustomerId(formDTO.getCustomerId()); + + //3.分批处理上传数据 + List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + //4.封装数据并执行 + p.forEach(m -> { + AtomicReference bl = new AtomicReference<>(false); + StringBuffer gridPids = new StringBuffer(""); + agencyList.forEach(ag -> { + if (m.getAgencyId().equals(ag.getId())) { + bl.set(true); + gridPids.append((StringUtils.isEmpty(ag.getPids()) || "0".equals(ag.getPids()) ? ag.getId() : ag.getPids().replaceAll(",", ":") + ":" + ag.getId())); + } + }); + if (bl.get()) { + m.setGridPids(gridPids.toString()); + m.setPatrolTotal(NumConstant.ZERO); + m.setTotalTime(NumConstant.ZERO); + m.setLatestPatrolStatus("end"); + } else { + log.warn(String.format("网格员事件总数上报,数据错误,根据agencyId未查询到组织信息,客户Id->%s,组织Id->%s", m.getCustomerId(), m.getAgencyId())); + } + }); + //批量新增或修改数据 + if (!CollectionUtils.isEmpty(p)) { + userService.saveOrUpGmUploadEvent(p); + } + }); } /** * @Param formDTO - * @Description 数据上报--网格员事件总数上报 + * @Description 数据上报--网格员数据分析上报 * @author sun */ @Override public void gmUploadData(GmUploadDataFormDTO formDTO) { + //1.判断是否批量删除历史数据 + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = dataStatsDao.delGmUploadData(formDTO.getCustomerId(), formDTO.getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + + //2.查询当前客户index库组织信息供数据封装使用 + List agencyList = screenCustomerAgencyService.getByCustomerId(formDTO.getCustomerId()); + + //3.分批处理上传数据 + List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + //4.封装数据并执行 + p.forEach(m -> { + AtomicReference bl = new AtomicReference<>(false); + StringBuffer pid = new StringBuffer(""); + StringBuffer pids = new StringBuffer(""); + agencyList.forEach(ag -> { + if (m.getAgencyId().equals(ag.getId())) { + bl.set(true); + pid.append(ag.getPid()); + pids.append((StringUtils.isEmpty(ag.getPids()) || "0".equals(ag.getPids()) ? ag.getId() : ag.getPids().replaceAll(",", ":") + ":" + ag.getId())); + } + }); + if (bl.get()) { + m.setPid(pid.toString()); + m.setPids(pids.toString()); + } else { + log.warn(String.format("网格员数据分析上报,数据错误,根据agencyId未查询到组织信息,客户Id->%s,组织Id->%s", m.getCustomerId(), m.getAgencyId())); + } + }); + //批量新增或修改数据 + if (!CollectionUtils.isEmpty(p)) { + dataStatsDao.saveOrUpGmUploadData(p); + } + }); } 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 ebc01ebdb3..f69bcb5165 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 @@ -4,6 +4,7 @@ import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.extract.form.GridHeartedFormDTO; import com.epmet.dto.org.result.OrgStaffDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; +import com.epmet.dto.stats.form.GmUploadEventFormDTO; import com.epmet.dto.stats.user.result.UserStatisticalData; import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity; import com.epmet.util.DimIdGenerator; @@ -94,4 +95,16 @@ public interface UserService { * @return com.epmet.dto.user.OrgGridManagerTotalDTO */ Map queryOrgGridManager(String customerId,List orgStaffDTOList); + + /** + * @Description 数据上报--网格员事件总数上报--按客户Id和dateId删除历史数据 + * @author sun + */ + int delGmUploadEvent(String customerId, String dateId); + + /** + * @Description 数据上报--网格员事件总数上报--批量新增或修改数据 + * @author sun + */ + void saveOrUpGmUploadEvent(List list); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java index 59897628e3..46a3bb2258 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java @@ -12,6 +12,7 @@ import com.epmet.dto.extract.form.GridHeartedFormDTO; import com.epmet.dto.extract.result.UserPartyResultDTO; import com.epmet.dto.org.result.OrgStaffDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; +import com.epmet.dto.stats.form.GmUploadEventFormDTO; import com.epmet.dto.stats.user.*; import com.epmet.dto.stats.user.result.UserStatisticalData; import com.epmet.dto.user.result.CommonTotalAndIncCountResultDTO; @@ -797,4 +798,22 @@ public class UserServiceImpl implements UserService { return resultMap; } + /** + * @Description 数据上报--网格员事件总数上报--按客户Id和dateId删除历史数据 + * @author sun + */ + @Override + public int delGmUploadEvent(String customerId, String dateId) { + return userDao.delGmUploadEvent(customerId, dateId); + } + + /** + * @Description 数据上报--网格员事件总数上报--批量新增或修改数据 + * @author sun + */ + @Override + public void saveOrUpGmUploadEvent(List list) { + userDao.saveOrUpGmUploadEvent(list); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml index 4640aeebe6..e313a60faf 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml @@ -485,4 +485,22 @@ AND CUSTOMER_ID = #{customerId} and level='community' + + + 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 new file mode 100644 index 0000000000..65ea939f02 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DatsStatsDao.xml @@ -0,0 +1,101 @@ + + + + + + + DELETE + FROM + fact_grid_member_statistics_daily + WHERE + customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + INSERT INTO fact_grid_member_statistics_daily + ( + id, + date_id, + month_id, + year_id, + customer_id, + agency_id, + grid_id, + pid, + pids, + staff_id, + staff_name, + project_count, + issue_to_project_count, + closed_issue_count, + project_response_count, + project_transfer_count, + project_closed_count, + project_incr, + issue_to_project_incr, + closed_issue_incr, + project_response_incr, + project_transfer_incr, + project_closed_incr, + del_flag, + revision, + created_by, + created_time, + updated_by, + updated_time + ) + VALUES + + ( + REPLACE(UUID(), '-', ''), + #{i.dateId}, + #{i.monthId}, + #{i.yearId}, + #{i.customerId}, + #{i.agencyId}, + #{i.gridId}, + #{i.pid}, + #{i.pids}, + #{i.staffId}, + #{i.staffName}, + #{i.projectCount}, + #{i.issueToProjectCount}, + #{i.closedIssueCount}, + #{i.projectResponseCount}, + #{i.projectTransferCount}, + #{i.projectClosedCount}, + #{i.projectIncr}, + #{i.issueToProjectIncr}, + #{i.closedIssueIncr}, + #{i.projectResponseIncr}, + #{i.projectTransferIncr}, + #{i.projectClosedIncr}, + 0, + 0, + 'BASE_REPORT', + NOW(), + 'BASE_REPORT', + NOW() + ) + + ON DUPLICATE KEY + UPDATE + project_count = values(project_count), + issue_to_project_count = values(issue_to_project_count), + closed_issue_count = values(closed_issue_count), + project_response_count = values(project_response_count), + project_transfer_count = values(project_transfer_count), + project_closed_count = values(project_closed_count), + project_incr = values(project_incr), + issue_to_project_incr = values(issue_to_project_incr), + closed_issue_incr = values(closed_issue_incr), + project_response_incr = values(project_response_incr), + project_transfer_incr = values(project_transfer_incr), + project_closed_incr = values(project_closed_incr), + updated_by = 'BASE_REPORT', + updated_time = NOW() + + + 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 acb6c9feb3..c235e69647 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 @@ -570,4 +570,75 @@ user_id = #{userId} + + + DELETE + FROM + stats_staff_patrol_record_daily + WHERE + customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + INSERT INTO stats_staff_patrol_record_daily + ( + id, + customer_id, + date_id, + week_id, + month_id, + quarter_id, + year_id, + grid_id, + agency_id, + grid_pids, + staff_id, + patrol_total, + total_time, + report_project_count, + latest_patrol_time, + latest_patrol_status, + del_flag, + revision, + created_by, + created_time, + updated_by, + updated_time + ) + VALUES + + ( + REPLACE(UUID(), '-', ''), + #{i.customerId}, + #{i.dateId}, + #{i.weekId}, + #{i.monthId}, + #{i.quarterId}, + #{i.yearId}, + #{i.gridId}, + #{i.agencyId}, + #{i.gridPids}, + #{i.staffId}, + #{i.patrolTotal}, + #{i.totalTime}, + #{i.reportProjectCount}, + #{i.latestPatrolTime}, + #{i.latestPatrolStatus}, + 0, + 0, + 'BASE_REPORT', + NOW(), + 'BASE_REPORT', + NOW() + ) + + ON DUPLICATE KEY + UPDATE + report_project_count = values(report_project_count), + updated_by = 'BASE_REPORT', + updated_time = NOW() + + From 6bd490d4f67f9983089317db5af3aaa2940f0ecb Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 8 Jul 2021 10:52:32 +0800 Subject: [PATCH 07/21] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E7=BD=91?= =?UTF-8?q?=E6=A0=BC=E5=91=98=E6=95=B0=E6=8D=AE=E7=BB=9F=E8=AE=A1=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=8E=92=E5=BA=8F=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/datastats/FactGridMemberStatisticsDailyDao.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/FactGridMemberStatisticsDailyDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/FactGridMemberStatisticsDailyDao.xml index 6795b4cd23..835e266dd8 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/FactGridMemberStatisticsDailyDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/FactGridMemberStatisticsDailyDao.xml @@ -98,7 +98,7 @@ and del_flag = 0 group by member.staff_id, member.grid_id - order by ${sort} desc + order by ${sort} desc, convert(member.staff_name using gbk) asc, member.GRID_ID SELECT * FROM customer_relation WHERE DEL_FLAG = 0 AND PARENT_CUSTOMER_ID = #{customerId} + + + \ 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 12/21] =?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 13/21] =?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 14/21] =?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), From 240d97705042a814c703c407521d1e78de7f603f Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 8 Jul 2021 16:45:19 +0800 Subject: [PATCH 15/21] =?UTF-8?q?=E7=93=9C=E7=9A=AE=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/service/impl/StatsUserServiceImpl.java | 2 -- 1 file changed, 2 deletions(-) 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 26ba03ca2e..041fcf74d4 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 @@ -155,7 +155,6 @@ public class StatsUserServiceImpl implements StatsUserService { * @author sun */ @Override - @Transactional(rollbackFor = Exception.class) public void gmUploadEvent(GmUploadEventFormDTO formDTO) { //1.数据上报只涉及数据库部分数据,其他数据都是计算出来的,所以不存在删除历史数据,有就更新没有就新增 String customerId = formDTO.getDataList().get(0).getCustomerId(); @@ -207,7 +206,6 @@ 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.判断是否批量删除历史数据 From b65b3e2aaa0c00ba81ad1451fd0d9a369d6a1b87 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 9 Jul 2021 14:34:09 +0800 Subject: [PATCH 16/21] =?UTF-8?q?=E7=BD=91=E6=A0=BC=E5=91=98=E5=B7=A1?= =?UTF-8?q?=E6=9F=A5=20=E9=80=82=E5=BA=94=20=E6=95=B0=E6=8D=AE=E8=9E=8D?= =?UTF-8?q?=E5=90=88=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../result/StatsStaffPatrolRecordDailyDTO.java | 10 ++++++++++ .../user/StatsStaffPatrolRecordDailyDao.java | 18 +++++++++++++++++- .../biz/impl/BizDataStatsServiceImpl.java | 3 +++ .../user/impl/StatsStaffPatrolServiceImpl.java | 2 +- .../user/StatsStaffPatrolRecordDailyDao.xml | 11 ++++++++++- 5 files changed, 41 insertions(+), 3 deletions(-) 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..64d3eb84e4 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/dao/user/StatsStaffPatrolRecordDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/StatsStaffPatrolRecordDailyDao.java index 1a25f9cfdf..42233f31d6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/StatsStaffPatrolRecordDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/StatsStaffPatrolRecordDailyDao.java @@ -35,7 +35,23 @@ import java.util.List; @Mapper public interface StatsStaffPatrolRecordDailyDao extends BaseDao { + /** + * desc: 请描述类的业务用途 + * + * @param insertList + * @return java.lang.Integer + * @author LiuJanJun + * @date 2021/7/9 1:57 下午 + */ Integer insertBatch(@Param("list") List insertList); - int delete(StaffPatrolStatsFormDTO formDTO); + /** + * desc: 删除内部数据 + * + * @param formDTO + * @return int + * @author LiuJanJun + * @date 2021/7/9 2:03 下午 + */ + int deleteInternal(StaffPatrolStatsFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/impl/BizDataStatsServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/impl/BizDataStatsServiceImpl.java index 29cca916f7..fbeb7a391f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/impl/BizDataStatsServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/impl/BizDataStatsServiceImpl.java @@ -227,6 +227,9 @@ public class BizDataStatsServiceImpl implements BizDataStatsService { record.setPatrolTotal(NumConstant.ZERO); record.setLatestPatrolStatus("end"); record.setReportProjectCount(NumConstant.ZERO); + + record.setSourceType("internal"); + record.setSourceCustomerId(record.getCustomerId()); //最后巡查时间 record.setLatestPatrolTime(null); if (recordDailyDTO != null) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/StatsStaffPatrolServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/StatsStaffPatrolServiceImpl.java index 0da9e3eea6..b07253b001 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/StatsStaffPatrolServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/StatsStaffPatrolServiceImpl.java @@ -32,7 +32,7 @@ public class StatsStaffPatrolServiceImpl implements StatsStaffPatrolService { @Override public Integer delAndInsertBatch(StaffPatrolStatsFormDTO formDTO, List insertList) { - int delete = statsStaffPatrolRecordDailyDao.delete(formDTO); + int delete = statsStaffPatrolRecordDailyDao.deleteInternal(formDTO); log.debug("delAndInsertBatch delete:{},param:{}", delete, JSON.toJSONString(formDTO)); return statsStaffPatrolRecordDailyDao.insertBatch(insertList); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/StatsStaffPatrolRecordDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/StatsStaffPatrolRecordDailyDao.xml index d3ea3d3f9a..3f6cda5d85 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/StatsStaffPatrolRecordDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/StatsStaffPatrolRecordDailyDao.xml @@ -6,7 +6,9 @@ insert into stats_staff_patrol_record_daily ( ID, + SOURCE_TYPE, CUSTOMER_ID, + SOURCE_CUSTOMER_ID, DATE_ID, WEEK_ID, MONTH_ID, @@ -31,7 +33,9 @@ ( (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.sourceType}, #{item.customerId}, + #{item.sourceCustomerId}, #{item.dateId}, #{item.weekId}, #{item.monthId}, @@ -54,11 +58,16 @@ now() ) + ON DUPLICATE KEY UPDATE + PATROL_TOTAL = values(PATROL_TOTAL), + TOTAL_TIME = values(TOTAL_TIME), + UPDATED_BY = VALUES(UPDATED_BY) - + DELETE FROM stats_staff_patrol_record_daily WHERE CUSTOMER_ID = #{customerId} AND DATE_ID = #{dateId} + AND SOURCE_TYPE = 'internal' AND GRID_ID = #{gridId} From 7024d6dd204bdbc904980d13d383d3ed568cb7aa Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 9 Jul 2021 14:50:13 +0800 Subject: [PATCH 17/21] =?UTF-8?q?=E7=BD=91=E6=A0=BC=E5=91=98=E5=B7=A1?= =?UTF-8?q?=E6=9F=A5=20=E9=80=82=E5=BA=94=20=E6=95=B0=E6=8D=AE=E8=9E=8D?= =?UTF-8?q?=E5=90=88=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/user/result/StatsStaffPatrolRecordDailyDTO.java | 5 ----- 1 file changed, 5 deletions(-) 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 2d3001d3a6..64d3eb84e4 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 @@ -54,11 +54,6 @@ public class StatsStaffPatrolRecordDailyDTO implements Serializable { */ private String sourceCustomerId; - /** - * 数据来源客户Id - */ - private String sourceCustomerId; - /** * 统计日期 关联日期dim表 */ From 143b0dd7503a08ba8127ee3a612f59866372a747 Mon Sep 17 00:00:00 2001 From: wxz Date: Mon, 12 Jul 2021 10:05:57 +0800 Subject: [PATCH 18/21] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E5=AF=B9?= =?UTF-8?q?=E5=A4=96=E5=BC=80=E6=94=BE=E5=BA=94=E7=94=A8api=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-gateway/src/main/resources/bootstrap.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index 4259540d53..bc6bb866cd 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -481,6 +481,9 @@ epmet: - /epmetuser/customerstaff/customerlist - /message/template/** - /data/aggregator/project/projectdistribution + - /data/aggregator/epmetuser/open-staffdetail + - /data/stats/statsuser/gm-uploadevent + - /data/stats/statsuser/gm-uploaddata # 对外开放接口认证白名单 externalAuthUrlsWhiteList: From 65edd3e7264625b6a121b27d328c7fa3ac1d75a1 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 12 Jul 2021 17:07:14 +0800 Subject: [PATCH 19/21] =?UTF-8?q?=E7=BD=91=E6=A0=BC=E5=91=98=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=B8=8A=E6=8A=A5bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/service/impl/StatsUserServiceImpl.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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 041fcf74d4..4117b32b7b 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 @@ -34,6 +34,7 @@ import org.springframework.util.CollectionUtils; import java.util.Calendar; import java.util.Date; +import java.util.Iterator; import java.util.List; import java.util.concurrent.atomic.AtomicReference; @@ -170,9 +171,12 @@ public class StatsUserServiceImpl implements StatsUserService { //3.分批处理上传数据 List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); - partition.forEach(p -> { + for (int i = 0; i < partition.size(); i++) { + List p = partition.get(i); //4.封装数据并执行 - p.forEach(m -> { + Iterator iterator = p.iterator(); + while (iterator.hasNext()) { + GmUploadEventFormDTO.DataList m = iterator.next(); AtomicReference bl = new AtomicReference<>(false); StringBuffer gridPids = new StringBuffer(""); agencyList.forEach(ag -> { @@ -190,13 +194,14 @@ public class StatsUserServiceImpl implements StatsUserService { m.setLatestPatrolStatus("end"); } else { log.warn(String.format("网格员事件总数上报,数据错误,根据agencyId未查询到组织信息,客户Id->%s,组织Id->%s", m.getCustomerId(), m.getAgencyId())); + iterator.remove(); } - }); + } //批量新增或修改数据 if (!CollectionUtils.isEmpty(p)) { userService.saveOrUpGmUploadEvent(p); } - }); + } } From 5cc98b1a6aabe7e1686a522aeea63cf7eeafbdc6 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 12 Jul 2021 17:28:26 +0800 Subject: [PATCH 20/21] =?UTF-8?q?=E4=B8=A4=E4=B8=AA=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E9=83=BD=E8=A6=81=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/service/impl/StatsUserServiceImpl.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 4117b32b7b..291cafb7eb 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 @@ -232,9 +232,12 @@ public class StatsUserServiceImpl implements StatsUserService { //3.分批处理上传数据 List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); - partition.forEach(p -> { + for (int i = 0; i < partition.size(); i++) { + List p = partition.get(i); //4.封装数据并执行 - p.forEach(m -> { + Iterator iterator = p.iterator(); + while (iterator.hasNext()) { + GmUploadDataFormDTO.DataList m = iterator.next(); AtomicReference bl = new AtomicReference<>(false); StringBuffer pid = new StringBuffer(""); StringBuffer pids = new StringBuffer(""); @@ -252,13 +255,10 @@ public class StatsUserServiceImpl implements StatsUserService { m.setPids(pids.toString()); } else { log.warn(String.format("网格员数据分析上报,数据错误,根据agencyId未查询到组织信息,客户Id->%s,组织Id->%s", m.getCustomerId(), m.getAgencyId())); + iterator.remove(); } - }); - //批量新增或修改数据 - if (!CollectionUtils.isEmpty(p)) { - dataStatsDao.saveOrUpGmUploadData(p); } - }); + } } From 760e0bed709246628c94db087bee8dc1cfd44cb5 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 13 Jul 2021 11:09:50 +0800 Subject: [PATCH 21/21] =?UTF-8?q?=E8=AF=AF=E5=88=A0=E4=BB=A3=E7=A0=81=20?= =?UTF-8?q?=20=E4=BA=BA=E6=89=8D=E7=9A=84=E4=B8=8D=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/service/impl/StatsUserServiceImpl.java | 4 ++++ 1 file changed, 4 insertions(+) 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 291cafb7eb..dc082b44ca 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 @@ -258,6 +258,10 @@ public class StatsUserServiceImpl implements StatsUserService { iterator.remove(); } } + //批量新增或修改数据 + if (!CollectionUtils.isEmpty(p)) { + dataStatsDao.saveOrUpGmUploadData(p); + } } }