Browse Source

Merge branches 'dev_pingyin_7_22' and 'pingyin_master' of http://git.elinkit.com.cn:7070/r/epmet-cloud into pingyin_master

master
wangxianzhang 3 years ago
parent
commit
fba5215eed
  1. 7
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/EventInfoFormDTO.java
  2. 10
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/CustomerAgencyDTO.java
  3. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
  4. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java
  5. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DataReportingController.java
  6. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java
  7. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/DataReportingService.java
  8. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java
  9. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java
  10. 64
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java
  11. 74
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml
  12. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml
  13. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml
  14. 2
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
  15. 2
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
  16. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java
  17. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffGridService.java
  18. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffGridServiceImpl.java
  19. 2
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml
  20. 38
      epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/ExractGridInfoPingYinFormDTO.java
  21. 17
      epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/GridStaffInfoFormDTO.java
  22. 18
      epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/HistoryDataSyncFormDTO.java
  23. 3
      epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/UpsertPatrolRecordForm.java
  24. 25
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/BaseGridDailyworkController.java
  25. 34
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/EventreportPingyinController.java
  26. 39
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/GridInfoPingyinController.java
  27. 17
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/GridstaffInfoPingyinController.java
  28. 11
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/BaseGridDailyworkDao.java
  29. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/EventreportPingyinDao.java
  30. 17
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridInfoPingyinDao.java
  31. 3
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridstaffInfoPingyinDao.java
  32. 4
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridstaffWorkInfoPingyinDao.java
  33. 19
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/BaseGridDailyworkEntity.java
  34. 9
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/GridstaffWorkInfoPingyinEntity.java
  35. 30
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataOrgChangeEventListener.java
  36. 3
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataPatrolChangeEventListener.java
  37. 5
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataProjectChangeEventListener.java
  38. 17
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/BaseGridDailyworkService.java
  39. 9
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/EventreportPingyinService.java
  40. 15
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/GridInfoPingyinService.java
  41. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/GridstaffInfoPingyinService.java
  42. 4
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/GridstaffWorkInfoPingyinService.java
  43. 155
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java
  44. 138
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java
  45. 164
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java
  46. 73
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffInfoPingyinServiceImpl.java
  47. 6
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffWorkInfoPingyinServiceImpl.java
  48. 43
      epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/BaseGridDailyworkDao.xml
  49. 3
      epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/EventreportPingyinDao.xml
  50. 21
      epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridInfoPingyinDao.xml
  51. 33
      epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridstaffInfoPingyinDao.xml
  52. 3
      epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridstaffWorkInfoPingyinDao.xml
  53. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolRoutineWorkResult.java
  54. 3
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  55. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  56. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/PatrolRoutineWorkController.java

7
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/EventInfoFormDTO.java

@ -20,4 +20,11 @@ public class EventInfoFormDTO extends PageFormDTO implements Serializable {
* 操作类型新增:add 修改删除:edit
*/
private String type;
/**
* 是否初始化, 通常用于初期初始化数据由自己控制
* 0不初始化有则更新没有则新增
* 1完全初始化删除全部数据
* 2在完全初始化之后由于eventreport_pingyin表没有客户ID初始化其他客户的数据时候可以设2直接新增
*/
private String initFlag = "0";
}

10
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/CustomerAgencyDTO.java

@ -147,4 +147,14 @@ public class CustomerAgencyDTO implements Serializable {
* 社区
*/
private String community;
/**
* 中心位置经度
*/
private String longitude;
/**
* 中心位置纬度
*/
private String latitude;
}

5
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java

@ -36,7 +36,7 @@ import java.util.List;
* @author: jianjun liu
*/
//url="http://localhost:8108"
//@FeignClient(name = ServiceConstant.DATA_STATISTICAL_SERVER, fallback = DataStatisticalOpenFeignClientFallBack.class, url = "http://localhost:6666")
// @FeignClient(name = ServiceConstant.DATA_STATISTICAL_SERVER, fallbackFactory = DataStatisticalOpenFeignClientFallBackFactory.class, url = "http://localhost:8108")
@FeignClient(name = ServiceConstant.DATA_STATISTICAL_SERVER, fallbackFactory = DataStatisticalOpenFeignClientFallBackFactory.class)
public interface DataStatisticalOpenFeignClient {
@ -341,7 +341,8 @@ public interface DataStatisticalOpenFeignClient {
*/
@PostMapping("/data/stats/datareporting/eventinfo")
Result<List<EventInfoResultDTO>> getEventInfo(@RequestBody EventInfoFormDTO formDTO);
@PostMapping("/data/stats/datareporting/eventinfoV2")
Result<List<EventInfoResultDTO>> getEventInfoV2(@RequestBody EventInfoFormDTO formDTO);
/**
* wangxianzhang
*

5
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java

@ -333,6 +333,11 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "getEventInfo", formDTO);
}
@Override
public Result<List<EventInfoResultDTO>> getEventInfoV2(EventInfoFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "getEventInfoV2", formDTO);
}
@Override
public Result statsVolunteerDemandServicesDaily(String customerId) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "statsVolunteerDemandServicesDaily", customerId);

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DataReportingController.java

@ -102,5 +102,8 @@ public class DataReportingController {
public Result<List<EventInfoResultDTO>> getEventInfo(@RequestBody(required = false) EventInfoFormDTO formDTO) {
return new Result<List<EventInfoResultDTO>>().ok(dataReportingService.getEventInfo(formDTO));
}
@PostMapping("eventinfoV2")
public Result<List<EventInfoResultDTO>> getEventInfoV2(@RequestBody(required = false) EventInfoFormDTO formDTO) {
return new Result<List<EventInfoResultDTO>>().ok(dataReportingService.getEventInfoV2(formDTO));
}
}

1
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java

@ -72,6 +72,7 @@ public interface ScreenProjectDataDao extends BaseDao<ScreenProjectDataEntity> {
int updateProjectSatisfactionScore(@Param("projectId")String projectId, @Param("score")BigDecimal score);
List<ScreenProjectDataDTO> selectProjectList(@Param("customerId") String customerId, @Param("projectIds") List<String> projectIds);
List<ScreenProjectDataDTO> selectProjectListV2(@Param("customerId") String customerId, @Param("projectIds") List<String> projectIds);
/**
* @Description 查询网格下的项目分类

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/DataReportingService.java

@ -69,4 +69,13 @@ public interface DataReportingService {
*/
List<EventInfoResultDTO> getEventInfo(EventInfoFormDTO formDTO);
/**
* 事件上报
* @Param formDTO
* @Return {@link List<EventInfoResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/15 14:10
*/
List<EventInfoResultDTO> getEventInfoV2(EventInfoFormDTO formDTO);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java

@ -139,7 +139,7 @@ public interface ScreenProjectDataService extends BaseService<ScreenProjectDataE
* @Date 2021/10/15 14:22
*/
List<ScreenProjectDataDTO> getProjectList(String customerId, List<String> projectId, Integer pageNo, Integer pageSize);
List<ScreenProjectDataDTO> getProjectListV2(String customerId, List<String> projectId, Integer pageNo, Integer pageSize);
/**
* 项目变更MQ
* @Param msg

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

@ -309,6 +309,11 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl<ScreenProjectD
PageHelper.startPage(pageNo, pageSize, false);
return baseDao.selectProjectList(customerId, projectId);
}
@Override
public List<ScreenProjectDataDTO> getProjectListV2(String customerId, List<String> projectId, Integer pageNo, Integer pageSize) {
PageHelper.startPage(pageNo, pageSize, false);
return baseDao.selectProjectListV2(customerId, projectId);
}
/**
* @Description 项目变更MQ

64
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java

@ -201,12 +201,72 @@ public class DataReportingServiceImpl implements DataReportingService {
return list.stream().collect(collectingAndThen(toCollection(() -> new TreeSet<>(Comparator.comparing(EventInfoResultDTO::getId))), ArrayList::new));
}
/**
* 事件上报
*
* @param formDTO
* @Param formDTO
* @Return {@link List<EventInfoResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/15 14:10
*/
@Override
public List<EventInfoResultDTO> getEventInfoV2(EventInfoFormDTO formDTO) {
List<EventInfoResultDTO> list;
//根据入参,获取项目
long start = System.currentTimeMillis();
List<ScreenProjectDataDTO> projectList = screenProjectDataService.getProjectListV2(formDTO.getCustomerId(), formDTO.getProjectId(), formDTO.getPageNo(), formDTO.getPageSize());
log.info("事件上报-查询项目列表耗时:{}ms",System.currentTimeMillis()-start);
//项目列表为空,返回空数组
if(CollectionUtils.isEmpty(projectList)) {
return Collections.emptyList();
}
start = System.currentTimeMillis();
Map<String, CustomerProjectCategoryDictEntity> epmetCodeMap = new HashMap<>();
Result<String> parentCustomer = operCrmOpenFeignClient.getExternalAndParentCustomerId(formDTO.getCustomerId());
if (StringUtils.isNotBlank(parentCustomer.getData())) {
epmetCodeMap = customerProjectCategoryDictService.getByCategoryCodeMap(parentCustomer.getData());
}
Map<String, CustomerProjectCategoryDictEntity> codeMap = customerProjectCategoryDictService.getByCategoryCodeMap(formDTO.getCustomerId());
//项目ID不为空时,因为只有一条,可以直接处理
Map<String, CustomerProjectCategoryDictEntity> finalEpmetCodeMap = epmetCodeMap;
if (CollectionUtils.isNotEmpty(formDTO.getProjectId())) {
list = projectList.stream().map(project -> {
EventInfoResultDTO dto = getEventInfoResultDTO(project, finalEpmetCodeMap, codeMap);
ScreenCustomerGridDTO grid = screenCustomerGridService.getGridById(project.getOrgId());
dto.setOrgId(project.getOrgId());
if (null != grid) {
dto.setOrgCode(grid.getCode());
dto.setOrgName(grid.getGridName());
}
return dto;
}).collect(Collectors.toList());
} else {
//项目ID不为空时,提前取出客户下的组织和网格
Map<String, ScreenCustomerAgencyEntity> agencyMap = screenCustomerAgencyService.getAgencyList(formDTO.getCustomerId());
Map<String, ScreenCustomerGridDTO> gridMap = screenCustomerGridService.getGridList(formDTO.getCustomerId());
list = projectList.stream().map(project -> {
EventInfoResultDTO dto = getEventInfoResultDTO(project, finalEpmetCodeMap, codeMap);
ScreenCustomerGridDTO grid = gridMap.get(project.getOrgId());
dto.setOrgId(project.getOrgId());
if (null != grid) {
dto.setOrgCode(grid.getCode());
dto.setOrgName(grid.getGridName());
}
return dto;
}).collect(Collectors.toList());
}
log.info("事件上报-组装数据耗时:{}ms",System.currentTimeMillis()-start);
return list.stream().collect(collectingAndThen(toCollection(() -> new TreeSet<>(Comparator.comparing(EventInfoResultDTO::getId))), ArrayList::new));
}
private EventInfoResultDTO getEventInfoResultDTO(ScreenProjectDataDTO project, Map<String, CustomerProjectCategoryDictEntity> epmetCodeMap, Map<String, CustomerProjectCategoryDictEntity> codeMap) {
EventInfoResultDTO dto = new EventInfoResultDTO();
dto.setId(project.getProjectId());
dto.setCustomerId(project.getCustomerId());
dto.setEventName(project.getProjectTitle());
dto.setReporterId(project.getProjectCreator());
//获取工作人员姓名和身份证
String categoryCode = project.getCategoryCode().split(StrConstant.COMMA)[0];
String parentCode = null == codeMap.get(categoryCode)?null:codeMap.get(categoryCode).getParentCategoryCode();
//如果是孔村、榆山、锦水的项目需要关联分类字典表
@ -290,6 +350,7 @@ public class DataReportingServiceImpl implements DataReportingService {
dto.setCompleteTime(project.getCloseCaseTime());
dto.setLat(project.getLatitude());
dto.setLng(project.getLongitude());
dto.setWaysOfResolving(ProjectConstant.PROJECT_SELF_CLOSED);
return dto;
}
@ -333,4 +394,7 @@ public class DataReportingServiceImpl implements DataReportingService {
return userService.getPatrolDetailList(formDTO);
}
}

74
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml

@ -269,6 +269,80 @@
ORDER BY
a.CREATED_TIME ASC
</select>
<select id="selectProjectListV2" resultType="com.epmet.dto.screen.ScreenProjectDataDTO">
SELECT
a.ID,
a.CUSTOMER_ID,
a.ORG_TYPE,
a.ORG_ID,
a.PARENT_ID,
a.ORG_NAME,
a.PROJECT_ID,
a.PROJECT_TITLE,
a.PROJECT_CREATE_TIME,
a.LINK_USER_ID,
a.LINK_NAME,
a.LINK_MOBILE,
a.PROJECT_CONTENT,
a.PROJECT_LEVEL,
a.PROJECT_ADDRESS,
a.ALL_CATEGORY_NAME,
a.LONGITUDE,
a.LATITUDE,
a.SATISFACTION_SCORE,
a.PROJECT_STATUS_CODE,
a.CLOSE_CASE_TIME,
a.DATA_END_TIME,
a.ALL_PARENT_IDS,
a.PROJECT_CREATOR,
a.ORIGIN,
a.CATEGORY_CODE,
b.HANDLER_ID AS finishOrg,
b.HANDLER_TYPE AS finishOrgType,
b.ORG_ID_PATH AS orgIdPath,
c.`LEVEL` AS finishOrgLevel
FROM
screen_project_data a
LEFT JOIN (
SELECT
spp.CUSTOMER_ID,
PROJECT_ID,
HANDLER_ID,
HANDLER_TYPE,
ORG_ID_PATH
FROM
screen_project_process spp
WHERE
(( spp.CUSTOMER_ID = '2fe0065f70ca0e23ce4c26fca5f1d933' OR spp.CUSTOMER_ID = '44876154d10d7cb7affd92000f84f833' OR spp.CUSTOMER_ID = '46c55cb862d6d5e6d05d2ab61a1cc07e' )
AND OPERATION = 'closed_case')
OR
(( spp.CUSTOMER_ID != '2fe0065f70ca0e23ce4c26fca5f1d933' AND spp.CUSTOMER_ID != '44876154d10d7cb7affd92000f84f833' AND spp.CUSTOMER_ID != '46c55cb862d6d5e6d05d2ab61a1cc07e' )
AND OPERATION = 'close')
<if test='null != customerId and "" != customerId'>
AND spp.CUSTOMER_ID = #{customerId}
</if>
<if test='null != projectIds and projectIds.size()>0'>
<foreach collection="projectIds" item="projectId" open="AND (" separator=" OR " close=" )">
spp.PROJECT_ID = #{projectId}
</foreach>
</if>
) b ON a.PROJECT_ID = b.PROJECT_ID
LEFT JOIN screen_customer_agency c ON b.HANDLER_ID = c.AGENCY_ID
WHERE a.DEL_FLAG = '0'
AND a.ORG_TYPE = 'grid'
AND a.CATEGORY_CODE IS NOT NULL
AND a.CATEGORY_CODE != ''
<if test='null != customerId and "" != customerId'>
AND a.CUSTOMER_ID = #{customerId}
</if>
<if test='null != projectIds and projectIds.size()>0'>
<foreach collection="projectIds" item="projectId" open="AND (" separator=" OR " close=" )">
a.PROJECT_ID = #{projectId}
</foreach>
</if>
ORDER BY
a.CREATED_TIME ASC
</select>
<!-- 查询网格下的项目分类 -->
<select id="selectGridCategoryProjectCount" resultType="com.epmet.dto.screen.result.GridAndOrgCategoryCountResultDTO">

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

@ -160,6 +160,9 @@
customer_grid
WHERE del_flag = '0'
AND customer_id = #{customerId}
and CODE is not null
and CODE !=''
and grid_name not like '%专属网格'
<if test="orgIdList != null and orgIdList.size() > 0">
<foreach collection="orgIdList" item="gridId" open="AND id IN (" separator="," close=")">
#{gridId}

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

@ -216,6 +216,8 @@
customer_agency
WHERE del_flag = '0'
AND customer_id = #{customerId}
and CODE is not null
and CODE !=''
<if test="orgIdList != null and orgIdList.size() > 0">
<foreach collection="orgIdList" item="agencyId" open="AND id IN (" separator="," close=")">
#{agencyId}

2
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java

@ -696,7 +696,7 @@ public interface GovOrgOpenFeignClient {
@PostMapping("/gov/org/coverage/dictinit/{customerId}")
Result dictInit(@PathVariable(value = "customerId") String customerId);
@PostMapping("/gov/org/customerstaffgrid/gridstaff")
@PostMapping("/gov/org/customerstaffgrid/gridstafflist")
Result<List<CustomerGridStaffListResultDTO>> gridStaff(CustomerGridStaffListFormDTO dto);
}

2
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java

@ -447,7 +447,7 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient {
@Override
public Result<List<CustomerGridStaffListResultDTO>> gridStaff(CustomerGridStaffListFormDTO dto) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "gridStaff", dto);
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "gridStaffList", dto);
}
}

6
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java

@ -161,8 +161,8 @@ public class CustomerStaffGridController {
* @Author sun
* @Description 网格下工作人员列表
**/
@PostMapping(value = "gridstaff")
public Result<List<CustomerGridStaffListResultDTO>> gridStaff(@RequestBody CustomerGridStaffListFormDTO formDTO) {
return new Result<List<CustomerGridStaffListResultDTO>>().ok(customerStaffGridService.gridStaff(formDTO));
@PostMapping("gridstafflist")
public Result<List<CustomerGridStaffListResultDTO>> gridStaffList(@RequestBody CustomerGridStaffListFormDTO formDTO) {
return new Result<List<CustomerGridStaffListResultDTO>>().ok(customerStaffGridService.gridStaffList(formDTO));
}
}

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffGridService.java

@ -144,5 +144,5 @@ public interface CustomerStaffGridService extends BaseService<CustomerStaffGridE
*/
List<String> getAllStaffByGridId(String gridId);
List<CustomerGridStaffListResultDTO> gridStaff(CustomerGridStaffListFormDTO formDTO);
List<CustomerGridStaffListResultDTO> gridStaffList(CustomerGridStaffListFormDTO formDTO);
}

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffGridServiceImpl.java

@ -206,7 +206,8 @@ public class CustomerStaffGridServiceImpl extends BaseServiceImpl<CustomerStaffG
}
@Override
public List<CustomerGridStaffListResultDTO> gridStaff(CustomerGridStaffListFormDTO formDTO) {
public List<CustomerGridStaffListResultDTO> gridStaffList(CustomerGridStaffListFormDTO formDTO) {
//查询客户下未被禁用的工作人员基本信息
return baseDao.getGridStaffByCustomerId(formDTO.getCustomerId());
}

2
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml

@ -205,7 +205,7 @@
a.user_id gridUserId
FROM
customer_staff_grid a
INNER JOIN customer_grid b ON a.grid_id = b.id AND b.del_flag = '0'
INNER JOIN customer_grid b ON a.grid_id = b.id AND b.del_flag = '0' AND b.`code` is not null
WHERE
a.del_flag = '0'
AND a.customer_id = #{customerId}

38
epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/ExractGridInfoPingYinFormDTO.java

@ -0,0 +1,38 @@
package com.epmet.opendata.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* @Description
* @Author yzm
* @Date 2022/7/22 14:02
*/
@Data
public class ExractGridInfoPingYinFormDTO implements Serializable {
public interface GridInfo extends CustomerClientShowGroup {
}
/**
* 客户Id
*/
@NotBlank(message = "客户Id不能为空", groups = {GridInfo.class})
private String customerId = "";
/**
* 网格Id或者组织id
*/
private List<String> orgIdList;
/**
* 操作类型新增:add 修改删除:edit 初始化所有数据:all
*/
@NotBlank(message = "操作类型【新增:add 修改删除:edit 初始化所有数据:all】不能为空", groups = {GridInfo.class})
private String type;
}

17
epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/GridStaffInfoFormDTO.java

@ -0,0 +1,17 @@
package com.epmet.opendata.dto.form;
import lombok.Data;
import java.io.Serializable;
@Data
public class GridStaffInfoFormDTO implements Serializable {
private static final long serialVersionUID = -5277855973512833181L;
/**
* 客户Id
*/
private String customerId;
}

18
epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/HistoryDataSyncFormDTO.java

@ -0,0 +1,18 @@
package com.epmet.opendata.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2022/7/22 13:23
* @DESC
*/
@Data
public class HistoryDataSyncFormDTO implements Serializable {
private static final long serialVersionUID = -58891187838165930L;
private String customerId;
}

3
epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/UpsertPatrolRecordForm.java

@ -22,8 +22,9 @@ public class UpsertPatrolRecordForm extends PageFormDTO {
/**
* 记录id
* 2022-07-22 注释校验的原因是兼容初始化当不传id时查询全部
*/
@NotEmpty(message = "id不能为空",groups = AddGroup.class)
// @NotEmpty(message = "id不能为空",groups = AddGroup.class)
private String id;
/**

25
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/BaseGridDailyworkController.java

@ -21,6 +21,7 @@ package com.epmet.opendata.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.opendata.dto.form.HistoryDataSyncFormDTO;
import com.epmet.opendata.dto.form.UpsertPatrolRecordForm;
import com.epmet.opendata.service.BaseGridDailyworkService;
import org.springframework.beans.factory.annotation.Autowired;
@ -54,5 +55,29 @@ public class BaseGridDailyworkController {
return new Result();
}
/**
* Desc: 2022-07-22 新表 例行工作同步
* @param formDTO
* @author zxc
* @date 2022/7/22 11:16
*/
@PostMapping("syncV2")
public Result getStaffBaseInfoV2(@RequestBody(required = false) UpsertPatrolRecordForm formDTO) {
ValidatorUtils.validateEntity(formDTO, DefaultGroup.class);
baseGridDailyworkService.insertBaseGridWorkRecordV2(formDTO);
return new Result();
}
/**
* Desc: 历史数据处理
* @param formDTO
* @author zxc
* @date 2022/7/22 13:24
*/
@PostMapping("historyDataSync")
public Result historyDataSync(@RequestBody HistoryDataSyncFormDTO formDTO){
baseGridDailyworkService.historyDataSync(formDTO);
return new Result();
}
}

34
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/EventreportPingyinController.java

@ -1,19 +1,14 @@
package com.epmet.opendata.controller;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.epmet.dto.basereport.form.EventInfoFormDTO;
import com.epmet.opendata.service.EventreportPingyinService;
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;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
/**
@ -25,7 +20,20 @@ import java.util.Map;
@RestController
@RequestMapping("eventreportPingyin")
public class EventreportPingyinController {
@Resource
private EventreportPingyinService eventreportPingyinService;
/**
* 获取上报事件
* @Param formDTO
* @Return {@link Result}
* @Author zhaoqifeng
* @Date 2021/10/15 16:59
*/
@PostMapping("eventinfo")
public Result getEventinfo(@RequestBody(required = false) EventInfoFormDTO formDTO) {
eventreportPingyinService.getEventInfo(formDTO);
return new Result();
}
}

39
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/GridInfoPingyinController.java

@ -1,19 +1,14 @@
package com.epmet.opendata.controller;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.opendata.dto.form.ExractGridInfoPingYinFormDTO;
import com.epmet.opendata.service.GridInfoPingyinService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
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;
/**
@ -26,6 +21,28 @@ import java.util.Map;
@RequestMapping("gridInfoPingyin")
public class GridInfoPingyinController {
@Autowired
private GridInfoPingyinService gridInfoPingyinService;
/**
* @Author yzm
* @Description 组织基础信息中间库同步
**/
@PostMapping("extract-agency")
public Result getAgencyBaseInfo(@RequestBody ExractGridInfoPingYinFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, ExractGridInfoPingYinFormDTO.GridInfo.class);
gridInfoPingyinService.exractAgency(formDTO);
return new Result();
}
/**
* @Author yzm
* @Description 网格基础信息中间库同步
**/
@PostMapping("extract-grid")
public Result getGridBaseInfo(@RequestBody ExractGridInfoPingYinFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, ExractGridInfoPingYinFormDTO.GridInfo.class);
gridInfoPingyinService.exractGrid(formDTO);
return new Result();
}
}

17
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/GridstaffInfoPingyinController.java

@ -8,10 +8,15 @@ import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.form.CustomerGridStaffListFormDTO;
import com.epmet.dto.result.CustomerGridStaffListResultDTO;
import com.epmet.opendata.dto.form.GridStaffInfoFormDTO;
import com.epmet.opendata.service.GridstaffInfoPingyinService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
@ -25,6 +30,18 @@ import java.util.Map;
@RequestMapping("gridstaffInfoPingyin")
public class GridstaffInfoPingyinController {
@Autowired
private GridstaffInfoPingyinService gridstaffInfoPingyinService;
/**
* @Author sun
* @Description 网格员基本信息同步
**/
@PostMapping(value = "gridstaffinfo")
public Result gridStaffInfo(@RequestBody GridStaffInfoFormDTO formDTO) {
gridstaffInfoPingyinService.gridStaffInfo(formDTO);
return new Result();
}
}

11
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/BaseGridDailyworkDao.java

@ -21,6 +21,9 @@ package com.epmet.opendata.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.opendata.entity.BaseGridDailyworkEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 巡查例行工作
@ -31,4 +34,12 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface BaseGridDailyworkDao extends BaseDao<BaseGridDailyworkEntity> {
/**
* Desc: 每次查询1000
* @param customerId
* @author zxc
* @date 2022/7/22 13:26
*/
List<BaseGridDailyworkEntity> getBaseGridDailyWork(@Param("customerId")String customerId,@Param("size")Integer size);
}

2
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/EventreportPingyinDao.java

@ -12,5 +12,5 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface EventreportPingyinDao extends BaseDao<EventreportPingyinEntity> {
void deleteAllData();
}

17
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridInfoPingyinDao.java

@ -3,6 +3,10 @@ package com.epmet.opendata.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.opendata.entity.GridInfoPingyinEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
/**
* 平阴区网格表
@ -12,5 +16,16 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface GridInfoPingyinDao extends BaseDao<GridInfoPingyinEntity> {
int deleteAllAgencyData();
int deleteAllGridData();
List<GridInfoPingyinEntity> selectByGridCode(String gridCode);
int updateSomeCol(@Param("id") Long id,
@Param("gridName")String gridName,
@Param("gridLevel")Integer gridLevel,
@Param("lng")BigDecimal lng,
@Param("lat")BigDecimal lat);
}

3
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridstaffInfoPingyinDao.java

@ -12,5 +12,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface GridstaffInfoPingyinDao extends BaseDao<GridstaffInfoPingyinEntity> {
void del();
}

4
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridstaffWorkInfoPingyinDao.java

@ -12,5 +12,7 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface GridstaffWorkInfoPingyinDao extends BaseDao<GridstaffWorkInfoPingyinEntity> {
Integer delAllGridStaffWorkInfoPY();
}

19
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/BaseGridDailyworkEntity.java

@ -17,6 +17,7 @@
package com.epmet.opendata.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@ -152,4 +153,22 @@ public class BaseGridDailyworkEntity implements Serializable {
*/
private Date updateTime;
@TableField(exist = false)
private String qxBm;
/**
* 上报区县名称
*/
@TableField(exist = false)
private String qxMc;
@TableField(exist = false)
private String workType;
@TableField(exist = false)
private String happenTimeString;
@TableField(exist = false)
private Date recoredInsertTime;
}

9
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/GridstaffWorkInfoPingyinEntity.java

@ -1,8 +1,7 @@
package com.epmet.opendata.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -46,6 +45,9 @@ public class GridstaffWorkInfoPingyinEntity {
*/
private String gridName;
@TableField(exist = false)
private String gridId;
/**
* 例行工作类型,应符合10.27中的例行工作类型
*/
@ -86,4 +88,7 @@ public class GridstaffWorkInfoPingyinEntity {
*/
private Date recoredInsertTime;
@TableField(exist = false)
private String happenTimeString;
}

30
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataOrgChangeEventListener.java

@ -10,8 +10,8 @@ import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.opendata.dto.form.ExDeptFormDTO;
import com.epmet.opendata.service.ExDeptService;
import com.epmet.opendata.dto.form.ExractGridInfoPingYinFormDTO;
import com.epmet.opendata.service.GridInfoPingyinService;
import org.apache.commons.lang.StringUtils;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
@ -78,17 +78,31 @@ public class OpenDataOrgChangeEventListener implements MessageListenerConcurrent
lock = distributedLock.getLock(String.format("lock:open_data_org:%s", obj.getOrgId()),
30L, 30L, TimeUnit.SECONDS);
ExDeptFormDTO dto = new ExDeptFormDTO();
dto.setCustomerId(obj.getCustomerId());
dto.setType(obj.getType());
// ExDeptFormDTO dto = new ExDeptFormDTO();
// dto.setCustomerId(obj.getCustomerId());
// dto.setType(obj.getType());
// List<String> orgIdList = new ArrayList<>();
// orgIdList.add(obj.getOrgId());
// dto.setOrgIdList(orgIdList);
// if ("agency".equals(obj.getOrgType())) {
// SpringContextUtils.getBean(ExDeptService.class).getAgencyBaseInfo(dto);
// } else {
// SpringContextUtils.getBean(ExDeptService.class).getGridBaseInfo(dto);
// }
// 抽取到grid_info_pingyin
ExractGridInfoPingYinFormDTO extractFormDto = new ExractGridInfoPingYinFormDTO();
extractFormDto.setCustomerId(obj.getCustomerId());
extractFormDto.setType(obj.getType());
List<String> orgIdList = new ArrayList<>();
orgIdList.add(obj.getOrgId());
dto.setOrgIdList(orgIdList);
extractFormDto.setOrgIdList(orgIdList);
if ("agency".equals(obj.getOrgType())) {
SpringContextUtils.getBean(ExDeptService.class).getAgencyBaseInfo(dto);
SpringContextUtils.getBean(GridInfoPingyinService.class).exractAgency(extractFormDto);
} else {
SpringContextUtils.getBean(ExDeptService.class).getGridBaseInfo(dto);
SpringContextUtils.getBean(GridInfoPingyinService.class).exractGrid(extractFormDto);
}
} catch (RenException e) {
// 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试
logger.error("【开放数据事件监听器】-组织信息变更-同步信息到中间库失败:".concat(ExceptionUtils.getErrorStackTrace(e)));

3
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataPatrolChangeEventListener.java

@ -98,7 +98,8 @@ public class OpenDataPatrolChangeEventListener implements MessageListenerConcurr
aBoolean = true;
break;
case SystemMessageType.PATROL_ROUTINE_WORK_ADD:
aBoolean = SpringContextUtils.getBean(BaseGridDailyworkService.class).insertBaseGridWorkRecord(patrolRecordForm);
// aBoolean = SpringContextUtils.getBean(BaseGridDailyworkService.class).insertBaseGridWorkRecord(patrolRecordForm);
aBoolean = SpringContextUtils.getBean(BaseGridDailyworkService.class).insertBaseGridWorkRecordV2(patrolRecordForm);
break;
default:
log.error("错误的消息类型:{}", tags);

5
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataProjectChangeEventListener.java

@ -11,7 +11,7 @@ import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.dto.basereport.form.EventInfoFormDTO;
import com.epmet.opendata.service.BaseDisputeProcessService;
import com.epmet.opendata.service.EventreportPingyinService;
import org.apache.commons.lang3.StringUtils;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
@ -75,7 +75,8 @@ public class OpenDataProjectChangeEventListener implements MessageListenerConcur
try {
lock = distributedLock.getLock(String.format("lock:open_data_project:%s", obj.getProjectId()),
30L, 30L, TimeUnit.SECONDS);
SpringContextUtils.getBean(BaseDisputeProcessService.class).getEventinfo(formDTO);
//SpringContextUtils.getBean(BaseDisputeProcessService.class).getEventinfo(formDTO);
SpringContextUtils.getBean(EventreportPingyinService.class).getEventInfo(formDTO);
} catch (RenException e) {
// 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试
logger.error("【开放数据事件监听器】-项目信息变更-上报项目信息失败:".concat(ExceptionUtils.getErrorStackTrace(e)));

17
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/BaseGridDailyworkService.java

@ -18,6 +18,7 @@
package com.epmet.opendata.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.opendata.dto.form.HistoryDataSyncFormDTO;
import com.epmet.opendata.dto.form.UpsertPatrolRecordForm;
import com.epmet.opendata.entity.BaseGridDailyworkEntity;
@ -36,6 +37,14 @@ public interface BaseGridDailyworkService extends BaseService<BaseGridDailyworkE
*/
Boolean insertBaseGridWorkRecord(UpsertPatrolRecordForm patrolRecordForm);
/**
* Desc: 2022-07-22 新表 例行工作同步
* @param formDTO
* @author zxc
* @date 2022/7/22 11:16
*/
Boolean insertBaseGridWorkRecordV2(UpsertPatrolRecordForm formDTO);
/**
* desc重新加载数据
* @param customerId
@ -43,4 +52,12 @@ public interface BaseGridDailyworkService extends BaseService<BaseGridDailyworkE
*/
Boolean reloadPatrolData(String customerId);
/**
* Desc: 历史数据处理
* @param formDTO
* @author zxc
* @date 2022/7/22 13:24
*/
void historyDataSync(HistoryDataSyncFormDTO formDTO);
}

9
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/EventreportPingyinService.java

@ -2,6 +2,7 @@ package com.epmet.opendata.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dto.basereport.form.EventInfoFormDTO;
import com.epmet.opendata.entity.EventreportPingyinEntity;
/**
@ -11,4 +12,12 @@ import com.epmet.opendata.entity.EventreportPingyinEntity;
* @since v1.0.0 2022-07-22
*/
public interface EventreportPingyinService extends BaseService<EventreportPingyinEntity> {
/**
* 获取上报事件
* @Param formDTO
* @Return
* @Author zhaoqifeng
* @Date 2021/10/15 16:59
*/
void getEventInfo(EventInfoFormDTO formDTO);
}

15
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/GridInfoPingyinService.java

@ -1,10 +1,9 @@
package com.epmet.opendata.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.opendata.dto.form.ExractGridInfoPingYinFormDTO;
import com.epmet.opendata.entity.GridInfoPingyinEntity;
import java.util.Map;
/**
* 平阴区网格表
*
@ -12,5 +11,17 @@ import java.util.Map;
* @since v1.0.0 2022-07-22
*/
public interface GridInfoPingyinService extends BaseService<GridInfoPingyinEntity> {
/**
* 抽取customer_agency到grid_info_pingyin表
*
* @param formDTO
*/
void exractAgency(ExractGridInfoPingYinFormDTO formDTO);
/**
* 抽取customer_grid到grid_info_pingyin表
*
* @param formDTO
*/
void exractGrid(ExractGridInfoPingYinFormDTO formDTO);
}

2
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/GridstaffInfoPingyinService.java

@ -1,6 +1,7 @@
package com.epmet.opendata.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.opendata.dto.form.GridStaffInfoFormDTO;
import com.epmet.opendata.entity.GridstaffInfoPingyinEntity;
import java.util.Map;
@ -13,4 +14,5 @@ import java.util.Map;
*/
public interface GridstaffInfoPingyinService extends BaseService<GridstaffInfoPingyinEntity> {
void gridStaffInfo(GridStaffInfoFormDTO formDTO);
}

4
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/GridstaffWorkInfoPingyinService.java

@ -3,8 +3,6 @@ package com.epmet.opendata.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.opendata.entity.GridstaffWorkInfoPingyinEntity;
import java.util.Map;
/**
* 平阴区网格员例行工作信息
*
@ -13,4 +11,6 @@ import java.util.Map;
*/
public interface GridstaffWorkInfoPingyinService extends BaseService<GridstaffWorkInfoPingyinEntity> {
Integer delAllGridStaffWorkInfoPY();
}

155
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java

@ -1,20 +1,3 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.opendata.service.impl;
import com.alibaba.fastjson.JSON;
@ -23,6 +6,10 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
@ -32,15 +19,18 @@ import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.opendata.dao.BaseGridDailyworkDao;
import com.epmet.opendata.dto.ExDeptDTO;
import com.epmet.opendata.dto.ExUserDTO;
import com.epmet.opendata.dto.form.HistoryDataSyncFormDTO;
import com.epmet.opendata.dto.form.UpsertPatrolRecordForm;
import com.epmet.opendata.entity.BaseGridDailyworkEntity;
import com.epmet.opendata.service.BaseGridDailyworkService;
import com.epmet.opendata.service.ExDeptService;
import com.epmet.opendata.service.ExUserService;
import com.epmet.opendata.entity.GridstaffWorkInfoPingyinEntity;
import com.epmet.opendata.service.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
@ -64,6 +54,12 @@ public class BaseGridDailyworkServiceImpl extends BaseServiceImpl<BaseGridDailyw
private ExDeptService exDeptService;
@Autowired
private ExUserService exUserService;
@Autowired
private GridstaffWorkInfoPingyinService pingYinService;
@Autowired
private GridstaffInfoPingyinService gridstaffInfoPingyinService;
@Autowired
private GridInfoPingyinService gridInfoPingyinService;
@Override
public Boolean insertBaseGridWorkRecord(UpsertPatrolRecordForm patrolRecordForm) {
@ -117,6 +113,7 @@ public class BaseGridDailyworkServiceImpl extends BaseServiceImpl<BaseGridDailyw
return null;
}
private Boolean insertRecordBatch(List<PatrolRoutineWorkResult> list, Map<String, ExDeptDTO> deptMap, Map<String, ExUserDTO> userMap){
List<BaseGridDailyworkEntity> insertList = new ArrayList<>();
list.forEach(o-> insertList.add(buildEntity(o, deptMap, userMap)));
@ -130,7 +127,6 @@ public class BaseGridDailyworkServiceImpl extends BaseServiceImpl<BaseGridDailyw
return true;
}
private BaseGridDailyworkEntity buildEntity(PatrolRoutineWorkResult record, Map<String, ExDeptDTO> deptMap, Map<String, ExUserDTO> userMap) {
BaseGridDailyworkEntity entity = new BaseGridDailyworkEntity();
entity.setCustomerId(record.getCustomerId());
@ -178,9 +174,122 @@ public class BaseGridDailyworkServiceImpl extends BaseServiceImpl<BaseGridDailyw
private PatrolQueryFormDTO buildParam(UpsertPatrolRecordForm patrolRecordForm) {
PatrolQueryFormDTO midPatrolFormDTO = new PatrolQueryFormDTO();
midPatrolFormDTO.setCustomerId(patrolRecordForm.getCustomerId());
midPatrolFormDTO.setId(patrolRecordForm.getId());
midPatrolFormDTO.setId(StringUtils.isBlank(patrolRecordForm.getId()) ? "" : patrolRecordForm.getId());
midPatrolFormDTO.setPageNo(patrolRecordForm.getPageNo());
midPatrolFormDTO.setPageSize(patrolRecordForm.getPageSize());
midPatrolFormDTO.setPageSize(NumConstant.ONE_THOUSAND);
return midPatrolFormDTO;
}
private GridstaffWorkInfoPingyinEntity buildNewEntity(PatrolRoutineWorkResult record) {
GridstaffWorkInfoPingyinEntity entity = ConvertUtils.sourceToTarget(record, GridstaffWorkInfoPingyinEntity.class);
entity.setQxBm("370124");
entity.setQxMc("平阴县");
entity.setHappenTime(DateUtils.parseDate(record.getHappenTime().concat(" 00:00:00"),DateUtils.DATE_PATTERN));
entity.setWorkResult(NumConstant.ONE == record.getIsNormal()? "Y":"N");
entity.setWorkType(record.getWorkTypeSecondCode());
entity.setRecoredInsertTime(record.getCreatedTime());
entity.setUpdateTime(record.getUpdatedTime());
entity.setId(null);
entity.setIsDel(NumConstant.ZERO_STR);
return entity;
}
@Override
public Boolean insertBaseGridWorkRecordV2(UpsertPatrolRecordForm patrolRecordForm) {
log.info("insertBaseGridWorkRecordV2 param:{}", JSON.toJSONString(patrolRecordForm));
ValidatorUtils.validateEntity(patrolRecordForm, AddGroup.class);
// 构建传参
PatrolQueryFormDTO midPatrolFormDTO = buildParam(patrolRecordForm);
if (StringUtils.isBlank(patrolRecordForm.getId())){
Integer row;
do {
row = pingYinService.delAllGridStaffWorkInfoPY();
}while (row == NumConstant.ONE_THOUSAND);
}
List<PatrolRoutineWorkResult> data;
do {
Result<List<PatrolRoutineWorkResult>> record = epmetUserOpenFeignClient.getPatrolRoutineWorkListV2(midPatrolFormDTO);
if (record == null || !record.success()) {
log.error("获取例行工作记录V2失败,param:{}", JSON.toJSONString(midPatrolFormDTO));
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode());
}
data = record.getData();
if (CollectionUtils.isEmpty(data)) {
//数据已被删除了
//暂时设置error 用于排错
log.error("获取例行工作记录返回为空,param:{}", JSON.toJSONString(midPatrolFormDTO));
int effectRow = baseDao.deleteById(patrolRecordForm.getId());
log.warn("del effectRow:{}", effectRow);
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode());
}
data.forEach(d -> {
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(d.getGridId());
if (null == gridInfo){
throw new EpmetException("未查询到网格信息:"+ d.getGridId());
}
d.setGridCode(gridInfo.getCode());
d.setGridName(gridInfo.getGridName());
});
insertNewRecordBatch(data);
}while (data.size() == NumConstant.ONE_THOUSAND);
return true;
}
/**
* Desc: 历史数据处理
* @param formDTO
* @author zxc
* @date 2022/7/22 13:24
*/
@Override
public void historyDataSync(HistoryDataSyncFormDTO formDTO) {
Integer pageSize = NumConstant.ONE_THOUSAND;
Integer pageNo = NumConstant.ONE;
List<BaseGridDailyworkEntity> baseGridDailyWork;
do {
baseGridDailyWork = baseDao.getBaseGridDailyWork(formDTO.getCustomerId(),(pageNo - NumConstant.ONE) * pageSize);
List<GridstaffWorkInfoPingyinEntity> newEntities = ConvertUtils.sourceToTarget(baseGridDailyWork, GridstaffWorkInfoPingyinEntity.class);
newEntities.forEach(n -> {
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(n.getGridId());
if (null == gridInfo){
throw new EpmetException("未查询到网格信息:"+ n.getGridId());
}
n.setGridCode(gridInfo.getCode());
n.setHappenTime(DateUtils.parseDate(n.getHappenTimeString(),DateUtils.DATE_PATTERN));
n.setIsDel(NumConstant.ZERO_STR);
});
insertGridStaffWorkInfoPY(newEntities);
pageNo++;
}while (baseGridDailyWork.size() == NumConstant.ONE_THOUSAND);
}
/**
* Desc: 数据存入
* @param newEntities
* @author zxc
* @date 2022/7/22 14:17
*/
@Transactional(rollbackFor = Exception.class)
public void insertGridStaffWorkInfoPY(List<GridstaffWorkInfoPingyinEntity> newEntities){
if (!CollectionUtils.isEmpty(newEntities)){
List<List<GridstaffWorkInfoPingyinEntity>> partition = ListUtils.partition(newEntities, NumConstant.ONE_HUNDRED);
partition.forEach(p -> {
pingYinService.insertBatch(p);
});
}
}
private Boolean insertNewRecordBatch(List<PatrolRoutineWorkResult> list){
List<GridstaffWorkInfoPingyinEntity> insertList = new ArrayList<>();
list.forEach(o-> insertList.add(buildNewEntity(o)));
//insert
if (CollectionUtils.isEmpty(insertList)){
log.error("新构建要插入的数据为空,param:{}", JSON.toJSONString(list));
return false;
}
insertGridStaffWorkInfoPY(insertList);
// pingYinService.saveOrUpdateBatch(insertList, NumConstant.ONE_HUNDRED);
return true;
}
}

138
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java

@ -1,10 +1,27 @@
package com.epmet.opendata.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.basereport.form.EventInfoFormDTO;
import com.epmet.dto.basereport.result.EventInfoResultDTO;
import com.epmet.feign.DataStatisticalOpenFeignClient;
import com.epmet.opendata.dao.EventreportPingyinDao;
import com.epmet.opendata.dao.GridstaffInfoPingyinDao;
import com.epmet.opendata.entity.EventreportPingyinEntity;
import com.epmet.opendata.entity.GridstaffInfoPingyinEntity;
import com.epmet.opendata.service.EventreportPingyinService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
/**
* 平阴区事件上报中间表
@ -12,8 +29,129 @@ import org.springframework.stereotype.Service;
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-07-22
*/
@Slf4j
@Service
public class EventreportPingyinServiceImpl extends BaseServiceImpl<EventreportPingyinDao, EventreportPingyinEntity> implements EventreportPingyinService {
@Resource
private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient;
@Resource
private GridstaffInfoPingyinDao gridstaffInfoPingyinDao;
/**
* 获取上报事件
*
* @param formDTO
* @Param formDTO
* @Return
* @Author zhaoqifeng
* @Date 2021/10/15 16:59
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void getEventInfo(EventInfoFormDTO formDTO) {
formDTO.setPageSize(1000);
long start = System.currentTimeMillis();
if (NumConstant.ONE_STR.equals(formDTO.getInitFlag())) {
//清空表里数据
baseDao.deleteAllData();
}
Result<List<EventInfoResultDTO>> result = dataStatisticalOpenFeignClient.getEventInfoV2(formDTO);
if (!result.success()) {
log.error("getEventinfo cost:{}ms",System.currentTimeMillis()-start);
throw new RenException(result.getInternalMsg());
}
List<EventInfoResultDTO> list = result.getData();
saveEvent(list, formDTO.getInitFlag());
//分批次循环
while (CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize()) {
formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE);
result = dataStatisticalOpenFeignClient.getEventInfo(formDTO);
list = result.getData();
saveEvent(list, formDTO.getInitFlag());
}
}
private void saveEvent(List<EventInfoResultDTO> list, String initFlag) {
if (CollectionUtils.isEmpty(list)) {
log.warn("no event data to save table base_conflicts_resolve");
return;
}
List<EventreportPingyinEntity> entityList = list.stream().map(item -> {
EventreportPingyinEntity entity = new EventreportPingyinEntity();
entity.setQxBm("370124");
entity.setQxMc("平阴县");
entity.setGridCode(item.getOrgCode());
entity.setGridName(item.getOrgName());
entity.setEventCode(("py_").concat(item.getId()));
entity.setEventName(item.getEventName());
entity.setEventCategory(item.getEventCategory());
entity.setGridUserCardid("");
entity.setGridUserName("");
LambdaQueryWrapper<GridstaffInfoPingyinEntity> staffWrapper = new LambdaQueryWrapper<>();
staffWrapper.eq(GridstaffInfoPingyinEntity::getGridUserId, item.getReporterId());
List<GridstaffInfoPingyinEntity> staffList = gridstaffInfoPingyinDao.selectList(staffWrapper);
if (CollectionUtils.isNotEmpty(staffList)) {
entity.setGridUserCardid(staffList.get(NumConstant.ZERO).getCardNum());
entity.setGridUserName(staffList.get(NumConstant.ZERO).getNickName());
} else {
staffWrapper = new LambdaQueryWrapper<>();
staffWrapper.eq(GridstaffInfoPingyinEntity::getGridCode, item.getOrgCode());
staffList = gridstaffInfoPingyinDao.selectList(staffWrapper);
if (CollectionUtils.isNotEmpty(staffList)) {
for (GridstaffInfoPingyinEntity staff : staffList) {
entity.setGridUserCardid(staff.getCardNum());
entity.setGridUserName(staff.getNickName());
if (StringUtils.isNotBlank(staff.getCardNum())) {
break;
}
}
}
}
entity.setReportTime(item.getReportTime());
entity.setHappenTime(item.getHappenDate());
entity.setHappenPlace(item.getHappenPlace());
String eventDescription = item.getEventDescription();
//如果不为空 长度控制1000以内
if (StringUtils.isNotBlank(eventDescription) && eventDescription.length() > NumConstant.ONE_THOUSAND) {
eventDescription = eventDescription.substring(NumConstant.ZERO, NumConstant.ONE_THOUSAND);
}
entity.setEventDescription(eventDescription);
entity.setWaysOfResolving(item.getWaysOfResolving());
//业务不确定
if (("03").equals(item.getStatus())) {
entity.setSuccessfulOrNo("Y");
} else {
entity.setSuccessfulOrNo("N");
}
entity.setCompleteLevel(item.getCompleteLevel());
entity.setCompleteTime(item.getCompleteTime());
entity.setLng(null == item.getLng() ? null : item.getLng());
entity.setLat(null == item.getLat() ? null : item.getLat());
entity.setIsDel("N");
//业务不包含 一级分类里 如果是03 矛盾纠纷 则涉及人数写2(目前业务不支持 所以应产品需求 填2)
if ("03".equals(item.getParentEventCategory())) {
entity.setNumberInvolved(NumConstant.TWO);
}
return entity;
}).collect(Collectors.toList());
if (NumConstant.ZERO_STR.equals(initFlag)) {
entityList.forEach(entity -> {
LambdaQueryWrapper<EventreportPingyinEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(EventreportPingyinEntity::getEventCode, entity.getEventCode());
EventreportPingyinEntity event = baseDao.selectOne(wrapper);
if (null == event) {
baseDao.insert(entity);
} else {
entity.setId(event.getId());
baseDao.updateById(entity);
}
});
} else {
insertBatch(entityList);
}
}
}

164
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java

@ -1,11 +1,27 @@
package com.epmet.opendata.service.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.IndexCalConstant;
import com.epmet.dto.org.result.CustomerAgencyDTO;
import com.epmet.dto.org.result.CustomerGridDTO;
import com.epmet.feign.DataStatisticalOpenFeignClient;
import com.epmet.opendata.dao.GridInfoPingyinDao;
import com.epmet.opendata.dto.form.ExractGridInfoPingYinFormDTO;
import com.epmet.opendata.entity.GridInfoPingyinEntity;
import com.epmet.opendata.service.GridInfoPingyinService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
* 平阴区网格表
@ -15,5 +31,153 @@ import org.springframework.stereotype.Service;
*/
@Service
public class GridInfoPingyinServiceImpl extends BaseServiceImpl<GridInfoPingyinDao, GridInfoPingyinEntity> implements GridInfoPingyinService {
@Autowired
private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient;
/**
* 抽取customer_agency到grid_info_pingyin表
*
* @param formDTO
*/
@Override
public void exractAgency(ExractGridInfoPingYinFormDTO formDTO) {
// 1.查询组织基础信息,customer_agency.code为空的不抽取
com.epmet.dto.org.form.GridBaseInfoFormDTO formDTO1 = ConvertUtils.sourceToTarget(formDTO, com.epmet.dto.org.form.GridBaseInfoFormDTO.class);
Result<List<CustomerAgencyDTO>> result = dataStatisticalOpenFeignClient.getAgencyBaseInfo(formDTO1);
if (!result.success()) {
throw new RenException(result.getInternalMsg());
}
if (null == result.getData() || result.getData().size() < NumConstant.ONE) {
return;
}
// 2.封装数据
List<GridInfoPingyinEntity> gridInfoList = new ArrayList<>();
result.getData().forEach(ag -> {
GridInfoPingyinEntity entity = new GridInfoPingyinEntity();
entity.setQxBm("370124");
entity.setQxMc("平阴县");
entity.setGridCode(ag.getCode());
entity.setGridName(ag.getOrganizationName());
if ("district".equals(ag.getLevel())) {
entity.setGridLevel(3);
} else if ("street".equals(ag.getLevel())) {
entity.setGridLevel(4);
} else if ("community".equals(ag.getLevel())) {
entity.setGridLevel(6);
}
entity.setLat(new BigDecimal(ag.getLatitude()));
entity.setLng(new BigDecimal(ag.getLongitude()));
gridInfoList.add(entity);
});
// 3、初始化传all;新增或者编辑
if ("all".equals(formDTO.getType())) {
// 全删,全增
baseDao.deleteAllAgencyData();
// 一次100
List<List<GridInfoPingyinEntity>> partition = ListUtils.partition(gridInfoList, IndexCalConstant.INSERT_SIZE);
partition.forEach(list -> {
this.insertBatch(list);
});
} else if ("add".equals(formDTO.getType())) {
// 单独新增组织
this.insertBatch(gridInfoList);
} else if ("edit".equals(formDTO.getType())) {
// 修改组织时,先根据code查询,如果有数据,更新
for (GridInfoPingyinEntity entity : gridInfoList) {
List<GridInfoPingyinEntity> orginList = baseDao.selectByGridCode(entity.getGridCode());
if (CollectionUtils.isNotEmpty(orginList)) {
// 更新网格名称、网格层级、网格中心点的经度,网格中心点纬度
for (GridInfoPingyinEntity oigin : orginList) {
baseDao.updateSomeCol(oigin.getId(), entity.getGridName(), entity.getGridLevel(), entity.getLng(), entity.getLat());
}
} else {
// 插入
baseDao.insert(entity);
}
}
}
}
/**
* 抽取customer_grid到grid_info_pingyin表
*
* @param formDTO
*/
@Override
public void exractGrid(ExractGridInfoPingYinFormDTO formDTO) {
// 1.查询网格基础信息
com.epmet.dto.org.form.GridBaseInfoFormDTO formDTO1 = ConvertUtils.sourceToTarget(formDTO, com.epmet.dto.org.form.GridBaseInfoFormDTO.class);
Result<List<CustomerGridDTO>> result = dataStatisticalOpenFeignClient.getGridBaseInfo(formDTO1);
if (!result.success()) {
throw new RenException(result.getInternalMsg());
}
if (null == result.getData() || result.getData().size() < NumConstant.ONE) {
return;
}
// 2.封装数据
List<GridInfoPingyinEntity> gridInfoList = new ArrayList<>();
result.getData().forEach(ag -> {
GridInfoPingyinEntity entity = new GridInfoPingyinEntity();
entity.setQxBm("370124");
entity.setQxMc("平阴县");
entity.setGridCode(ag.getCode());
entity.setGridName(ag.getGridName());
entity.setGridLevel(7);
if (ag.getLatitude().length() > 10) {
entity.setLat(new BigDecimal(ag.getLatitude().substring(0, 10)));
} else {
entity.setLat(new BigDecimal(ag.getLatitude()));
}
if (ag.getLongitude().length() > 10) {
entity.setLng(new BigDecimal(ag.getLongitude().substring(0, 10)));
} else {
entity.setLng(new BigDecimal(ag.getLongitude()));
}
gridInfoList.add(entity);
});
// 3、初始化传all;新增或者编辑
if ("all".equals(formDTO.getType())) {
// 全删,全增
baseDao.deleteAllGridData();
// 一次100
List<List<GridInfoPingyinEntity>> partition = ListUtils.partition(gridInfoList, IndexCalConstant.INSERT_SIZE);
partition.forEach(list -> {
this.insertBatch(list);
});
} else if ("add".equals(formDTO.getType())) {
// 单独新增组织
this.insertBatch(gridInfoList);
} else if ("edit".equals(formDTO.getType())) {
// 修改组织时,先根据code查询,如果有数据,更新
for (GridInfoPingyinEntity entity : gridInfoList) {
List<GridInfoPingyinEntity> orginList = baseDao.selectByGridCode(entity.getGridCode());
if (CollectionUtils.isNotEmpty(orginList)) {
// 更新网格名称、网格层级、网格中心点的经度,网格中心点纬度
for (GridInfoPingyinEntity oigin : orginList) {
baseDao.updateSomeCol(oigin.getId(), entity.getGridName(), entity.getGridLevel(), entity.getLng(), entity.getLat());
}
} else {
// 插入
baseDao.insert(entity);
}
}
}
}
}

73
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffInfoPingyinServiceImpl.java

@ -1,10 +1,29 @@
package com.epmet.opendata.service.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.CustomerGridStaffListFormDTO;
import com.epmet.dto.form.GridStaffUploadtFormDTO;
import com.epmet.dto.result.CustomerGridStaffListResultDTO;
import com.epmet.dto.result.GridStaffUploadResultDTO;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.opendata.dao.GridstaffInfoPingyinDao;
import com.epmet.opendata.dto.form.GridStaffInfoFormDTO;
import com.epmet.opendata.entity.GridstaffInfoPingyinEntity;
import com.epmet.opendata.service.GridstaffInfoPingyinService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 平阴区网格员基础信息
@ -13,6 +32,60 @@ import org.springframework.stereotype.Service;
* @since v1.0.0 2022-07-22
*/
@Service
@Slf4j
public class GridstaffInfoPingyinServiceImpl extends BaseServiceImpl<GridstaffInfoPingyinDao, GridstaffInfoPingyinEntity> implements GridstaffInfoPingyinService {
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Override
@Transactional(rollbackFor = Exception.class)
public void gridStaffInfo(GridStaffInfoFormDTO formDTO) {
//1.查询客户网格下工作人员【存在网格code的网格下的工作人员】
CustomerGridStaffListFormDTO org = new CustomerGridStaffListFormDTO();
org.setCustomerId(formDTO.getCustomerId());
Result<List<CustomerGridStaffListResultDTO>> orgList = govOrgOpenFeignClient.gridStaff(org);
if (!orgList.success()) {
throw new RenException("查询客户网格下工作人员列表信息失败:".concat(orgList.toString()));
}
log.info(String.format("网格员数据同步,查询到网格下工作人员记录共%s条", orgList.getData().size()));
//2.查询客户工作人员基础信息【客户下未被禁用的有效工作人员信息】
GridStaffUploadtFormDTO user = new GridStaffUploadtFormDTO();
user.setCustomerId(formDTO.getCustomerId());
Result<List<GridStaffUploadResultDTO>> userList = epmetUserOpenFeignClient.customerStaff(user);
if (!userList.success()) {
throw new RenException("查询客户下工作人员基础信息失败:".concat(userList.toString()));
}
log.info(String.format("网格员数据同步,查询到客户下工作人员基础信息记录共%s条", userList.getData().size()));
Map<String, GridStaffUploadResultDTO> map = userList.getData().stream().collect(Collectors.toMap(GridStaffUploadResultDTO::getGridUserId, m -> m, (k1, k2) -> k1));
//3.拼装数据
List<GridstaffInfoPingyinEntity> entityList = new ArrayList();
if (!CollectionUtils.isEmpty(orgList.getData()) && !CollectionUtils.isEmpty(userList.getData())) {
for (CustomerGridStaffListResultDTO gs : orgList.getData()) {
if (map.containsKey(gs.getGridUserId())) {
GridstaffInfoPingyinEntity entity = ConvertUtils.sourceToTarget(map.get(gs.getGridUserId()), GridstaffInfoPingyinEntity.class);
entity.setQxBm("370124");
entity.setQxMc("平阴县");
entity.setGridCode(gs.getGridCode());
entity.setGridName(gs.getGridName());
entityList.add(entity);
}
}
}
//4.删除表中历史数据
baseDao.del();
//5.批量新增数据
log.info(String.format("网格员数据同步,本次共同步%s条记录", entityList.size()));
insertBatch(entityList);
}
}

6
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffWorkInfoPingyinServiceImpl.java

@ -14,4 +14,10 @@ import org.springframework.stereotype.Service;
*/
@Service
public class GridstaffWorkInfoPingyinServiceImpl extends BaseServiceImpl<GridstaffWorkInfoPingyinDao, GridstaffWorkInfoPingyinEntity> implements GridstaffWorkInfoPingyinService {
@Override
public Integer delAllGridStaffWorkInfoPY() {
return baseDao.delAllGridStaffWorkInfoPY();
}
}

43
epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/BaseGridDailyworkDao.xml

@ -3,33 +3,22 @@
<mapper namespace="com.epmet.opendata.dao.BaseGridDailyworkDao">
<resultMap type="com.epmet.opendata.entity.BaseGridDailyworkEntity" id="patrolRoutineWorkMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="gridId" column="GRID_ID"/>
<result property="gridName" column="GRID_NAME"/>
<result property="firstWorkType" column="FIRST_WORK_TYPE"/>
<result property="secondWorkType" column="SECOND_WORK_TYPE"/>
<result property="eventName" column="EVENT_NAME"/>
<result property="happenTime" column="HAPPEN_TIME"/>
<result property="workResult" column="WORK_RESULT"/>
<result property="workContent" column="WORK_CONTENT"/>
<result property="keyAreaType" column="KEY_AREA_TYPE"/>
<result property="regionScale" column="REGION_SCALE"/>
<result property="isKeyareaState" column="IS_KEYAREA_STATE"/>
<result property="isKeypeopleLocate" column="IS_KEY_PEOPLE_LOCATE"/>
<result property="keypeopleStatus" column="KEY_PEOPLE_STATUS"/>
<result property="happenPlace" column="HAPPEN_PLACE"/>
<result property="lng" column="LNG"/>
<result property="lat" column="LAT"/>
<result property="flag" column="FLAG"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createBy" column="CREATE_BY"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="updateBy" column="UPDATE_BY"/>
<result property="updateTime" column="UPDATE_TIME"/>
</resultMap>
<select id="getBaseGridDailyWork" resultType="com.epmet.opendata.entity.BaseGridDailyworkEntity">
SELECT '370124' AS qxBm,
'平阴县' AS qxMc,
w.SECOND_WORK_TYPE AS workType,
w.GRID_ID,
w.GRID_NAME,
concat(w.HAPPEN_TIME,' 00:00:00') as happenTimeString,
w.WORK_RESULT,
w.WORK_CONTENT,
w.update_time,
w.create_time as recoredInsertTime
FROM base_grid_dailywork w
WHERE w.CUSTOMER_ID = #{customerId}
ORDER BY w.CREATE_TIME ASC
LIMIT #{size},1000
</select>
</mapper>

3
epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/EventreportPingyinDao.xml

@ -39,6 +39,9 @@
<result property="isDel" column="is_del"/>
<result property="recoredInsertTime" column="recored_insert_time"/>
</resultMap>
<delete id="deleteAllData">
DELETE FROM eventreport_pingyin
</delete>
</mapper>

21
epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridInfoPingyinDao.xml

@ -22,5 +22,26 @@
<result property="recoredInsertTime" column="recored_insert_time"/>
</resultMap>
<delete id="deleteAllAgencyData">
delete from grid_info_pingyin where grid_level !='7'
</delete>
<delete id="deleteAllGridData">
delete from grid_info_pingyin where grid_level ='7'
</delete>
<select id="selectByGridCode" parameterType="java.lang.String" resultType="com.epmet.opendata.entity.GridInfoPingyinEntity">
select g.* from grid_info_pingyin g
where g.grid_code = #{gridCode}
</select>
<update id="updateSomeCol" parameterType="map">
update grid_info_pingyin
set grid_name = #{gridName},
grid_level = #{gridLevel},
lng = #{lng},
lat = #{lat}
where id = #{id}
</update>
</mapper>

33
epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridstaffInfoPingyinDao.xml

@ -3,35 +3,8 @@
<mapper namespace="com.epmet.opendata.dao.GridstaffInfoPingyinDao">
<resultMap type="com.epmet.opendata.entity.GridstaffInfoPingyinEntity" id="gridstaffInfoPingyinMap">
<result property="id" column="id"/>
<result property="qxBm" column="qx_bm"/>
<result property="qxMc" column="qx_mc"/>
<result property="gridUserId" column="grid_user_id"/>
<result property="gridCode" column="grid_code"/>
<result property="gridName" column="grid_name"/>
<result property="nickName" column="nick_name"/>
<result property="cardNum" column="card_num"/>
<result property="userType" column="user_type"/>
<result property="phonenumber" column="phonenumber"/>
<result property="sex" column="sex"/>
<result property="nation" column="nation"/>
<result property="paerty" column="paerty"/>
<result property="birthday" column="birthday"/>
<result property="education" column="education"/>
<result property="entryDate" column="ENTRY_DATE"/>
<result property="isLeave" column="IS_LEAVE"/>
<result property="leaveDate" column="LEAVE_DATE"/>
<result property="income" column="INCOME"/>
<result property="isCommittee" column="IS_COMMITTEE"/>
<result property="isCommunityWorkers" column="IS_COMMUNITY_WORKERS"/>
<result property="isSocialWorker" column="IS_SOCIAL_WORKER"/>
<result property="isVillageLeader" column="IS_VILLAGE_LEADER"/>
<result property="isPoliceAssistant" column="IS_POLICE_ASSISTANT"/>
<result property="isMediator" column="IS_MEDIATOR"/>
<result property="updateTime" column="update_time"/>
<result property="recoredInsertTime" column="recored_insert_time"/>
</resultMap>
<delete id="del">
delete from gridstaff_info_pingyin
</delete>
</mapper>

3
epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridstaffWorkInfoPingyinDao.xml

@ -18,6 +18,9 @@
<result property="isDel" column="is_del"/>
<result property="recoredInsertTime" column="recored_insert_time"/>
</resultMap>
<delete id="delAllGridStaffWorkInfoPY">
delete from gridstaff_work_info_pingyin LIMIT 1000
</delete>
</mapper>

2
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolRoutineWorkResult.java

@ -22,6 +22,8 @@ public class PatrolRoutineWorkResult implements Serializable {
private String customerId;
private String gridId;
private String gridCode;
private String gridName;
private String title;

3
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java

@ -689,6 +689,9 @@ public interface EpmetUserOpenFeignClient {
@PostMapping(value = "/epmetuser/patrolroutinework/selectList")
Result<List<PatrolRoutineWorkResult>> getPatrolRoutineWorkList(@RequestBody PatrolQueryFormDTO patrolQueryFormDTO);
@PostMapping(value = "/epmetuser/patrolroutinework/selectListV2")
Result<List<PatrolRoutineWorkResult>> getPatrolRoutineWorkListV2(@RequestBody PatrolQueryFormDTO patrolQueryFormDTO);
/**
* 获取ic_resi_user
* @param icResiUserId

5
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java

@ -510,6 +510,11 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getPatrolRoutineWorkList", patrolQueryFormDTO);
}
@Override
public Result<List<PatrolRoutineWorkResult>> getPatrolRoutineWorkListV2(PatrolQueryFormDTO patrolQueryFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getPatrolRoutineWorkListV2", patrolQueryFormDTO);
}
@Override
public Result<IcResiUserDTO> getIcResiUserDTO(String icResiUserId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getIcResiUserDTO", icResiUserId);

7
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/PatrolRoutineWorkController.java

@ -47,6 +47,13 @@ public class PatrolRoutineWorkController {
Page<PatrolRoutineWorkResult> data = gridUserWorkService.listPage(formDTO);
return new Result().ok(data.getResult());
}
@NoRepeatSubmit
@PostMapping("selectListV2")
public Result<List<PatrolRoutineWorkResult>> gridUserWorkV2(@RequestBody PatrolQueryFormDTO formDTO){
Page<PatrolRoutineWorkResult> data = gridUserWorkService.listPage(formDTO);
return new Result().ok(data.getResult());
}
/**
* @Description 添加例行工作
* @param formDTO

Loading…
Cancel
Save