Browse Source

Merge branch 'lingshan_master' into dev

master
wxz 2 years ago
parent
commit
38f26f02cc
  1. 9
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/TCCCClientUtils.java
  2. 25
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/LingshanServiceAgentAgentList.java
  3. 10
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/beans/LingShanAgentServiceStaffAndGrid.java
  4. 14
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/beans/StaffInfoInGridOfRole.java
  5. 46
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/LingShanServiceAgentController.java
  6. 21
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java
  7. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffGridDao.java
  8. 8
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/LingShanServiceAgentService.java
  9. 4
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java
  10. 20
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java
  11. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
  12. 14
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  13. 128
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/LingShanServiceAgentServiceImpl.java
  14. 31
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml
  15. 10
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffGridDao.xml
  16. 30
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/LingShanAgentServiceController.java
  17. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LingShanAgentServiceService.java
  18. 83
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LingShanAgentServiceServiceImpl.java

9
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/TCCCClientUtils.java

@ -21,12 +21,15 @@ public class TCCCClientUtils {
private static String SECRETKEY = "ymRuDJI8mCRUUPFvQqCPQME0c2MbfaM2"; private static String SECRETKEY = "ymRuDJI8mCRUUPFvQqCPQME0c2MbfaM2";
private static String ENDPOINT ="ccc.ap-shanghai.tencentcloudapi.com";
public static String getToken() { public static String getToken() {
try { try {
Credential cred = new Credential(SECRETID, SECRETKEY); Credential cred = new Credential(SECRETID, SECRETKEY);
// 实例化一个http选项,可选的,没有特殊需求可以跳过 // 实例化一个http选项,可选的,没有特殊需求可以跳过
HttpProfile httpProfile = new HttpProfile(); HttpProfile httpProfile = new HttpProfile();
httpProfile.setEndpoint("ccc.ap-shanghai.tencentcloudapi.com"); httpProfile.setEndpoint(ENDPOINT);
// 实例化一个client选项,可选的,没有特殊需求可以跳过 // 实例化一个client选项,可选的,没有特殊需求可以跳过
ClientProfile clientProfile = new ClientProfile(); ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile); clientProfile.setHttpProfile(httpProfile);
@ -46,4 +49,8 @@ public class TCCCClientUtils {
return e.toString(); return e.toString();
} }
} }
public static void main(String[] args) {
getToken();
}
} }

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

@ -0,0 +1,25 @@
package com.epmet.dataaggre.dto.epmetuser.result;
import lombok.Data;
/**
* @Description 灵山代办代办员列表
* @Author wangxianzhang
* @Time 2023/5/9 4:26 PM
*/
@Data
public class LingshanServiceAgentAgentList {
private String gridId;
private String orgNamePath;
private String agentId;
private String agentName;
private Integer gender;
private String genderDisplay;
private Integer age;
private String cultureDisplay;
private Integer culture;
private String mobile;
private String idCard;
}

10
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/beans/LingShanAgentServiceStaffAndGrid.java

@ -0,0 +1,10 @@
package com.epmet.dataaggre.beans;
import lombok.Data;
@Data
public class LingShanAgentServiceStaffAndGrid {
private String staffId;
private String gridId;
}

14
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/beans/StaffInfoInGridOfRole.java

@ -0,0 +1,14 @@
package com.epmet.dataaggre.beans;
import lombok.Data;
@Data
public class StaffInfoInGridOfRole {
private String staffId;
private String staffName;
private Integer gender;
private Integer age;
private Integer culture;
private String mobile;
private String idCard;
}

46
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/LingShanServiceAgentController.java

@ -0,0 +1,46 @@
package com.epmet.dataaggre.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dataaggre.dto.epmetuser.result.LingshanServiceAgentAgentList;
import com.epmet.dataaggre.service.LingShanServiceAgentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("lingshan/serviceAgent")
public class LingShanServiceAgentController {
@Autowired
private LingShanServiceAgentService lingShanServiceAgentService;
/**
* @description: 工作端pc代办员列表
* @param pageNo:
* @param pageSize:
* @param orgId:
* @param orgType:
* @param agentName:
* @param mobile:
* @param idCard:
* @return
* @author: WangXianZhang
* @date: 2023/5/9 4:30 PM
*/
@GetMapping("workpc/agentList")
public Result<PageData<LingshanServiceAgentAgentList>> workPcAgentList(@RequestParam("pageNo") Integer pageNo,
@RequestParam("pageSize") Integer pageSize,
@RequestParam("orgId") String orgId,
@RequestParam("orgType") String orgType,
@RequestParam("agentName") String agentName,
@RequestParam("mobile") Integer mobile,
@RequestParam("idCard") Integer idCard) {
PageData<LingshanServiceAgentAgentList> pd = lingShanServiceAgentService.workPcAgentList(orgId, orgType, agentName, mobile, idCard, pageNo, pageSize);
return new Result<PageData<LingshanServiceAgentAgentList>>().ok(pd);
}
}

21
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java

@ -18,6 +18,7 @@
package com.epmet.dataaggre.dao.epmetuser; package com.epmet.dataaggre.dao.epmetuser;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.beans.StaffInfoInGridOfRole;
import com.epmet.dataaggre.dto.epmetuser.CustomerStaffDTO; import com.epmet.dataaggre.dto.epmetuser.CustomerStaffDTO;
import com.epmet.dataaggre.dto.epmetuser.result.ListStaffResultDTO; import com.epmet.dataaggre.dto.epmetuser.result.ListStaffResultDTO;
import com.epmet.dataaggre.dto.epmetuser.result.StaffSelectResDTO; import com.epmet.dataaggre.dto.epmetuser.result.StaffSelectResDTO;
@ -28,6 +29,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* 政府工作人员表 * 政府工作人员表
@ -78,8 +80,25 @@ public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
/** /**
* 根据staffId查询姓名手机号 * 根据staffId查询姓名手机号
* 禁用的不展示 * 禁用的不展示
* @param staffIds * @param staffIdss
* @return * @return
*/ */
List<StaffSelectResDTO> staffSelectList(@Param("staffIds") List<String> staffIds); List<StaffSelectResDTO> staffSelectList(@Param("staffIds") List<String> staffIds);
/**
* @Description:查询工作人员列表
* @param staffIds: 工作人员id列表
* @param roleId: 角色id
* @param mobile: 手机号
* @param realname: realname
* @param idCard: 身份证
* @Return void
* @Author: wangxianzhang
* @Date: 2023/5/10 9:37 AM
*/
List<StaffInfoInGridOfRole> selectStaffListByStaffIdsAndRole(@Param("staffIds") Set<String> staffIds,
@Param("roleId") String roleId,
@Param("mobile") Integer mobile,
@Param("realname") String realname,
@Param("idCard") Integer idCard);
} }

5
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffGridDao.java

@ -18,14 +18,17 @@
package com.epmet.dataaggre.dao.govorg; package com.epmet.dataaggre.dao.govorg;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.beans.LingShanAgentServiceStaffAndGrid;
import com.epmet.dataaggre.dto.govorg.OrgDTO; import com.epmet.dataaggre.dto.govorg.OrgDTO;
import com.epmet.dataaggre.dto.govorg.result.GridStaffResultDTO; import com.epmet.dataaggre.dto.govorg.result.GridStaffResultDTO;
import com.epmet.dataaggre.dto.govorg.result.StaffAgencyGridListResultDTO; import com.epmet.dataaggre.dto.govorg.result.StaffAgencyGridListResultDTO;
import com.epmet.dataaggre.entity.govorg.CustomerStaffGridEntity; import com.epmet.dataaggre.entity.govorg.CustomerStaffGridEntity;
import com.epmet.dataaggre.service.impl.LingShanServiceAgentServiceImpl;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 网格人员关系表 * 网格人员关系表
@ -58,4 +61,6 @@ public interface CustomerStaffGridDao extends BaseDao<CustomerStaffGridEntity> {
List<OrgDTO> selectGridList(@Param("agencyId") String agencyId, @Param("userId") String userId); List<OrgDTO> selectGridList(@Param("agencyId") String agencyId, @Param("userId") String userId);
List<GridStaffResultDTO> getGridStaffByAgency(@Param("agencyId") String agencyId); List<GridStaffResultDTO> getGridStaffByAgency(@Param("agencyId") String agencyId);
List<LingShanAgentServiceStaffAndGrid> getStaffAndItsBelongsGridByAgencyIdPath(@Param("agencyIdPath") String agencyIdPath);
} }

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

@ -0,0 +1,8 @@
package com.epmet.dataaggre.service;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dataaggre.dto.epmetuser.result.LingshanServiceAgentAgentList;
public interface LingShanServiceAgentService {
PageData<LingshanServiceAgentAgentList> workPcAgentList(String orgId, String orgType, String agentName, Integer mobile, Integer idCard, Integer pageNo, Integer pageSize);
}

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

@ -2,6 +2,7 @@ package com.epmet.dataaggre.service.epmetuser;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dataaggre.beans.StaffInfoInGridOfRole;
import com.epmet.dataaggre.dto.datastats.form.NowStatsDataFormDTO; import com.epmet.dataaggre.dto.datastats.form.NowStatsDataFormDTO;
import com.epmet.dataaggre.dto.datastats.result.NowStatsDataResultDTO; import com.epmet.dataaggre.dto.datastats.result.NowStatsDataResultDTO;
import com.epmet.dataaggre.dto.epmetuser.form.*; import com.epmet.dataaggre.dto.epmetuser.form.*;
@ -26,6 +27,7 @@ import com.epmet.dto.result.DetailByTypeResultDTO;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* @Author zxc * @Author zxc
@ -263,4 +265,6 @@ public interface EpmetUserService {
*/ */
DetailByTypeResultDTO detailByType(DetailByTypeFormDTO formDTO, TokenDto tokenDto); DetailByTypeResultDTO detailByType(DetailByTypeFormDTO formDTO, TokenDto tokenDto);
PageData<StaffInfoInGridOfRole> staffListInGridsOfRole(String roleKey, Set<String> staffIds, String agentName, Integer mobile, Integer idCard,
Integer pageNo, Integer pageSize);
} }

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

@ -24,6 +24,7 @@ import com.epmet.commons.tools.utils.*;
import com.epmet.constant.BadgeConstant; import com.epmet.constant.BadgeConstant;
import com.epmet.constant.NeighborhoodConstant; import com.epmet.constant.NeighborhoodConstant;
import com.epmet.constant.OrgInfoConstant; import com.epmet.constant.OrgInfoConstant;
import com.epmet.dataaggre.beans.StaffInfoInGridOfRole;
import com.epmet.dataaggre.constant.DataSourceConstant; import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.dao.epmetuser.*; import com.epmet.dataaggre.dao.epmetuser.*;
import com.epmet.dataaggre.dto.datastats.form.NowStatsDataFormDTO; import com.epmet.dataaggre.dto.datastats.form.NowStatsDataFormDTO;
@ -1149,4 +1150,23 @@ public class EpmetUserServiceImpl implements EpmetUserService, ResultDataResolve
epmetMessageOpenFeignClient.sendSystemMsgByMQ(form); epmetMessageOpenFeignClient.sendSystemMsgByMQ(form);
return result; return result;
} }
@Override
public PageData<StaffInfoInGridOfRole> staffListInGridsOfRole(String roleKey, Set<String> staffIds, String agentName, Integer mobile,
Integer idCard, Integer pageNo, Integer pageSize) {
LambdaQueryWrapper<GovStaffRoleEntity> rq = new LambdaQueryWrapper<>();
rq.eq(GovStaffRoleEntity::getCustomerId, EpmetRequestHolder.getLoginUserCustomerId());
rq.eq(GovStaffRoleEntity::getRoleKey, roleKey);
GovStaffRoleEntity role = govStaffRoleDao.selectOne(rq);
if (role == null) {
return null;
}
PageHelper.startPage(pageNo, pageSize);
List<StaffInfoInGridOfRole> ss = customerStaffDao.selectStaffListByStaffIdsAndRole(staffIds, role.getId(), mobile, agentName, idCard);
return new PageData<>(ss, new PageInfo<>(ss).getTotal());
}
} }

5
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java

@ -3,6 +3,7 @@ package com.epmet.dataaggre.service.govorg;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.bean.BuildingInfoCache; import com.epmet.commons.tools.redis.common.bean.BuildingInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dataaggre.beans.LingShanAgentServiceStaffAndGrid;
import com.epmet.dataaggre.dto.epmetuser.form.ResisByPolicyRulesFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.ResisByPolicyRulesFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.StaffSelectResDTO; import com.epmet.dataaggre.dto.epmetuser.result.StaffSelectResDTO;
import com.epmet.dataaggre.dto.evaluationindex.ScreenAgencyOrGridListDTO; import com.epmet.dataaggre.dto.evaluationindex.ScreenAgencyOrGridListDTO;
@ -18,6 +19,7 @@ import com.epmet.dto.IcNeighborHoodDTO;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* @Author zxc * @Author zxc
@ -301,4 +303,7 @@ public interface GovOrgService {
*/ */
Map<String,String> getEmployeeRegisterMobileAndIdCard(String registerId); Map<String,String> getEmployeeRegisterMobileAndIdCard(String registerId);
List<LingShanAgentServiceStaffAndGrid> getStaffAndItsBelongsGridByAgencyIdPath(String agencyIdPath);
Set<String> getStaffIdsInGrid(String gridId);
} }

14
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java

@ -32,6 +32,7 @@ import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dataaggre.beans.LingShanAgentServiceStaffAndGrid;
import com.epmet.dataaggre.constant.DataSourceConstant; import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.constant.OrgConstant; import com.epmet.dataaggre.constant.OrgConstant;
import com.epmet.dataaggre.dao.govorg.*; import com.epmet.dataaggre.dao.govorg.*;
@ -49,6 +50,7 @@ import com.epmet.dataaggre.dto.govorg.result.*;
import com.epmet.dataaggre.dto.resigroup.result.OrgInfoCommonDTO; import com.epmet.dataaggre.dto.resigroup.result.OrgInfoCommonDTO;
import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity; import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity;
import com.epmet.dataaggre.entity.govorg.CustomerGridEntity; import com.epmet.dataaggre.entity.govorg.CustomerGridEntity;
import com.epmet.dataaggre.entity.govorg.CustomerStaffGridEntity;
import com.epmet.dataaggre.excel.GridLivelyDetailExcel; import com.epmet.dataaggre.excel.GridLivelyDetailExcel;
import com.epmet.dataaggre.excel.GridLivelyExcel; import com.epmet.dataaggre.excel.GridLivelyExcel;
import com.epmet.dataaggre.service.commonservice.AreaCodeService; import com.epmet.dataaggre.service.commonservice.AreaCodeService;
@ -1540,4 +1542,16 @@ public class GovOrgServiceImpl implements GovOrgService {
return customerAgencyDao.getEmployeeRegisterMobileAndIdCard(registerId); return customerAgencyDao.getEmployeeRegisterMobileAndIdCard(registerId);
} }
@Override
public List<LingShanAgentServiceStaffAndGrid> getStaffAndItsBelongsGridByAgencyIdPath(String agencyIdPath) {
return customerStaffGridDao.getStaffAndItsBelongsGridByAgencyIdPath(agencyIdPath);
}
@Override
public Set<String> getStaffIdsInGrid(String gridId) {
LambdaQueryWrapper<CustomerStaffGridEntity> q = new LambdaQueryWrapper<>();
q.eq(CustomerStaffGridEntity::getGridId, gridId);
List<CustomerStaffGridEntity> es = customerStaffGridDao.selectList(q);
return es.stream().map(CustomerStaffGridEntity::getUserId).collect(Collectors.toSet());
}
} }

128
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/LingShanServiceAgentServiceImpl.java

@ -0,0 +1,128 @@
package com.epmet.dataaggre.service.impl;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.enums.DictTypeEnum;
import com.epmet.commons.tools.enums.GenderEnum;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.PidUtils;
import com.epmet.constant.OrgInfoConstant;
import com.epmet.constant.RoleKeyConstants;
import com.epmet.dataaggre.beans.LingShanAgentServiceStaffAndGrid;
import com.epmet.dataaggre.beans.StaffInfoInGridOfRole;
import com.epmet.dataaggre.dto.epmetuser.result.LingshanServiceAgentAgentList;
import com.epmet.dataaggre.service.LingShanServiceAgentService;
import com.epmet.dataaggre.service.epmetuser.EpmetUserService;
import com.epmet.dataaggre.service.govorg.GovOrgService;
import com.epmet.dto.SysDictDataDTO;
import com.epmet.feign.EpmetAdminOpenFeignClient;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.sql.Array;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class LingShanServiceAgentServiceImpl implements LingShanServiceAgentService, ResultDataResolver {
@Autowired
private EpmetUserService epmetUserService;
@Autowired
private GovOrgService govOrgService;
@Autowired
private EpmetAdminOpenFeignClient adminOpenFeignClient;
@Override
public PageData<LingshanServiceAgentAgentList> workPcAgentList(String orgId, String orgType, String agentName, Integer mobile, Integer idCard,
Integer pageNo, Integer pageSize) {
// 1个人可能属于多个wangge
Map<String, List<String>> staffIdAndGridIds = new HashMap<>();
Set<String> staffIds = new HashSet<>();
// 得到staffIds和staffIdAndGridIds
if (OrgInfoConstant.AGENCY.equals(orgType)) {
// agency
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(orgId);
List<LingShanAgentServiceStaffAndGrid> sags = govOrgService.getStaffAndItsBelongsGridByAgencyIdPath(PidUtils.convertPid2OrgIdPath(agencyInfo.getId(), agencyInfo.getPids()));
for (LingShanAgentServiceStaffAndGrid sag : sags) {
staffIds.add(sag.getStaffId());
List<String> gridIds = staffIdAndGridIds.get(sag.getStaffId());
if (CollectionUtils.isEmpty(gridIds)) {
gridIds = new ArrayList<>();
staffIdAndGridIds.put(sag.getStaffId(), gridIds);
}
gridIds.add(sag.getGridId());
}
} else if (OrgInfoConstant.GRID.equals(orgType)) {
// 网格
staffIds = govOrgService.getStaffIdsInGrid(orgId);
for (String staffId : staffIds) {
staffIdAndGridIds.put(staffId, Arrays.asList(orgId));
}
}
// 开始查询staff列表
PageData<StaffInfoInGridOfRole> pd = epmetUserService.staffListInGridsOfRole(RoleKeyConstants.ROLE_KEY_AGENT, staffIds, agentName, mobile, idCard, pageNo, pageSize);
if (pd == null) {
return new PageData(new ArrayList(), 0);
}
// 性别字典
List<SysDictDataDTO> edus = getResultDataOrReturnNull(adminOpenFeignClient.dictDataList(DictTypeEnum.EDUCATION.getCode()), ServiceConstant.EPMET_ADMIN_SERVER);
Map<String, String> eduMap = edus.stream().collect(Collectors.toMap(SysDictDataDTO::getDictValue, SysDictDataDTO::getDictLabel));
// 转换为dto
List<LingshanServiceAgentAgentList> rl = pd.getList().stream().map(e -> {
LingshanServiceAgentAgentList d = new LingshanServiceAgentAgentList();
d.setAgentName(e.getStaffName());
d.setAgentId(e.getStaffId());
d.setGender(e.getGender());
d.setGenderDisplay(GenderEnum.getName(e.getGender().toString()));
d.setAge(e.getAge());
d.setCulture(e.getCulture());
if (e.getCulture() != null) {
d.setCultureDisplay(eduMap.get(e.getCulture().toString()));
}
d.setMobile(e.getMobile());
d.setIdCard(e.getIdCard());
// 组织名称
d.setOrgNamePath(getOrgNamePath(staffIdAndGridIds.get(e.getStaffId())));
return d;
}).collect(Collectors.toList());
return new PageData<>(rl, pd.getTotal());
}
/**
* 通过gridid列表拼接处组织名称path例如开发者社区-Java第一网格开发者社区-Python第一网格
*/
private String getOrgNamePath(List<String> gridIds) {
List<String> orgNames = gridIds.stream().map(gridId -> {
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(gridId);
if (gridInfo == null) {
return null;
}
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(gridInfo.getPid());
String agencyName = agencyInfo.getOrganizationName();
return agencyName.concat("-").concat(gridInfo.getGridName());
}).filter(Objects::nonNull).collect(Collectors.toList());
return String.join(",", orgNames);
}
}

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

@ -163,4 +163,35 @@
cs.user_id = #{staffId} cs.user_id = #{staffId}
</foreach> </foreach>
</select> </select>
<select id="selectStaffListByStaffIdsAndRole" resultType="com.epmet.dataaggre.beans.StaffInfoInGridOfRole">
select sr.STAFF_ID staffId
, s.REAL_NAME staffName
, s.GENDER
, year(now()) - year(s.BIRTHDAY) age
, s.CULTURE
, s.MOBILE
, s.ID_CARD
from staff_role sr
inner join customer_staff s on (s.DEL_FLAG = 0 and sr.STAFF_ID = s.USER_ID)
where sr.DEL_FLAG = 0
<if test="staffIds != null and staffIds.size() > 0">
and sr.STAFF_ID in
<foreach collection="staffIds" item="staffId" open="(" separator="," close=")">
#{staffId}
</foreach>
</if>
<if test="roleId != null and roleId != ''">
and sr.ROLE_ID = #{roleId}
</if>
<if test="mobile != null and mobile != ''">
and s.MOBILE like CONCAT('%',#{mobile},'%')
</if>
<if test="realname != null and realname != ''">
and s.REAL_NAME like CONCAT('%',#{realname},'%')
</if>
<if test="idCard != null and idCard != ''">
and s.ID_CARD like CONCAT('%',#{idCard},'%')
</if>
</select>
</mapper> </mapper>

10
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffGridDao.xml

@ -68,4 +68,14 @@
AND b.PID = #{agencyId} AND b.PID = #{agencyId}
</select> </select>
<select id="getStaffAndItsBelongsGridByAgencyIdPath" resultType="com.epmet.dataaggre.beans.LingShanAgentServiceStaffAndGrid">
select g.ID gridId, sg.USER_ID staffId
from customer_grid g
inner join customer_staff_grid sg on (sg.DEL_FLAG = 0 and g.ID = sg.GRID_ID)
where g.PIDS like CONCAT(#{agencyIdPath}, '%')
and g.DEL_FLAG = 0
</select>
</mapper> </mapper>

30
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/LingShanAgentServiceController.java

@ -61,6 +61,36 @@ public class LingShanAgentServiceController {
return new Result().ok(pd); return new Result().ok(pd);
} }
/**
* @Description: 撤回
* @param form:
* @Return com.epmet.commons.tools.utils.Result
* @Author: wangxianzhang
* @Date: 2023/5/10 11:20 AM
*/
@PostMapping("resi/withdraw")
public Result resiWithDraw(@RequestBody Map<String, String> form) {
String id = form.get("id");
if (StringUtils.isBlank(id)) {
throw new ValidateException("缺少ID参数");
}
lingShanServiceAgentService.resiWithDraw(id);
return new Result();
}
@PostMapping("resi/evaluate")
public Result resiEvaluate(@RequestBody Map<String, Object> form) {
String id = (String) form.get("id");
Integer satisfication = (Integer) form.get("satisfication");
if (StringUtils.isAnyBlank(id) || satisfication == null) {
throw new ValidateException("缺少ID参数");
}
lingShanServiceAgentService.resiEvaluate(id, satisfication);
return new Result();
}
/** /**
* @description: 工作端-服务列表 * @description: 工作端-服务列表
* 这个接口返回的跟居民端一样所以暂时就调用居民端一样的接口了 * 这个接口返回的跟居民端一样所以暂时就调用居民端一样的接口了

4
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LingShanAgentServiceService.java

@ -17,4 +17,8 @@ public interface LingShanAgentServiceService {
void workProcess(String id, Integer processType, String processDesc); void workProcess(String id, Integer processType, String processDesc);
void workClose(String id, String processDesc, List<String> processAttachments); void workClose(String id, String processDesc, List<String> processAttachments);
void resiWithDraw(String id);
void resiEvaluate(String id, Integer satisfication);
} }

83
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LingShanAgentServiceServiceImpl.java

@ -3,8 +3,10 @@ package com.epmet.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.LingShanAgentServiceProcessStatusEnum; import com.epmet.LingShanAgentServiceProcessStatusEnum;
import com.epmet.commons.tools.distributedlock.DistributedLock;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerResiUserRedis; import com.epmet.commons.tools.redis.common.CustomerResiUserRedis;
@ -24,6 +26,7 @@ import com.epmet.service.LingShanAgentServiceService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RLock;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -41,6 +44,11 @@ public class LingShanAgentServiceServiceImpl implements LingShanAgentServiceServ
@Autowired @Autowired
private LingshanAgentServiceRecordDao agentServiceRecordDao; private LingshanAgentServiceRecordDao agentServiceRecordDao;
@Autowired
private DistributedLock distributedLock;
public static final String AGENT_SERVICE_LOCK_PREFIX = "lingshan:agentservice:statuschange:";
@Override @Override
public void resiSubmit(AgentServiceResiSubmitFormDTO form) { public void resiSubmit(AgentServiceResiSubmitFormDTO form) {
@ -104,8 +112,10 @@ public class LingShanAgentServiceServiceImpl implements LingShanAgentServiceServ
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "【代办服务】未找到指定的服务信息,ID:" + id); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "【代办服务】未找到指定的服务信息,ID:" + id);
} }
RLock lock = distributedLock.getLock(AGENT_SERVICE_LOCK_PREFIX + id);
try {
// 执行状态变更校验 // 执行状态变更校验
statusChangeValid(service.getProcessStatus(), processType); statusChangeCheck(service.getProcessStatus(), processType);
Date now = new Date(); Date now = new Date();
@ -117,6 +127,15 @@ public class LingShanAgentServiceServiceImpl implements LingShanAgentServiceServ
e2Update.setProcessTime(now); e2Update.setProcessTime(now);
agentServiceRecordDao.updateById(e2Update); agentServiceRecordDao.updateById(e2Update);
} catch (Exception e) {
log.error("【待办服务】办结:分布式锁错误:" + ExceptionUtils.getErrorStackTrace(e));
throw e;
} finally {
// 释放锁
if (lock.isHeldByCurrentThread()) {
lock.unlock();
}
}
} }
@Override @Override
@ -126,9 +145,12 @@ public class LingShanAgentServiceServiceImpl implements LingShanAgentServiceServ
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "【代办服务】未找到指定的服务信息,ID:" + id); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "【代办服务】未找到指定的服务信息,ID:" + id);
} }
RLock lock = distributedLock.getLock(AGENT_SERVICE_LOCK_PREFIX + id);
try {
// 执行状态变更校验 // 执行状态变更校验
LingShanAgentServiceProcessStatusEnum closeStatusEnum = LingShanAgentServiceProcessStatusEnum.CLOSED; LingShanAgentServiceProcessStatusEnum closeStatusEnum = LingShanAgentServiceProcessStatusEnum.CLOSED;
statusChangeValid(service.getProcessStatus(), closeStatusEnum.getStatusCode()); statusChangeCheck(service.getProcessStatus(), closeStatusEnum.getStatusCode());
Date now = new Date(); Date now = new Date();
@ -140,6 +162,15 @@ public class LingShanAgentServiceServiceImpl implements LingShanAgentServiceServ
e2Update.setCloseTime(now); e2Update.setCloseTime(now);
agentServiceRecordDao.updateById(e2Update); agentServiceRecordDao.updateById(e2Update);
} catch (Exception e) {
log.error("【待办服务】办结:分布式锁错误:" + ExceptionUtils.getErrorStackTrace(e));
throw e;
} finally {
// 释放锁
if (lock.isHeldByCurrentThread()) {
lock.unlock();
}
}
} }
/** /**
@ -150,7 +181,7 @@ public class LingShanAgentServiceServiceImpl implements LingShanAgentServiceServ
* @author: WangXianZhang * @author: WangXianZhang
* @date: 2023/5/9 1:57 PM * @date: 2023/5/9 1:57 PM
*/ */
private void statusChangeValid(Integer oldStatus, Integer newStatus) { private void statusChangeCheck(Integer oldStatus, Integer newStatus) {
if (newStatus.intValue() == LingShanAgentServiceProcessStatusEnum.WITHDRAW.getStatusCode() if (newStatus.intValue() == LingShanAgentServiceProcessStatusEnum.WITHDRAW.getStatusCode()
&& oldStatus.intValue() != LingShanAgentServiceProcessStatusEnum.WAIT_ACCEPT.getStatusCode()) { && oldStatus.intValue() != LingShanAgentServiceProcessStatusEnum.WAIT_ACCEPT.getStatusCode()) {
// 只有待处理状态,才能撤回 // 只有待处理状态,才能撤回
@ -170,4 +201,50 @@ public class LingShanAgentServiceServiceImpl implements LingShanAgentServiceServ
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, String.format("【代办服务】当前状态为'%s',不允许操作", LingShanAgentServiceProcessStatusEnum.getByStatus(oldStatus).getStatusName())); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, String.format("【代办服务】当前状态为'%s',不允许操作", LingShanAgentServiceProcessStatusEnum.getByStatus(oldStatus).getStatusName()));
} }
} }
@Override
public void resiWithDraw(String id) {
LingshanAgentServiceRecordEntity service;
if ((service = agentServiceRecordDao.selectById(id)) == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "【代办服务】未找到指定的服务信息,ID:" + id);
}
RLock lock = distributedLock.getLock(AGENT_SERVICE_LOCK_PREFIX + id);
try {
// 状态检查
statusChangeCheck(service.getProcessStatus(), LingShanAgentServiceProcessStatusEnum.WITHDRAW.getStatusCode());
LingshanAgentServiceRecordEntity e2update = new LingshanAgentServiceRecordEntity();
e2update.setId(id);
e2update.setProcessStatus(LingShanAgentServiceProcessStatusEnum.WITHDRAW.getStatusCode());
agentServiceRecordDao.updateById(e2update);
} catch (Exception e) {
log.error("【待办服务】撤回:分布式锁错误:" + ExceptionUtils.getErrorStackTrace(e));
throw e;
} finally {
// 释放锁
if (lock.isHeldByCurrentThread()) {
lock.unlock();
}
}
}
@Override
public void resiEvaluate(String id, Integer satisfication) {
LingshanAgentServiceRecordEntity service;
if ((service = agentServiceRecordDao.selectById(id)) == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "【代办服务】未找到指定的服务信息,ID:" + id);
}
if (! service.getProcessStatus().equals(LingShanAgentServiceProcessStatusEnum.CLOSED.getStatusCode())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null,
"【代办服务】只有办结的服务才能进行评价,当前状态为:" + LingShanAgentServiceProcessStatusEnum.getByStatus(service.getProcessStatus()).getStatusName());
}
LingshanAgentServiceRecordEntity e2update = new LingshanAgentServiceRecordEntity();
e2update.setId(id);
e2update.setSatisfication(satisfication);
agentServiceRecordDao.updateById(e2update);
}
} }

Loading…
Cancel
Save