Browse Source

Merge remote-tracking branch 'origin/dev_gridmember_fusion' into develop

# Conflicts:
#	epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java
#	epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java
#	epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java
#	epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
#	epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
#	epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
#	epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java
#	epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java
#	epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml
master
yinzuomei 4 years ago
parent
commit
c4279be3dc
  1. 29
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/OpenStaffDetailFormDTO.java
  2. 28
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/OpenStaffDetailResultDTO.java
  3. 13
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java
  4. 9
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java
  5. 6
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffAgencyDao.java
  6. 8
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java
  7. 36
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java
  8. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
  9. 10
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  10. 12
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml
  11. 14
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml
  12. 21
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/SyncOrgInfoFormDTO.java
  13. 81
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadDataFormDTO.java
  14. 65
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadEventFormDTO.java
  15. 22
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  16. 27
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java
  17. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  18. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java
  19. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java
  20. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerAgencyEntity.java
  21. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerGridEntity.java
  22. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsUserService.java
  23. 23
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java
  24. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java
  25. 27
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java
  26. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java
  27. 24
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java
  28. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java
  29. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java
  30. 183
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java
  31. 17
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java
  32. 33
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml
  33. 15
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml
  34. 4
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml
  35. 15
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml
  36. 2
      epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.5__add_sync_flag.sql

29
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 {}
}

28
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 = "";
}

13
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java

@ -8,9 +8,11 @@ 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.GridMemberStatsFormDTO;
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.PersonalPatrolListResultDTO;
@ -186,5 +188,16 @@ public class EpmetUserController {
maps.add(projectClosedCountMap);
return maps;
}
/**
* @Param formDTO
* @Description 对外接口--查询工作人员基本信息
* @author sun
*/
@PostMapping("open-staffdetail")
public Result<OpenStaffDetailResultDTO> openStaffDetail(@RequestBody OpenStaffDetailFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, OpenStaffDetailFormDTO.Open.class);
return new Result<OpenStaffDetailResultDTO>().ok(epmetUserService.openStaffDetail(formDTO));
}
}

9
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<CustomerStaffEntity> {
/**
* @Description 按staffId查询基础信息
* @author sun
*/
CustomerStaffDTO selectByMobile(@Param("customerId") String customerId, @Param("mobile") String mobile);
}

6
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<CustomerStaffAgencyEntit
**/
CustomerStaffAgencyDTO selectByStaffId(@Param("userId") String userId);
/**
* @Description 查询工作人员所属组织信息
* @author sun
*/
CustomerAgencyDTO selectAgencyByStaffId(@Param("customerId") String customerId, @Param("staffId") String staffId);
}

8
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java

@ -1,5 +1,6 @@
package com.epmet.dataaggre.service.epmetuser;
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;
@ -73,4 +74,11 @@ public interface EpmetUserService {
* @author sun
*/
List<PersonalPatrolListResultDTO> personalPatrolList(String staffId);
/**
* @Param formDTO
* @Description 对外接口--查询工作人员基本信息
* @author sun
*/
OpenStaffDetailResultDTO openStaffDetail(OpenStaffDetailFormDTO formDTO);
}

36
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;
@ -51,6 +55,8 @@ public class EpmetUserServiceImpl implements EpmetUserService {
private StaffPatrolRecordService staffPatrolRecordService;
@Resource
private StaffRoleDao staffRoleDao;
@Resource
private CustomerStaffDao customerStaffDao;
/**
* @Description 根据UserIds查询
@ -329,5 +335,35 @@ public class EpmetUserServiceImpl implements EpmetUserService {
return resultList;
}
/**
* @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;
}
}

7
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.*;
@ -65,4 +66,10 @@ public interface GovOrgService {
* @author sun
*/
List<CustomerGridDTO> getGridInfoList(List<String> gridIds, String staffId);
/**
* @Description 查询工作人员所属组织信息
* @author sun
*/
CustomerAgencyDTO gridByAgencyId(String customerId, String staffId);
}

10
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;
@ -275,4 +276,13 @@ public class GovOrgServiceImpl implements GovOrgService {
return list;
}
/**
* @Description 查询工作人员所属组织信息
* @author sun
*/
@Override
public CustomerAgencyDTO gridByAgencyId(String customerId, String staffId) {
return customerStaffAgencyDao.selectAgencyByStaffId(customerId, staffId);
}
}

12
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml

@ -3,4 +3,16 @@
<mapper namespace="com.epmet.dataaggre.dao.epmetuser.CustomerStaffDao">
<select id="selectByMobile" resultType="com.epmet.dataaggre.dto.epmetuser.CustomerStaffDTO">
SELECT
*
FROM
customer_staff
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND mobile = #{mobile}
LIMIT 1
</select>
</mapper>

14
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml

@ -16,4 +16,18 @@
AND user_id = #{userId}
</select>
<select id="selectAgencyByStaffId" resultType="com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO">
SELECT
ca.id,
ca.all_parent_name
FROM
customer_staff_agency csa
INNER JOIN customer_agency ca ON csa.agency_id = ca.id
WHERE
csa.del_flag = '0'
AND ca.del_flag = '0'
AND csa.customer_id = #{customerId}
AND csa.user_id = #{staffId}
</select>
</mapper>

21
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;
}

81
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> 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;
}
}

65
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> 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";
}
}

22
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 com.epmet.service.stats.DimCustomerService;
@ -965,4 +969,22 @@ public class DemoController {
return new Result();
}
@Autowired
private CustomerAgencyService customerAgencyService;
@Autowired
private CustomerGridService customerGridService;
/**
* 将孔村榆山锦水3个街道的网格组织插入到gov-org库的customer_gridcustomer_agency
*
* @param formDTO
* @return Result<XxxxDO>
*/
@PostMapping("syncorginfo")
public Result syncOrgInfo(@RequestBody SyncOrgInfoFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
customerAgencyService.sysAgencyInfo(formDTO.getFromCustomerId(), formDTO.getToCustomerId());
return new Result();
}
}

27
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();
}
}

7
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<ScreenCustomerAgencyEnt
* @date 2021/5/24 9:42 上午
*/
ScreenCustomerAgencyEntity selectTopAgency(@Param("customerId")String customerId);
ScreenCustomerAgencyEntity selectRootAgency(String customerId);
List<ScreenCustomerAgencyEntity> selectByPid(@Param("customerId") String customerId, @Param("parentAgencyId")String parentAgencyId);
List<ScreenCustomerAgencyEntity> selectKcCommunity(String customerId);
}

2
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<ScreenCustomerGridEntity>
* @date 2021/6/10 10:45 上午
*/
List<ScreenProjectGridDailyDTO> selectGridInfoList(@Param("customerId") String customerId, @Param("pids") String pids);
List<ScreenCustomerGridEntity> selectEntityByAgencyId(@Param("customerId") String customerId, @Param("parentAgencyId") String parentAgencyId);
}

2
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<CustomerAgencyEntity> {
* @return com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity
*/
CustomerAgencyEntity selectByDeptId(String deptId);
CustomerAgencyEntity selecByAreaCode(@Param("customerId")String customerId, @Param("areaCode")String areaCode);
}

5
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;
}

5
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;
}

16
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);
}

23
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<ScreenCustomerAgencyEntity> getByPid(String customerId, String parentAgencyId);
/**
* 查询出孔村的社区
*
* @param customerId
* @return com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity
*/
List<ScreenCustomerAgencyEntity> selectKcCommunity(String customerId);
}

2
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<ScreenCustomerGri
List<ScreenProjectGridDailyDTO> selectGridInfoByCustomerId(String customerId);
List<ScreenProjectGridDailyDTO> selectGridInfoList(String customerId, String pids);
List<ScreenCustomerGridEntity> selectEntityByAgencyId(String customerId, String parentAgencyId);
}

27
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java

@ -275,5 +275,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<ScreenCustomerAgencyEntity> getByPid(String customerId, String parentAgencyId) {
return screenCustomerAgencyDao.selectByPid(customerId,parentAgencyId);
}
/**
* 查询出孔村的社区
*
* @param customerId
* @return com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity
*/
@Override
public List<ScreenCustomerAgencyEntity> selectKcCommunity(String customerId) {
return screenCustomerAgencyDao.selectKcCommunity(customerId);
}
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java

@ -211,4 +211,9 @@ public class ScreenCustomerGridServiceImpl extends BaseServiceImpl<ScreenCustome
public List<ScreenProjectGridDailyDTO> selectGridInfoList(String customerId, String pids) {
return baseDao.selectGridInfoList(customerId,pids);
}
@Override
public List<ScreenCustomerGridEntity> selectEntityByAgencyId(String customerId, String parentAgencyId) {
return baseDao.selectEntityByAgencyId(customerId,parentAgencyId);
}
}

24
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) {
}
}

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java

@ -49,4 +49,14 @@ public interface CustomerAgencyService {
*/
CustomerAgencyEntity getAgencyByDeptId(String deptId);
/**
* 将孔村榆山锦水3个街道的组织插入到gov-org库的customer_agency
*
* @param fromCustomerId
* @param toCustomerId
* @return Result<XxxxDO>
*/
void sysAgencyInfo(String fromCustomerId, String toCustomerId);
}

3
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;
@ -10,7 +11,7 @@ import com.epmet.entity.org.CustomerGridEntity;
import java.util.Date;
import java.util.List;
public interface CustomerGridService {
public interface CustomerGridService extends BaseService<CustomerGridEntity> {
/**
* 根据创建时间截取时间段内的网格
* @param start

183
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<CustomerAgencyEntity> listAgenciesByCreateTime(Date statsStartTime, Date statsEndTime) {
@ -103,4 +118,172 @@ public class CustomerAgencyServiceImpl implements CustomerAgencyService {
resultList.addAll(gridStaffIds);
return resultList;
}
@Override
public List<CustomerAgencyEntity> queryAgencyListByCustomerId(String customerId) {
return customerAgencyDao.queryAgencyListByCustomerId(customerId);
}
/**
* 根据组织id查询基本信息
*
* @param agencyId
* @return com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity
*/
@Override
public CustomerAgencyEntity getAgencyById(String agencyId) {
return customerAgencyDao.selectById(agencyId);
}
/**
* 查询部门所属组织信息
*
* @param deptId
* @return com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity
*/
@Override
public CustomerAgencyEntity getAgencyByDeptId(String deptId) {
return customerAgencyDao.selectByDeptId(deptId);
}
/**
* 将孔村榆山锦水3个街道的组织插入到gov-org库的customer_agency
*
* @param fromCustomerId
* @param toCustomerId
* @return Result<XxxxDO>
*/
@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<ScreenCustomerAgencyEntity> 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<ScreenCustomerAgencyEntity> 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<ScreenCustomerGridEntity> 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);
}
}
}
}

17
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;
@ -10,7 +11,6 @@ import com.epmet.dto.org.CustomerStaffGridDTO;
import com.epmet.dto.org.GridInfoDTO;
import com.epmet.entity.org.CustomerGridEntity;
import com.epmet.service.org.CustomerGridService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
@ -18,14 +18,11 @@ import java.util.List;
@Service
@DataSource(DataSourceConstant.GOV_ORG)
public class CustomerGridServiceImpl implements CustomerGridService {
@Autowired
private CustomerGridDao customerGridDao;
public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, CustomerGridEntity> implements CustomerGridService {
@Override
public List<CustomerGridEntity> listGridsByCreateTime(Date start, Date end) {
return customerGridDao.listGridsByCreateTime(start, end);
return baseDao.listGridsByCreateTime(start, end);
}
/**
@ -35,7 +32,7 @@ public class CustomerGridServiceImpl implements CustomerGridService {
*/
@Override
public List<AgencyGridTotalCountResultDTO> selectAgencyGridTotalCount(List<AgencyDTO> community, String dateId) {
return customerGridDao.selectAgencyGridTotalCount(community,dateId);
return baseDao.selectAgencyGridTotalCount(community,dateId);
}
/**
@ -46,12 +43,12 @@ public class CustomerGridServiceImpl implements CustomerGridService {
*/
@Override
public List<GridIdListByCustomerResultDTO> getCustomerGridIdList(String customerId, String dateId) {
return customerGridDao.getCustomerGridIdList(customerId, dateId);
return baseDao.getCustomerGridIdList(customerId, dateId);
}
@Override
public List<CustomerGridEntity> listUpdatedGridsByUpdateTime(Date lastInitTime, Date now) {
return customerGridDao.listUpdatedGridsByUpdateTime(lastInitTime, now);
return baseDao.listUpdatedGridsByUpdateTime(lastInitTime, now);
}
/**
@ -63,7 +60,7 @@ public class CustomerGridServiceImpl implements CustomerGridService {
**/
@Override
public List<GridInfoDTO> queryGridInfoList(String customerId) {
return customerGridDao.selectListGridInfo(customerId);
return baseDao.selectListGridInfo(customerId);
}
/**

33
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml

@ -453,4 +453,37 @@
AND CUSTOMER_ID = #{customerId}
</select>
<select id="selectRootAgency" parameterType="java.lang.String" resultType="com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity">
SELECT
*
FROM
screen_customer_agency
WHERE
DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId}
and pid='0'
</select>
<select id="selectByPid" parameterType="map" resultType="com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity">
SELECT
*
FROM
screen_customer_agency
WHERE
DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId}
and pid=#{parentAgencyId}
</select>
<select id="selectKcCommunity" parameterType="java.lang.String" resultType="com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity">
SELECT
*
FROM
screen_customer_agency
WHERE
DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId}
and level='community'
</select>
</mapper>

15
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},'%')
</select>
<select id="selectEntityByAgencyId" parameterType="map" resultType="com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity">
SELECT
*
FROM
screen_customer_grid scg
WHERE
scg.DEL_FLAG = '0'
<if test="customerId != null and customerId!= ''">
AND scg.CUSTOMER_ID = #{customerId}
</if>
<if test="parentAgencyId != null and parentAgencyId!= ''">
AND scg.PARENT_AGENCY_ID = #{parentAgencyId}
</if>
</select>
</mapper>

4
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml

@ -9,6 +9,7 @@
FROM customer_grid
<where>
DEL_FLAG = 0
AND SYNC_FLAG='1'
<if test="start != null">
AND CREATED_TIME >= #{start}
</if>
@ -65,7 +66,8 @@
pid,
pids
FROM customer_grid
WHERE UPDATED_TIME >= #{startTime}
WHERE SYNC_FLAG='1'
AND UPDATED_TIME >= #{startTime}
AND UPDATED_TIME <![CDATA[<]]> #{endTime}
</select>

15
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml

@ -16,6 +16,7 @@
FROM customer_agency
<where>
DEL_FLAG = 0
AND SYNC_FLAG='1'
<if test="statsStartTime != null">
AND CREATED_TIME >= #{statsStartTime}
</if>
@ -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 <![CDATA[<=]]> #{endTime}
</select>
@ -191,4 +193,15 @@
AND cd.DEL_FLAG = '0'
)
</select>
<select id="selecByAreaCode" parameterType="map" resultType="com.epmet.entity.org.CustomerAgencyEntity">
SELECT
*
FROM
customer_agency ca
WHERE
ca.DEL_FLAG = '0'
AND ca.CUSTOMER_ID = #{customerId}
AND ca.AREA_CODE = #{areaCode}
</select>
</mapper>

2
epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.5__add_sync_flag.sql

@ -0,0 +1,2 @@
alter table customer_agency 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;
Loading…
Cancel
Save