Browse Source

Merge branches 'dev' and 'dev_ic_mp' of http://121.42.41.42:7070/r/epmet-cloud into dev_ic_mp

 Conflicts:
	epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
	epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
master
yinzuomei 4 years ago
parent
commit
33946fcd46
  1. 15
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/CustomerIdConstant.java
  2. 8
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  3. 4
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java
  4. 13
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassRootsGovernController.java
  5. 3
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenGovernRankDataDao.java
  6. 6
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/GrassRootsGovernService.java
  7. 56
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java
  8. 79
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenGovernRankDataDao.xml
  9. 6
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml
  10. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexOriginExtractServiceImpl.java
  11. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java
  12. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java
  13. 7
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzLeftPieChartResultDTO.java
  14. 9
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueVoteStatisticalController.java
  15. 22
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java
  16. 51
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java
  17. 113
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml
  18. 1
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  19. 59
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
  20. 18
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  21. 34
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  22. 2
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java
  23. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/BaseGridDailyworkController.java
  24. 4
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/BaseGridDailyworkEntity.java
  25. 4
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataPatrolChangeEventListener.java
  26. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/BaseGridDailyworkService.java
  27. 14
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java
  28. 18
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/UserPatrolRecordServiceImpl.java
  29. 4
      epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/BaseGridDailyworkDao.xml
  30. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VolunteerDistributionResultDTO.java
  31. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  32. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
  33. 90
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridUserWorkEntity.java
  34. 134
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/VolunteerServiceImpl.java
  35. 17
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

15
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/CustomerIdConstant.java

@ -0,0 +1,15 @@
package com.epmet.commons.tools.constant;
/**
* desc:
*
* @author: LiuJanJun
* @date: 2021/12/27 10:22 上午
* @version: 1.0
*/
public interface CustomerIdConstant {
/**
* 市北生产-客户ID
*/
String SHI_BEI_CUSTOMER_ID = "b09527201c4409e19d1dbc5e3c3429a1";
}

8
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -628,4 +628,12 @@ public class RedisKeys {
return rootPrefix.concat("resi:").concat("export").concat(":template:changed").concat(customerId); return rootPrefix.concat("resi:").concat("export").concat(":template:changed").concat(customerId);
} }
/**
* desc:临时方案
* @param agencyId
* @return
*/
public static String getOrgTreeCacheKey(String agencyId) {
return rootPrefix.concat("org:temp:orgtree").concat(agencyId);
}
} }

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

@ -487,9 +487,9 @@ public class GovProjectServiceImpl implements GovProjectService {
if (!org.springframework.util.CollectionUtils.isEmpty(userList)) { if (!org.springframework.util.CollectionUtils.isEmpty(userList)) {
//2-1.根据身份证号查询负能平台用户信息 //2-1.根据身份证号查询负能平台用户信息
IcResiUserDTO icResiUserDTO = epmetUserService.getIcResiUser(userList.get(0).getIdNum(), formDTO.getCustomerId()); IcResiUserDTO icResiUserDTO = epmetUserService.getIcResiUser(userList.get(0).getIdNum(), formDTO.getCustomerId());
resultDTO.setIcUserId(icResiUserDTO.getId());
resultDTO.setIcUserName(icResiUserDTO.getName());
if (null != icResiUserDTO) { if (null != icResiUserDTO) {
resultDTO.setIcUserId(icResiUserDTO.getId());
resultDTO.setIcUserName(icResiUserDTO.getName());
//2-2.查询人员的家庭成员数据 //2-2.查询人员的家庭成员数据
List<ProjectAnalysisResultDTO.Home> homeList = epmetUserService.getHomeUserList(icResiUserDTO.getHomeId(), icResiUserDTO.getId()); List<ProjectAnalysisResultDTO.Home> homeList = epmetUserService.getHomeUserList(icResiUserDTO.getHomeId(), icResiUserDTO.getId());
resultDTO.setHomeUserList(homeList); resultDTO.setHomeUserList(homeList);

13
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassRootsGovernController.java

@ -97,4 +97,17 @@ public class GrassRootsGovernController {
return new Result<List<GovernCapacityRankResultDTO>>().ok(grassRootsGovernService.governCapacityRank(param)); return new Result<List<GovernCapacityRankResultDTO>>().ok(grassRootsGovernService.governCapacityRank(param));
} }
/**
* @Description 治理能力榜单查询 screen_govern_rank_data
* @NEI https://nei.netease.com/interface/detail/req/?pid=57068&id=321627
* @param param
* @return
* @author wangc
* @date 2020.08.20 17:46
**/
@PostMapping("governcapacityrank-origin")
public Result<List<GovernCapacityRankResultDTO>> governCapacityRankOrigin(@RequestBody AgencyAndNumFormDTO param){
ValidatorUtils.validateEntity(param,AgencyFormDTO.CommonAgencyIdGroup.class);
return new Result<List<GovernCapacityRankResultDTO>>().ok(grassRootsGovernService.governCapacityRankOrigin(param));
}
} }

3
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenGovernRankDataDao.java

@ -50,4 +50,7 @@ public interface ScreenGovernRankDataDao{
* @date 2021/2/26 上午9:22 * @date 2021/2/26 上午9:22
*/ */
List<GovernCapacityResultDTO> selectGovernCapacityRatioNew(@Param("monthId") String monthId,@Param("orgIds") List<String> orgIds); List<GovernCapacityResultDTO> selectGovernCapacityRatioNew(@Param("monthId") String monthId,@Param("orgIds") List<String> orgIds);
List<GovernCapacityResultDTO> selectGovernCapacityRatioBak(@Param("monthId") String monthId,@Param("agencyId") String agencyId);
List<GovernCapacityResultDTO> selectGovernCapacityRatioNewBak(@Param("monthId") String monthId,@Param("orgIds") List<String> orgIds);
} }

6
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/GrassRootsGovernService.java

@ -65,6 +65,12 @@ public interface GrassRootsGovernService {
**/ **/
List<GovernCapacityRankResultDTO> governCapacityRank(AgencyAndNumFormDTO param); List<GovernCapacityRankResultDTO> governCapacityRank(AgencyAndNumFormDTO param);
/**
* 治理能力榜单查询 screen_govern_rank_data
* @param param
* @return
*/
List<GovernCapacityRankResultDTO> governCapacityRankOrigin(AgencyAndNumFormDTO param);
/** /**
* @Description 6公众参与-柱状折线图 * @Description 6公众参与-柱状折线图
* @NEI https://nei.netease.com/interface/detail/req/?pid=57068&id=322434 * @NEI https://nei.netease.com/interface/detail/req/?pid=57068&id=322434

56
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java

@ -295,6 +295,62 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService {
return result; return result;
} }
/**
* 治理能力榜单查询 screen_govern_rank_data
* @param param
* @return
*/
@DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true)
@Override
public List<GovernCapacityRankResultDTO> governCapacityRankOrigin(AgencyAndNumFormDTO param) {
List<GovernCapacityResultDTO> orderList = new ArrayList<>();
if (null == param.getTopNum() || NumConstant.ZERO == param.getTopNum()) {
param.setTopNum(NumConstant.TEN);
}
String monthId = dateUtils.getCurrentMonthId();
if (StringUtils.isNotEmpty(param.getAreaCode())){
List<String> nextAgencyIds = screenCustomerAgencyService.getNextAgencyIds(param.getAreaCode(), param.getAgencyId());
if (CollectionUtils.isEmpty(nextAgencyIds)){
return new ArrayList<>();
}
PageHelper.startPage(NumConstant.ONE,param.getTopNum());
orderList = screenGovernRankDataDao.selectGovernCapacityRatioNewBak(monthId,nextAgencyIds);
int time = NumConstant.TWELVE;
while(CollectionUtils.isEmpty(orderList) && time > NumConstant.ONE){
time--;
monthId = dateUtils.getPreviousMonthIdByDest(null, monthId);
PageHelper.startPage(NumConstant.ONE,param.getTopNum());
orderList = screenGovernRankDataDao.selectGovernCapacityRatioNewBak(monthId,nextAgencyIds);
}
}else {
PageHelper.startPage(NumConstant.ONE,param.getTopNum());
orderList = screenGovernRankDataDao.selectGovernCapacityRatioBak(monthId, param.getAgencyId());
int time = NumConstant.TWELVE;
while (CollectionUtils.isEmpty(orderList) && time > NumConstant.ONE) {
time++;
monthId = dateUtils.getPreviousMonthIdByDest(null, monthId);
PageHelper.startPage(NumConstant.ONE, param.getTopNum());
orderList = screenGovernRankDataDao.selectGovernCapacityRatioBak(monthId, param.getAgencyId());
}
}
if(null == orderList || orderList.isEmpty()) {
return new ArrayList<>();
}
List<GovernCapacityRankResultDTO> result = new LinkedList<>();
orderList.forEach(o -> {
GovernCapacityRankResultDTO rank = new GovernCapacityRankResultDTO();
rank.setAgencyName(o.getAgencyName());
rank.setGovernRatio(convertPercentStr(o.getGovernRatio(),NumConstant.ONE));
rank.setResolvedRatio(convertPercentStr(o.getResolvedRatio(),NumConstant.ONE));
rank.setResponseRatio(convertPercentStr(o.getResponseRatio(),NumConstant.ONE));
rank.setSatisfactionRatio(convertPercentStr(o.getSatisfactionRatio(),NumConstant.ONE));
rank.setParentAgencyName(o.getParentAgencyName());
rank.setMonthId(o.getMonthId());
result.add(rank);
});
return result;
}
/** /**
* @Description 6公众参与-柱状折线图 * @Description 6公众参与-柱状折线图
* @NEI https://nei.netease.com/interface/detail/req/?pid=57068&id=322434 * @NEI https://nei.netease.com/interface/detail/req/?pid=57068&id=322434

79
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenGovernRankDataDao.xml

@ -82,4 +82,83 @@
RESPONSE_RATIO DESC RESPONSE_RATIO DESC
</select> </select>
<!-- 查询政府治理能力各项指标 -->
<select id="selectGovernCapacityRatioBak" resultType="com.epmet.evaluationindex.screen.dto.result.GovernCapacityResultDTO">
SELECT
rankData.org_id as orgId,
rankData.ORG_NAME AS agencyName,
rankData.RESPONSE_RATIO,
rankData.RESOLVED_RATIO,
rankData.GOVERN_RATIO,
rankData.SATISFACTION_RATIO,
agency.AGENCY_NAME AS parentAgencyName,
rankData.MONTH_ID as monthId
FROM
screen_govern_rank_data rankData
LEFT JOIN
screen_customer_agency agency
ON rankData.PARENT_ID = agency.AGENCY_ID AND agency.DEL_FLAG = '0' AND agency.AGENCY_ID = #{agencyId}
WHERE
rankData.DEL_FLAG = '0'
AND rankData.PARENT_ID = #{agencyId}
AND rankData.MONTH_ID = #{monthId}
ORDER BY
rankData.RESPONSE_RATIO DESC
</select>
<!-- 基层治理-治理能力榜单 多客户版,调用此sql -->
<select id="selectGovernCapacityRatioNewBak" resultType="com.epmet.evaluationindex.screen.dto.result.GovernCapacityResultDTO">
(SELECT
agency.agency_id as orgId,
agency.AGENCY_NAME AS agencyName,
IFNULL(rankData.RESPONSE_RATIO,0) AS RESPONSE_RATIO,
IFNULL(rankData.RESOLVED_RATIO,0) AS RESOLVED_RATIO,
IFNULL(rankData.GOVERN_RATIO,0) AS GOVERN_RATIO,
IFNULL(rankData.SATISFACTION_RATIO,0) AS SATISFACTION_RATIO,
pa.AGENCY_NAME AS parentAgencyName,
rankData.MONTH_ID as monthId
FROM screen_customer_agency agency
left join screen_customer_agency pa
on(agency.PARENT_AREA_CODE=pa.AREA_CODE
and pa.DEL_FLAG='0')
left join screen_govern_rank_data rankData
ON (agency.AGENCY_ID =rankData.org_id
AND rankData.DEL_FLAG = '0'
and rankData.org_type='agency')
WHERE
agency.DEL_FLAG = '0'
AND agency.agency_id in
<foreach collection="orgIds" item="orgId" open="(" close=")" separator=",">
#{orgId}
</foreach>
AND rankData.MONTH_ID =#{monthId}
)
union
(
SELECT
grid.grid_id as orgId,
grid.GRID_NAME AS agencyName,
IFNULL(rankData.RESPONSE_RATIO,0) AS RESPONSE_RATIO,
IFNULL(rankData.RESOLVED_RATIO,0) AS RESOLVED_RATIO,
IFNULL(rankData.GOVERN_RATIO,0) AS GOVERN_RATIO,
IFNULL(rankData.SATISFACTION_RATIO,0) AS SATISFACTION_RATIO,
ca.agency_name AS parentAgencyName,
rankData.MONTH_ID as monthId
FROM screen_customer_grid grid
left join screen_customer_agency ca
on (ca.agency_id = grid.parent_agency_id)
left join screen_govern_rank_data_daily rankData
ON (grid.grid_id=rankData.org_id
AND grid.DEL_FLAG = 0
and rankData.org_type='grid')
WHERE grid.DEL_FLAG = '0'
AND grid.GRID_ID in
<foreach collection="orgIds" item="orgId" open="(" close=")" separator=",">
#{orgId}
</foreach>
AND rankData.MONTH_ID =#{monthId}
)
ORDER BY
RESPONSE_RATIO DESC
</select>
</mapper> </mapper>

6
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml

@ -260,10 +260,10 @@
WHERE WHERE
dm.del_flag = '0' dm.del_flag = '0'
AND rd.del_flag = '0' AND rd.del_flag = '0'
<if test="customerId != null and customerId != ''">
AND org.CUSTOMER_ID = #{customerId}
</if>
<choose> <choose>
<when test="customerId != null and customerId != ''">
AND org.CUSTOMER_ID = #{customerId}
</when>
<when test="areaCode != null and areaCode != ''"> <when test="areaCode != null and areaCode != ''">
AND org.AREA_CODE LIKE concat(#{areaCode}, '%') AND org.AREA_CODE LIKE concat(#{areaCode}, '%')
</when> </when>

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexOriginExtractServiceImpl.java

@ -1,6 +1,7 @@
package com.epmet.service.evaluationindex.extract.dataToIndex.impl; package com.epmet.service.evaluationindex.extract.dataToIndex.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.constant.CustomerIdConstant;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.extract.form.ExtractIndexFormDTO; import com.epmet.dto.extract.form.ExtractIndexFormDTO;
@ -67,6 +68,8 @@ public class IndexOriginExtractServiceImpl implements IndexOriginExtractService
log.error("indexOriginExtractAll 获取客户Id为空"); log.error("indexOriginExtractAll 获取客户Id为空");
return; return;
} }
//去除 市北客户id的抽取
customerIds.remove(CustomerIdConstant.SHI_BEI_CUSTOMER_ID);
} }
String finalMonthId = monthId; String finalMonthId = monthId;

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java

@ -1,6 +1,7 @@
package com.epmet.service.evaluationindex.extract.toscreen.impl; package com.epmet.service.evaluationindex.extract.toscreen.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.constant.CustomerIdConstant;
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.distributedlock.DistributedLock; import com.epmet.commons.tools.distributedlock.DistributedLock;
@ -461,6 +462,11 @@ public class ScreenExtractServiceImpl implements ScreenExtractService {
} catch (Exception e) { } catch (Exception e) {
log.error("项目(事件)数量分析按组织_按月统计失败,参数为{}" + JSON.toJSONString(formDTO), e); log.error("项目(事件)数量分析按组织_按月统计失败,参数为{}" + JSON.toJSONString(formDTO), e);
} }
//去除 市北客户id的抽取
if (CustomerIdConstant.SHI_BEI_CUSTOMER_ID.equals(customerId)){
log.info("===== extractMonthly method end not contains shi bei:{}======", customerId);
return;
}
//此方法保持在最后即可 计算指标分数 todo 优化 手动创建线程池 控制任务数量 //此方法保持在最后即可 计算指标分数 todo 优化 手动创建线程池 控制任务数量
ExecutorService pool = Executors.newSingleThreadExecutor(); ExecutorService pool = Executors.newSingleThreadExecutor();
pool.submit(() -> { pool.submit(() -> {

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java

@ -15,7 +15,6 @@ import com.epmet.dto.indexcal.IndexStatisticsFormDTO;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.redis.IndexCalRedis; import com.epmet.redis.IndexCalRedis;
import com.epmet.service.crm.CustomerRelationService; import com.epmet.service.crm.CustomerRelationService;
import com.epmet.service.evaluationindex.extract.dataToIndex.IndexOriginExtractService;
import com.epmet.service.evaluationindex.indexcal.*; import com.epmet.service.evaluationindex.indexcal.*;
import com.epmet.service.evaluationindex.indexcoll.FactIndexCollectService; import com.epmet.service.evaluationindex.indexcoll.FactIndexCollectService;
import com.epmet.util.DimIdGenerator; import com.epmet.util.DimIdGenerator;
@ -59,8 +58,6 @@ public class IndexCalculateServiceImpl implements IndexCalculateService {
private ScreenCustomerAgencyDao screenCustomerAgencyDao; private ScreenCustomerAgencyDao screenCustomerAgencyDao;
@Autowired @Autowired
private CustomerRelationService customerRelationService; private CustomerRelationService customerRelationService;
@Autowired
private IndexOriginExtractService indexOriginExtractService;
@Override @Override
public Boolean indexCalculate(CalculateCommonFormDTO formDTO) { public Boolean indexCalculate(CalculateCommonFormDTO formDTO) {

7
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzLeftPieChartResultDTO.java

@ -37,10 +37,17 @@ public class ResiBuzzLeftPieChartResultDTO implements Serializable {
*/ */
private String color; private String color;
@JsonIgnore
private String issueId;
@JsonIgnore
private Boolean status;
public ResiBuzzLeftPieChartResultDTO() { public ResiBuzzLeftPieChartResultDTO() {
this.count = NumConstant.ZERO; this.count = NumConstant.ZERO;
this.categoryCode = ""; this.categoryCode = "";
this.categoryName = ""; this.categoryName = "";
this.color = ""; this.color = "";
this.status = false;
} }
} }

9
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueVoteStatisticalController.java

@ -35,6 +35,7 @@ import com.epmet.dto.result.VoteResultDTO;
import com.epmet.dto.result.VotingTrendResultDTO; import com.epmet.dto.result.VotingTrendResultDTO;
import com.epmet.excel.IssueVoteStatisticalExcel; import com.epmet.excel.IssueVoteStatisticalExcel;
import com.epmet.service.IssueVoteStatisticalService; import com.epmet.service.IssueVoteStatisticalService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -49,10 +50,11 @@ import java.util.Map;
* @author generator generator@elink-cn.com * @author generator generator@elink-cn.com
* @since v1.0.0 2020-05-11 * @since v1.0.0 2020-05-11
*/ */
@Slf4j
@RestController @RestController
@RequestMapping("issuevotestatistical") @RequestMapping("issuevotestatistical")
public class IssueVoteStatisticalController { public class IssueVoteStatisticalController {
@Autowired @Autowired
private IssueVoteStatisticalService issueVoteStatisticalService; private IssueVoteStatisticalService issueVoteStatisticalService;
@ -129,7 +131,8 @@ public class IssueVoteStatisticalController {
**/ **/
@PostMapping("syncvotingcacheanddb") @PostMapping("syncvotingcacheanddb")
public Result syncVotingCacheAndDb(){ public Result syncVotingCacheAndDb(){
issueVoteStatisticalService.syncVotingCacheToDb(); //issueVoteStatisticalService.syncVotingCacheToDb();
log.error("syncvotingcacheanddb 又执行了");
return new Result(); return new Result();
} }
@ -159,4 +162,4 @@ public class IssueVoteStatisticalController {
return new Result<List<MyPartIssuesResultDTO>>().ok(issueVoteStatisticalService.myPartIssues(myPartIssuesFormDTO)); return new Result<List<MyPartIssuesResultDTO>>().ok(issueVoteStatisticalService.myPartIssues(myPartIssuesFormDTO));
} }
} }

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

@ -254,6 +254,26 @@ public interface IssueDao extends BaseDao<IssueEntity> {
*/ */
List<ResiBuzzLeftPieChartResultDTO> resiBuzzLeftPieChart(@Param("orgId")String orgId,@Param("orgType")String orgType,@Param("length")Integer length,@Param("customerId")String customerId); List<ResiBuzzLeftPieChartResultDTO> resiBuzzLeftPieChart(@Param("orgId")String orgId,@Param("orgType")String orgType,@Param("length")Integer length,@Param("customerId")String customerId);
/**
* @Description
* @param length
* @author zxc
* @date 2021/12/30 9:18 上午
*/
List<ResiBuzzLeftPieChartResultDTO> resiBuzzLeftPieChartByIssueIds(@Param("length")Integer length,@Param("issueIds")List<String> issueIds);
List<ResiBuzzLeftPieChartResultDTO> resiBuzzIssueCategoryByIssueIds(@Param("length")Integer length,@Param("issueIds")List<String> issueIds);
List<ResiBuzzLeftPieChartResultDTO> resiBuzzIssueCategoryNameByIssueIds(List<ResiBuzzLeftPieChartResultDTO> categories,@Param("customerId")String customerId);
/**
* @Description 查询前50名的议题ID
* @param orgId
* @param orgType
* @author zxc
* @date 2021/12/30 9:16 上午
*/
List<String> resiBuzzLeftPieChartIssueIds(@Param("orgId")String orgId,@Param("orgType")String orgType);
/** /**
* @Description 查询组织下每个网格的项目数 * @Description 查询组织下每个网格的项目数
* @param orgId * @param orgId
@ -270,4 +290,6 @@ public interface IssueDao extends BaseDao<IssueEntity> {
*/ */
List<ResiBuzzIssueCategoryDTO> selectCategoryNameByIssueIds(@Param("issueIds")List<String> issueIds); List<ResiBuzzIssueCategoryDTO> selectCategoryNameByIssueIds(@Param("issueIds")List<String> issueIds);
List<ResiBuzzIssueCategoryDTO> selectCategoryNameByIssueList(List<ResiBuzzLeftPieChartResultDTO> issueIds,@Param("customerId")String customerId);
} }

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

@ -1616,7 +1616,22 @@ 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())); List<ResiBuzzLeftPieChartResultDTO> categories = baseDao.resiBuzzIssueCategoryByIssueIds(length, list.stream().map(m -> m.getIssueId()).collect(Collectors.toList()));
List<ResiBuzzLeftPieChartResultDTO> pieChat = getPieChat(list.stream().map(m -> m.getIssueId()).collect(Collectors.toList()));
Iterator<ResiBuzzLeftPieChartResultDTO> listIterator = pieChat.iterator();
while (listIterator.hasNext()){
ResiBuzzLeftPieChartResultDTO next = listIterator.next();
for (int i = 0; i < categories.size(); i++) {
if (next.getIssueId().equals(categories.get(i).getIssueId()) && !next.getStatus()){
next.setStatus(true);
listIterator.remove();
continue;
}
}
}
categories.addAll(pieChat);
// List<ResiBuzzIssueCategoryDTO> names = baseDao.selectCategoryNameByIssueIds(allList.stream().map(m -> m.getIssueId()).collect(Collectors.toList()));
List<ResiBuzzIssueCategoryDTO> names = baseDao.selectCategoryNameByIssueList(categories,tokenDto.getCustomerId());
if (CollectionUtils.isNotEmpty(names)){ if (CollectionUtils.isNotEmpty(names)){
list.forEach(l -> names.stream().filter(n -> l.getIssueId().equals(n.getIssueId())).forEach(n -> l.setCategoryName(n.getCn()))); list.forEach(l -> names.stream().filter(n -> l.getIssueId().equals(n.getIssueId())).forEach(n -> l.setCategoryName(n.getCn())));
} }
@ -1662,13 +1677,43 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp
} }
// 分类编码长度 // 分类编码长度
Integer length = baseDao.selectOneLevelCategoryLength(tokenDto.getCustomerId()); Integer length = baseDao.selectOneLevelCategoryLength(tokenDto.getCustomerId());
List<ResiBuzzLeftPieChartResultDTO> result = baseDao.resiBuzzLeftPieChart(formDTO.getOrgId(), formDTO.getOrgType(), length, tokenDto.getCustomerId()); // List<ResiBuzzLeftPieChartResultDTO> result = baseDao.resiBuzzLeftPieChart(formDTO.getOrgId(), formDTO.getOrgType(), length, tokenDto.getCustomerId());
if(CollectionUtils.isEmpty(result)){ List<String> issueIds = baseDao.resiBuzzLeftPieChartIssueIds(formDTO.getOrgId(), formDTO.getOrgType());
if(CollectionUtils.isEmpty(issueIds)){
return new ArrayList<>();
}
List<ResiBuzzLeftPieChartResultDTO> categories = baseDao.resiBuzzIssueCategoryByIssueIds(length, issueIds);
List<ResiBuzzLeftPieChartResultDTO> pieChat = getPieChat(issueIds);
Iterator<ResiBuzzLeftPieChartResultDTO> list = pieChat.iterator();
while (list.hasNext()){
ResiBuzzLeftPieChartResultDTO next = list.next();
for (int i = 0; i < categories.size(); i++) {
if (next.getIssueId().equals(categories.get(i).getIssueId()) && !next.getStatus()){
next.setStatus(true);
list.remove();
continue;
}
}
}
categories.addAll(pieChat);
// List<ResiBuzzLeftPieChartResultDTO> result = baseDao.resiBuzzLeftPieChartByIssueIds(length, issueIds);
List<ResiBuzzLeftPieChartResultDTO> result = baseDao.resiBuzzIssueCategoryNameByIssueIds(categories, tokenDto.getCustomerId());
if (CollectionUtils.isEmpty(result)){
return new ArrayList<>(); return new ArrayList<>();
} }
return result; return result;
} }
public List<ResiBuzzLeftPieChartResultDTO> getPieChat(List<String> issueIds){
List<ResiBuzzLeftPieChartResultDTO> resultDTOS = new ArrayList<>();
issueIds.forEach(i -> {
ResiBuzzLeftPieChartResultDTO dto = new ResiBuzzLeftPieChartResultDTO();
dto.setIssueId(i);
resultDTOS.add(dto);
});
return resultDTOS;
}
/** /**
* @Description 查询组织下每个网格的项目数 * @Description 查询组织下每个网格的项目数
* @param formDTO * @param formDTO

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

@ -617,25 +617,25 @@
<!-- 查询居民热议左侧饼图 --> <!-- 查询居民热议左侧饼图 -->
<select id="resiBuzzLeftPieChart" resultType="com.epmet.dto.result.ResiBuzzLeftPieChartResultDTO"> <select id="resiBuzzLeftPieChart" resultType="com.epmet.dto.result.ResiBuzzLeftPieChartResultDTO">
SELECT COUNT(issueId) AS count,categoryCode,categoryName,color FROM
(SELECT SELECT COUNT(t2.issueId) AS count,cd.CATEGORY_CODE,IFNULL(cd.CATEGORY_NAME,'其他') AS categoryName, IFNULL(cd.COLOR,'#0091ed') AS color FROM
i.ID AS issueId, (SELECT t1.issueId AS issueId,IFNULL(LEFT(ic.CATEGORY_CODE,#{length}),'') AS categoryCode FROM
IFNULL(LEFT(ic.CATEGORY_CODE,#{length}),'') AS categoryCode, (SELECT
IFNULL(cd.CATEGORY_NAME,'其他') AS categoryName, i.ID AS issueId
IFNULL(cd.color,'#0091ed') AS color FROM issue i
FROM issue i INNER 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') WHERE i.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) <if test='orgType == "grid" '>
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) AND i.GRID_ID = #{orgId}
WHERE i.DEL_FLAG = '0' </if>
<if test='orgType == "grid" '> <if test='orgType == "agency" '>
AND i.GRID_ID = #{orgId} AND i.ORG_ID_PATH LIKE CONCAT('%',#{orgId},'%')
</if> </if>
<if test='orgType == "agency" '> ORDER BY (s.SUPPORT_COUNT + s.OPPOSITION_COUNT) DESC,i.created_time DESC LIMIT 50)t1
AND i.ORG_ID_PATH LIKE CONCAT('%',#{orgId},'%') LEFT JOIN issue_category ic ON (t1.issueId = ic.ISSUE_ID AND ic.DEL_FLAG = '0')
</if> GROUP BY t1.issueId,categoryCode)t2
ORDER BY (s.SUPPORT_COUNT + s.OPPOSITION_COUNT) DESC,i.created_time DESC LIMIT 50)temp LEFT JOIN issue_project_category_dict cd ON (cd.CATEGORY_CODE = t2.categoryCode AND cd.CUSTOMER_ID = #{customerId} AND cd.DEL_FLAG = '0' )
GROUP BY categoryName GROUP BY cd.CATEGORY_NAME
</select> </select>
<!-- 查询组织下每个网格的项目数 --> <!-- 查询组织下每个网格的项目数 -->
@ -672,4 +672,79 @@
</foreach> </foreach>
) )
</select> </select>
<!-- 查询前50名的议题ID -->
<select id="resiBuzzLeftPieChartIssueIds" resultType="java.lang.String">
SELECT
i.ID AS issueId
FROM issue i
INNER JOIN issue_vote_statistical s ON (s.ISSUE_ID = i.ID AND s.DEL_FLAG = '0')
WHERE i.DEL_FLAG = '0'
<if test='orgType == "grid" '>
AND i.GRID_ID = #{orgId}
</if>
<if test='orgType == "agency" '>
AND i.ORG_ID_PATH LIKE CONCAT('%',#{orgId},'%')
</if>
ORDER BY (s.SUPPORT_COUNT + s.OPPOSITION_COUNT) DESC,i.created_time DESC LIMIT 50
</select>
<select id="resiBuzzLeftPieChartByIssueIds" resultType="com.epmet.dto.result.ResiBuzzLeftPieChartResultDTO">
SELECT
COUNT(ic.ISSUE_ID) AS count,
IFNULL(LEFT(ic.CATEGORY_CODE,#{length}),'') AS categoryCode,
IFNULL(cd.CATEGORY_NAME,'其他') AS categoryName,
IFNULL(cd.color,'#0091ed') AS color
FROM issue_category ic
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)
AND ic.ISSUE_ID IN (
<foreach collection="issueIds" item="issueId" separator=",">
#{issueId}
</foreach>
) GROUP BY categoryCode
</select>
<select id="resiBuzzIssueCategoryByIssueIds"
resultType="com.epmet.dto.result.ResiBuzzLeftPieChartResultDTO">
SELECT
ISSUE_ID ,
IFNULL(LEFT(CATEGORY_CODE,#{length}),'') AS categoryCode
FROM issue_category
WHERE DEL_FLAG = '0'
AND ISSUE_ID IN(
<foreach collection="issueIds" item="issueId" separator=",">
#{issueId}
</foreach>
)
GROUP BY issue_id,categoryCode
</select>
<select id="resiBuzzIssueCategoryNameByIssueIds"
resultType="com.epmet.dto.result.ResiBuzzLeftPieChartResultDTO">
select count(t2.issueId) as count , t2.categoryCode,t2.categoryName,t2.color from
(<foreach collection="categories" item="c" separator="UNION ALL">
select
t1.issueId as issueId,
cd.CATEGORY_CODE as categoryCode,
IFNULL(cd.CATEGORY_NAME,'其他') AS categoryName,
IFNULL(cd.COLOR,'#0091ed') AS color
from (select #{c.issueId} as issueId,#{c.categoryCode} as categoryCode) t1
LEFT JOIN issue_project_category_dict cd ON (cd.CATEGORY_CODE = t1.categoryCode AND cd.CUSTOMER_ID = #{customerId} AND cd.DEL_FLAG = '0' )
</foreach>)t2
group by t2.categoryName
</select>
<resultMap id="selectCategoryNameByIssueListMap" 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="selectCategoryNameByIssueList" resultMap="selectCategoryNameByIssueListMap">
<foreach collection="issueIds" item="c" separator="UNION ALL">
SELECT
t1.issueId AS issueId,
IFNULL(cd.CATEGORY_NAME,'其他') as categoryName
FROM ( select #{c.issueId} as issueId,#{c.categoryCode} as categoryCode) t1
LEFT JOIN issue_project_category_dict cd ON (cd.CATEGORY_CODE = t1.categoryCode AND cd.DEL_FLAG = '0' AND cd.CUSTOMER_ID = #{customerId})
</foreach>
</select>
</mapper> </mapper>

1
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java

@ -366,6 +366,7 @@ public class CustomerAgencyController {
*/ */
@PostMapping("agencygridtree") @PostMapping("agencygridtree")
public Result<AgencyTreeResultDTO> getOrgTreeData(@LoginUser TokenDto tokenDTO) { public Result<AgencyTreeResultDTO> getOrgTreeData(@LoginUser TokenDto tokenDTO) {
//tokenDTO.setUserId("dffe71e021a61b900f9025f4f07f6955");
return new Result<AgencyTreeResultDTO>().ok(customerAgencyService.getOrgTreeData(tokenDTO.getUserId())); return new Result<AgencyTreeResultDTO>().ok(customerAgencyService.getOrgTreeData(tokenDTO.getUserId()));
} }

59
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java

@ -58,6 +58,7 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
* @Description 组织首页-下级机关列表 * @Description 组织首页-下级机关列表
**/ **/
List<SubListResultDTO> selectSubAgencyById(@Param("pId") String pId, @Param("agencyNum") Integer agencyNum); List<SubListResultDTO> selectSubAgencyById(@Param("pId") String pId, @Param("agencyNum") Integer agencyNum);
List<SubListResultDTO> selectSubAgencyByAgencyId(@Param("pId") String pId); List<SubListResultDTO> selectSubAgencyByAgencyId(@Param("pId") String pId);
/** /**
@ -79,8 +80,8 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
CustomerAgencyEntity getAgencyByStaffId(@Param("staffId") String staffId); CustomerAgencyEntity getAgencyByStaffId(@Param("staffId") String staffId);
/** /**
* @Description 根据agencyId查询地区编码
* @param agencyId 所属机关id * @param agencyId 所属机关id
* @Description 根据agencyId查询地区编码
* @author zxc * @author zxc
* @date 2020/4/28 15:50 * @date 2020/4/28 15:50
*/ */
@ -104,6 +105,7 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
/** /**
* 查询客户根级组织 * 查询客户根级组织
*
* @param customerId * @param customerId
* @return * @return
*/ */
@ -111,10 +113,11 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
/** /**
* 获取所属机关单位名称上级-所属 * 获取所属机关单位名称上级-所属
* @author zhaoqifeng *
* @date 2020/5/22 17:53
* @param agencyId * @param agencyId
* @return java.lang.String * @return java.lang.String
* @author zhaoqifeng
* @date 2020/5/22 17:53
*/ */
String selectAgencyName(@Param("agencyId") String agencyId); String selectAgencyName(@Param("agencyId") String agencyId);
@ -127,46 +130,48 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
List<ArticleGridResultDTO> selectAllSubAgency(@Param("subAgencyPids") String subAgencyPids); List<ArticleGridResultDTO> selectAllSubAgency(@Param("subAgencyPids") String subAgencyPids);
/** /**
* @Description 查询一个工作人员最近登录的网格以及机关信息
* @param gridId * @param gridId
* @return * @return
* @Description 查询一个工作人员最近登录的网格以及机关信息
* @author wangc * @author wangc
* @date 2020.08.17 09:50 * @date 2020.08.17 09:50
**/ **/
ExtStaffInfoResultDTO selectAgencyAndGridInfoExt(@Param("gridId") String gridId); ExtStaffInfoResultDTO selectAgencyAndGridInfoExt(@Param("gridId") String gridId);
/** /**
* @Description 当没有工作人员最近访问的gridId时查询该用户所属的组织机关信息
* @param staffId * @param staffId
* @return * @return
* @Description 当没有工作人员最近访问的gridId时查询该用户所属的组织机关信息
* @author wangc * @author wangc
* @date 2020.08.17 09:50 * @date 2020.08.17 09:50
**/ **/
ExtStaffInfoResultDTO selectAgencyInfoWhenGridIdIsNull(@Param("staffId")String staffId); ExtStaffInfoResultDTO selectAgencyInfoWhenGridIdIsNull(@Param("staffId") String staffId);
/** /**
* @Description 根据agencyId查找指定机构的信息直属网格部门
* @param agencyId * @param agencyId
* @return * @return
* @Description 根据agencyId查找指定机构的信息直属网格部门
* @author wangc * @author wangc
* @date 2020.08.18 13:41 * @date 2020.08.18 13:41
**/ **/
ExtStaffPermissionResultDTO selectAgencyById(@Param("agencyId")String agencyId); ExtStaffPermissionResultDTO selectAgencyById(@Param("agencyId") String agencyId);
/** /**
* @Description 根绝agencyId查找其下属机构的信息
* @param pid * @param pid
* @return * @return
* @Description 根绝agencyId查找其下属机构的信息
* @author wangc * @author wangc
* @date 2020.08.18 13:42 * @date 2020.08.18 13:42
**/ **/
List<ExtStaffPermissionResultDTO> selectSubAgencyByPid(@Param("pid") String pid); List<ExtStaffPermissionResultDTO> selectSubAgencyByPid(@Param("pid") String pid);
/** /**
* @Description 根据agencyId查找指定机构直属的部门将grid与dept分开是因为grid与dept的数量可能不等造成重复数据无法去重
* @param agencyId * @param agencyId
* @return * @return
* @Description 根据agencyId查找指定机构直属的部门将grid与dept分开是因为grid与dept的数量可能不等造成重复数据无法去重
* @author wangc * @author wangc
* @date 2020.08.18 13:42 * @date 2020.08.18 13:42
**/ **/
List<ExtDeptResultDTO> selectDeptList(@Param("agencyId") String agencyId); List<ExtDeptResultDTO> selectDeptList(@Param("agencyId") String agencyId);
/** /**
@ -186,30 +191,33 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
AgencyResultDTO selectAgencyByStaffId(@Param("staffId") String staffId); AgencyResultDTO selectAgencyByStaffId(@Param("staffId") String staffId);
/** /**
* @Description 返回elementTree结构的agency树
* @param customerId * @param customerId
* @param pid * @param pid
* @return java.util.List<com.epmet.dto.result.AgencyElementTreeResultDTO.Agency> * @return java.util.List<com.epmet.dto.result.AgencyElementTreeResultDTO.Agency>
* @Description 返回elementTree结构的agency树
* @Author liushaowen * @Author liushaowen
* @Date 2020/11/6 14:57 * @Date 2020/11/6 14:57
*/ */
List<AgencyElementTreeResultDTO.Agency> getAgencyElementTree(@Param("customerId") String customerId,@Param("pid") String pid); List<AgencyElementTreeResultDTO.Agency> getAgencyElementTree(@Param("customerId") String customerId, @Param("pid") String pid);
/** /**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据 * @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun * @author sun
**/ **/
OrganizeTreeResultDTO selectorganizeTree(@Param("agencyId") String agencyId); OrganizeTreeResultDTO selectorganizeTree(@Param("agencyId") String agencyId);
/** /**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据 * @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun * @author sun
**/ **/
List<OrganizeTreeGridResultDTO> selectAgencyGridList(@Param("agencyId") String agencyId); List<OrganizeTreeGridResultDTO> selectAgencyGridList(@Param("agencyId") String agencyId);
/** /**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据 * @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun * @author sun
**/ **/
List<OrganizeTreeDeptResultDTO> selectAgencyDeptList(@Param("agencyId") String agencyId); List<OrganizeTreeDeptResultDTO> selectAgencyDeptList(@Param("agencyId") String agencyId);
/** /**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据 * @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun * @author sun
@ -236,6 +244,7 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
/** /**
* 根据新增人员类型判断查询机关信息 * 根据新增人员类型判断查询机关信息
*
* @author sun * @author sun
*/ */
OrgResultDTO selectAgencyDetail(@Param("orgId") String orgId, @Param("orgType") String orgType); OrgResultDTO selectAgencyDetail(@Param("orgId") String orgId, @Param("orgType") String orgType);
@ -247,41 +256,47 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
List<StaffOrgsResultDTO> getStaffOrgListByStaffId(@Param("staffId") String staffId); List<StaffOrgsResultDTO> getStaffOrgListByStaffId(@Param("staffId") String staffId);
/** /**
* @Description 地图配置删除
* @param orgId * @param orgId
* @param level * @param level
* @Description 地图配置删除
* @author zxc * @author zxc
* @date 2021/10/25 9:39 上午 * @date 2021/10/25 9:39 上午
*/ */
void delMapArea(@Param("orgId") String orgId, @Param("level") String level); void delMapArea(@Param("orgId") String orgId, @Param("level") String level);
/** /**
* @Description 地图配置新增
* @param orgId * @param orgId
* @param level * @param level
* @param coordinates * @param coordinates
* @Description 地图配置新增
* @author zxc * @author zxc
* @date 2021/10/25 9:59 上午 * @date 2021/10/25 9:59 上午
*/ */
void addMapArea(@Param("orgId") String orgId, @Param("level") String level,@Param("coordinates")String coordinates); void addMapArea(@Param("orgId") String orgId, @Param("level") String level, @Param("coordinates") String coordinates);
/** /**
* @Description 地图查询下级组织
* @param pid * @param pid
* @param type * @param type
* @Description 地图查询下级组织
* @author zxc * @author zxc
* @date 2021/10/25 2:30 下午 * @date 2021/10/25 2:30 下午
*/ */
List<MapSonOrgResultDTO> selectSonOrg(@Param("pid")String pid,@Param("type")String type); List<MapSonOrgResultDTO> selectSonOrg(@Param("pid") String pid, @Param("type") String type);
/** /**
* @Description 查询下级agencyId
* @param orgId * @param orgId
* @Description 查询下级agencyId
* @author zxc * @author zxc
* @date 2021/12/9 4:42 下午 * @date 2021/12/9 4:42 下午
*/ */
List<String> getSonAgencyId(@Param("orgId") String orgId); List<String> getSonAgencyId(@Param("orgId") String orgId);
/**
* desc:获取组织和网格的数据 树形sql
* @param agencyId
* @return
*/
ExtStaffPermissionResultDTO selectAgencyAndGridById(@Param("agencyId") String agencyId);
/** /**
* @Description 事件社区服务热线 * @Description 事件社区服务热线
* @author sun * @author sun

18
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java

@ -16,6 +16,7 @@
*/ */
package com.epmet.service.impl; package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
@ -24,6 +25,8 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
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;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.CustomerAgencyConstant; import com.epmet.constant.CustomerAgencyConstant;
@ -81,6 +84,8 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
private EpmetUserFeignClient epmetUserFeignClient; private EpmetUserFeignClient epmetUserFeignClient;
@Autowired @Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private RedisUtils redisUtils;
@Override @Override
public PageData<CustomerAgencyDTO> page(Map<String, Object> params) { public PageData<CustomerAgencyDTO> page(Map<String, Object> params) {
@ -1125,8 +1130,17 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
result.setOrgLevel(rootAgency.getAgencyId().concat("-").concat(rootAgency.getLevel())); result.setOrgLevel(rootAgency.getAgencyId().concat("-").concat(rootAgency.getLevel()));
result.setLongitude(rootAgency.getLongitude()); result.setLongitude(rootAgency.getLongitude());
result.setLatitude(rootAgency.getLatitude()); result.setLatitude(rootAgency.getLatitude());
ExtStaffPermissionResultDTO res = baseDao.selectAgencyById(rootAgency.getAgencyId());
convert2AgencyTreeResult(result,res.getSubAgencyList(),res.getGridList()); String orgTreeCacheKey = RedisKeys.getOrgTreeCacheKey(rootAgency.getAgencyId());
Object o = redisUtils.get(orgTreeCacheKey);
if (o == null){
ExtStaffPermissionResultDTO res = baseDao.selectAgencyAndGridById(rootAgency.getAgencyId());
convert2AgencyTreeResult(result,res.getSubAgencyList(),res.getGridList());
redisUtils.set(orgTreeCacheKey,result, 60 * 60 * 24L);
}else {
result = (AgencyTreeResultDTO) o;
}
return result; return result;
} }
/** /**

34
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml

@ -303,6 +303,26 @@
</collection> </collection>
</resultMap> </resultMap>
<resultMap id="agencyAndGridMap" type="com.epmet.dto.result.ExtStaffPermissionResultDTO">
<id column="agencyId" property="agencyId" />
<result column="agencyName" property="agencyName"/>
<result column="level" property="level" />
<result column="longitude" property="longitude" />
<result column="latitude" property="latitude" />
<result column="customerId" property="customerId"/>
<collection property="gridList" column="agencyId" ofType="com.epmet.dto.result.ExtGridResultDTO" select="selectGridList">
<id column="gridId" property="gridId" />
<result column="gridName" property="gridName" />
<result column="customerId" property="customerId"/>
<result column="longitude" property="longitude" />
<result column="latitude" property="latitude" />
</collection>
<collection property="subAgencyList" column="agencyId"
ofType="com.epmet.dto.result.ExtStaffPermissionResultDTO" select="selectSubAgencyByPid">
</collection>
</resultMap>
<select id="selectAgencyById" resultMap="treeMap"> <select id="selectAgencyById" resultMap="treeMap">
SELECT SELECT
@ -672,6 +692,20 @@
DEL_FLAG = '0' DEL_FLAG = '0'
AND PID = #{orgId} AND PID = #{orgId}
</select> </select>
<select id="selectAgencyAndGridById" resultMap="agencyAndGridMap">
SELECT
agency.ID AS agencyId,
agency.ORGANIZATION_NAME AS agencyName,
agency.LEVEL AS level,
agency.CUSTOMER_ID as customerId,
agency.longitude,
agency.latitude
FROM
CUSTOMER_AGENCY agency
WHERE
agency.DEL_FLAG = '0'
AND agency.ID = #{agencyId}
</select>
<select id="getAgencyMobile" resultType="com.epmet.dto.result.OrgMobileResultDTO"> <select id="getAgencyMobile" resultType="com.epmet.dto.result.OrgMobileResultDTO">
SELECT SELECT

2
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java

@ -99,7 +99,7 @@ public class ProjectTraceController {
* @date 2020/5/11 16:25 * @date 2020/5/11 16:25
*/ */
@PostMapping("projectdetail") @PostMapping("projectdetail")
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PROJECT_TRACE_DETAIL) //@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PROJECT_TRACE_DETAIL)
public Result<ProjectDetailResultDTO> getProjectDetail(@LoginUser TokenDto tokenDto, @RequestBody ProjectDetailFromDTO fromDTO) { public Result<ProjectDetailResultDTO> getProjectDetail(@LoginUser TokenDto tokenDto, @RequestBody ProjectDetailFromDTO fromDTO) {
ProjectDetailResultDTO result = projectTraceService.getProjectDetail(tokenDto, fromDTO); ProjectDetailResultDTO result = projectTraceService.getProjectDetail(tokenDto, fromDTO);
return new Result<ProjectDetailResultDTO>().ok(result); return new Result<ProjectDetailResultDTO>().ok(result);

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

@ -50,7 +50,7 @@ public class BaseGridDailyworkController {
@PostMapping("sync") @PostMapping("sync")
public Result getStaffBaseInfo(@RequestBody(required = false) UpsertPatrolRecordForm formDTO) { public Result getStaffBaseInfo(@RequestBody(required = false) UpsertPatrolRecordForm formDTO) {
ValidatorUtils.validateEntity(formDTO, DefaultGroup.class); ValidatorUtils.validateEntity(formDTO, DefaultGroup.class);
baseGridDailyworkService.insertPatrolRecord(formDTO); baseGridDailyworkService.insertBaseGridWorkRecord(formDTO);
return new Result(); return new Result();
} }

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

@ -103,12 +103,12 @@ public class BaseGridDailyworkEntity implements Serializable {
/** /**
* 重点人员是否在当地-当事件类型为特殊人群服务与管理时必填 * 重点人员是否在当地-当事件类型为特殊人群服务与管理时必填
*/ */
private String isKeyPeopleLocate; private String isKeypeopleLocate;
/** /**
* 重点人员现状 * 重点人员现状
*/ */
private String keyPeopleStatus; private String keypeopleStatus;
/** /**
* 发生地 * 发生地

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

@ -3,6 +3,7 @@ package com.epmet.opendata.mq.listener;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.epmet.commons.rocketmq.constants.MQUserPropertys; import com.epmet.commons.rocketmq.constants.MQUserPropertys;
import com.epmet.commons.rocketmq.messages.StaffPatrolMQMsg; import com.epmet.commons.rocketmq.messages.StaffPatrolMQMsg;
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.distributedlock.DistributedLock; import com.epmet.commons.tools.distributedlock.DistributedLock;
import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.ExceptionUtils;
@ -53,6 +54,7 @@ public class OpenDataPatrolChangeEventListener implements MessageListenerConcurr
} }
try { try {
Thread.sleep(NumConstant.ONE_THOUSAND);
msgs.forEach(this::consumeMessage); msgs.forEach(this::consumeMessage);
} catch (Exception e) { } catch (Exception e) {
logger.error(ExceptionUtils.getErrorStackTrace(e)); logger.error(ExceptionUtils.getErrorStackTrace(e));
@ -96,7 +98,7 @@ public class OpenDataPatrolChangeEventListener implements MessageListenerConcurr
aBoolean = SpringContextUtils.getBean(UserPatrolRecordService.class).updatePatrolRecord(patrolRecordForm); aBoolean = SpringContextUtils.getBean(UserPatrolRecordService.class).updatePatrolRecord(patrolRecordForm);
break; break;
case SystemMessageType.PATROL_ROUTINE_WORK_ADD: case SystemMessageType.PATROL_ROUTINE_WORK_ADD:
aBoolean = SpringContextUtils.getBean(BaseGridDailyworkService.class).insertPatrolRecord(patrolRecordForm); aBoolean = SpringContextUtils.getBean(BaseGridDailyworkService.class).insertBaseGridWorkRecord(patrolRecordForm);
break; break;
default: default:
log.error("错误的消息类型:{}", tags); log.error("错误的消息类型:{}", tags);

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

@ -34,7 +34,7 @@ public interface BaseGridDailyworkService extends BaseService<BaseGridDailyworkE
* @param patrolRecordForm * @param patrolRecordForm
* @return * @return
*/ */
Boolean insertPatrolRecord(UpsertPatrolRecordForm patrolRecordForm); Boolean insertBaseGridWorkRecord(UpsertPatrolRecordForm patrolRecordForm);
/** /**
* desc重新加载数据 * desc重新加载数据

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

@ -21,6 +21,8 @@ import com.alibaba.fastjson.JSON;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
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.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.AddGroup;
@ -64,14 +66,14 @@ public class BaseGridDailyworkServiceImpl extends BaseServiceImpl<BaseGridDailyw
private ExUserService exUserService; private ExUserService exUserService;
@Override @Override
public Boolean insertPatrolRecord(UpsertPatrolRecordForm patrolRecordForm) { public Boolean insertBaseGridWorkRecord(UpsertPatrolRecordForm patrolRecordForm) {
log.info("upsertPatrolRecord param:{}", JSON.toJSONString(patrolRecordForm)); log.info("insertBaseGridWorkRecord param:{}", JSON.toJSONString(patrolRecordForm));
ValidatorUtils.validateEntity(patrolRecordForm, AddGroup.class); ValidatorUtils.validateEntity(patrolRecordForm, AddGroup.class);
PatrolQueryFormDTO midPatrolFormDTO = buildParam(patrolRecordForm); PatrolQueryFormDTO midPatrolFormDTO = buildParam(patrolRecordForm);
Result<List<PatrolRoutineWorkResult>> record = epmetUserOpenFeignClient.getPatrolRoutineWorkList(midPatrolFormDTO); Result<List<PatrolRoutineWorkResult>> record = epmetUserOpenFeignClient.getPatrolRoutineWorkList(midPatrolFormDTO);
if (record == null || !record.success()) { if (record == null || !record.success()) {
log.error("获取例行工作记录失败,param:{}", JSON.toJSONString(midPatrolFormDTO)); log.error("获取例行工作记录失败,param:{}", JSON.toJSONString(midPatrolFormDTO));
return false; throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode());
} }
Map<String, ExDeptDTO> deptMap = exDeptService.getDeptDTOMap(patrolRecordForm.getCustomerId()); Map<String, ExDeptDTO> deptMap = exDeptService.getDeptDTOMap(patrolRecordForm.getCustomerId());
Map<String, ExUserDTO> userMap = exUserService.getUserDTOMap(patrolRecordForm.getCustomerId()); Map<String, ExUserDTO> userMap = exUserService.getUserDTOMap(patrolRecordForm.getCustomerId());
@ -82,7 +84,7 @@ public class BaseGridDailyworkServiceImpl extends BaseServiceImpl<BaseGridDailyw
log.error("获取例行工作记录返回为空,param:{}", JSON.toJSONString(midPatrolFormDTO)); log.error("获取例行工作记录返回为空,param:{}", JSON.toJSONString(midPatrolFormDTO));
int effectRow = baseDao.deleteById(patrolRecordForm.getId()); int effectRow = baseDao.deleteById(patrolRecordForm.getId());
log.warn("del effectRow:{}", effectRow); log.warn("del effectRow:{}", effectRow);
return true; throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode());
} }
insertRecordBatch(data, deptMap, userMap); insertRecordBatch(data, deptMap, userMap);
return true; return true;
@ -152,10 +154,10 @@ public class BaseGridDailyworkServiceImpl extends BaseServiceImpl<BaseGridDailyw
Integer isKeyPeopleLocate = record.getIsKeyPeopleLocate(); Integer isKeyPeopleLocate = record.getIsKeyPeopleLocate();
if (isKeyPeopleLocate != null){ if (isKeyPeopleLocate != null){
entity.setIsKeyPeopleLocate(isKeyPeopleLocate == NumConstant.ONE ?"Y":"N"); entity.setIsKeypeopleLocate(isKeyPeopleLocate == NumConstant.ONE ?"Y":"N");
} }
entity.setKeyPeopleStatus(record.getKeyPeopleStatus()); entity.setKeypeopleStatus(record.getKeyPeopleStatus());
entity.setHappenPlace(record.getAddress()); entity.setHappenPlace(record.getAddress());
entity.setLng(record.getLongitude()); entity.setLng(record.getLongitude());
entity.setLat(record.getLatitude()); entity.setLat(record.getLatitude());

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

@ -21,6 +21,8 @@ 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.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.user.param.MidPatrolFormDTO; import com.epmet.dto.user.param.MidPatrolFormDTO;
@ -64,17 +66,17 @@ public class UserPatrolRecordServiceImpl extends BaseServiceImpl<UserPatrolRecor
MidPatrolFormDTO midPatrolFormDTO = buildParam(patrolRecordForm); MidPatrolFormDTO midPatrolFormDTO = buildParam(patrolRecordForm);
Result<List<MidPatrolRecordResult>> record = dataStatisticalOpenFeignClient.getPatrolRecordList(midPatrolFormDTO); Result<List<MidPatrolRecordResult>> record = dataStatisticalOpenFeignClient.getPatrolRecordList(midPatrolFormDTO);
if (record == null || !record.success()) { if (record == null || !record.success()) {
log.error("获取巡查记录失败,param:{}", JSON.toJSONString(midPatrolFormDTO)); log.error("insertPatrolRecord 获取巡查记录失败,param:{}", JSON.toJSONString(midPatrolFormDTO));
return false; throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode());
} }
List<MidPatrolRecordResult> data = record.getData(); List<MidPatrolRecordResult> data = record.getData();
if (CollectionUtils.isEmpty(data)) { if (CollectionUtils.isEmpty(data)) {
//数据已被删除了 //数据已被删除了
//暂时设置error 用于排错 //暂时设置error 用于排错
log.error("获取巡查记录返回为空,param:{}", JSON.toJSONString(midPatrolFormDTO)); log.error("insertPatrolRecord获取巡查记录返回为空,param:{}", JSON.toJSONString(midPatrolFormDTO));
int effectRow = baseDao.deleteById(patrolRecordForm.getId()); int effectRow = baseDao.deleteById(patrolRecordForm.getId());
log.warn("del effectRow:{}", effectRow); log.warn("del effectRow:{}", effectRow);
return true; throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode());
} }
List<UserPatrolRecordEntity> insertList = new ArrayList<>(); List<UserPatrolRecordEntity> insertList = new ArrayList<>();
data.forEach(o-> insertList.add(buildEntity(o))); data.forEach(o-> insertList.add(buildEntity(o)));
@ -94,17 +96,17 @@ public class UserPatrolRecordServiceImpl extends BaseServiceImpl<UserPatrolRecor
MidPatrolFormDTO midPatrolFormDTO = buildParam(patrolRecordForm); MidPatrolFormDTO midPatrolFormDTO = buildParam(patrolRecordForm);
Result<List<MidPatrolRecordResult>> record = dataStatisticalOpenFeignClient.getPatrolRecordList(midPatrolFormDTO); Result<List<MidPatrolRecordResult>> record = dataStatisticalOpenFeignClient.getPatrolRecordList(midPatrolFormDTO);
if (record == null || !record.success()) { if (record == null || !record.success()) {
log.error("获取巡查记录失败,param:{}", JSON.toJSONString(midPatrolFormDTO)); log.error("updatePatrolRecord 获取巡查记录失败,param:{}", JSON.toJSONString(midPatrolFormDTO));
return false; throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode());
} }
List<MidPatrolRecordResult> data = record.getData(); List<MidPatrolRecordResult> data = record.getData();
if (CollectionUtils.isEmpty(data)) { if (CollectionUtils.isEmpty(data)) {
//数据已被删除了 //数据已被删除了
//暂时设置error 用于排错 //暂时设置error 用于排错
log.error("获取巡查记录返回为空,param:{}", JSON.toJSONString(midPatrolFormDTO)); log.error("updatePatrolRecord 获取巡查记录返回为空,param:{}", JSON.toJSONString(midPatrolFormDTO));
int effectRow = baseDao.deleteById(patrolRecordForm.getId()); int effectRow = baseDao.deleteById(patrolRecordForm.getId());
log.warn("del effectRow:{}", effectRow); log.warn("del effectRow:{}", effectRow);
return true; throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode());
} }
data.forEach(o->{ data.forEach(o->{
UserPatrolRecordEntity recordEntity = buildEntity(o); UserPatrolRecordEntity recordEntity = buildEntity(o);

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

@ -17,8 +17,8 @@
<result property="keyAreaType" column="KEY_AREA_TYPE"/> <result property="keyAreaType" column="KEY_AREA_TYPE"/>
<result property="regionScale" column="REGION_SCALE"/> <result property="regionScale" column="REGION_SCALE"/>
<result property="isKeyareaState" column="IS_KEYAREA_STATE"/> <result property="isKeyareaState" column="IS_KEYAREA_STATE"/>
<result property="isKeyPeopleLocate" column="IS_KEY_PEOPLE_LOCATE"/> <result property="isKeypeopleLocate" column="IS_KEY_PEOPLE_LOCATE"/>
<result property="keyPeopleStatus" column="KEY_PEOPLE_STATUS"/> <result property="keypeopleStatus" column="KEY_PEOPLE_STATUS"/>
<result property="happenPlace" column="HAPPEN_PLACE"/> <result property="happenPlace" column="HAPPEN_PLACE"/>
<result property="lng" column="LNG"/> <result property="lng" column="LNG"/>
<result property="lat" column="LAT"/> <result property="lat" column="LAT"/>

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

@ -28,6 +28,8 @@ public class VolunteerDistributionResultDTO {
@Data @Data
public static class Distribution { public static class Distribution {
private Set<String> volunteerCategories; private Set<String> volunteerCategories;
private String volunteerCategoriesStr;
private String buildingId;
private String epmetUserId; private String epmetUserId;
private String icResiUserId; private String icResiUserId;
private String longitude; private String longitude;

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

@ -688,7 +688,7 @@ public interface EpmetUserOpenFeignClient {
* @param patrolQueryFormDTO * @param patrolQueryFormDTO
* @return * @return
*/ */
@PostMapping(value = "//epmetuser/patrolroutinework/selectList") @PostMapping(value = "/epmetuser/patrolroutinework/selectList")
Result<List<PatrolRoutineWorkResult>> getPatrolRoutineWorkList(@RequestBody PatrolQueryFormDTO patrolQueryFormDTO); Result<List<PatrolRoutineWorkResult>> getPatrolRoutineWorkList(@RequestBody PatrolQueryFormDTO patrolQueryFormDTO);
/** /**

2
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java

@ -226,4 +226,6 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
*/ */
List<PartyMemberEducationResultDTO> getPartyMemberEducationList(@Param("orgType") String orgType, @Param("orgId") String orgId, List<PartyMemberEducationResultDTO> getPartyMemberEducationList(@Param("orgType") String orgType, @Param("orgId") String orgId,
@Param("code") String code); @Param("code") String code);
List<VolunteerDistributionResultDTO.Distribution> listIcResiInfosByUserIds(@Param("userIds") List<String> userIds);
} }

90
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridUserWorkEntity.java

@ -1,90 +0,0 @@
/**
* 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.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 网格员例行工作
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-10-19
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("patrol_routine_work")
public class GridUserWorkEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 网格ID
*/
private String gridId;
/**
* gridId的PID
*/
private String pids;
/**
* 用户Id user.id 谁创建的
*/
private String userId;
/**
* 事项名称
*/
private String title;
/**
* 发生日期 格式为YYYY-MM-DD
*/
private Date happenTime;
/**
* 有无变动异常10
*/
private Integer isNormal;
/**
* 备注说明
*/
private String workContent;
/**
* 经度
*/
private String longitude;
/**
* 纬度
*/
private String latitude;
}

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

@ -7,19 +7,22 @@ import com.epmet.dao.IcResiUserDao;
import com.epmet.dao.UserBaseInfoDao; import com.epmet.dao.UserBaseInfoDao;
import com.epmet.dto.IcBuildingDTO; import com.epmet.dto.IcBuildingDTO;
import com.epmet.dto.IcFormItemOptionsDTO; import com.epmet.dto.IcFormItemOptionsDTO;
import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.form.IcFormOptionsQueryFormDTO; import com.epmet.dto.form.IcFormOptionsQueryFormDTO;
import com.epmet.dto.form.resi.VolunteerCommonFormDTO; import com.epmet.dto.form.resi.VolunteerCommonFormDTO;
import com.epmet.dto.result.ResiUserBaseInfoResultDTO;
import com.epmet.dto.result.VolunteerDistributionResultDTO; import com.epmet.dto.result.VolunteerDistributionResultDTO;
import com.epmet.dto.result.resi.PageVolunteerInfoResultDTO; import com.epmet.dto.result.resi.PageVolunteerInfoResultDTO;
import com.epmet.feign.EpmetHeartOpenFeignClient; import com.epmet.feign.EpmetHeartOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.feign.OperCustomizeOpenFeignClient; import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.service.VolunteerService; import com.epmet.service.VolunteerService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.google.common.collect.Lists;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -29,6 +32,7 @@ import java.util.stream.Collectors;
* @Date 2021/12/10 5:48 下午 * @Date 2021/12/10 5:48 下午
* @Version 1.0 * @Version 1.0
*/ */
@Slf4j
@Service @Service
public class VolunteerServiceImpl implements VolunteerService, ResultDataResolver { public class VolunteerServiceImpl implements VolunteerService, ResultDataResolver {
@ -94,10 +98,10 @@ public class VolunteerServiceImpl implements VolunteerService, ResultDataResolve
// 1.分页查询出所有志愿者列表 // 1.分页查询出所有志愿者列表
int pageNo = 1; int pageNo = 1;
int pageSize = 100; int pageSize = 200;
// 志愿者epmet user id // 志愿者epmet user id
Set<String> volunteerEpmetUserIds = new HashSet<>(); List<String> volunteerEpmetUserIds = new ArrayList<>();
// 分页查询志愿者的epmet user id // 分页查询志愿者的epmet user id
while (true) { while (true) {
@ -129,51 +133,95 @@ public class VolunteerServiceImpl implements VolunteerService, ResultDataResolve
VolunteerDistributionResultDTO r = new VolunteerDistributionResultDTO(); VolunteerDistributionResultDTO r = new VolunteerDistributionResultDTO();
log.info("【志愿者分布】查询到志愿者userId公{}个", volunteerEpmetUserIds.size());
// 2.填充ic居民信息 // 2.填充ic居民信息
for (String volunteerEpmetUserId : volunteerEpmetUserIds) { List<List<String>> volunteerEpmetUserIdParts = Lists.partition(volunteerEpmetUserIds, 100);
for (List<String> volunteerEpmetUserIdPart : volunteerEpmetUserIdParts) {
VolunteerDistributionResultDTO.Distribution distribution = new VolunteerDistributionResultDTO.Distribution();
List<VolunteerDistributionResultDTO.Distribution> icResiInfos = icResiUserDao.listIcResiInfosByUserIds(volunteerEpmetUserIdPart);
ResiUserBaseInfoResultDTO userBaseInfo = userBaseInfoDao.selecUserBaseInfoByUserId(volunteerEpmetUserId);
// 填充志愿者类型
//使用身份证号查询ic resi信息 for (VolunteerDistributionResultDTO.Distribution icResiInfo : icResiInfos) {
IcResiUserDTO icResiUserInfo = icResiUserDao.selectIdByIdCard(customerId, userBaseInfo.getIdNum(), null); // 将志愿者类型列表字符串,切割放到set中
if (icResiUserInfo == null) { Set<String> volunteerTypes = new HashSet();
continue; String volunteerCategoriesStr = icResiInfo.getVolunteerCategoriesStr();
}
if (StringUtils.isNotEmpty(volunteerCategoriesStr)) {
// 查询志愿者类别 String[] vTypes = volunteerCategoriesStr.split(",");
List<String> volunteerCategories = icResiUserDao.selectVolunteerByUserId(icResiUserInfo.getId()); if (vTypes != null && vTypes.length > 0) {
//if (CollectionUtils.isEmpty(volunteerCategories)) { volunteerTypes.addAll(Arrays.asList(vTypes));
// // 此人没有志愿者信息 }
// continue; icResiInfo.setVolunteerCategories(volunteerTypes);
//} } else {
icResiInfo.setVolunteerCategories(new HashSet<>());
// 将志愿者类型列表字符串,切割放到set中
Set<String> volunteerTypes = new HashSet();
for (String vTypesString : volunteerCategories) {
String[] vTypes = vTypesString.split(",");
if (vTypes != null && vTypes.length > 0) {
volunteerTypes.addAll(Arrays.asList(vTypes));
} }
}
// 填充建筑坐标
String msg = "【志愿者分布】查询楼栋信息失败";
IcBuildingDTO building = getResultDataOrThrowsException(govOrgOpenFeignClient.getBuildingById(icResiInfo.getBuildingId()),
ServiceConstant.GOV_ORG_SERVER,
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg);
String msg = "【志愿者分布】查询楼栋信息失败"; icResiInfo.setEpmetUserId(icResiInfo.getEpmetUserId());
IcBuildingDTO building = getResultDataOrThrowsException(govOrgOpenFeignClient.getBuildingById(icResiUserInfo.getBuildId()), icResiInfo.setIcResiUserId(icResiInfo.getIcResiUserId());
ServiceConstant.GOV_ORG_SERVER, Optional.of(building).ifPresent(b -> {
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg); icResiInfo.setLongitude(b.getLongitude());
icResiInfo.setLatitude(b.getLatitude());
});
distribution.setVolunteerCategories(volunteerTypes); }
distribution.setEpmetUserId(userBaseInfo.getUserId()); r.getDistributions().addAll(icResiInfos);
distribution.setIcResiUserId(icResiUserInfo.getId());
Optional.of(building).ifPresent(b -> {
distribution.setLongitude(b.getLongitude());
distribution.setLatitude(b.getLatitude());
});
r.getDistributions().add(distribution);
} }
// 就有代码,稳定之后可以删掉
//for (String volunteerEpmetUserId : volunteerEpmetUserIds) {
//
// VolunteerDistributionResultDTO.Distribution distribution = new VolunteerDistributionResultDTO.Distribution();
//
// ResiUserBaseInfoResultDTO userBaseInfo = userBaseInfoDao.selecUserBaseInfoByUserId(volunteerEpmetUserId);
// if (userBaseInfo == null || StringUtils.isBlank(userBaseInfo.getIdNum())){
// log.warn("getVolunteerDistribution selecUserBaseInfoByUserId return null or idCard is null,volunteerEpmetUserId:{}", volunteerEpmetUserId);
// continue;
// }
// //使用身份证号查询ic resi信息
// IcResiUserDTO icResiUserInfo = icResiUserDao.selectIdByIdCard(customerId, userBaseInfo.getIdNum(), null);
// if (icResiUserInfo == null) {
// continue;
// }
//
// // 查询志愿者类别
// List<String> volunteerCategories = icResiUserDao.selectVolunteerByUserId(icResiUserInfo.getId());
// //if (CollectionUtils.isEmpty(volunteerCategories)) {
// // // 此人没有志愿者信息
// // continue;
// //}
//
// // 将志愿者类型列表字符串,切割放到set中
// Set<String> volunteerTypes = new HashSet();
// for (String vTypesString : volunteerCategories) {
// String[] vTypes = vTypesString.split(",");
// if (vTypes != null && vTypes.length > 0) {
// volunteerTypes.addAll(Arrays.asList(vTypes));
// }
// }
//
//
// String msg = "【志愿者分布】查询楼栋信息失败";
// IcBuildingDTO building = getResultDataOrThrowsException(govOrgOpenFeignClient.getBuildingById(icResiUserInfo.getBuildId()),
// ServiceConstant.GOV_ORG_SERVER,
// EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg);
//
// distribution.setVolunteerCategories(volunteerTypes);
// distribution.setEpmetUserId(userBaseInfo.getUserId());
// distribution.setIcResiUserId(icResiUserInfo.getId());
// Optional.of(building).ifPresent(b -> {
// distribution.setLongitude(b.getLongitude());
// distribution.setLatitude(b.getLatitude());
// });
//
// r.getDistributions().add(distribution);
//}
return r; return r;
} }

17
epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

@ -489,4 +489,21 @@
</choose> </choose>
GROUP BY CULTURE GROUP BY CULTURE
</select> </select>
<select id="listIcResiInfosByUserIds"
resultType="com.epmet.dto.result.VolunteerDistributionResultDTO$Distribution">
select userbaseinfo.USER_ID as epmetUserId,
icuser.ID as icResiUserId,
icuser.BUILD_ID as buildingId,
icvol.VOLUNTEER_CATEGORY as volunteerCategoriesStr
from user_base_info userbaseinfo
inner join ic_resi_user icuser on (userbaseinfo.ID_NUM = icuser.ID_CARD and icuser.DEL_FLAG = '0')
inner join ic_volunteer icvol on (icuser.ID = icvol.IC_RESI_USER and icvol.DEL_FLAG = '0')
where userbaseinfo.DEL_FLAG = '0'
and userbaseinfo.ID_NUM is not null
and userbaseinfo.USER_ID in
<foreach collection="userIds" open="(" separator="," close=")" item="userId">
#{userId}
</foreach>
</select>
</mapper> </mapper>

Loading…
Cancel
Save