Browse Source

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

# Conflicts:
#	epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
dev
yinzuomei 4 years ago
parent
commit
75f9c6b4f1
  1. 6
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  2. 3
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenGovernRankDataDao.xml
  3. 9
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueVoteStatisticalController.java
  4. 1
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/PartyServiceCenterConstant.java
  5. 15
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  6. 59
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
  7. 18
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  8. 32
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPartyServiceCenterServiceImpl.java
  9. 34
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  10. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/BaseGridDailyworkController.java
  11. 4
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataPatrolChangeEventListener.java
  12. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/BaseGridDailyworkService.java
  13. 10
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java
  14. 18
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/UserPatrolRecordServiceImpl.java
  15. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VolunteerDistributionResultDTO.java
  16. 10
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  17. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  18. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java
  19. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
  20. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/RegisterRelationDao.java
  21. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java
  22. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java
  23. 134
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/VolunteerServiceImpl.java
  24. 17
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml
  25. 5
      epmet-user/epmet-user-server/src/main/resources/mapper/RegisterRelationDao.xml

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

@ -630,10 +630,10 @@ public class RedisKeys {
/**
* desc:临时方案
* @param userId
* @param agencyId
* @return
*/
public static String getOrgTreeCacheKey(String userId) {
return rootPrefix.concat("ic:temp:orgtree").concat("userId");
public static String getOrgTreeCacheKey(String agencyId) {
return rootPrefix.concat("org:temp:orgtree").concat(agencyId);
}
}

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

@ -91,7 +91,8 @@
rankData.RESOLVED_RATIO,
rankData.GOVERN_RATIO,
rankData.SATISFACTION_RATIO,
agency.AGENCY_NAME AS parentAgencyName
agency.AGENCY_NAME AS parentAgencyName,
rankData.MONTH_ID as monthId
FROM
screen_govern_rank_data rankData
LEFT JOIN

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

1
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/PartyServiceCenterConstant.java

@ -8,6 +8,7 @@ package com.epmet.constant;
public interface PartyServiceCenterConstant {
String ORG_TYPE_AGENCY = "agency";
String ORG_TYPE_GRID = "grid";
String APPOINTMENT_STATUS_APPOINTING = "appointing";
String APPOINTMENT_STATUS_CANCEL = "cancel";

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

@ -20,8 +20,6 @@ package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.exception.RenException;
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.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
@ -55,8 +53,6 @@ import java.util.Set;
@RestController
@RequestMapping("customeragency")
public class CustomerAgencyController {
@Autowired
private RedisUtils redisUtils;
@Autowired
private CustomerAgencyService customerAgencyService;
@ -371,16 +367,7 @@ public class CustomerAgencyController {
@PostMapping("agencygridtree")
public Result<AgencyTreeResultDTO> getOrgTreeData(@LoginUser TokenDto tokenDTO) {
//tokenDTO.setUserId("dffe71e021a61b900f9025f4f07f6955");
String orgTreeCacheKey = RedisKeys.getOrgTreeCacheKey(tokenDTO.getUserId());
Object o = redisUtils.get(orgTreeCacheKey);
AgencyTreeResultDTO result = null;
if (o == null){
result = customerAgencyService.getOrgTreeData(tokenDTO.getUserId());
redisUtils.set(orgTreeCacheKey,result,RedisUtils.MINUTE_THIRTY_EXPIRE);
}else {
result = (AgencyTreeResultDTO) o;
}
return new Result<AgencyTreeResultDTO>().ok(result);
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 组织首页-下级机关列表
**/
List<SubListResultDTO> selectSubAgencyById(@Param("pId") String pId, @Param("agencyNum") Integer agencyNum);
List<SubListResultDTO> selectSubAgencyByAgencyId(@Param("pId") String pId);
/**
@ -79,8 +80,8 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
CustomerAgencyEntity getAgencyByStaffId(@Param("staffId") String staffId);
/**
* @Description 根据agencyId查询地区编码
* @param agencyId 所属机关id
* @Description 根据agencyId查询地区编码
* @author zxc
* @date 2020/4/28 15:50
*/
@ -104,6 +105,7 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
/**
* 查询客户根级组织
*
* @param customerId
* @return
*/
@ -111,10 +113,11 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
/**
* 获取所属机关单位名称上级-所属
* @author zhaoqifeng
* @date 2020/5/22 17:53
*
* @param agencyId
* @return java.lang.String
* @author zhaoqifeng
* @date 2020/5/22 17:53
*/
String selectAgencyName(@Param("agencyId") String agencyId);
@ -127,46 +130,48 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
List<ArticleGridResultDTO> selectAllSubAgency(@Param("subAgencyPids") String subAgencyPids);
/**
* @Description 查询一个工作人员最近登录的网格以及机关信息
* @param gridId
* @return
* @Description 查询一个工作人员最近登录的网格以及机关信息
* @author wangc
* @date 2020.08.17 09:50
**/
**/
ExtStaffInfoResultDTO selectAgencyAndGridInfoExt(@Param("gridId") String gridId);
/**
* @Description 当没有工作人员最近访问的gridId时查询该用户所属的组织机关信息
* @param staffId
* @return
* @Description 当没有工作人员最近访问的gridId时查询该用户所属的组织机关信息
* @author wangc
* @date 2020.08.17 09:50
**/
ExtStaffInfoResultDTO selectAgencyInfoWhenGridIdIsNull(@Param("staffId")String staffId);
ExtStaffInfoResultDTO selectAgencyInfoWhenGridIdIsNull(@Param("staffId") String staffId);
/**
* @Description 根据agencyId查找指定机构的信息直属网格部门
* @param agencyId
* @return
* @Description 根据agencyId查找指定机构的信息直属网格部门
* @author wangc
* @date 2020.08.18 13:41
**/
ExtStaffPermissionResultDTO selectAgencyById(@Param("agencyId")String agencyId);
**/
ExtStaffPermissionResultDTO selectAgencyById(@Param("agencyId") String agencyId);
/**
* @Description 根绝agencyId查找其下属机构的信息
* @param pid
* @return
* @Description 根绝agencyId查找其下属机构的信息
* @author wangc
* @date 2020.08.18 13:42
**/
**/
List<ExtStaffPermissionResultDTO> selectSubAgencyByPid(@Param("pid") String pid);
/**
* @Description 根据agencyId查找指定机构直属的部门将grid与dept分开是因为grid与dept的数量可能不等造成重复数据无法去重
* @param agencyId
* @return
* @Description 根据agencyId查找指定机构直属的部门将grid与dept分开是因为grid与dept的数量可能不等造成重复数据无法去重
* @author wangc
* @date 2020.08.18 13:42
**/
**/
List<ExtDeptResultDTO> selectDeptList(@Param("agencyId") String agencyId);
/**
@ -186,30 +191,33 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
AgencyResultDTO selectAgencyByStaffId(@Param("staffId") String staffId);
/**
* @Description 返回elementTree结构的agency树
* @param customerId
* @param pid
* @return java.util.List<com.epmet.dto.result.AgencyElementTreeResultDTO.Agency>
* @Description 返回elementTree结构的agency树
* @Author liushaowen
* @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 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
OrganizeTreeResultDTO selectorganizeTree(@Param("agencyId") String agencyId);
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
List<OrganizeTreeGridResultDTO> selectAgencyGridList(@Param("agencyId") String agencyId);
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
List<OrganizeTreeDeptResultDTO> selectAgencyDeptList(@Param("agencyId") String agencyId);
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
@ -236,6 +244,7 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
/**
* 根据新增人员类型判断查询机关信息
*
* @author sun
*/
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);
/**
* @Description 地图配置删除
* @param orgId
* @param level
* @Description 地图配置删除
* @author zxc
* @date 2021/10/25 9:39 上午
*/
void delMapArea(@Param("orgId") String orgId, @Param("level") String level);
/**
* @Description 地图配置新增
* @param orgId
* @param level
* @param coordinates
* @Description 地图配置新增
* @author zxc
* @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 type
* @Description 地图查询下级组织
* @author zxc
* @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
* @Description 查询下级agencyId
* @author zxc
* @date 2021/12/9 4:42 下午
*/
List<String> getSonAgencyId(@Param("orgId") String orgId);
/**
* desc:获取组织和网格的数据 树形sql
* @param agencyId
* @return
*/
ExtStaffPermissionResultDTO selectAgencyAndGridById(@Param("agencyId") String agencyId);
/**
* @Description 事件社区服务热线
* @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;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
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.RenException;
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.Result;
import com.epmet.constant.CustomerAgencyConstant;
@ -81,6 +84,8 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
private EpmetUserFeignClient epmetUserFeignClient;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private RedisUtils redisUtils;
@Override
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.setLongitude(rootAgency.getLongitude());
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;
}
/**

32
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPartyServiceCenterServiceImpl.java

@ -40,6 +40,7 @@ import com.epmet.constant.PartyServiceCenterConstant;
import com.epmet.dao.IcMatterAppointmentRecordDao;
import com.epmet.dao.IcPartyServiceCenterDao;
import com.epmet.dto.IcPartyServiceCenterDTO;
import com.epmet.dto.RegisterRelationDTO;
import com.epmet.dto.TimeDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
@ -347,13 +348,9 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ
throw new RenException(EpmetErrorCode.APPOINTMENT_TIME_ERROR.getCode());
}
}
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, tokenDto.getUserId());
if (null == staffInfo){
throw new RenException(String.format("查询人员{%s}信息失败",tokenDto.getUserId()));
}
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(staffInfo.getAgencyId());
if (null == agencyInfo){
throw new RenException(String.format("查询组织信息失败%s",staffInfo.getAgencyId()));
Result<RegisterRelationDTO> registerRelation = userOpenFeignClient.resiRelationInfo(tokenDto.getUserId());
if (!registerRelation.success()){
throw new EpmetException(String.format("查询居民{%s}信息失败",tokenDto.getUserId()));
}
IcMatterAppointmentRecordEntity e = ConvertUtils.sourceToTarget(formDTO, IcMatterAppointmentRecordEntity.class);
e.setCustomerId(customerId);
@ -361,11 +358,24 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ
e.setOrgId(formDTO.getOrgId());
e.setOrgType(formDTO.getOrgType());
}else {
e.setOrgId(staffInfo.getAgencyId());
e.setOrgType(PartyServiceCenterConstant.ORG_TYPE_AGENCY);
e.setOrgId(registerRelation.getData().getGridId());
e.setOrgType(PartyServiceCenterConstant.ORG_TYPE_GRID);
}
if (e.getOrgType().equals(PartyServiceCenterConstant.ORG_TYPE_GRID)){
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(e.getOrgId());
if (null == gridInfo){
throw new EpmetException(String.format("查询组织信息失败%s",e.getOrgId()));
}
e.setPid(gridInfo.getPid());
e.setPids(gridInfo.getPids());
}else {
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(e.getOrgId());
if (null == agencyInfo){
throw new EpmetException(String.format("查询组织信息失败%s",e.getOrgId()));
}
e.setPid(agencyInfo.getPid());
e.setPids(agencyInfo.getPids());
}
e.setPid(agencyInfo.getPid());
e.setPids(agencyInfo.getPids());
e.setStatus(PartyServiceCenterConstant.APPOINTMENT_STATUS_APPOINTING);
matterAppointmentRecordDao.insert(e);
}

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

@ -303,6 +303,26 @@
</collection>
</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
@ -672,6 +692,20 @@
DEL_FLAG = '0'
AND PID = #{orgId}
</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

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")
public Result getStaffBaseInfo(@RequestBody(required = false) UpsertPatrolRecordForm formDTO) {
ValidatorUtils.validateEntity(formDTO, DefaultGroup.class);
baseGridDailyworkService.insertPatrolRecord(formDTO);
baseGridDailyworkService.insertBaseGridWorkRecord(formDTO);
return new Result();
}

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.epmet.commons.rocketmq.constants.MQUserPropertys;
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.distributedlock.DistributedLock;
import com.epmet.commons.tools.exception.ExceptionUtils;
@ -53,6 +54,7 @@ public class OpenDataPatrolChangeEventListener implements MessageListenerConcurr
}
try {
Thread.sleep(NumConstant.ONE_THOUSAND);
msgs.forEach(this::consumeMessage);
} catch (Exception e) {
logger.error(ExceptionUtils.getErrorStackTrace(e));
@ -96,7 +98,7 @@ public class OpenDataPatrolChangeEventListener implements MessageListenerConcurr
aBoolean = SpringContextUtils.getBean(UserPatrolRecordService.class).updatePatrolRecord(patrolRecordForm);
break;
case SystemMessageType.PATROL_ROUTINE_WORK_ADD:
aBoolean = SpringContextUtils.getBean(BaseGridDailyworkService.class).insertPatrolRecord(patrolRecordForm);
aBoolean = SpringContextUtils.getBean(BaseGridDailyworkService.class).insertBaseGridWorkRecord(patrolRecordForm);
break;
default:
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
* @return
*/
Boolean insertPatrolRecord(UpsertPatrolRecordForm patrolRecordForm);
Boolean insertBaseGridWorkRecord(UpsertPatrolRecordForm patrolRecordForm);
/**
* desc重新加载数据

10
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.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
@ -64,14 +66,14 @@ public class BaseGridDailyworkServiceImpl extends BaseServiceImpl<BaseGridDailyw
private ExUserService exUserService;
@Override
public Boolean insertPatrolRecord(UpsertPatrolRecordForm patrolRecordForm) {
log.info("upsertPatrolRecord param:{}", JSON.toJSONString(patrolRecordForm));
public Boolean insertBaseGridWorkRecord(UpsertPatrolRecordForm patrolRecordForm) {
log.info("insertBaseGridWorkRecord param:{}", JSON.toJSONString(patrolRecordForm));
ValidatorUtils.validateEntity(patrolRecordForm, AddGroup.class);
PatrolQueryFormDTO midPatrolFormDTO = buildParam(patrolRecordForm);
Result<List<PatrolRoutineWorkResult>> record = epmetUserOpenFeignClient.getPatrolRoutineWorkList(midPatrolFormDTO);
if (record == null || !record.success()) {
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, ExUserDTO> userMap = exUserService.getUserDTOMap(patrolRecordForm.getCustomerId());
@ -82,7 +84,7 @@ public class BaseGridDailyworkServiceImpl extends BaseServiceImpl<BaseGridDailyw
log.error("获取例行工作记录返回为空,param:{}", JSON.toJSONString(midPatrolFormDTO));
int effectRow = baseDao.deleteById(patrolRecordForm.getId());
log.warn("del effectRow:{}", effectRow);
return true;
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode());
}
insertRecordBatch(data, deptMap, userMap);
return true;

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

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

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

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

@ -698,4 +698,14 @@ public interface EpmetUserOpenFeignClient {
*/
@PostMapping(value = "/epmetuser/icresiuser/geticresiuser/{icResiUserId}")
Result<IcResiUserDTO> getIcResiUserDTO(@PathVariable("icResiUserId") String icResiUserId);
/**
* @Description 查询居民注册关系
* @param userId
* @author zxc
* @date 2021/12/30 3:12 下午
*/
@PostMapping("/epmetuser/userbaseinfo/resirelationinfo")
Result<RegisterRelationDTO> resiRelationInfo(@RequestParam("userId")String userId);
}

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

@ -518,4 +518,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getIcResiUserDTO", icResiUserId);
}
@Override
public Result<RegisterRelationDTO> resiRelationInfo(String userId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "resiRelationInfo", userId);
}
}

12
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java

@ -27,6 +27,7 @@ import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.RegisterRelationDTO;
import com.epmet.dto.UserBaseInfoDTO;
import com.epmet.dto.form.CommonUserIdFormDTO;
import com.epmet.dto.form.IssueInitiatorFormDTO;
@ -203,5 +204,16 @@ public class UserBaseInfoController {
ValidatorUtils.validateEntity(param, CommonUserIdFormDTO.CommonUserIdGroup.class);
return new Result<ExtUserInfoResultDTO>().ok(userBaseInfoService.extUserInfo(param));
}
/**
* @Description 查询居民注册关系
* @param userId
* @author zxc
* @date 2021/12/30 3:12 下午
*/
@PostMapping("resirelationinfo")
public Result<RegisterRelationDTO> resiRelationInfo(@RequestParam("userId")String userId){
return new Result<RegisterRelationDTO>().ok(userBaseInfoService.resiRelationInfo(userId));
}
}

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,
@Param("code") String code);
List<VolunteerDistributionResultDTO.Distribution> listIcResiInfosByUserIds(@Param("userIds") List<String> userIds);
}

9
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/RegisterRelationDao.java

@ -18,6 +18,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.RegisterRelationDTO;
import com.epmet.entity.RegisterRelationEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -55,4 +56,12 @@ public interface RegisterRelationDao extends BaseDao<RegisterRelationEntity> {
* @date 2021/3/16 下午3:05
*/
String selectRegisterGridIdByUserId(@Param("userId")String userId);
/**
* @Description 居民注册关系
* @param userId
* @author zxc
* @date 2021/12/30 3:14 下午
*/
RegisterRelationDTO resiRelationInfo(@Param("userId")String userId);
}

9
epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java

@ -20,6 +20,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.RegisterRelationDTO;
import com.epmet.dto.UserBaseInfoDTO;
import com.epmet.dto.form.CommonUserIdFormDTO;
import com.epmet.dto.form.VolunteerRegResiFormDTO;
@ -194,4 +195,12 @@ public interface UserBaseInfoService extends BaseService<UserBaseInfoEntity> {
@Deprecated
Integer checkIdNum(String idNum, String customerId, String excludeUserId);
/**
* @Description 查询居民注册关系
* @param userId
* @author zxc
* @date 2021/12/30 3:12 下午
*/
RegisterRelationDTO resiRelationInfo(String userId);
}

14
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java

@ -30,6 +30,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.*;
import com.epmet.dto.RegisterRelationDTO;
import com.epmet.dto.UserBaseInfoDTO;
import com.epmet.dto.UserResiInfoDTO;
import com.epmet.dto.UserWechatDTO;
@ -86,6 +87,8 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl<UserBaseInfoDao, Us
private RegisterRelationService registerRelationService;
@Autowired
private UserResiInfoService userResiInfoService;
@Autowired
private RegisterRelationDao registerRelationDao;
@Override
public PageData<UserBaseInfoDTO> page(Map<String, Object> params) {
@ -490,4 +493,15 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl<UserBaseInfoDao, Us
public Integer checkIdNum(String idNum, String customerId, String excludeUserId) {
return baseDao.selectCountIdNum(idNum,customerId,excludeUserId);
}
/**
* @Description 查询居民注册关系
* @param userId
* @author zxc
* @date 2021/12/30 3:12 下午
*/
@Override
public RegisterRelationDTO resiRelationInfo(String userId) {
return registerRelationDao.resiRelationInfo(userId);
}
}

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

@ -7,10 +7,8 @@ import com.epmet.dao.IcResiUserDao;
import com.epmet.dao.UserBaseInfoDao;
import com.epmet.dto.IcBuildingDTO;
import com.epmet.dto.IcFormItemOptionsDTO;
import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.form.IcFormOptionsQueryFormDTO;
import com.epmet.dto.form.resi.VolunteerCommonFormDTO;
import com.epmet.dto.result.ResiUserBaseInfoResultDTO;
import com.epmet.dto.result.VolunteerDistributionResultDTO;
import com.epmet.dto.result.resi.PageVolunteerInfoResultDTO;
import com.epmet.feign.EpmetHeartOpenFeignClient;
@ -18,10 +16,13 @@ import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.feign.OperCustomizeOpenFeignClient;
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.stereotype.Service;
import com.google.common.collect.Lists;
import java.util.*;
import java.util.stream.Collectors;
@ -97,10 +98,10 @@ public class VolunteerServiceImpl implements VolunteerService, ResultDataResolve
// 1.分页查询出所有志愿者列表
int pageNo = 1;
int pageSize = 100;
int pageSize = 200;
// 志愿者epmet user id
Set<String> volunteerEpmetUserIds = new HashSet<>();
List<String> volunteerEpmetUserIds = new ArrayList<>();
// 分页查询志愿者的epmet user id
while (true) {
@ -132,54 +133,95 @@ public class VolunteerServiceImpl implements VolunteerService, ResultDataResolve
VolunteerDistributionResultDTO r = new VolunteerDistributionResultDTO();
log.info("【志愿者分布】查询到志愿者userId公{}个", volunteerEpmetUserIds.size());
// 2.填充ic居民信息
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));
List<List<String>> volunteerEpmetUserIdParts = Lists.partition(volunteerEpmetUserIds, 100);
for (List<String> volunteerEpmetUserIdPart : volunteerEpmetUserIdParts) {
List<VolunteerDistributionResultDTO.Distribution> icResiInfos = icResiUserDao.listIcResiInfosByUserIds(volunteerEpmetUserIdPart);
// 填充志愿者类型
for (VolunteerDistributionResultDTO.Distribution icResiInfo : icResiInfos) {
// 将志愿者类型列表字符串,切割放到set中
Set<String> volunteerTypes = new HashSet();
String volunteerCategoriesStr = icResiInfo.getVolunteerCategoriesStr();
if (StringUtils.isNotEmpty(volunteerCategoriesStr)) {
String[] vTypes = volunteerCategoriesStr.split(",");
if (vTypes != null && vTypes.length > 0) {
volunteerTypes.addAll(Arrays.asList(vTypes));
}
icResiInfo.setVolunteerCategories(volunteerTypes);
} else {
icResiInfo.setVolunteerCategories(new HashSet<>());
}
}
// 填充建筑坐标
String msg = "【志愿者分布】查询楼栋信息失败";
IcBuildingDTO building = getResultDataOrThrowsException(govOrgOpenFeignClient.getBuildingById(icResiInfo.getBuildingId()),
ServiceConstant.GOV_ORG_SERVER,
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg);
String msg = "【志愿者分布】查询楼栋信息失败";
IcBuildingDTO building = getResultDataOrThrowsException(govOrgOpenFeignClient.getBuildingById(icResiUserInfo.getBuildId()),
ServiceConstant.GOV_ORG_SERVER,
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg);
icResiInfo.setEpmetUserId(icResiInfo.getEpmetUserId());
icResiInfo.setIcResiUserId(icResiInfo.getIcResiUserId());
Optional.of(building).ifPresent(b -> {
icResiInfo.setLongitude(b.getLongitude());
icResiInfo.setLatitude(b.getLatitude());
});
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);
}
r.getDistributions().addAll(icResiInfos);
}
// 就有代码,稳定之后可以删掉
//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;
}

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

@ -489,4 +489,21 @@
</choose>
GROUP BY CULTURE
</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>

5
epmet-user/epmet-user-server/src/main/resources/mapper/RegisterRelationDao.xml

@ -82,5 +82,10 @@
SELECT GRID_ID FROM register_relation WHERE DEL_FLAG = 0 and USER_ID = #{userId}
</select>
<!-- 居民注册关系 -->
<select id="resiRelationInfo" resultType="com.epmet.dto.RegisterRelationDTO">
SELECT * FROM register_relation WHERE DEL_FLAG = 0 AND USER_ID = #{userId}
</select>
</mapper>

Loading…
Cancel
Save