Browse Source

Merge branch 'wxz_demand_service_stats' into dev_ic_mp

# Conflicts:
#	epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/VolunteerInfoEntity.java
#	epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java
#	epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
master
wangxianzhang 4 years ago
parent
commit
17df75d84d
  1. 2
      epmet-auth/src/main/resources/bootstrap.yml
  2. 5
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffPatrolDetailDTO.java
  3. 5
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolRecordDetailDTO.java
  4. 4
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java
  5. 19
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/heart/VolunteerDemandServiceFormDTO.java
  6. 12
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/heart/DataReportHeartDemandController.java
  7. 5
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactVolunteerServiceDailyDao.java
  8. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/heart/DemandService.java
  9. 44
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/heart/impl/DemandServiceImpl.java
  10. 13
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactVolunteerServiceDailyDao.xml
  11. 2
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml
  12. 7
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenCentralZoneDataFormDTO.java
  13. 23
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  14. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/IcUserDemandServiceDao.java
  15. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactVolunteerServiceDailyEntity.java
  16. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java
  17. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/HeartDemandService.java
  18. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/HeartDemandServiceImpl.java
  19. 83
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DemandServiceImpl.java
  20. 14
      epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.27__volunteer_service_daily_add_gridid.sql
  21. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/IcUserDemandServiceDao.xml
  22. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactVolunteerServiceDailyDao.xml
  23. 12
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/VolunteerCommonFormDTO.java
  24. 1
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java
  25. 6
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java
  26. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java
  27. 26
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java
  28. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/VolunteerInfoDao.xml
  29. 0
      epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/uv11__point_rule_sort.sql
  30. 8
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/BlockChainProjectController.java
  31. 21
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzIssueCategoryDTO.java
  32. 8
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java
  33. 4
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java
  34. 46
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml
  35. 46
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
  36. 2
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml
  37. 4
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/BlockChainUploadServiceImpl.java
  38. 21
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolUploadDetailFormDTO.java
  39. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolUploadFormDTO.java
  40. 3
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VolunteerCommonFormDTO.java
  41. 71
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  42. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffPatrolController.java
  43. 3
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/VolunteerController.java
  44. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffPatrolDetailEntity.java
  45. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffPatrolRecordService.java
  46. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/VolunteerService.java
  47. 40
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java
  48. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/VolunteerServiceImpl.java
  49. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_import_cid_for_easy_excel.xls

2
epmet-auth/src/main/resources/bootstrap.yml

@ -32,6 +32,8 @@ spring:
namespace: @nacos.discovery.namespace@ namespace: @nacos.discovery.namespace@
#不把自己注册到注册中心的地址 #不把自己注册到注册中心的地址
register-enabled: @nacos.register-enabled@ register-enabled: @nacos.register-enabled@
serviceListChangedListening:
enable: @nacos.service-list-changed-listening.enable@
config: config:
enabled: @nacos.config-enabled@ enabled: @nacos.config-enabled@
server-addr: @nacos.server-addr@ server-addr: @nacos.server-addr@

5
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffPatrolDetailDTO.java

@ -17,9 +17,10 @@
package com.epmet.dataaggre.dto.epmetuser; package com.epmet.dataaggre.dto.epmetuser;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import lombok.Data;
/** /**
@ -94,7 +95,7 @@ public class StaffPatrolDetailDTO implements Serializable {
private String horizontalaccuracy; private String horizontalaccuracy;
/** /**
* 地址暂时不用 * 地址
*/ */
private String address; private String address;

5
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolRecordDetailDTO.java

@ -34,4 +34,9 @@ public class PatrolRecordDetailDTO implements Serializable {
* 后端返回开始巡查结束巡查此列只有集合第一条和最后一条有值 * 后端返回开始巡查结束巡查此列只有集合第一条和最后一条有值
*/ */
private String flag; private String flag;
/**
* 位置信息
*/
private String address;
} }

4
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java

@ -226,8 +226,7 @@ public class EpmetUserServiceImpl implements EpmetUserService {
String totalTimeDesc = minutes / 60 + "小时"+ minutes % 60 + "分"; String totalTimeDesc = minutes / 60 + "小时"+ minutes % 60 + "分";
dto.setTotalTimeDesc(totalTimeDesc); dto.setTotalTimeDesc(totalTimeDesc);
List<StaffPatrolDetailDTO> detailList = details.get(record.getId()); List<StaffPatrolDetailDTO> detailList = details.get(record.getId());
detailList = detailList = detailList.stream().sorted(Comparator.comparing(StaffPatrolDetailDTO::getSerialNum).reversed()).collect(Collectors.toList()).stream()
detailList.stream().sorted(Comparator.comparing(StaffPatrolDetailDTO::getSerialNum).reversed()).collect(Collectors.toList()).stream()
.filter(item -> null == record.getPatrolEndTime() || record.getPatrolEndTime().compareTo(item.getUploadTime()) > -1).collect(Collectors.toList()); .filter(item -> null == record.getPatrolEndTime() || record.getPatrolEndTime().compareTo(item.getUploadTime()) > -1).collect(Collectors.toList());
List<PatrolRecordDetailDTO> recordDetails = detailList.stream().map( detail -> { List<PatrolRecordDetailDTO> recordDetails = detailList.stream().map( detail -> {
PatrolRecordDetailDTO detailDTO = new PatrolRecordDetailDTO(); PatrolRecordDetailDTO detailDTO = new PatrolRecordDetailDTO();
@ -235,6 +234,7 @@ public class EpmetUserServiceImpl implements EpmetUserService {
detailDTO.setLongitude(detail.getLongitude()); detailDTO.setLongitude(detail.getLongitude());
detailDTO.setSpeed(detail.getSpeed()); detailDTO.setSpeed(detail.getSpeed());
detailDTO.setUploadTime(DateUtils.format(detail.getUploadTime(), DateUtils.DATE_TIME_PATTERN)); detailDTO.setUploadTime(DateUtils.format(detail.getUploadTime(), DateUtils.DATE_TIME_PATTERN));
detailDTO.setAddress(detail.getAddress());
return detailDTO; return detailDTO;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
if (("end").equals(record.getStatus())) { if (("end").equals(record.getStatus())) {

19
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/heart/VolunteerDemandServiceFormDTO.java

@ -0,0 +1,19 @@
package com.epmet.dto.form.heart;
import lombok.Data;
/**
* @Description
* @Author wangxianzhang
* @Date 2021/12/22 3:12 下午
* @Version 1.0
*/
@Data
public class VolunteerDemandServiceFormDTO {
/**
* 组织ID
*/
private String agencyId;
}

12
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/heart/DataReportHeartDemandController.java

@ -3,10 +3,13 @@ package com.epmet.datareport.controller.heart;
import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.heart.DemandService; import com.epmet.datareport.service.heart.DemandService;
import com.epmet.dto.form.heart.VolunteerDemandServiceFormDTO;
import com.epmet.dto.result.heart.VolunteerDemandServiceStatsResultDTO; import com.epmet.dto.result.heart.VolunteerDemandServiceStatsResultDTO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; 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.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -29,9 +32,14 @@ public class DataReportHeartDemandController {
* @return * @return
*/ */
@PostMapping("volunteer/service") @PostMapping("volunteer/service")
public Result<VolunteerDemandServiceStatsResultDTO> getVolunteerServiceStats(@LoginUser TokenDto loginUser) { public Result<VolunteerDemandServiceStatsResultDTO> getVolunteerServiceStats(@LoginUser TokenDto loginUser, @RequestBody VolunteerDemandServiceFormDTO input) {
ValidatorUtils.validateEntity(input);
String agencyId = input.getAgencyId();
String customerId = loginUser.getCustomerId(); String customerId = loginUser.getCustomerId();
VolunteerDemandServiceStatsResultDTO r = demandService.getVolunteerServiceStats(customerId);
VolunteerDemandServiceStatsResultDTO r = demandService.getVolunteerServiceStats(customerId, agencyId);
return new Result<VolunteerDemandServiceStatsResultDTO>().ok(r); return new Result<VolunteerDemandServiceStatsResultDTO>().ok(r);
} }

5
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactVolunteerServiceDailyDao.java

@ -36,8 +36,9 @@ public interface FactVolunteerServiceDailyDao extends BaseDao<FactVolunteerServi
/** /**
* 查询最新一条"志愿者需求服务统计信息" * 查询最新一条"志愿者需求服务统计信息"
* @param customerId * @param customerId 客户ID
* @param agencyPids 查询条件的组织的PIDS
* @return * @return
*/ */
VolunteerDemandServiceStatsResultDTO getLatestVolunteerDemandServiceStats(@Param("customerId") String customerId); VolunteerDemandServiceStatsResultDTO getLatestVolunteerDemandServiceStats(@Param("customerId") String customerId, @Param("agencyPids") String agencyPids);
} }

2
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/heart/DemandService.java

@ -9,5 +9,5 @@ import com.epmet.dto.result.heart.VolunteerDemandServiceStatsResultDTO;
* @Version 1.0 * @Version 1.0
*/ */
public interface DemandService { public interface DemandService {
VolunteerDemandServiceStatsResultDTO getVolunteerServiceStats(String customerId); VolunteerDemandServiceStatsResultDTO getVolunteerServiceStats(String customerId, String agencyId);
} }

44
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/heart/impl/DemandServiceImpl.java

@ -1,12 +1,14 @@
package com.epmet.datareport.service.heart.impl; package com.epmet.datareport.service.heart.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.constant.DataSourceConstant; import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.datareport.dao.fact.FactVolunteerServiceDailyDao; import com.epmet.datareport.dao.fact.FactVolunteerServiceDailyDao;
import com.epmet.datareport.entity.heart.FactVolunteerServiceDailyEntity;
import com.epmet.datareport.service.heart.DemandService; import com.epmet.datareport.service.heart.DemandService;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.result.heart.VolunteerDemandServiceStatsResultDTO; import com.epmet.dto.result.heart.VolunteerDemandServiceStatsResultDTO;
import com.epmet.feign.GovOrgOpenFeignClient;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -17,13 +19,41 @@ import org.springframework.stereotype.Service;
* @Version 1.0 * @Version 1.0
*/ */
@Service @Service
public class DemandServiceImpl implements DemandService { public class DemandServiceImpl implements DemandService, ResultDataResolver {
@Autowired @Autowired
private FactVolunteerServiceDailyDao factVolunteerServiceDailyDao; private FactVolunteerServiceDailyDao factVolunteerServiceDailyDao;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Override @Override
public VolunteerDemandServiceStatsResultDTO getVolunteerServiceStats(String customerId) { public VolunteerDemandServiceStatsResultDTO getVolunteerServiceStats(String customerId, String agencyId) {
return factVolunteerServiceDailyDao.getLatestVolunteerDemandServiceStats(customerId);
String errorMsg = "【查询志愿者需求服务信息】查询选中组织信息失败";
CustomerAgencyDTO agencyInfo = getResultDataOrThrowsException(govOrgOpenFeignClient.getAgencyById(agencyId),
ServiceConstant.GOV_ORG_SERVER,
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),
errorMsg, errorMsg);
if (agencyInfo == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg);
}
String agencyIdPath = agencyInfo.getPids().concat(":").concat(agencyId);
agencyIdPath = agencyIdPath.startsWith(":") ? agencyIdPath.replaceFirst(":", "") : agencyIdPath;
VolunteerDemandServiceStatsResultDTO r = factVolunteerServiceDailyDao.getLatestVolunteerDemandServiceStats(customerId, agencyIdPath);
if (r == null) {
r = new VolunteerDemandServiceStatsResultDTO();
r.setCustomerId(customerId);
r.setDateId(null);
r.setPartyServiceTotal(0);
r.setServiceTotal(0);
r.setResiServiceTotal(0);
r.setVolunteerTotal(0);
r.setPartyTotal(0);
r.setResiTotal(0);
}
return r;
} }
} }

13
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactVolunteerServiceDailyDao.xml

@ -24,12 +24,21 @@
<select id="getLatestVolunteerDemandServiceStats" <select id="getLatestVolunteerDemandServiceStats"
resultType="com.epmet.dto.result.heart.VolunteerDemandServiceStatsResultDTO"> resultType="com.epmet.dto.result.heart.VolunteerDemandServiceStatsResultDTO">
select * select CUSTOMER_ID CUSTOMER_ID,
DATE_ID DATE_ID,
sum(VOLUNTEER_TOTAL) VOLUNTEER_TOTAL,
sum(PARTY_TOTAL) PARTY_TOTAL,
sum(RESI_TOTAL) RESI_TOTAL,
sum(SERVICE_TOTAL) SERVICE_TOTAL,
sum(PARTY_SERVICE_TOTAL) PARTY_SERVICE_TOTAL,
sum(RESI_SERVICE_TOTAL) RESI_SERVICE_TOTAL
from fact_volunteer_service_daily from fact_volunteer_service_daily
where DEL_FLAG = 0 where DEL_FLAG = 0
and CUSTOMER_ID = #{customerId} and CUSTOMER_ID = #{customerId}
and PIDS like CONCAT(#{agencyPids}, "%")
group by CUSTOMER_ID, DATE_ID
order by DATE_ID desc order by DATE_ID desc
limit 1 limit 1
</select> </select>

2
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml

@ -46,7 +46,7 @@
IFNULL(avg(data.publish_issue_ratio),0) AS publishIssueRatioA, IFNULL(avg(data.publish_issue_ratio),0) AS publishIssueRatioA,
CEILING(sum(data.PLAT_ISSUE_TOTAL)) AS platIssueTotal, CEILING(sum(data.PLAT_ISSUE_TOTAL)) AS platIssueTotal,
IFNULL(avg(data.PLAT_JOIN_PARTY_RATIO),0) AS platJoinPartyRatio, IFNULL(avg(data.PLAT_JOIN_PARTY_RATIO),0) AS platJoinPartyRatio,
DATA_END_TIME as dataEndTime data.DATA_END_TIME as dataEndTime
FROM FROM
screen_pioneer_data data screen_pioneer_data data
LEFT JOIN LEFT JOIN

7
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenCentralZoneDataFormDTO.java

@ -1,9 +1,6 @@
package com.epmet.dto.screen.form; package com.epmet.dto.screen.form;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.RequiredArgsConstructor;
import java.io.Serializable; import java.io.Serializable;
@ -26,4 +23,8 @@ public class ScreenCentralZoneDataFormDTO implements Serializable {
* 时间维度 不一定是dateId 需要根据其格式进行判断维度的类型 * 时间维度 不一定是dateId 需要根据其格式进行判断维度的类型
* */ * */
private String dateId; private String dateId;
private String startDate;
private String endDate;
} }

23
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java

@ -881,10 +881,17 @@ public class DemoController {
*/ */
@PostMapping("project-test") @PostMapping("project-test")
public Result project(@RequestBody ScreenCentralZoneDataFormDTO param) { public Result project(@RequestBody ScreenCentralZoneDataFormDTO param) {
if(StringUtils.isBlank(param.getDateId())){ List<String> dateIds = new ArrayList<>();
//默认截止到昨天。 if ((StringUtils.isBlank(param.getStartDate()) && StringUtils.isBlank(param.getEndDate()))){
param.setDateId(DateUtils.getBeforeNDay(1)); if (StringUtils.isNotBlank(param.getDateId())){
dateIds.add(param.getDateId());
}else {
dateIds.add(DimIdGenerator.getDateDimId(DateUtils.addDateDays(new Date(), -1)));
}
}else {
dateIds = DateUtils.getDaysBetween(param.getStartDate(), param.getEndDate());
} }
List<String> customerIds = new ArrayList(); List<String> customerIds = new ArrayList();
if (StringUtils.isNotBlank(param.getCustomerId())) { if (StringUtils.isNotBlank(param.getCustomerId())) {
customerIds.add(param.getCustomerId()); customerIds.add(param.getCustomerId());
@ -892,10 +899,12 @@ public class DemoController {
customerIds = dimCustomerService.selectCustomerIdPage(1, 100); customerIds = dimCustomerService.selectCustomerIdPage(1, 100);
} }
for (String customerId : customerIds) { for (String customerId : customerIds) {
ScreenCentralZoneDataFormDTO formDTO = new ScreenCentralZoneDataFormDTO(); dateIds.forEach(dateId -> {
formDTO.setCustomerId(customerId); ScreenCentralZoneDataFormDTO formDTO = new ScreenCentralZoneDataFormDTO();
formDTO.setDateId(param.getDateId()); formDTO.setCustomerId(customerId);
screenProjectSettleService.extractScreenData(param); formDTO.setDateId(dateId);
screenProjectSettleService.extractScreenData(formDTO);
});
} }
return new Result(); return new Result();
} }

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/IcUserDemandServiceDao.java

@ -40,5 +40,5 @@ public interface IcUserDemandServiceDao extends BaseDao<IcUserDemandServiceEntit
* @param customerId 客户id * @param customerId 客户id
* @param serviceType 服务者类型 * @param serviceType 服务者类型
*/ */
List<DemandServiceCountResultDTO> listDemandServeTimes(@Param("customerId") String customerId, @Param("endTime") Date endTime, @Param("serviceType") String serviceType); List<DemandServiceCountResultDTO> listDemandServeTimes(@Param("customerId") String customerId, @Param("gridId") String gridId, @Param("endTime") Date endTime, @Param("serviceType") String serviceType);
} }

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactVolunteerServiceDailyEntity.java

@ -43,6 +43,11 @@ public class FactVolunteerServiceDailyEntity extends BaseEpmetEntity {
*/ */
private String customerId; private String customerId;
/**
* 网格ID
*/
private String gridId;
/** /**
* yyyyMMdd * yyyyMMdd
*/ */
@ -82,5 +87,9 @@ public class FactVolunteerServiceDailyEntity extends BaseEpmetEntity {
* 居民服务总次数 * 居民服务总次数
*/ */
private Integer resiServiceTotal; private Integer resiServiceTotal;
private String pid;
private String pids;
} }

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

@ -266,6 +266,12 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl<ScreenProjectD
List<List<ScreenProjectDataDTO>> partition = ListUtils.partition(meta, NumConstant.ONE_HUNDRED); List<List<ScreenProjectDataDTO>> partition = ListUtils.partition(meta, NumConstant.ONE_HUNDRED);
partition.forEach(part -> { partition.forEach(part -> {
List<ScreenProjectDataEntity> list = ConvertUtils.sourceToTarget(part, ScreenProjectDataEntity.class); List<ScreenProjectDataEntity> list = ConvertUtils.sourceToTarget(part, ScreenProjectDataEntity.class);
// 把来源网格的,已结案的项目,满意度分默认设置80
list.forEach(l -> {
if (l.getOrgType().equals("grid") && l.getProjectStatusCode().equals("closed_case")){
l.setSatisfactionScore(new BigDecimal(NumConstant.EIGHTY));
}
});
insertBatch(list); insertBatch(list);
saveCategory(customerId, list); saveCategory(customerId, list);
}); });

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/HeartDemandService.java

@ -11,5 +11,5 @@ import java.util.List;
*@Date 2021/12/8 *@Date 2021/12/8
*/ */
public interface HeartDemandService { public interface HeartDemandService {
List<DemandServiceCountResultDTO> listDemandServeTimesPage(String customerId, Date endTime, int serviceCountPageNo, int serviceCountPageSize); List<DemandServiceCountResultDTO> listDemandServeTimesPage(String customerId, String gridId, Date endTime, int serviceCountPageNo, int serviceCountPageSize);
} }

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/HeartDemandServiceImpl.java

@ -29,11 +29,11 @@ public class HeartDemandServiceImpl implements HeartDemandService {
private IcUserDemandServiceDao demandServiceDao; private IcUserDemandServiceDao demandServiceDao;
@Override @Override
public List<DemandServiceCountResultDTO> listDemandServeTimesPage(String customerId, Date endTime, int serviceCountPageNo, int serviceCountPageSize) { public List<DemandServiceCountResultDTO> listDemandServeTimesPage(String customerId, String gridId, Date endTime, int serviceCountPageNo, int serviceCountPageSize) {
return PageHelper.startPage(serviceCountPageNo, serviceCountPageSize).doSelectPage(new ISelect() { return PageHelper.startPage(serviceCountPageNo, serviceCountPageSize).doSelectPage(new ISelect() {
@Override @Override
public void doSelect() { public void doSelect() {
demandServiceDao.listDemandServeTimes(customerId, endTime, "volunteer"); demandServiceDao.listDemandServeTimes(customerId, gridId, endTime, "volunteer");
} }
}); });
} }

83
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DemandServiceImpl.java

@ -1,11 +1,16 @@
package com.epmet.service.impl; package com.epmet.service.impl;
import com.epmet.commons.tools.constant.EpmetRoleKeyConstant; import com.epmet.commons.tools.constant.EpmetRoleKeyConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.heart.result.DemandServiceCountResultDTO; import com.epmet.dto.heart.result.DemandServiceCountResultDTO;
import com.epmet.entity.crm.CustomerEntity;
import com.epmet.entity.heart.VolunteerInfoEntity; import com.epmet.entity.heart.VolunteerInfoEntity;
import com.epmet.entity.stats.FactVolunteerServiceDailyEntity; import com.epmet.entity.stats.FactVolunteerServiceDailyEntity;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.DemandService; import com.epmet.service.DemandService;
import com.epmet.service.crm.CustomerService; import com.epmet.service.crm.CustomerService;
import com.epmet.service.heart.HeartDemandService; import com.epmet.service.heart.HeartDemandService;
@ -27,7 +32,7 @@ import java.util.stream.Collectors;
* @Version 1.0 * @Version 1.0
*/ */
@Service @Service
public class DemandServiceImpl implements DemandService { public class DemandServiceImpl implements DemandService, ResultDataResolver {
@Autowired @Autowired
private HeartDemandService heartDemandService; private HeartDemandService heartDemandService;
@ -37,12 +42,15 @@ public class DemandServiceImpl implements DemandService {
@Autowired @Autowired
private UserService userService; private UserService userService;
@Autowired @Autowired
private DemandStatsService demandStatsService; private DemandStatsService demandStatsService;
@Autowired @Autowired
private CustomerService customerService; private CustomerService customerService;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Override @Override
public void statsVolunteerDemandServicesDaily(String customerId) { public void statsVolunteerDemandServicesDaily(String customerId) {
@ -50,7 +58,7 @@ public class DemandServiceImpl implements DemandService {
Date now = new Date(); Date now = new Date();
Date today = DateUtils.integrate(now, "yyyy-MM-dd"); Date today = DateUtils.integrate(now, "yyyy-MM-dd");
Date yestoday = DateUtils.addDateDays(today, -1); Date yestoday = DateUtils.addDateDays(today, -1);
if (StringUtils.isNotBlank(customerId)) { if (StringUtils.isNotBlank(customerId)) {
// 只计算单个客户 // 只计算单个客户
clearOldDatas(Arrays.asList(customerId), yestoday); clearOldDatas(Arrays.asList(customerId), yestoday);
@ -67,7 +75,8 @@ public class DemandServiceImpl implements DemandService {
/** /**
* 清理旧数据 * 清理旧数据
* @param targetDate 要清理哪天的数据 *
* @param targetDate 要清理哪天的数据
* @param customerIds 要清理哪些客户的 * @param customerIds 要清理哪些客户的
*/ */
private void clearOldDatas(List<String> customerIds, Date targetDate) { private void clearOldDatas(List<String> customerIds, Date targetDate) {
@ -80,12 +89,44 @@ public class DemandServiceImpl implements DemandService {
/** /**
* 统计单个客户的志愿者服务情况 * 统计单个客户的志愿者服务情况
*
* @param customerId 客户ID * @param customerId 客户ID
* @param endTime 统计截止时间(<endTime) * @param endTime 统计截止时间(<endTime)
*/ */
private void statsVolunteerDemandServicesDaily4Customer(String customerId, Date endTime, Date belongTime) { private void statsVolunteerDemandServicesDaily4Customer(String customerId, Date endTime, Date belongTime) {
// 一.将客户下所有志愿者,按照网格ID,放到map中去
// 网格ID和志愿者列表。key:网格id;value:志愿者列表
HashMap<String, List<VolunteerInfoEntity>> gridIdAndVolunteers = new HashMap<>();
heartVolunteerService.listVolunteers(customerId, endTime).forEach(v -> {
String volunteerGridId = v.getGridId();
if (StringUtils.isNotBlank(volunteerGridId)) {
if (!gridIdAndVolunteers.containsKey(volunteerGridId)) {
gridIdAndVolunteers.put(volunteerGridId, new ArrayList<>());
}
gridIdAndVolunteers.get(volunteerGridId).add(v);
}
});
// 2.按网格分别统计,且持久化
for (Map.Entry<String, List<VolunteerInfoEntity>> entry : gridIdAndVolunteers.entrySet()) {
statsVolunteerDemandServicesDaily4Grid(customerId, entry.getKey(), endTime, entry.getValue(), belongTime);
}
}
/**
* 按日统计网格需求服务数据
* @param customerId
* @param gridId
* @param endTime 统计截止时间
* @param volunteers 志愿者volunteerInfo列表
* @param belongTime 该次统计要归属到哪一天即createTime
* @return 统计结果entity以备他用
*/
private FactVolunteerServiceDailyEntity statsVolunteerDemandServicesDaily4Grid(String customerId, String gridId, Date endTime, List<VolunteerInfoEntity> volunteers, Date belongTime) {
// 1.志愿者分流为党员志愿者&普通居民志愿者 // 1.志愿者分流为党员志愿者&普通居民志愿者
Integer volunteerTotalCount = 0; Integer volunteerTotalCount = volunteers.size();
// 党员志愿者数量 // 党员志愿者数量
Integer partymemberVolunteerCount = 0; Integer partymemberVolunteerCount = 0;
// 居民志愿者数量 // 居民志愿者数量
@ -94,15 +135,13 @@ public class DemandServiceImpl implements DemandService {
// 党员志愿者用户id列表 // 党员志愿者用户id列表
List<String> partymemberVolunteerUserIds = new ArrayList<>(16); List<String> partymemberVolunteerUserIds = new ArrayList<>(16);
List<VolunteerInfoEntity> volunteers = heartVolunteerService.listVolunteers(customerId, endTime); //--------------------------------【以上是结果数据变量】------------------------------------------
volunteerTotalCount = volunteers.size();
// 分片开始下标 // 分片开始下标
int shardingStartIndex = 0; int shardingStartIndex = 0;
// 分片大小(条数) // 分片大小(条数)
int shardingSize = 100; int shardingSize = 100;
// 分片去确定党员身份,防止in条件过大 // 分片去确定党员身份,防止in条件过大
while (true) { while (true) {
int realShardingSize = Math.min(shardingSize, volunteerTotalCount - shardingStartIndex); int realShardingSize = Math.min(shardingSize, volunteerTotalCount - shardingStartIndex);
@ -141,7 +180,7 @@ public class DemandServiceImpl implements DemandService {
while (true) { while (true) {
// 取出每一个服务者的服务次数 // 取出每一个服务者的服务次数
List<DemandServiceCountResultDTO> damendServeTimes = heartDemandService.listDemandServeTimesPage(customerId, endTime, serviceCountPageNo, serviceCountPageSize); List<DemandServiceCountResultDTO> damendServeTimes = heartDemandService.listDemandServeTimesPage(customerId, gridId, endTime, serviceCountPageNo, serviceCountPageSize);
for (DemandServiceCountResultDTO damendServiceTimes : damendServeTimes) { for (DemandServiceCountResultDTO damendServiceTimes : damendServeTimes) {
String serverId = damendServiceTimes.getServerId(); String serverId = damendServiceTimes.getServerId();
@ -158,11 +197,12 @@ public class DemandServiceImpl implements DemandService {
} }
totalDemandServeTimes = partymemberDemandServeTimes + resiDemandServeTimes; totalDemandServeTimes = partymemberDemandServeTimes + resiDemandServeTimes;
// 3.持久化 // 3.组装entity数据返回,待存储
FactVolunteerServiceDailyEntity insert = new FactVolunteerServiceDailyEntity(); FactVolunteerServiceDailyEntity insert = new FactVolunteerServiceDailyEntity();
insert.setDateId(DimIdGenerator.getDateDimId(belongTime)); insert.setDateId(DimIdGenerator.getDateDimId(belongTime));
insert.setCustomerId(customerId); insert.setCustomerId(customerId);
insert.setGridId(gridId);
insert.setMonthId(DimIdGenerator.getMonthDimId(belongTime)); insert.setMonthId(DimIdGenerator.getMonthDimId(belongTime));
insert.setPartyServiceTotal(partymemberDemandServeTimes); insert.setPartyServiceTotal(partymemberDemandServeTimes);
insert.setServiceTotal(totalDemandServeTimes); insert.setServiceTotal(totalDemandServeTimes);
@ -171,6 +211,19 @@ public class DemandServiceImpl implements DemandService {
insert.setResiTotal(resiVolunteerCount); insert.setResiTotal(resiVolunteerCount);
insert.setVolunteerTotal(volunteerTotalCount); insert.setVolunteerTotal(volunteerTotalCount);
CustomerGridFormDTO gridForm = new CustomerGridFormDTO();
gridForm.setGridId(gridId);
String errorMsg = "【志愿者服务按日统计】查询网格基本信息失败";
CustomerGridDTO gridInfo = getResultDataOrThrowsException(govOrgOpenFeignClient.getGridBaseInfoByGridId(gridForm), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg);
Optional.ofNullable(gridInfo).ifPresent(gi -> {
insert.setPid(gi.getPid());
insert.setPids(gi.getPids());
});
// 持久化
demandStatsService.addVolunteerServiceDaily(insert); demandStatsService.addVolunteerServiceDaily(insert);
return insert;
} }
} }

14
epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.27__volunteer_service_daily_add_gridid.sql

@ -0,0 +1,14 @@
-- 发布前执行
alter table fact_volunteer_service_daily add column GRID_ID varchar(64) not null comment '网格ID' after CUSTOMER_ID;
alter table fact_volunteer_service_daily add column PID varchar(64) default '' comment 'pid网格父级ID' after RESI_SERVICE_TOTAL;
alter table fact_volunteer_service_daily add column PIDS varchar(255) default '' comment 'pid网格父级ID路径,包含PID' after PID;
-- 发布后执行
delete from fact_volunteer_service_daily;
alter table fact_volunteer_service_daily drop key uni_vsd;
alter table fact_volunteer_service_daily
add constraint uni_vsd
unique (GRID_ID, DATE_ID, DEL_FLAG);

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/IcUserDemandServiceDao.xml

@ -24,11 +24,13 @@
select service.SERVER_ID, SERVICE_TYPE, count(1) as SERVE_TIMES select service.SERVER_ID, SERVICE_TYPE, count(1) as SERVE_TIMES
from ic_user_demand_rec damend from ic_user_demand_rec damend
inner join ic_user_demand_service service on (damend.ID = service.DEMAND_REC_ID and service.DEL_FLAG = 0) inner join ic_user_demand_service service on (damend.ID = service.DEMAND_REC_ID and service.DEL_FLAG = 0)
inner join volunteer_info v on (service.SERVER_ID = v.USER_ID and v.DEL_FLAG = 0)
where damend.DEL_FLAG = 0 where damend.DEL_FLAG = 0
and damend.STATUS = 'finished' and damend.STATUS = 'finished'
and damend.CUSTOMER_ID = #{customerId} and damend.CUSTOMER_ID = #{customerId}
and service.SERVICE_END_TIME <![CDATA[<]]> #{endTime} and service.SERVICE_END_TIME <![CDATA[<]]> #{endTime}
and service.SERVICE_TYPE = #{serviceType} and service.SERVICE_TYPE = #{serviceType}
and v.GRID_ID = #{gridId}
group by service.SERVER_ID, SERVICE_TYPE group by service.SERVER_ID, SERVICE_TYPE
</select> </select>
</mapper> </mapper>

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactVolunteerServiceDailyDao.xml

@ -14,6 +14,8 @@
<result property="serviceTotal" column="SERVICE_TOTAL"/> <result property="serviceTotal" column="SERVICE_TOTAL"/>
<result property="partyServiceTotal" column="PARTY_SERVICE_TOTAL"/> <result property="partyServiceTotal" column="PARTY_SERVICE_TOTAL"/>
<result property="resiServiceTotal" column="RESI_SERVICE_TOTAL"/> <result property="resiServiceTotal" column="RESI_SERVICE_TOTAL"/>
<result property="pid" column="PID"/>
<result property="pids" column="PIDS"/>
<result property="delFlag" column="DEL_FLAG"/> <result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/> <result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/> <result property="createdBy" column="CREATED_BY"/>

12
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/VolunteerCommonFormDTO.java

@ -14,12 +14,16 @@ import javax.validation.constraints.NotNull;
@Data @Data
public class VolunteerCommonFormDTO { public class VolunteerCommonFormDTO {
public interface VolunteerPage { /**
} * 客户ID
*/
@NotBlank(message = "客户ID不能为空", groups = {VolunteerPage.class})
private String customerId; private String customerId;
/**
* 上级组织ID使用PIDS like查询该组织下所有志愿者注意是like 'agencyId:%'
*/
private String superiorAgencyId;
private Integer pageNo = 0; private Integer pageNo = 0;
private Integer pageSize = 20; private Integer pageSize = 20;

1
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java

@ -23,6 +23,7 @@ import java.util.List;
* @date 2020/6/4 13:25 * @date 2020/6/4 13:25
*/ */
@FeignClient(name = ServiceConstant.EPMET_HEART_SERVER, fallbackFactory = EpmetHeartOpenFeignClientFallbackFactory.class) @FeignClient(name = ServiceConstant.EPMET_HEART_SERVER, fallbackFactory = EpmetHeartOpenFeignClientFallbackFactory.class)
//@FeignClient(name = ServiceConstant.EPMET_HEART_SERVER, fallbackFactory = EpmetHeartOpenFeignClientFallbackFactory.class, url = "http://localhost:8111")
public interface EpmetHeartOpenFeignClient { public interface EpmetHeartOpenFeignClient {
/** /**

6
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java

@ -138,13 +138,11 @@ public class ResiVolunteerController {
*/ */
@PostMapping("page") @PostMapping("page")
public Result<List<PageVolunteerInfoResultDTO>> queryVolunteerPage(@RequestBody VolunteerCommonFormDTO input) { public Result<List<PageVolunteerInfoResultDTO>> queryVolunteerPage(@RequestBody VolunteerCommonFormDTO input) {
ValidatorUtils.validateEntity(input, VolunteerCommonFormDTO.VolunteerPage.class);
Integer pageNo = input.getPageNo(); Integer pageNo = input.getPageNo();
Integer pageSize = input.getPageSize(); Integer pageSize = input.getPageSize();
String customerId = input.getCustomerId(); String customerId = input.getCustomerId();
List<PageVolunteerInfoResultDTO> l = volunteerInfoService.queryVolunteerPage(customerId, pageNo, pageSize); String superiorAgencyId = input.getSuperiorAgencyId();
List<PageVolunteerInfoResultDTO> l = volunteerInfoService.queryVolunteerPage(customerId, pageNo, pageSize, superiorAgencyId);
return new Result<List<PageVolunteerInfoResultDTO>>().ok(l); return new Result<List<PageVolunteerInfoResultDTO>>().ok(l);
} }
} }

2
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java

@ -95,5 +95,5 @@ public interface VolunteerInfoService extends BaseService<VolunteerInfoEntity> {
*/ */
List<OptionDTO> queryListVolunteer(String customerId,String staffId,String userRealName); List<OptionDTO> queryListVolunteer(String customerId,String staffId,String userRealName);
List<PageVolunteerInfoResultDTO> queryVolunteerPage(String customerId, Integer pageNo, Integer pageSize); List<PageVolunteerInfoResultDTO> queryVolunteerPage(String customerId, Integer pageNo, Integer pageSize, String superiorAgencyId);
} }

26
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java

@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.MqConstant; import com.epmet.commons.tools.constant.MqConstant;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO; import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO;
import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg; import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg;
@ -30,6 +31,7 @@ import com.epmet.commons.tools.enums.EventEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
@ -39,6 +41,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.SendMqMsgUtils; import com.epmet.commons.tools.utils.SendMqMsgUtils;
import com.epmet.constant.SmsTemplateConstant; import com.epmet.constant.SmsTemplateConstant;
import com.epmet.dao.VolunteerInfoDao; import com.epmet.dao.VolunteerInfoDao;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.HeartUserInfoDTO; import com.epmet.dto.HeartUserInfoDTO;
import com.epmet.dto.VolunteerInfoDTO; import com.epmet.dto.VolunteerInfoDTO;
@ -73,6 +76,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.Optional;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -83,7 +87,7 @@ import java.util.stream.Collectors;
* @since v1.0.0 2020-07-19 * @since v1.0.0 2020-07-19
*/ */
@Service @Service
public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao, VolunteerInfoEntity> implements VolunteerInfoService { public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao, VolunteerInfoEntity> implements VolunteerInfoService, ResultDataResolver {
private Logger logger = LogManager.getLogger(VolunteerInfoServiceImpl.class); private Logger logger = LogManager.getLogger(VolunteerInfoServiceImpl.class);
private static final String SEND_SMS_CODE_ERROR = "发送短信验证码异常,手机号[%s],code[%s],msg[%s]"; private static final String SEND_SMS_CODE_ERROR = "发送短信验证码异常,手机号[%s],code[%s],msg[%s]";
@ -305,7 +309,7 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
*/ */
@Override @Override
public List<OptionDTO> queryListVolunteer(String customerId, String staffId,String userRealName) { public List<OptionDTO> queryListVolunteer(String customerId, String staffId,String userRealName) {
CustomerStaffInfoCacheResult staffInfo=CustomerStaffRedis.getStaffInfo(customerId,staffId); CustomerStaffInfoCacheResult staffInfo= CustomerStaffRedis.getStaffInfo(customerId,staffId);
if (null == staffInfo) { if (null == staffInfo) {
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询工作人员信息异常"); throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询工作人员信息异常");
} }
@ -351,9 +355,23 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
} }
@Override @Override
public List<PageVolunteerInfoResultDTO> queryVolunteerPage(String customerId, Integer pageNo, Integer pageSize) { public List<PageVolunteerInfoResultDTO> queryVolunteerPage(String customerId, Integer pageNo, Integer pageSize, String superiorAgencyId) {
LambdaQueryWrapper<VolunteerInfoEntity> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<VolunteerInfoEntity> query = new LambdaQueryWrapper<>();
query.eq(VolunteerInfoEntity::getCustomerId, customerId); Optional.ofNullable(customerId).ifPresent(cid -> query.eq(VolunteerInfoEntity::getCustomerId, cid));
Optional.ofNullable(superiorAgencyId).ifPresent(cid -> {
// 需要查询agency的pids:id,通过这个字符串去匹配志愿者的Pids字段来查询
String errorMsg = "【分页查询志愿者列表】失败";
CustomerAgencyDTO agencyInfo = getResultDataOrThrowsException(govOrgOpenFeignClient.getAgencyById(superiorAgencyId), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg);
if (agencyInfo == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg);
}
String pidsAndAgencyIdPath = agencyInfo.getPids().concat(":").concat(superiorAgencyId);
if (pidsAndAgencyIdPath.startsWith(":")) pidsAndAgencyIdPath = pidsAndAgencyIdPath.replaceFirst(":", "");
query.likeRight(VolunteerInfoEntity::getPids, pidsAndAgencyIdPath);
});
PageHelper.startPage(pageNo, pageSize); PageHelper.startPage(pageNo, pageSize);
List<VolunteerInfoEntity> volunteerInfoEntities = baseDao.selectList(query); List<VolunteerInfoEntity> volunteerInfoEntities = baseDao.selectList(query);

2
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/VolunteerInfoDao.xml

@ -17,6 +17,8 @@
<result property="createdTime" column="CREATED_TIME"/> <result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/> <result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/> <result property="updatedTime" column="UPDATED_TIME"/>
<result property="pid" column="PID"/>
<result property="pids" column="PIDS"/>
</resultMap> </resultMap>
<select id="queryVolunteerFlagByUserId" parameterType="java.lang.String" resultType="java.lang.Integer"> <select id="queryVolunteerFlagByUserId" parameterType="java.lang.String" resultType="java.lang.Integer">

0
epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.11__point_rule_sort.sql → epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/uv11__point_rule_sort.sql

8
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/BlockChainProjectController.java

@ -28,8 +28,8 @@ public class BlockChainProjectController {
*/ */
@PostMapping("create") @PostMapping("create")
public Result blockChainCreateProject(@RequestBody BlockChainCreateProjectFormDTO input) { public Result blockChainCreateProject(@RequestBody BlockChainCreateProjectFormDTO input) {
ValidatorUtils.validateEntity(input); //ValidatorUtils.validateEntity(input);
blockChainProjectService.blockChainCreateProject(input); //blockChainProjectService.blockChainCreateProject(input);
return new Result(); return new Result();
} }
@ -40,8 +40,8 @@ public class BlockChainProjectController {
*/ */
@PostMapping("process") @PostMapping("process")
public Result blockChainProcessProject(@RequestBody BlockChainProcessProjectFormDTO input) { public Result blockChainProcessProject(@RequestBody BlockChainProcessProjectFormDTO input) {
ValidatorUtils.validateEntity(input); //ValidatorUtils.validateEntity(input);
blockChainProjectService.blockChainProcessProject(input); //blockChainProjectService.blockChainProcessProject(input);
return new Result(); return new Result();
} }
} }

21
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzIssueCategoryDTO.java

@ -0,0 +1,21 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Author zxc
* @DateTime 2021/12/20 5:14 下午
* @DESC
*/
@Data
public class ResiBuzzIssueCategoryDTO implements Serializable {
private static final long serialVersionUID = 5050318228251317747L;
private String issueId;
private List<String> cn;
}

8
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java

@ -262,4 +262,12 @@ public interface IssueDao extends BaseDao<IssueEntity> {
*/ */
List<ProjectDistributionAnalysisRightDTO> getProjectCountByGrid(@Param("orgId")String orgId,@Param("startDate")String startDate,@Param("endDate")String endDate); List<ProjectDistributionAnalysisRightDTO> getProjectCountByGrid(@Param("orgId")String orgId,@Param("startDate")String startDate,@Param("endDate")String endDate);
/**
* @Description 根据issueIds查询分类名
* @param issueIds
* @author zxc
* @date 2021/12/20 5:15 下午
*/
List<ResiBuzzIssueCategoryDTO> selectCategoryNameByIssueIds(@Param("issueIds")List<String> issueIds);
} }

4
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java

@ -1592,6 +1592,10 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp
} }
List<ResiBuzzDTO> list = allList.stream().skip(formDTO.getPageSize() * (formDTO.getPageNo() - NumConstant.ONE)) List<ResiBuzzDTO> list = allList.stream().skip(formDTO.getPageSize() * (formDTO.getPageNo() - NumConstant.ONE))
.limit(formDTO.getPageSize()).collect(Collectors.toList()); .limit(formDTO.getPageSize()).collect(Collectors.toList());
List<ResiBuzzIssueCategoryDTO> names = baseDao.selectCategoryNameByIssueIds(allList.stream().map(m -> m.getIssueId()).collect(Collectors.toList()));
if (CollectionUtils.isNotEmpty(names)){
list.forEach(l -> names.stream().filter(n -> l.getIssueId().equals(n.getIssueId())).forEach(n -> l.setCategoryName(n.getCn())));
}
AtomicReference<Integer> no = new AtomicReference<>((formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize() + NumConstant.ONE); AtomicReference<Integer> no = new AtomicReference<>((formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize() + NumConstant.ONE);
ResiBuzzResultDTO result = new ResiBuzzResultDTO(); ResiBuzzResultDTO result = new ResiBuzzResultDTO();
UserResiInfoListFormDTO userResiInfoListFormDTO = new UserResiInfoListFormDTO(); UserResiInfoListFormDTO userResiInfoListFormDTO = new UserResiInfoListFormDTO();

46
epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml

@ -576,21 +576,7 @@
</select> </select>
<!-- 查询表决前50名 --> <!-- 查询表决前50名 -->
<resultMap id="selectIssueLimit50" type="com.epmet.dto.result.ResiBuzzDTO"> <select id="selectIssueLimit50" resultType="com.epmet.dto.result.ResiBuzzDTO">
<result column="issueId" property="issueId"/>
<result column="issueTitle" property="issueTitle"/>
<result column="suggestion" property="suggestion"/>
<result column="createdBy" property="createdBy"/>
<result column="status" property="status"/>
<result column="createdTime" property="createdTime"/>
<result column="supportCount" property="supportCount"/>
<result column="oppositionCount" property="oppositionCount"/>
<result column="voteAccount" property="voteAccount"/>
<collection property="categoryName" ofType="java.lang.String">
<result column="cn"/>
</collection>
</resultMap>
<select id="selectIssueLimit50" resultMap="selectIssueLimit50">
SELECT SELECT
i.ID AS issueId, i.ID AS issueId,
i.ISSUE_TITLE AS issueTitle, i.ISSUE_TITLE AS issueTitle,
@ -603,12 +589,9 @@
i.CREATED_TIME AS createdTime, i.CREATED_TIME AS createdTime,
s.SUPPORT_COUNT AS supportCount, s.SUPPORT_COUNT AS supportCount,
s.OPPOSITION_COUNT AS oppositionCount, s.OPPOSITION_COUNT AS oppositionCount,
CONCAT(s.SUPPORT_COUNT + s.OPPOSITION_COUNT,'/',s.VOTABLE_COUNT) AS voteAccount, CONCAT(s.SUPPORT_COUNT + s.OPPOSITION_COUNT,'/',s.VOTABLE_COUNT) AS voteAccount
cd.CATEGORY_NAME as cn
FROM issue i FROM issue i
LEFT JOIN issue_vote_statistical s ON (s.ISSUE_ID = i.ID AND s.DEL_FLAG = '0') INNER JOIN issue_vote_statistical s ON (s.ISSUE_ID = i.ID AND s.DEL_FLAG = '0')
LEFT JOIN issue_category ic ON (ic.ISSUE_ID = i.ID AND ic.DEL_FLAG = '0' AND ic.CUSTOMER_ID = i.CUSTOMER_ID)
LEFT JOIN issue_project_category_dict cd ON (cd.CATEGORY_CODE = LEFT(ic.CATEGORY_CODE,#{length}) AND cd.DEL_FLAG = '0' AND cd.CUSTOMER_ID = ic.CUSTOMER_ID)
WHERE i.DEL_FLAG = '0' WHERE i.DEL_FLAG = '0'
<if test='status != "all" '> <if test='status != "all" '>
AND i.ISSUE_STATUS = #{status} AND i.ISSUE_STATUS = #{status}
@ -641,7 +624,7 @@
IFNULL(cd.CATEGORY_NAME,'其他') AS categoryName, IFNULL(cd.CATEGORY_NAME,'其他') AS categoryName,
IFNULL(cd.color,'#0091ed') AS color IFNULL(cd.color,'#0091ed') AS color
FROM issue i FROM issue i
LEFT JOIN issue_vote_statistical s ON (s.ISSUE_ID = i.ID AND s.DEL_FLAG = '0') INNER JOIN issue_vote_statistical s ON (s.ISSUE_ID = i.ID AND s.DEL_FLAG = '0')
LEFT JOIN issue_category ic ON (ic.ISSUE_ID = i.ID AND ic.DEL_FLAG = '0' AND ic.CUSTOMER_ID = i.CUSTOMER_ID) LEFT JOIN issue_category ic ON (ic.ISSUE_ID = i.ID AND ic.DEL_FLAG = '0' AND ic.CUSTOMER_ID = i.CUSTOMER_ID)
LEFT JOIN issue_project_category_dict cd ON (cd.CATEGORY_CODE = LEFT(ic.CATEGORY_CODE,#{length}) AND cd.DEL_FLAG = '0' AND cd.CUSTOMER_ID = ic.CUSTOMER_ID) LEFT JOIN issue_project_category_dict cd ON (cd.CATEGORY_CODE = LEFT(ic.CATEGORY_CODE,#{length}) AND cd.DEL_FLAG = '0' AND cd.CUSTOMER_ID = ic.CUSTOMER_ID)
WHERE i.DEL_FLAG = '0' WHERE i.DEL_FLAG = '0'
@ -668,4 +651,25 @@
AND DATE_FORMAT(SHIFTED_TIME,'%Y-%m-%d') <![CDATA[ <= ]]> #{endDate} AND DATE_FORMAT(SHIFTED_TIME,'%Y-%m-%d') <![CDATA[ <= ]]> #{endDate}
GROUP BY GRID_ID GROUP BY GRID_ID
</select> </select>
<!-- 根据issueIds查询分类名 -->
<resultMap id="selectCategoryNameMaps" type="com.epmet.dto.result.ResiBuzzIssueCategoryDTO">
<result property="issueId" column="issueId"/>
<collection property="cn" ofType="java.lang.String">
<result column="categoryName"/>
</collection>
</resultMap>
<select id="selectCategoryNameByIssueIds" resultMap="selectCategoryNameMaps">
SELECT
ic.ISSUE_ID AS issueId,
cd.CATEGORY_NAME as categoryName
FROM issue_category ic
LEFT JOIN issue_project_category_dict cd ON (cd.CATEGORY_CODE = LEFT(ic.CATEGORY_CODE,4) AND cd.DEL_FLAG = '0' AND cd.CUSTOMER_ID = ic.CUSTOMER_ID)
WHERE ic.DEL_FLAG = '0'
AND ic.ISSUE_ID IN (
<foreach collection="issueIds" item="i" separator=",">
#{i}
</foreach>
)
</select>
</mapper> </mapper>

46
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java

@ -19,7 +19,6 @@ package com.epmet.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.rocketmq.messages.OrgOrStaffMQMsg;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
@ -46,7 +45,6 @@ import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.redis.CustomerAgencyRedis; import com.epmet.redis.CustomerAgencyRedis;
import com.epmet.send.SendMqMsgUtil;
import com.epmet.service.AgencyService; import com.epmet.service.AgencyService;
import com.epmet.service.CustomerAgencyService; import com.epmet.service.CustomerAgencyService;
import com.epmet.service.CustomerOrgParameterService; import com.epmet.service.CustomerOrgParameterService;
@ -553,14 +551,25 @@ public class AgencyServiceImpl implements AgencyService {
formDTO.setOrgId(staffInfo.getAgencyId()); formDTO.setOrgId(staffInfo.getAgencyId());
formDTO.setLevel(OrgInfoConstant.AGENCY); formDTO.setLevel(OrgInfoConstant.AGENCY);
} }
if (StringUtils.isNotBlank(customerAgencyEntity.getLatitude())){
result.setLatitude(new BigDecimal(customerAgencyEntity.getLatitude()));
}
if (StringUtils.isNotBlank(customerAgencyEntity.getLongitude())){
result.setLongitude(new BigDecimal(customerAgencyEntity.getLongitude()));
}
if (formDTO.getLevel().equals(OrgInfoConstant.AGENCY)){ if (formDTO.getLevel().equals(OrgInfoConstant.AGENCY)){
CustomerAgencyEntity entity = customerAgencyDao.selectById(formDTO.getOrgId()); CustomerAgencyEntity entity = customerAgencyDao.selectById(formDTO.getOrgId());
result = ConvertUtils.sourceToTarget(entity,MapOrgResultDTO.class); result = ConvertUtils.sourceToTarget(entity,MapOrgResultDTO.class);
result.setName(entity.getOrganizationName()); result.setName(entity.getOrganizationName());
result.setLevel(formDTO.getLevel()); result.setLevel(formDTO.getLevel());
result.setAgencyLevel(entity.getLevel()); result.setAgencyLevel(entity.getLevel());
result.setLatitude(StringUtils.isBlank(entity.getLatitude()) ? new BigDecimal(customerAgencyEntity.getLatitude()) : new BigDecimal(entity.getLatitude())); //经纬度 如果本级没有则取根级组织的 根级没有就空着
result.setLongitude(StringUtils.isBlank(entity.getLongitude()) ? new BigDecimal(customerAgencyEntity.getLongitude()) : new BigDecimal(entity.getLongitude())); if (StringUtils.isNotBlank(entity.getLatitude())){
result.setLatitude(new BigDecimal(entity.getLatitude()));
}
if (StringUtils.isNotBlank(entity.getLongitude())){
result.setLongitude(new BigDecimal(entity.getLongitude()));
}
if (entity.getLevel().equals(OrgInfoConstant.COMMUNITY)){ if (entity.getLevel().equals(OrgInfoConstant.COMMUNITY)){
List<MapSonOrgResultDTO> son = customerAgencyDao.selectSonOrg(formDTO.getOrgId(), OrgInfoConstant.GRID); List<MapSonOrgResultDTO> son = customerAgencyDao.selectSonOrg(formDTO.getOrgId(), OrgInfoConstant.GRID);
if (CollectionUtils.isNotEmpty(son)){ if (CollectionUtils.isNotEmpty(son)){
@ -582,12 +591,9 @@ public class AgencyServiceImpl implements AgencyService {
if (CollectionUtils.isNotEmpty(directlySub)){ if (CollectionUtils.isNotEmpty(directlySub)){
dtoList.addAll(directlySub); dtoList.addAll(directlySub);
} }
if (CollectionUtils.isNotEmpty(dtoList)){ for (MapSonOrgResultDTO d : dtoList) {
MapOrgResultDTO finalResult1 = result; d.setLatitude(StringUtils.isBlank(d.getLatitudeOrigin()) ? result.getLatitude() : new BigDecimal(d.getLatitudeOrigin()));
dtoList.forEach(d -> { d.setLongitude(StringUtils.isBlank(d.getLongitudeOrigin()) ? result.getLongitude() : new BigDecimal(d.getLongitudeOrigin()));
d.setLatitude(StringUtils.isBlank(d.getLatitudeOrigin()) ? finalResult1.getLatitude() : new BigDecimal(d.getLatitudeOrigin()));
d.setLongitude(StringUtils.isBlank(d.getLongitudeOrigin()) ? finalResult1.getLongitude() : new BigDecimal(d.getLongitudeOrigin()));
});
} }
result.setChildren(dtoList); result.setChildren(dtoList);
} }
@ -597,15 +603,19 @@ public class AgencyServiceImpl implements AgencyService {
result.setName(entity.getGridName()); result.setName(entity.getGridName());
result.setLevel(formDTO.getLevel()); result.setLevel(formDTO.getLevel());
result.setAgencyLevel(OrgInfoConstant.GRID); result.setAgencyLevel(OrgInfoConstant.GRID);
result.setLatitude(StringUtils.isBlank(entity.getLatitude()) ? new BigDecimal(customerAgencyEntity.getLatitude()) : new BigDecimal(entity.getLatitude())); //经纬度 如果本级没有则取根级组织的 根级没有就空着
result.setLongitude(StringUtils.isBlank(entity.getLongitude()) ? new BigDecimal(customerAgencyEntity.getLongitude()) : new BigDecimal(entity.getLongitude())); if (StringUtils.isNotBlank(entity.getLatitude())){
result.setLatitude(new BigDecimal(entity.getLatitude()));
}
if (StringUtils.isNotBlank(entity.getLongitude())){
result.setLongitude(new BigDecimal(entity.getLongitude()));
}
List<MapSonOrgResultDTO> son = customerAgencyDao.selectSonOrg(formDTO.getOrgId(), OrgInfoConstant.NEIGHBOR_HOOD); List<MapSonOrgResultDTO> son = customerAgencyDao.selectSonOrg(formDTO.getOrgId(), OrgInfoConstant.NEIGHBOR_HOOD);
if (CollectionUtils.isNotEmpty(son)){ if (CollectionUtils.isNotEmpty(son)){
MapOrgResultDTO finalResult2 = result; for (MapSonOrgResultDTO s : son) {
son.forEach(s -> { s.setLatitude(StringUtils.isBlank(s.getLatitudeOrigin()) ? result.getLatitude() : new BigDecimal(s.getLatitudeOrigin()));
s.setLatitude(StringUtils.isBlank(s.getLatitudeOrigin()) ? finalResult2.getLatitude() : new BigDecimal(s.getLatitudeOrigin())); s.setLongitude(StringUtils.isBlank(s.getLongitudeOrigin()) ? result.getLongitude() : new BigDecimal(s.getLongitudeOrigin()));
s.setLongitude(StringUtils.isBlank(s.getLongitudeOrigin()) ? finalResult2.getLongitude() : new BigDecimal(s.getLongitudeOrigin())); }
});
} }
result.setChildren(CollectionUtils.isEmpty(son) ? new ArrayList<>() : son); result.setChildren(CollectionUtils.isEmpty(son) ? new ArrayList<>() : son);
} }
@ -692,4 +702,4 @@ public class AgencyServiceImpl implements AgencyService {
return insertEntity; return insertEntity;
} }
} }

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

@ -94,7 +94,7 @@
AND a.DEL_FLAG = #{building.delFlag} AND a.DEL_FLAG = #{building.delFlag}
</if> </if>
</where> </where>
order by a.CREATED_TIME asc
</select> </select>
<select id="searchAllBuilding" resultType="com.epmet.excel.IcBuildingExcel"> <select id="searchAllBuilding" resultType="com.epmet.excel.IcBuildingExcel">
select select

4
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/BlockChainUploadServiceImpl.java

@ -36,6 +36,10 @@ public class BlockChainUploadServiceImpl implements BlockChainUploadService {
*/ */
public void send2BlockChain(ProjectEntity projectEntity, ProjectProcessEntity processEntity, List<ProjectStaffEntity> assignedStaffEntities, String projectStaffId) { public void send2BlockChain(ProjectEntity projectEntity, ProjectProcessEntity processEntity, List<ProjectStaffEntity> assignedStaffEntities, String projectStaffId) {
if (true) {
return;
}
// 1.项目主信息 // 1.项目主信息
BlockChainProjectFormDTO project = null; BlockChainProjectFormDTO project = null;

21
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolUploadDetailFormDTO.java

@ -1,21 +0,0 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/6/9 16:31
*/
@Data
public class PatrolUploadDetailFormDTO implements Serializable {
private static final long serialVersionUID = 1527344810917196996L;
/**
* 巡查主记录id, 开始巡查反参
*/
private String staffPatrolRecId;
private List<PatrolUploadFormDTO> details;
}

4
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolUploadFormDTO.java

@ -54,4 +54,8 @@ public class PatrolUploadFormDTO implements Serializable {
* 序号,前端生成后端记录 * 序号,前端生成后端记录
*/ */
private Integer serialNum; private Integer serialNum;
/**
* 位置信息
*/
private String address;
} }

3
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VolunteerCommonFormDTO.java

@ -23,4 +23,7 @@ public class VolunteerCommonFormDTO {
@NotBlank(message = "客户ID不能为空", groups = {GetVolunteerDistribution.class}) @NotBlank(message = "客户ID不能为空", groups = {GetVolunteerDistribution.class})
private String customerId; private String customerId;
@NotBlank(message = "组织ID不能为空", groups = {GetVolunteerDistribution.class})
private String agencyId;
} }

71
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java

@ -29,6 +29,7 @@ import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.dto.result.OptionDataResultDTO; import com.epmet.commons.tools.dto.result.OptionDataResultDTO;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
@ -52,6 +53,7 @@ import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.feign.OssFeignClient; import com.epmet.feign.OssFeignClient;
import com.epmet.service.IcResiUserImportService; import com.epmet.service.IcResiUserImportService;
import com.epmet.service.IcResiUserService; import com.epmet.service.IcResiUserService;
import jodd.io.FileUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
@ -59,6 +61,9 @@ import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -67,6 +72,7 @@ import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URLEncoder;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
@ -115,6 +121,30 @@ public class IcResiUserController {
@Autowired @Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
/**
* 模板枚举
*/
public enum IcUserTemplateEnums {
IC_RESI_IMPORT_TEMPLATE("excel/ic_resi_info_import_cid_for_easy_excel.xls", "居民信息导入模板.xls"),
IC_RESI_EXPORT_TEMPLATE("excel/ic_resi_info_cid_for_easy_excel.xlsx", "居民信息导出模板.xlsx");
private String pathInApp;
private String templateName;
IcUserTemplateEnums(String pathInApp, String templateName) {
this.pathInApp = pathInApp;
this.templateName = templateName;
}
public String getPathInApp() {
return pathInApp;
}
public String getTemplateName() {
return templateName;
}
}
{ {
// 初始化上传目录 // 初始化上传目录
String home = System.getProperty("user.home"); String home = System.getProperty("user.home");
@ -273,7 +303,7 @@ public class IcResiUserController {
pageFormDTO.setPageFlag(false); pageFormDTO.setPageFlag(false);
//获取模版文件 //获取模版文件
File file = getExportTemplateFile(customerId); File file = getIcResiTemplateFile(customerId, IcUserTemplateEnums.IC_RESI_EXPORT_TEMPLATE);
ExcelWriter excelWriter = null; ExcelWriter excelWriter = null;
try { try {
excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel("居民基本信息.xlsx", response)).withTemplate(file).build(); excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel("居民基本信息.xlsx", response)).withTemplate(file).build();
@ -352,7 +382,7 @@ public class IcResiUserController {
* @param customerId * @param customerId
* @return * @return
*/ */
private File getExportTemplateFile(String customerId) throws Exception{ private File getIcResiTemplateFile(String customerId, IcUserTemplateEnums template) throws Exception{
String fileType = ".xlsx"; String fileType = ".xlsx";
String fileName = customerId + fileType; String fileName = customerId + fileType;
File file = new File(IC_RESI_DOWNLOAD_DIR.resolve(fileName).toString()); File file = new File(IC_RESI_DOWNLOAD_DIR.resolve(fileName).toString());
@ -368,13 +398,12 @@ public class IcResiUserController {
Result<byte[]> result = HttpClientManager.getInstance().getDownloadFilebytes(fileUrlResult.getData(), null); Result<byte[]> result = HttpClientManager.getInstance().getDownloadFilebytes(fileUrlResult.getData(), null);
//获取模版失败 则把默认文件写入 //获取模版失败 则把默认文件写入
if (result == null || !result.success()) { if (result == null || !result.success()) {
log.warn("获取居民导出模版失败,path:{},走默认模版", ossFilePath); log.warn("获取居民模版失败,path:{},走默认模版", ossFilePath);
String defaultTemplatePath = "excel/ic_resi_info_cid_for_easy_excel.xlsx"; InputStream resourceAsStream = this.getClass().getClassLoader().getResourceAsStream(template.getPathInApp());
InputStream resourceAsStream = this.getClass().getClassLoader().getResourceAsStream(defaultTemplatePath);
FileUtils.copyInputStreamToFile(resourceAsStream,file); FileUtils.copyInputStreamToFile(resourceAsStream,file);
log.warn("getExportTemplateFile copy default file to template,customerId:{}",customerId); log.warn("getIcResiTemplateFile copy default file to template,customerId:{}",customerId);
} else { } else {
log.warn("getExportTemplateFile reload file form oss default file to template,customerId:{}",customerId); log.warn("getIcResiTemplateFile reload file form oss default file to template,customerId:{}",customerId);
FileUtils.writeByteArrayToFile(file,result.getData()); FileUtils.writeByteArrayToFile(file,result.getData());
} }
redisUtils.hSet(RedisKeys.getResiTempChangedKey(customerId), serverIp, NumConstant.ZERO_STR); redisUtils.hSet(RedisKeys.getResiTempChangedKey(customerId), serverIp, NumConstant.ZERO_STR);
@ -507,6 +536,34 @@ public class IcResiUserController {
return new Result<List<DemandUserResDTO>>().ok(icResiUserService.queryDemandUsers(formDTO)); return new Result<List<DemandUserResDTO>>().ok(icResiUserService.queryDemandUsers(formDTO));
} }
/**
* 下载ic居民信息导入excel模板
* @param loginUserInfo
* @return
*/
@PostMapping("import/download-template")
public ResponseEntity<byte[]> downloadIcResiDownloadTemplate(@LoginUser TokenDto loginUserInfo) {
String customerId = loginUserInfo.getCustomerId();
try {
File icResiImportTemplateFile = getIcResiTemplateFile(customerId, IcUserTemplateEnums.IC_RESI_IMPORT_TEMPLATE);
HttpHeaders headers = new HttpHeaders();
headers.add("Access-Control-Expose-Headers", "Content-Disposition");
headers.add("content-Type", "application/vnd.ms-excel");
headers.add("Content-Disposition", "attachment;fileName=" + URLEncoder.encode(IcUserTemplateEnums.IC_RESI_IMPORT_TEMPLATE.getTemplateName(), "UTF-8"));
return new ResponseEntity<>(FileUtil.readBytes(icResiImportTemplateFile), headers, HttpStatus.OK);
} catch (Exception e) {
String errorStackTrace = ExceptionUtils.getErrorStackTrace(e);
log.error("下载IC居民信息导入模板失败:{}", errorStackTrace);
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "下载IC居民信息导入模板失败");
}
}
/** /**
* 党员年龄范围统计 * 党员年龄范围统计
* @Param formDTO * @Param formDTO

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

@ -120,13 +120,6 @@ public class StaffPatrolController {
} }
@PostMapping("uploaddetails")
public Result<PatrolUploadResultDTO> uploadDetails(@LoginUser TokenDto tokenDto, @RequestBody PatrolUploadDetailFormDTO formDTO) {
PatrolUploadResultDTO result = staffPatrolRecordService.uploadDetails(tokenDto, formDTO);
return new Result<PatrolUploadResultDTO>().ok(result);
}
/** /**
* @Description 查询经纬度 * @Description 查询经纬度
* @Param userIds * @Param userIds

3
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/VolunteerController.java

@ -40,8 +40,9 @@ public class VolunteerController {
ValidatorUtils.validateEntity(input, VolunteerCommonFormDTO.GetVolunteerDistribution.class); ValidatorUtils.validateEntity(input, VolunteerCommonFormDTO.GetVolunteerDistribution.class);
String customerId = input.getCustomerId(); String customerId = input.getCustomerId();
String agencyId = input.getAgencyId();
VolunteerDistributionResultDTO r = volunteerService.getVolunteerDistributionAndLegends(customerId); VolunteerDistributionResultDTO r = volunteerService.getVolunteerDistributionAndLegends(customerId, agencyId);
return new Result<VolunteerDistributionResultDTO>().ok(r); return new Result<VolunteerDistributionResultDTO>().ok(r);
} }

2
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffPatrolDetailEntity.java

@ -94,7 +94,7 @@ public class StaffPatrolDetailEntity extends BaseEpmetEntity {
private String horizontalaccuracy; private String horizontalaccuracy;
/** /**
* 地址暂时不用 * 地址
*/ */
private String address; private String address;

10
epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffPatrolRecordService.java

@ -91,16 +91,6 @@ public interface StaffPatrolRecordService extends BaseService<StaffPatrolRecordE
*/ */
PatrolUploadResultDTO uploadDetail(TokenDto tokenDto, PatrolUploadFormDTO formDTO); PatrolUploadResultDTO uploadDetail(TokenDto tokenDto, PatrolUploadFormDTO formDTO);
/**
* 上传巡查记录
* @author zhaoqifeng
* @date 2021/6/9 16:32
* @param tokenDto
* @param formDTO
* @return com.epmet.dto.result.PatrolUploadResultDTO
*/
PatrolUploadResultDTO uploadDetails(TokenDto tokenDto, PatrolUploadDetailFormDTO formDTO);
/** /**
* @Description 查询经纬度 * @Description 查询经纬度
* @Param userIds * @Param userIds

2
epmet-user/epmet-user-server/src/main/java/com/epmet/service/VolunteerService.java

@ -10,6 +10,6 @@ import com.epmet.dto.result.VolunteerDistributionResultDTO;
*/ */
public interface VolunteerService { public interface VolunteerService {
VolunteerDistributionResultDTO getVolunteerDistributionAndLegends(String customerId); VolunteerDistributionResultDTO getVolunteerDistributionAndLegends(String customerId, String agencyId);
} }

40
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java

@ -100,7 +100,8 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl<StaffPatrolRec
result.setStaffPatrolRecId(entity.getId()); result.setStaffPatrolRecId(entity.getId());
result.setStatus(entity.getStatus()); result.setStatus(entity.getStatus());
result.setLatestSerialNum(PatrolConstant.END.equals(entity.getStatus()) ? NumConstant.ONE_NEG : detail.getSerialNum()); result.setLatestSerialNum(PatrolConstant.END.equals(entity.getStatus()) ? NumConstant.ONE_NEG : detail.getSerialNum());
result.setCarmDown(NumConstant.THIRTY); //最小间隔设置 3*60s
result.setCarmDown(NumConstant.THREE * NumConstant.SIXTY);
result.setPatrolStartTime(DateUtils.format(entity.getPatrolStartTime(), DateUtils.DATE_TIME_PATTERN)); result.setPatrolStartTime(DateUtils.format(entity.getPatrolStartTime(), DateUtils.DATE_TIME_PATTERN));
//状态为巡查中时返回所在网格ID和名称 //状态为巡查中时返回所在网格ID和名称
if (PatrolConstant.PATROLLING.equals(entity.getStatus())) { if (PatrolConstant.PATROLLING.equals(entity.getStatus())) {
@ -377,6 +378,7 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl<StaffPatrolRec
detailEntity.setAltitude(formDTO.getAltitude()); detailEntity.setAltitude(formDTO.getAltitude());
detailEntity.setVerticalaccuracy(formDTO.getVerticalAccuracy()); detailEntity.setVerticalaccuracy(formDTO.getVerticalAccuracy());
detailEntity.setHorizontalaccuracy(formDTO.getHorizontalAccuracy()); detailEntity.setHorizontalaccuracy(formDTO.getHorizontalAccuracy());
detailEntity.setAddress(formDTO.getAddress());
staffPatrolDetailService.insert(detailEntity); staffPatrolDetailService.insert(detailEntity);
PatrolUploadResultDTO dto = new PatrolUploadResultDTO(); PatrolUploadResultDTO dto = new PatrolUploadResultDTO();
@ -384,42 +386,6 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl<StaffPatrolRec
return dto; return dto;
} }
/**
* 上传巡查记录
*
* @param tokenDto
* @param formDTO
* @return com.epmet.dto.result.PatrolUploadResultDTO
* @author zhaoqifeng
* @date 2021/6/9 16:32
*/
@Override
public PatrolUploadResultDTO uploadDetails(TokenDto tokenDto, PatrolUploadDetailFormDTO formDTO) {
if (CollectionUtils.isNotEmpty(formDTO.getDetails())) {
List<StaffPatrolDetailEntity> list = formDTO.getDetails().stream().map(detail -> {
StaffPatrolDetailEntity detailEntity = new StaffPatrolDetailEntity();
detailEntity.setStaffPatrolRecId(formDTO.getStaffPatrolRecId());
detailEntity.setCustomerId(tokenDto.getCustomerId());
detailEntity.setSerialNum(detail.getSerialNum());
detailEntity.setUploadTime(new Date());
detailEntity.setLatitude(detail.getLatitude());
detailEntity.setLongitude(detail.getLongitude());
detailEntity.setSpeed(detail.getSpeed());
detailEntity.setAccuracy(detail.getAccuracy());
detailEntity.setAltitude(detail.getAltitude());
detailEntity.setVerticalaccuracy(detail.getVerticalAccuracy());
detailEntity.setHorizontalaccuracy(detail.getHorizontalAccuracy());
return detailEntity;
}).collect(Collectors.toList());
staffPatrolDetailService.insertBatch(list);
}
PatrolUploadResultDTO dto = new PatrolUploadResultDTO();
dto.setStaffPatrolRecId(formDTO.getStaffPatrolRecId());
return dto;
}
/** /**
* @Description 查询经纬度 * @Description 查询经纬度
* @Param userIds * @Param userIds

7
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/VolunteerServiceImpl.java

@ -54,10 +54,10 @@ public class VolunteerServiceImpl implements VolunteerService, ResultDataResolve
* @param customerId * @param customerId
* @return * @return
*/ */
public VolunteerDistributionResultDTO getVolunteerDistributionAndLegends(String customerId) { public VolunteerDistributionResultDTO getVolunteerDistributionAndLegends(String customerId, String agencyId) {
// 1.查询分布 // 1.查询分布
VolunteerDistributionResultDTO volunteerDistribution = getVolunteerDistribution(customerId); VolunteerDistributionResultDTO volunteerDistribution = getVolunteerDistribution(customerId, agencyId);
// 2.补充图例 // 2.补充图例
IcFormOptionsQueryFormDTO optionsForm = new IcFormOptionsQueryFormDTO(); IcFormOptionsQueryFormDTO optionsForm = new IcFormOptionsQueryFormDTO();
@ -89,7 +89,7 @@ public class VolunteerServiceImpl implements VolunteerService, ResultDataResolve
* @param customerId * @param customerId
* @return * @return
*/ */
public VolunteerDistributionResultDTO getVolunteerDistribution(String customerId) { public VolunteerDistributionResultDTO getVolunteerDistribution(String customerId, String agencyId) {
//epmetHeartOpenFeignClient.queryVolunteerPage() //epmetHeartOpenFeignClient.queryVolunteerPage()
// 1.分页查询出所有志愿者列表 // 1.分页查询出所有志愿者列表
@ -104,6 +104,7 @@ public class VolunteerServiceImpl implements VolunteerService, ResultDataResolve
VolunteerCommonFormDTO volunteerForm = new VolunteerCommonFormDTO(); VolunteerCommonFormDTO volunteerForm = new VolunteerCommonFormDTO();
volunteerForm.setCustomerId(customerId); volunteerForm.setCustomerId(customerId);
volunteerForm.setSuperiorAgencyId(agencyId);
volunteerForm.setPageNo(pageNo); volunteerForm.setPageNo(pageNo);
volunteerForm.setPageSize(pageSize); volunteerForm.setPageSize(pageSize);

BIN
epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_import_cid_for_easy_excel.xls

Binary file not shown.
Loading…
Cancel
Save