Browse Source

Merge remote-tracking branch 'origin/dev_bugfix' into dev

dev_shibei_match
yinzuomei 5 years ago
parent
commit
20c65b5547
  1. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 16
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java
  3. 87
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/ValidateException.java
  4. 7
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/validator/ValidatorUtils.java
  5. 2
      epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiTopicController.java
  6. 4
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffGridListDTO.java
  7. 1
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffSubmitFromDTO.java
  8. 31
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AllGridsByUserIdResultDTO.java
  9. 11
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
  10. 14
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java
  11. 49
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java
  12. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
  13. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffGridService.java
  14. 39
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  15. 27
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffGridServiceImpl.java
  16. 16
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  17. 71
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupDetailResult2DTO.java
  18. 2
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupDetailResultDTO.java
  19. 24
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/UserMessageConstant.java
  20. 38
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/EpmetMessageFeignClient.java
  21. 8
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java
  22. 15
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/GovOrgFeignClient.java
  23. 29
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/EpmetMessageFeignClientFallback.java
  24. 10
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallback.java
  25. 14
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/GovOrgFeignClientFallBack.java
  26. 10
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java
  27. 2
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java
  28. 96
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java
  29. 7
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java
  30. 20
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java
  31. 6
      epmet-module/resi-mine/resi-mine-server/pom.xml
  32. 11
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java
  33. 28
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/GovOrgFeignClient.java
  34. 13
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallBack.java
  35. 23
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/fallback/GovOrgFeignClientFallBack.java
  36. 15
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java
  37. 11
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/ResiMineGridService.java
  38. 37
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/impl/ResiMineGridServiceImpl.java
  39. 5
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java
  40. 32
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/RolesUsersListFormDTO.java
  41. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java
  42. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java
  43. 13
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridLatestDao.java
  44. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java
  45. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java
  46. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java
  47. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java
  48. 21
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java
  49. 10
      epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml
  50. 34
      epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -10,7 +10,7 @@ public enum EpmetErrorCode {
ERR10006(10006, "登录超时,请重新登录"),
ERR10007(10007, "当前帐号已在别处登录"),
ERR401(401, "未授权"),
VALIDATE_ERROR(7000, "数据校验异常"),
SERVER_ERROR(8000, "服务器开小差了..."),
CANNOT_JOIN_GROUP(8001, "只有认证党员和居民才可以加入小组,请选择您的身份"),
CANNOT_CREATE_GROUP(8002, "只有党员和热心居民才能创建小组,请选择您的身份"),

16
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java

@ -61,6 +61,22 @@ public class RenExceptionHandler {
// return new Result().error();
}
/**
* 处理自定义异常
* "code": 8000,
* "msg": "服务器开小差了...",
*/
@ExceptionHandler(ValidateException.class)
public Result handleVException(ValidateException ex){
logger.error(ExceptionUtils.getErrorStackTrace(ex));
Result result=new Result();
result.setCode(ex.getCode());
result.setMsg(ex.getMsg());
return result;
// return new Result().error();
}
/**
* 运行时异常拦截
* "code": 8000,

87
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/ValidateException.java

@ -0,0 +1,87 @@
package com.epmet.commons.tools.exception;
import com.epmet.commons.tools.utils.MessageUtils;
import org.apache.commons.lang3.StringUtils;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/4/29 18:13
*/
public class ValidateException extends RuntimeException {
private static final long serialVersionUID = 1L;
private int code;
private String msg;
public ValidateException(int code) {
this.code = code;
this.msg = EpmetErrorCode.getMsg(code);
if (StringUtils.isBlank(this.msg)) {
this.msg = MessageUtils.getMessage(code);
}
}
public ValidateException(int code, String... params) {
this.code = code;
this.msg = EpmetErrorCode.getMsg(code);
if (StringUtils.isBlank(this.msg)) {
this.msg = MessageUtils.getMessage(code, params);
}
}
public ValidateException(int code, Throwable e) {
super(e);
this.code = code;
this.msg = EpmetErrorCode.getMsg(code);
if (StringUtils.isBlank(this.msg)) {
this.msg = MessageUtils.getMessage(code);
}
}
public ValidateException(int code, Throwable e, String... params) {
super(e);
this.code = code;
}
public ValidateException(int code, String msg) {
this.code = code;
if (StringUtils.isBlank(msg)) {
this.msg = EpmetErrorCode.getMsg(code);
if (StringUtils.isBlank(this.msg)) {
this.msg = MessageUtils.getMessage(code, msg);
}
} else {
this.msg = msg;
}
}
public ValidateException(String msg) {
super(msg);
this.code = EpmetErrorCode.VALIDATE_ERROR.getCode();
this.msg = msg;
}
public ValidateException(String msg, Throwable e) {
super(msg, e);
this.code = EpmetErrorCode.VALIDATE_ERROR.getCode();
this.msg = msg;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
}

7
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/validator/ValidatorUtils.java

@ -9,6 +9,7 @@
package com.epmet.commons.tools.validator;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.exception.ValidateException;
import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.context.support.ResourceBundleMessageSource;
@ -40,10 +41,10 @@ public class ValidatorUtils {
* 校验对象
* @param object 待校验对象
* @param groups 待校验的组
* @throws RenException 校验不通过则报RenException异常
* @throws ValidateException 校验不通过则报RenException异常
*/
public static void validateEntity(Object object, Class<?>... groups)
throws RenException {
throws ValidateException {
Locale.setDefault(LocaleContextHolder.getLocale());
Validator validator = Validation.byDefaultProvider().configure().messageInterpolator(
new ResourceBundleMessageInterpolator(new MessageSourceResourceBundleLocator(getMessageSource())))
@ -51,7 +52,7 @@ public class ValidatorUtils {
Set<ConstraintViolation<Object>> constraintViolations = validator.validate(object, groups);
if (!constraintViolations.isEmpty()) {
ConstraintViolation<Object> constraint = constraintViolations.iterator().next();
throw new RenException(constraint.getMessage());
throw new ValidateException(constraint.getMessage());
}
}
}

2
epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiTopicController.java

@ -35,6 +35,7 @@ public class ResiTopicController {
**/
@PostMapping("hiddenlist")
Result<List<ResiTopicInfoResultDTO>> hiddenList(@LoginUser TokenDto tokenDto, @RequestBody ResiTopicPageFormDTO topicPageFormDTO){
topicPageFormDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(topicPageFormDTO);
return resiTopicService.hiddenList(topicPageFormDTO);
}
@ -49,6 +50,7 @@ public class ResiTopicController {
**/
@PostMapping("alltopics")
Result<List<ResiTopicInfoResultDTO>> allTopics(@LoginUser TokenDto tokenDto,@RequestBody ResiTopicPageFormDTO topicPageFormDTO){
topicPageFormDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(topicPageFormDTO);
return resiTopicService.allTopics(topicPageFormDTO);
}

4
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffGridListDTO.java

@ -2,12 +2,14 @@ package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @Auther zxc
* @Create 2020-04-23 10:38
*/
@Data
public class StaffGridListDTO {
public class StaffGridListDTO implements Serializable {
private static final long serialVersionUID = 1L;

1
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffSubmitFromDTO.java

@ -26,7 +26,6 @@ public class StaffSubmitFromDTO implements Serializable {
/**
* 机关ID
*/
@NotBlank(message = "机关ID不能为空")
private String agencyId;
/**
* 人员ID

31
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AllGridsByUserIdResultDTO.java

@ -0,0 +1,31 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Auther sun
* 获取用户访问过的所有网格列表-接口返参
*/
@Data
public class AllGridsByUserIdResultDTO implements Serializable {
private static final long serialVersionUID = -1L;
/**
* 客户Id
*/
private String customerId;
/**
* 网格Id
*/
private String gridId;
/**
* 网格名称
*/
private String gridName;
}

11
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java

@ -171,4 +171,15 @@ public class CustomerGridController {
return customerGridService.getAgencyAndStaffsBygridId(gridId);
}
/**
* @param gridIdList
* @return
* @Description 根据网格Id集合获取网格列表信息
* @Author sun
*/
@PostMapping("getgridlistbygridids")
public Result<List<AllGridsByUserIdResultDTO>> getGridListByGridIds(@RequestBody List<String> gridIdList) {
return customerGridService.getGridListByGridIds(gridIdList);
}
}

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

@ -26,6 +26,7 @@ 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.CustomerStaffGridDTO;
import com.epmet.dto.form.CommonGridIdFormDTO;
import com.epmet.dto.form.LatestGridFormDTO;
import com.epmet.dto.result.CustomerGridByUserIdResultDTO;
import com.epmet.excel.CustomerStaffGridExcel;
@ -105,4 +106,17 @@ public class CustomerStaffGridController {
ValidatorUtils.validateEntity(latestGridFormDTO);
return customerStaffGridService.getStaffGridOrderByGridName(latestGridFormDTO);
}
/**
* @Description 查询一个网格下的所有工作人员
* @param gridIdFormDTO
* @return Result<List<String>>
* @author wangc
* @date 2020.04.29 22:59
**/
@PostMapping("getgridstaffs")
public Result<List<String>> getGridStaffs(@RequestBody CommonGridIdFormDTO gridIdFormDTO){
ValidatorUtils.validateEntity(gridIdFormDTO);
return customerStaffGridService.getAllGridStaffs(gridIdFormDTO);
}
}

49
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java

@ -18,17 +18,12 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.UserIdAndPidDTO;
import com.epmet.dto.*;
import com.epmet.dto.form.ListCustomerGridFormDTO;
import com.epmet.dto.form.SelectGridNameByGridIdFormDTO;
import com.epmet.dto.result.*;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.UserIdDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.DeleteGridFormDTO;
import com.epmet.dto.form.ListCustomerGridFormDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
import com.epmet.entity.CustomerGridEntity;
import org.apache.ibatis.annotations.Mapper;
@ -38,7 +33,7 @@ import java.util.List;
import java.util.Map;
/**
* 客户网格表
* 客户网格表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-16
@ -46,32 +41,28 @@ import java.util.Map;
@Mapper
public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
/**
* @return CustomerGridForStrangerResultDTO
* @Description 查整个城市的网格
* @Param areaCode
* @return CustomerGridForStrangerResultDTO
* @Author wangc
* @Date 2020.03.19 15:53
**/
List<CustomerGridForStrangerResultDTO> selectGridByCityLike(ListCustomerGridFormDTO listCustomerGridFormDTO);
/**
* @return CustomerGridForStrangerResultDTO
* @Description 指定区时查询当前城市下除该区之外其余的网格
* @Param areaCode
* @Param cityCode
* @return CustomerGridForStrangerResultDTO
* @Author wangc
* @Date 2020.03.19 15:53
**/
List<CustomerGridForStrangerResultDTO> selectRestGridWithoutGivenAreaCode(Map<String,Object> paramsMap);
List<CustomerGridForStrangerResultDTO> selectRestGridWithoutGivenAreaCode(Map<String, Object> paramsMap);
CustomerGridDTO getCustomerGridByGridId(CustomerGridFormDTO customerGridFormDTO);
/**
*
* @Description 根据网格id查询网格名称
* @Author zxc
* @CreatedTime 2020/4/27 9:22
@ -88,6 +79,7 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
/**
* 根据gridId获取网格详情
*
* @param customerGridFormDTO
* @return
*/
@ -95,6 +87,7 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
/**
* 根据gridId查询uerId和pid
*
* @param customerGridFormDTO
* @return
*/
@ -102,6 +95,7 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
/**
* 根据userId查询customerId
*
* @param userId
* @return
*/
@ -109,57 +103,66 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
/**
* 根据pid查询pids
*
* @param pid
* @return
*/
String selectPidsByPid(@Param("pid")String pid);
String selectPidsByPid(@Param("pid") String pid);
/**
* 根据gridName查询gridId
*
* @param gridName
* @return
*/
String selectGridIdByGridName(@Param("gridName")String gridName,@Param("agencyId")String pid,@Param("gridId")String gridId);
AddGridResultDTO selectGridIdByGridName(@Param("gridName") String gridName, @Param("agencyId") String pid, @Param("gridId") String gridId);
/**
* 编辑网格信息
*
* @param customerGridDTO
*/
void editGrid(CustomerGridDTO customerGridDTO);
/**
* 删除网格
*
* @param deleteGridFormDTO
*/
void deleteGrid(DeleteGridFormDTO deleteGridFormDTO);
/**
*
* @Description 根据gridId查询userId
* @Author zxc
* @CreatedTime 2020/4/26 10:08
*/
List<UserIdDTO> selectUserIdByGrid(@Param("gridId")String gridId);
List<UserIdDTO> selectUserIdByGrid(@Param("gridId") String gridId);
/**
* @return int
* @Description 得到当前机构的网格总数
* @Param agencyId(String) 对应CUSTOMER_GRID中的PID字段
* @return int
* @Author wangc
* @Date 2020.04.23 15:05
**/
int selectGridCountByAgencyId(@Param("agencyId") String agencyId);
/**
* @return List<GridBaseInfoResultDTO> -> GridBaseInfoResultDTO :: getGridId :: getGridName :: getTotalUser
* @Description 得到当前机构的网格详情列表
* @Param agencyId(String) 对应CUSTOMER_GRID中的PID字段
* @return List<GridBaseInfoResultDTO> -> GridBaseInfoResultDTO :: getGridId :: getGridName :: getTotalUser
* @Author wangc
* @Date 2020.04.23 15:30
**/
List<GridBaseInfoResultDTO> selectGridListByAgencyId(@Param("agencyId")String agencyId,@Param("pageSize")Integer pageSize);
List<GridBaseInfoResultDTO> selectGridListByAgencyId(@Param("agencyId") String agencyId, @Param("pageSize") Integer pageSize);
List<GridByStaffResultDTO> listGridsbystaffid(@Param("staffId") String staffId);
/**
* @param gridIdList
* @return
* @Description 根据网格Id集合获取网格列表信息
* @Author sun
*/
List<AllGridsByUserIdResultDTO> selectGridByIds(@Param("gridIdList") List<String> gridIdList);
}

9
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java

@ -219,4 +219,13 @@ public interface CustomerGridService extends BaseService<CustomerGridEntity> {
Result<AgencyAndStaffsResultDTO> getAgencyAndStaffsBygridId(String gridId);
List<GridByStaffResultDTO> listGridsbystaffid(String staffId);
/**
* @param gridIdList
* @return
* @Description 根据网格Id集合获取网格列表信息
* @Author sun
*/
Result<List<AllGridsByUserIdResultDTO>> getGridListByGridIds(List<String> gridIdList);
}

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

@ -21,6 +21,7 @@ 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.CustomerStaffGridDTO;
import com.epmet.dto.form.CommonGridIdFormDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.LatestGridFormDTO;
import com.epmet.dto.result.CommonStaffInfoResultDTO;
@ -107,4 +108,13 @@ public interface CustomerStaffGridService extends BaseService<CustomerStaffGridE
* @Date 2020.04.23 09:11
**/
Result<CustomerGridByUserIdResultDTO> getStaffGridOrderByGridName(LatestGridFormDTO latestGridFormDTO);
/**
* @Description 查询一个网格下的所有工作人员
* @param gridIdFormDTO
* @return Result<List<String>>
* @author wangc
* @date 2020.04.29 22:59
**/
Result<List<String>> getAllGridStaffs(CommonGridIdFormDTO gridIdFormDTO);
}

39
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java

@ -45,6 +45,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -200,19 +201,17 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
@Transactional(rollbackFor = Exception.class)
public Result<AddGridResultDTO> addGrid(TokenDto tokenDto, AddGridFormDTO addGridFormDTO) {
//查询是否重名
String checkGridName = baseDao.selectGridIdByGridName(addGridFormDTO.getGridName(),addGridFormDTO.getAgencyId(),null);
if (checkGridName!=null){
AddGridResultDTO gridResult = baseDao.selectGridIdByGridName(addGridFormDTO.getGridName(), addGridFormDTO.getAgencyId(), null);
if (gridResult!=null){
return new Result().error(EpmetErrorCode.NOT_ADD_GRID.getCode());
}
//查询地区编码
String areaCode = customerAgencyDao.selectAreaCodeByAgencyId(addGridFormDTO.getAgencyId());
CustomerGridEntity customerGridEntity = new CustomerGridEntity();
customerGridEntity.setAreaCode(areaCode);
CustomerAgencyDTO customerAgencyDTO=customerAgencyService.get(addGridFormDTO.getAgencyId());
customerGridEntity.setCustomerId(customerAgencyDTO.getCustomerId());//查询customerId
customerGridEntity.setGridName(addGridFormDTO.getGridName());
customerGridEntity.setManageDistrict(addGridFormDTO.getManageDistrict());
CustomerGridEntity customerGridEntity = new CustomerGridEntity();
BeanUtils.copyProperties(addGridFormDTO,customerGridEntity);
customerGridEntity.setAreaCode(customerAgencyDTO.getAreaCode());
customerGridEntity.setCustomerId(customerAgencyDTO.getCustomerId());
customerGridEntity.setPid(addGridFormDTO.getAgencyId());
//所有上级机构id,必须包括当前机构id (放在所有上级机构id后)
if(StringUtils.isBlank(customerAgencyDTO.getPids())){
customerGridEntity.setPids(addGridFormDTO.getAgencyId());
}else{
@ -222,12 +221,9 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
customerGridEntity.setPids(customerAgencyDTO.getPids().concat(":").concat(addGridFormDTO.getAgencyId()));
}
}
//查询所有上级组织id
baseDao.insert(customerGridEntity);
//查询刚刚添加的gridId
String gridId = baseDao.selectGridIdByGridName(addGridFormDTO.getGridName(),addGridFormDTO.getAgencyId(),null);
AddGridResultDTO addGridResultDTO = new AddGridResultDTO();
addGridResultDTO.setGridId(gridId);
AddGridResultDTO addGridResultDTO = baseDao.selectGridIdByGridName(addGridFormDTO.getGridName(), addGridFormDTO.getAgencyId(), null);
return new Result<AddGridResultDTO>().ok(addGridResultDTO);
}
@ -239,8 +235,8 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
@Override
@Transactional(rollbackFor = Exception.class)
public Result editGrid(TokenDto tokenDto, EditGridFormDTO editGridFormDTO) {
String checkGridName = baseDao.selectGridIdByGridName(editGridFormDTO.getGridName(),editGridFormDTO.getAgencyId(),editGridFormDTO.getGridId());
if (checkGridName!=null){
AddGridResultDTO gridId = baseDao.selectGridIdByGridName(editGridFormDTO.getGridName(), editGridFormDTO.getAgencyId(), editGridFormDTO.getGridId());
if (gridId!=null){
return new Result().error(EpmetErrorCode.NOT_ADD_GRID.getCode());
}
CustomerGridDTO customerGridDTO = new CustomerGridDTO();
@ -522,4 +518,17 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
public List<GridByStaffResultDTO> listGridsbystaffid(String staffId) {
return baseDao.listGridsbystaffid(staffId);
}
/**
* @param gridIdList
* @return
* @Description 根据网格Id集合获取网格列表信息
* @Author sun
*/
@Override
public Result<List<AllGridsByUserIdResultDTO>> getGridListByGridIds(List<String> gridIdList) {
Result<List<AllGridsByUserIdResultDTO>> result = new Result<List<AllGridsByUserIdResultDTO>>();
List<AllGridsByUserIdResultDTO> list = baseDao.selectGridByIds(gridIdList);
return result.ok(list);
}
}

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

@ -23,17 +23,14 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.CustomerStaffGridDao;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.CommonGridIdFormDTO;
import com.epmet.dto.form.LatestGridFormDTO;
import com.epmet.dto.result.CommonStaffInfoResultDTO;
import com.epmet.dto.result.CustomerGridByUserIdResultDTO;
import com.epmet.entity.CustomerStaffGridEntity;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.redis.CustomerStaffGridRedis;
import com.epmet.service.CustomerStaffGridService;
import org.apache.commons.lang3.StringUtils;
@ -41,9 +38,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 网格人员关系表
@ -57,8 +56,6 @@ public class CustomerStaffGridServiceImpl extends BaseServiceImpl<CustomerStaffG
@Autowired
private CustomerStaffGridRedis customerStaffGridRedis;
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
@Override
public PageData<CustomerStaffGridDTO> page(Map<String, Object> params) {
@ -128,4 +125,22 @@ public class CustomerStaffGridServiceImpl extends BaseServiceImpl<CustomerStaffG
result.setAgencyId(grid.getPid());
return new Result<CustomerGridByUserIdResultDTO>().ok(result);
}
/**
* @Description 查询一个网格下的所有工作人员
* @param gridIdFormDTO
* @return Result<List<String>>
* @author wangc
* @date 2020.04.29 22:59
**/
@Override
public Result<List<String>> getAllGridStaffs(CommonGridIdFormDTO gridIdFormDTO) {
List<CustomerStaffGridDTO> staffs = baseDao.selectByGridId(gridIdFormDTO.getGridId());
return new Result<List<String>>().ok(
new ArrayList<>(
staffs.stream().map(CustomerStaffGridDTO::getUserId).
collect(Collectors.toSet())
)
);
}
}

16
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml

@ -176,7 +176,7 @@
</select>
<!-- 根据gridName查询gridId -->
<select id="selectGridIdByGridName" resultType="string">
<select id="selectGridIdByGridName" resultType="com.epmet.dto.result.AddGridResultDTO">
SELECT
id AS gridId
FROM
@ -263,4 +263,18 @@
AND sg.USER_ID = #{staffId}
</select>
<select id="selectGridByIds" resultType="com.epmet.dto.result.AllGridsByUserIdResultDTO">
SELECT
id AS 'gridId',
grid_name AS 'gridName',
customer_id AS 'customerId'
FROM customer_grid
WHERE del_flag = '0'
AND id IN
<foreach item="id" collection="gridIdList" open="(" separator="," close=")">
#{id}
</foreach>
ORDER BY CONVERT (grid_name USING gbk) ASC<!-- 网格名称对应拼音升序排序 -->
</select>
</mapper>

71
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupDetailResult2DTO.java

@ -0,0 +1,71 @@
package com.epmet.resi.group.dto.group.result;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Description 建组申请详情 请求返回实体 与NEI一致
* @ClassName ApplyingGroupDetailResult2DTO
* @Auth wangc
* @Date 2020-04-30 10:10
*/
@Data
public class ApplyingGroupDetailResult2DTO implements Serializable {
private static final long serialVersionUID = -924420303614397953L;
/**
* 组Id
* */
private String groupId;
/**
* 组名称
* */
private String groupName;
/**
* 组头像
* */
private String groupHeadPhoto;
/**
* 组介绍
* */
private String groupIntroduction;
/**
* 申请时间
* */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private Date createdTime;
/**
* 组长名称
* */
private String groupLeaderName;
/**
* 已同意该申请approved 已驳回rejected
* */
private String status;
/**
* 驳回理由
* */
private String rejectReason;
/**
* 街道
* */
private String street;
/**
* 未读已读标识 unread read
* */
private String readFlag;
}

2
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupDetailResultDTO.java

@ -7,7 +7,7 @@ import java.io.Serializable;
import java.util.Date;
/**
* @Description 建组申请详情
* @Description 建组申请详情 mapper查询返回 与NEI不一致
* @ClassName ApplyingGroupDetailResultDTO
* @Author wangc
* @date 2020.04.17 16:13

24
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/UserMessageConstant.java

@ -31,5 +31,29 @@ public interface UserMessageConstant {
*/
String SLIENT_IN_GROUP = "您已被禁言,禁言时间%s";
/**
* 建组审核驳回时消息模板
* */
String DISAGREE_CREATING_GROUP_MSG_TEMPLATE = "您好,您申请的%s小组,由于不符合%s条件的原因,已被驳回。";
/**
* 建组审核同意时消息模板
* */
String AGREE_CREATING_GROUP_MSG_TEMPLATE = "您好,您申请的%s小组,已审核通过。";
/**
* 审核建组申请消息名称
* */
String AUDITED_GROUP_APPLYING_TITLE = "您有一条建组审核消息";
/**
* 申请建组消息名称
* */
String CREATE_GROUP_APPLYING_MSG_TITLE = "您有一条建组申请消息";
/**
* 申请组时的消息模板
*/
String CREATION_OF_GROUP_MESSAGE_TEMPLATE = "%s%s申请创建小组【%s】,请审核。";
}

38
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/EpmetMessageFeignClient.java

@ -0,0 +1,38 @@
package com.epmet.modules.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.UserMessageFormDTO;
import com.epmet.modules.feign.fallback.EpmetMessageFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import java.util.List;
/**
* @Description epmet-message服务转发
* @author wangc
* @date 2020.04.29 23:52
**/
@FeignClient(name = ServiceConstant.EPMET_MESSAGE_SERVER, fallback = EpmetMessageFeignClientFallback.class)
public interface EpmetMessageFeignClient {
/**
* @param formDto
* @return com.epmet.commons.tools.utils.Result
* @Author sun
* @Description 新增未读消息
**/
@PostMapping(value = "message/usermessage/saveusermessage", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Result saveUserMessage(UserMessageFormDTO formDto);
/**
* @param msgList
* @return com.epmet.commons.tools.utils.Result
* @Author sun
* @Description 热心居民申请给网格长们发送消息
**/
@PostMapping(value = "message/usermessage/saveusermessagelist", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Result saveUserMessageList(List<UserMessageFormDTO> msgList);
}

8
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java

@ -2,10 +2,7 @@ package com.epmet.modules.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.UserInvitationFormDTO;
import com.epmet.dto.form.UserResiInfoFormDTO;
import com.epmet.dto.form.UserResiInfoListFormDTO;
import com.epmet.dto.form.UserRoleFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.UserResiInfoResultDTO;
import com.epmet.dto.result.UserRoleResultDTO;
import com.epmet.modules.feign.fallback.EpmetUserFeignClientFallback;
@ -63,4 +60,7 @@ public interface EpmetUserFeignClient {
**/
@PostMapping(value = "epmetuser/userinvitation/saveuserinvitation", consumes = MediaType.APPLICATION_JSON_VALUE)
Result saveUserInvitation(@RequestBody UserInvitationFormDTO userInvitationFormDTO);
@PostMapping(value = "epmetuser/staffrole/specificrolesstaffs", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<List<String>> specificRolesStaffs(RolesUsersListFormDTO rolesUsersListFormDTO);
}

15
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/GovOrgFeignClient.java

@ -4,9 +4,14 @@ import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerDepartmentDTO;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.CommonGridIdFormDTO;
import com.epmet.modules.feign.fallback.GovOrgFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* @Description gov-org服务feginClient 服务间调用
@ -34,4 +39,14 @@ public interface GovOrgFeignClient {
*/
@GetMapping("/gov/org/customerdepartment/{id}")
Result<CustomerDepartmentDTO> getDept(String id);
/**
* @Description 查询一个网格下的所有工作人员
* @param gridIdFormDTO
* @return Result<List<String>>
* @author wangc
* @date 2020.04.29 22:59
**/
@PostMapping("/gov/org/customerstaffgrid/getgridstaffs")
Result<List<String>> getGridStaffs(@RequestBody CommonGridIdFormDTO gridIdFormDTO);
}

29
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/EpmetMessageFeignClientFallback.java

@ -0,0 +1,29 @@
package com.epmet.modules.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.UserMessageFormDTO;
import com.epmet.modules.feign.EpmetMessageFeignClient;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @Description
* @ClassName EpmetMessageFeignClientFallback
* @Auth wangc
* @Date 2020-04-29 23:53
*/
@Component
public class EpmetMessageFeignClientFallback implements EpmetMessageFeignClient {
@Override
public Result saveUserMessage(UserMessageFormDTO formDto) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "saveUserMessage", formDto);
}
@Override
public Result saveUserMessageList(List<UserMessageFormDTO> msgList) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "saveUserMessageList", msgList);
}
}

10
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallback.java

@ -3,10 +3,7 @@ package com.epmet.modules.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.UserInvitationFormDTO;
import com.epmet.dto.form.UserResiInfoFormDTO;
import com.epmet.dto.form.UserResiInfoListFormDTO;
import com.epmet.dto.form.UserRoleFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.UserResiInfoResultDTO;
import com.epmet.dto.result.UserRoleResultDTO;
import com.epmet.modules.feign.EpmetUserFeignClient;
@ -41,4 +38,9 @@ public class EpmetUserFeignClientFallback implements EpmetUserFeignClient {
public Result saveUserInvitation(UserInvitationFormDTO userInvitationFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveUserInvitation", userInvitationFormDTO);
}
@Override
public Result<List<String>> specificRolesStaffs(RolesUsersListFormDTO rolesUsersListFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "specificRolesStaffs", rolesUsersListFormDTO);
}
}

14
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/GovOrgFeignClientFallBack.java

@ -1,12 +1,17 @@
package com.epmet.modules.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerDepartmentDTO;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.CommonGridIdFormDTO;
import com.epmet.modules.feign.GovOrgFeignClient;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public class GovOrgFeignClientFallBack implements GovOrgFeignClient {
@ -14,11 +19,16 @@ public class GovOrgFeignClientFallBack implements GovOrgFeignClient {
@Override
public Result<CustomerGridDTO> getGrid(String id) {
return null;
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGrid", id);
}
@Override
public Result<CustomerDepartmentDTO> getDept(String id) {
return null;
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getDept", id);
}
@Override
public Result<List<String>> getGridStaffs(CommonGridIdFormDTO gridIdFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridStaffs", gridIdFormDTO);
}
}

10
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java

@ -47,12 +47,6 @@ public class ResiGroupController {
@Autowired
private ResiGroupService resiGroupService;
@GetMapping("test/{test}")
public Result test(@PathVariable("test") String test) {
int result = 1 / 0;
return new Result().ok("请求成功啦❤");
}
/**
* @param tokenDto
* @param myGroupFormDTO
@ -269,12 +263,12 @@ public class ResiGroupController {
/**
* @Description 得到待审核/未审核小组信息的详情
* @Param CommonGroupIdFromDTO -> String groupId; String userId
* @return Result<ApplyingGroupDetailResultDTO>
* @return Result<ApplyingGroupDetailResult2DTO>
* @Author wangc
* @Date 2020.04.20 14:08
**/
@PostMapping("getapplyinggroupdetail")
public Result<ApplyingGroupDetailResultDTO> getApplyingGroupDetail(@RequestBody CommonGroupIdFromDTO groupIdFromDTO){
public Result<ApplyingGroupDetailResult2DTO> getApplyingGroupDetail(@RequestBody CommonGroupIdFromDTO groupIdFromDTO){
ValidatorUtils.validateEntity(groupIdFromDTO);
return resiGroupService.getApplyingGroupDetail(groupIdFromDTO);
}

2
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java

@ -240,5 +240,5 @@ public interface ResiGroupService extends BaseService<ResiGroupEntity> {
* @Author wangc
* @Date 2020.04.19 23:32
**/
Result<ApplyingGroupDetailResultDTO> getApplyingGroupDetail(CommonGroupIdFromDTO groupId);
Result<ApplyingGroupDetailResult2DTO> getApplyingGroupDetail(CommonGroupIdFromDTO groupId);
}

96
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java

@ -29,12 +29,14 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.UserResiInfoFormDTO;
import com.epmet.dto.form.UserResiInfoListFormDTO;
import com.epmet.dto.form.UserRoleFormDTO;
import com.epmet.constant.ReadFlagConstant;
import com.epmet.dto.form.*;
import com.epmet.dto.result.UserResiInfoResultDTO;
import com.epmet.dto.result.UserRoleResultDTO;
import com.epmet.modules.constant.UserMessageConstant;
import com.epmet.modules.feign.EpmetMessageFeignClient;
import com.epmet.modules.feign.EpmetUserFeignClient;
import com.epmet.modules.feign.GovOrgFeignClient;
import com.epmet.modules.group.dao.ResiGroupDao;
import com.epmet.modules.group.dao.ResiGroupOperationDao;
import com.epmet.modules.group.entity.ResiGroupEntity;
@ -110,6 +112,11 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
@Autowired
private ResiGroupMemberRedis resiGroupMemberRedis;
@Autowired
private GovOrgFeignClient govOrgFeignClient;
@Autowired
private EpmetMessageFeignClient epmetMessageFeignClient;
@Override
@ -336,7 +343,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
+ (StringUtils.isBlank(resiResult.getData().getName()) ? "" :resiResult.getData().getName());
}
userName = StringUtils.isBlank(userName) ? ModuleConstant.UNKNOWN : userName;
String msg = String.format(ModuleConstant.CREATION_OF_GROUP_MESSAGE_TEMPLATE,roleName,userName,applyCreateGroupFormDTO.getGroupName());
String msg = String.format(UserMessageConstant.CREATION_OF_GROUP_MESSAGE_TEMPLATE,roleName,userName,applyCreateGroupFormDTO.getGroupName());
//3.2、插入一条待审核的操作记录
ResiGroupOperationDTO resiGroupOperation = new ResiGroupOperationDTO();
resiGroupOperation.setResiGroupId(resiGroupEntity.getId());
@ -383,6 +390,8 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
resiGroupStatisticalDTO.setTotalEarnestMemebers(NumConstant.ZERO);
}
resiGroupStatisticalService.save(resiGroupStatisticalDTO);
//发送消息:创建小组
sendMsgResi2Gov(UserMessageConstant.CREATE_GROUP_APPLYING_MSG_TITLE,msg,applyCreateGroupFormDTO.getGridId(),applyCreateGroupFormDTO.getUserId(),applyCreateGroupFormDTO.getCustomerId());
return new Result();
}
@ -533,7 +542,18 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
*/
logger.warn(ModuleConstant.NO_SUCH_GROUP_STASTICAL_INFO);
}
//发送消息
UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO();
userMessageFormDTO.setUserId(resiGroupDTO.getCreatedBy());
userMessageFormDTO.setTitle(UserMessageConstant.AUDITED_GROUP_APPLYING_TITLE);
userMessageFormDTO.setReadFlag(ModuleConstant.UNREAD);
userMessageFormDTO.setApp(ModuleConstant.APP_RESI);
userMessageFormDTO.setGridId(resiGroupDTO.getGridId());
userMessageFormDTO.setCustomerId(resiGroupDTO.getCustomerId());
userMessageFormDTO.setMessageContent(String.format(UserMessageConstant.AGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName()));
if(!epmetMessageFeignClient.saveUserMessage(userMessageFormDTO).success()){
logger.warn(String.format(ModuleConstant.FAILED_SEND_MESSAGE,String.format(UserMessageConstant.AGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName())));
}
return new Result();
}
@ -567,6 +587,18 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
groupMemeberOperationDTO.setOperateUserId(disAgreeApplyGroupFormDTO.getUserId());
groupMemeberOperationService.update(groupMemeberOperationDTO);
//5、给用户发送消息???待定
UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO();
userMessageFormDTO.setUserId(resiGroupDTO.getCreatedBy());
userMessageFormDTO.setTitle(UserMessageConstant.AUDITED_GROUP_APPLYING_TITLE);
userMessageFormDTO.setReadFlag(ModuleConstant.UNREAD);
userMessageFormDTO.setApp(ModuleConstant.APP_RESI);
userMessageFormDTO.setGridId(resiGroupDTO.getGridId());
userMessageFormDTO.setCustomerId(resiGroupDTO.getCustomerId());
userMessageFormDTO.setMessageContent(String.format(UserMessageConstant.DISAGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName(),disAgreeApplyGroupFormDTO.getRejectReason()));
if(!epmetMessageFeignClient.saveUserMessage(userMessageFormDTO).success()){
logger.warn(String.format(ModuleConstant.FAILED_SEND_MESSAGE,String.format(UserMessageConstant.DISAGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName(),disAgreeApplyGroupFormDTO.getRejectReason())));
}
return new Result();
}
@ -719,7 +751,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
* @Date 2020.04.19 23:32
**/
@Override
public Result<ApplyingGroupDetailResultDTO> getApplyingGroupDetail(CommonGroupIdFromDTO groupId){
public Result<ApplyingGroupDetailResult2DTO> getApplyingGroupDetail(CommonGroupIdFromDTO groupId){
//1.查询小组信息
//注意,这里查询出的组申请详情中,无论是已审核还是未审核,都是将该组信息关联到初始化组时状态为[待审核、审核通过、拒绝]其中之一的组操作记录上,并读取审核的已读未读信息,上述三种状态在一个组的所有操作记录当中只可能存在一种,与之后的屏蔽、取消屏蔽、关闭无关,如果查出多条说明建组的逻辑有问题
ApplyingGroupDetailResultDTO detail = baseDao.getApplyingGroupDetailByGroupId(groupId.getGroupId());
@ -735,6 +767,9 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
//姓氏+名称
detail.setGroupLeaderName(userInfoResult.getData().get(0).getSurname() + userInfoResult.getData().get(0).getName());
detail.setStreet(userInfoResult.getData().get(0).getStreet());
StringBuffer buffer = new StringBuffer(detail.getStreet());
buffer.append(StringUtils.isBlank(buffer) ? "" : "-");
detail.setGroupLeaderName(buffer.append(detail.getGroupLeaderName()).toString());
}else{
logger.warn(ModuleConstant.USER_INFO_LIST_NOT_FOUND);
}
@ -750,7 +785,54 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
detail.setLeaderId(null);
detail.setOperationId(null);
return new Result<ApplyingGroupDetailResultDTO>().ok(detail);
return new Result<ApplyingGroupDetailResult2DTO>().ok(ConvertUtils.sourceToTarget(detail, ApplyingGroupDetailResult2DTO.class));
}
/**
* @Description 给加入此网格的网格长发送消息
* @param msg
* @param gridId
* @param userId
* @author wangc
* @date 2020.04.29 22:49
**/
private void sendMsgResi2Gov(String title,String msg,String gridId,String userId,String customerId){
//1.查询加入当前网格下的人员 customer_staff_grid
CommonGridIdFormDTO commonGridIdFormDTO = new CommonGridIdFormDTO();
commonGridIdFormDTO.setGridId(gridId);
commonGridIdFormDTO.setUserId(userId);
Result<List<String>> gridstaffs =
govOrgFeignClient.getGridStaffs(commonGridIdFormDTO);
//2.查询这些人是否有管理员身份且未被禁用 staff_role customer_staff
if(gridstaffs.success() && null != gridstaffs.getData() && gridstaffs.getData().size() > 0){
RolesUsersListFormDTO rolesUsersListFormDTO = new RolesUsersListFormDTO();
rolesUsersListFormDTO.setCustomerId(customerId);
List<String> roleKeys = new ArrayList<String>();
roleKeys.add(ModuleConstant.STAFF_ROLE_GRID_MANAGER);
rolesUsersListFormDTO.setRoleKeys(roleKeys);
rolesUsersListFormDTO.setUserIds(gridstaffs.getData());
Result<List<String>> staffRoles =
epmetUserFeignClient.specificRolesStaffs(rolesUsersListFormDTO);
//3.发送消息
if(staffRoles.success() && null != staffRoles.getData() && staffRoles.getData().size() > 0){
List<UserMessageFormDTO> msgList = new ArrayList<>();
for(String to : staffRoles.getData()){
UserMessageFormDTO msgObj = new UserMessageFormDTO();
msgObj.setApp(ModuleConstant.APP_GOV);
msgObj.setCustomerId(customerId);
msgObj.setGridId(gridId);
msgObj.setMessageContent(msg);
msgObj.setReadFlag(ReadFlagConstant.UN_READ);
msgObj.setTitle(title);
msgObj.setUserId(to);
msgList.add(msgObj);
}
Result result = epmetMessageFeignClient.saveUserMessageList(msgList);
if(!result.success()){
logger.warn(String.format(ModuleConstant.FAILED_SEND_MESSAGE,msg));
}
}
}
}
}

7
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java

@ -317,12 +317,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
**/
@Override
public Result<List<ResiTopicInfoResultDTO>> getPastTopicList(TokenDto tokenDto, ResiTopicPageFormDTO topicPageFormDTO) {
if (null == tokenDto) {
logger.error(ModuleConstant.USER_NOT_NULL);
throw new RenException(ModuleConstant.USER_NOT_NULL);
}
//1.查询历史话题列表
//1.查询历史话题列表
topicPageFormDTO.setUserId(tokenDto.getUserId());

20
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java

@ -209,6 +209,11 @@ public interface ModuleConstant extends Constant {
* */
String APP_RESI = "resi";
/**
* APP 政府端
* */
String APP_GOV = "gov";
/**
* 审核信息未读
* */
@ -226,7 +231,18 @@ public interface ModuleConstant extends Constant {
String UNKNOWN = "未知";
/**
* 申请组时的消息模板
* 工作人员角色key管理员
* */
String STAFF_ROLE_MANAGER = "manager";
/**
* 工作人员角色key网格长
* */
String STAFF_ROLE_GRID_MANAGER = "grid_manager";
/**
* 消息发送失败
*/
String CREATION_OF_GROUP_MESSAGE_TEMPLATE = "%s%s申请创建小组【%s】,请审核。";
String FAILED_SEND_MESSAGE = "消息发送失败,消息内容:【%s】";
}

6
epmet-module/resi-mine/resi-mine-server/pom.xml

@ -77,6 +77,12 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>gov-org-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

11
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java

@ -13,6 +13,8 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import java.util.List;
/**
* @Description 居民端陌生人导览 调用epmet-user服务
* @Author sun
@ -51,4 +53,13 @@ public interface EpmetUserFeignClient {
**/
@PostMapping(value = "epmetuser/userresiinfo/getverificationcode")
Result getVerificationCode(VerificationCodeFormDTO formDTO);
/**
* @return
* @param userId
* @Description 根据用户Id查询用户访问过的网格列表Id集合
* @Author sun
**/
@PostMapping(value = "epmetuser/gridlatest/getgridsbyuserid/{userId}")
Result<List<String>> getGridsByUserId(@PathVariable("userId") String userId);
}

28
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/GovOrgFeignClient.java

@ -0,0 +1,28 @@
package com.epmet.modules.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.AllGridsByUserIdResultDTO;
import com.epmet.modules.feign.fallback.GovOrgFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import java.util.List;
/**
* @Description gov-org服务
* @Author sun
*/
@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignClientFallBack.class)
public interface GovOrgFeignClient {
/**
* @param gridIdList
* @return
* @Description 根据网格Id集合获取网格列表信息
* @Author sun
*/
@PostMapping("/gov/org/customergrid/getgridlistbygridids")
Result<List<AllGridsByUserIdResultDTO>> getGridListByGridIds(List<String> gridIdList);
}

13
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallBack.java

@ -11,6 +11,8 @@ import com.epmet.dto.result.ResiRegisterResultDTO;
import com.epmet.modules.feign.EpmetUserFeignClient;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @Description 居民端-陌生人导览 调用epmet-user服务
* @Author sun
@ -61,5 +63,14 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getVerificationCode", formDTO);
}
/**
* @return
* @param userId
* @Description 根据用户Id查询用户访问过的网格列表Id集合
* @Author sun
**/
@Override
public Result<List<String>> getGridsByUserId(String userId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getGridsByUserId", userId);
}
}

23
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/fallback/GovOrgFeignClientFallBack.java

@ -0,0 +1,23 @@
package com.epmet.modules.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.AllGridsByUserIdResultDTO;
import com.epmet.modules.feign.GovOrgFeignClient;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @Description gov-org服务
* @Author sun
*/
@Component
public class GovOrgFeignClientFallBack implements GovOrgFeignClient {
@Override
public Result<List<AllGridsByUserIdResultDTO>> getGridListByGridIds(List<String> gridIdList) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridListByGridIds", gridIdList);
}
}

15
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java

@ -3,13 +3,17 @@ package com.epmet.modules.grid.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.AllGridsByUserIdResultDTO;
import com.epmet.dto.result.LatestGridInfoResultDTO;
import com.epmet.modules.grid.service.ResiMineGridService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @Description 居民端用户网格信息相关接口入口
* @Author yinzuomei
@ -32,4 +36,15 @@ public class ResiMineGridController {
public Result<LatestGridInfoResultDTO> getLatestGridInfo(@LoginUser TokenDto tokenDto){
return resiMineGridService.getLatestGridInfo(tokenDto);
}
/**
* @return
* @param tokenDto
* @Description 获取用户访问过的所有网格列表
* @Author sun
**/
@PostMapping("allgrids")
public Result<List<AllGridsByUserIdResultDTO>> allGrids(@LoginUser TokenDto tokenDto){
return resiMineGridService.allGrids(tokenDto.getUserId());
}
}

11
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/ResiMineGridService.java

@ -2,8 +2,11 @@ package com.epmet.modules.grid.service;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.AllGridsByUserIdResultDTO;
import com.epmet.dto.result.LatestGridInfoResultDTO;
import java.util.List;
/**
* @Description 居民端用户网格信息service
* @Author yinzuomei
@ -18,4 +21,12 @@ public interface ResiMineGridService {
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.mine.dto.result.LatestGridInfoResultDTO>
*/
Result<LatestGridInfoResultDTO> getLatestGridInfo(TokenDto tokenDto);
/**
* @return
* @param userId
* @Description 获取用户访问过的所有网格列表
* @Author sun
**/
Result<List<AllGridsByUserIdResultDTO>> allGrids(String userId);
}

37
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/impl/ResiMineGridServiceImpl.java

@ -1,11 +1,14 @@
package com.epmet.modules.grid.service.impl;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.AllGridsByUserIdResultDTO;
import com.epmet.dto.result.LatestGridInfoResultDTO;
import com.epmet.modules.feign.EpmetUserFeignClient;
import com.epmet.modules.feign.GovOrgFeignClient;
import com.epmet.modules.grid.service.ResiMineGridService;
import com.epmet.modules.utils.ModuleConstant;
import org.apache.commons.lang3.StringUtils;
@ -14,6 +17,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* @Description 居民端用户网格信息service
* @Author yinzuomei
@ -24,6 +30,8 @@ public class ResiMineGridServiceImpl implements ResiMineGridService {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
@Autowired
private GovOrgFeignClient govOrgFeignClient;
/**
* @param tokenDto
@ -44,4 +52,33 @@ public class ResiMineGridServiceImpl implements ResiMineGridService {
}
return epmetUserFeignClient.getLatestGridInfoByUserId(tokenDto.getUserId());
}
/**
* @return
* @param userId
* @Description 获取用户访问过的所有网格列表
* @Author sun
**/
@Override
public Result<List<AllGridsByUserIdResultDTO>> allGrids(String userId) {
Result<List<AllGridsByUserIdResultDTO>> result = new Result<List<AllGridsByUserIdResultDTO>>();
//1:调用epmet-user服务,根据用户Id查询用户访问过的网格列表Id集合
Result<List<String>> resultGridIds = epmetUserFeignClient.getGridsByUserId(userId);
if (!resultGridIds.success()) {
throw new RenException(ModuleConstant.SELECT_EXCEPTION);
}
if (null == resultGridIds.getData() || resultGridIds.getData().size() < NumConstant.ONE) {
return result.ok(new ArrayList<AllGridsByUserIdResultDTO>());
}
List<String> gridIdList = resultGridIds.getData();
//2:调用gov-org服务,根据网格Id集合获取网格列表信息
Result<List<AllGridsByUserIdResultDTO>> resultGrids = govOrgFeignClient.getGridListByGridIds(gridIdList);
if (!resultGrids.success()) {
throw new RenException(ModuleConstant.SELECT_EXCEPTION);
}
if (null == resultGrids.getData() || resultGrids.getData().size() < NumConstant.ONE) {
return result.ok(new ArrayList<AllGridsByUserIdResultDTO>());
}
return result.ok(resultGrids.getData());
}
}

5
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java

@ -28,4 +28,9 @@ public interface ModuleConstant extends Constant {
*/
String FOR_RESI_CALL="当前接口只限居民端调用";
/**
* 调用epmet-user服务查询用户访问过的网格列表失败
*/
String SELECT_EXCEPTION = "获取用户访问过的网格列表失败";
}

32
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/RolesUsersListFormDTO.java

@ -0,0 +1,32 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description 特定的角色 特定的员工
* @ClassName RolesUsersListFormDTO
* @Auth wangc
* @Date 2020-04-29 23:40
*/
@Data
public class RolesUsersListFormDTO implements Serializable {
private static final long serialVersionUID = -7375096282690016010L;
/**
* 客户Id
* */
private String CustomerId;
/**
* 角色列表
* */
private List<String> roleKeys;
/**
* 人员Id列表
*/
private List<String> userIds;
}

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

@ -103,4 +103,16 @@ public class GridLatestController {
public Result<LatestGridInfoResultDTO> getLatestGridInfoByUserId(@PathVariable("userId") String userId){
return gridLatestService.getLatestGridInfoByUserId(userId);
}
/**
* @return
* @param userId
* @Description 根据用户Id查询用户访问过的网格列表Id集合
* @Author sun
**/
@PostMapping("getgridsbyuserid/{userId}")
public Result<List<String>> getGridsByUserId(@PathVariable("userId") String userId){
return gridLatestService.getGridsByUserId(userId);
}
}

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

@ -7,6 +7,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.GovStaffRoleDTO;
import com.epmet.dto.form.CommonUserFormDTO;
import com.epmet.dto.form.RolesUsersListFormDTO;
import com.epmet.dto.form.StaffRoleFormDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.dto.result.StaffRolesResultDTO;
@ -88,4 +89,15 @@ public class StaffRoleController {
ValidatorUtils.validateEntity(commonUserFormDTO);
return staffRoleService.getStaffRoles(commonUserFormDTO);
}
/**
* @Description 查找具有特定角色的人员Id(可用)
* @param rolesUsersListFormDTO
* @author wangc
* @date 2020.04.29 23:49
**/
@PostMapping("specificrolesstaffs")
public Result<List<String>> specificRolesStaffs(@RequestBody RolesUsersListFormDTO rolesUsersListFormDTO){
return staffRoleService.getSpecificRolesStaffs(rolesUsersListFormDTO);
}
}

13
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridLatestDao.java

@ -22,6 +22,9 @@ import com.epmet.dto.GridLatestDTO;
import com.epmet.dto.result.LatestGridInfoResultDTO;
import com.epmet.entity.GridLatestEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 最近访问网格表 记录用户访问网格的最近一次记录对同一网格只记录一条记录同一网格每次只更新最近一次访问的时间
@ -36,8 +39,6 @@ public interface GridLatestDao extends BaseDao<GridLatestEntity> {
int updateByLatestId(GridLatestDTO dto);
GridLatestEntity getGridLatestByIds(GridLatestDTO formDTO);
/**
* @return com.epmet.dto.result.LatestGridInfoResultDTO
* @param userId
@ -46,4 +47,12 @@ public interface GridLatestDao extends BaseDao<GridLatestEntity> {
* @Date 2020/3/24 13:17
**/
LatestGridInfoResultDTO selectLatestGridInfoByUserId(String userId);
/**
* @return
* @param userId
* @Description 根据用户Id查询用户访问过的网格列表Id集合
* @Author sun
**/
List<String> selectAllGridsByUserId(@Param("userId") String userId);
}

10
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java

@ -66,4 +66,14 @@ public interface StaffRoleDao extends BaseDao<StaffRoleEntity> {
//@DataFilter(tableAliases = { "role" })
StaffRolesResultDTO getStaffRoles(CommonUserFormDTO commonUserFormDTO);
/**
* @Description 查询特定身份的员工Id
* @param roleKeys
* @param userIds
* @param customerId
* @author wangc
* @date 2020.04.29 23:38
**/
List<String> selectSpecificRolesStaffs(@Param("roleKeys")List<String> roleKeys,@Param("userIds")List<String> userIds,@Param("customerId")String customerId);
}

8
epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java

@ -112,4 +112,12 @@ public interface GridLatestService extends BaseService<GridLatestEntity> {
**/
Result<LatestGridInfoResultDTO> getLatestGridInfoByUserId(String userId);
/**
* @return
* @param userId
* @Description 根据用户Id查询用户访问过的网格列表Id集合
* @Author sun
**/
Result<List<String>> getGridsByUserId(String userId);
}

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

@ -23,6 +23,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.StaffRoleDTO;
import com.epmet.dto.form.CommonUserFormDTO;
import com.epmet.dto.form.RolesUsersListFormDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.dto.result.StaffRolesResultDTO;
import com.epmet.entity.StaffRoleEntity;
@ -120,4 +121,13 @@ public interface StaffRoleService extends BaseService<StaffRoleEntity> {
* @Date 2020.04.26 10:59
**/
Result<StaffRolesResultDTO> getStaffRoles(CommonUserFormDTO userParam);
/**
* @Description 查找具有特定角色的人员Id(可用)
* @param rolesUsersListFormDTO
* @return Result<String>
* @author wangc
* @date 2020.04.29 23:44
**/
Result<List<String>> getSpecificRolesStaffs(RolesUsersListFormDTO rolesUsersListFormDTO);
}

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

@ -21,10 +21,10 @@ 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;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.GridVisitedConstant;
import com.epmet.dao.GridLatestDao;
@ -160,4 +160,16 @@ public class GridLatestServiceImpl extends BaseServiceImpl<GridLatestDao, GridLa
return new Result<LatestGridInfoResultDTO>().ok(latestGridInfoResultDTO);
}
/**
* @return
* @param userId
* @Description 根据用户Id查询用户访问过的网格列表Id集合
* @Author sun
**/
@Override
public Result<List<String>> getGridsByUserId(String userId) {
List<String> gridList = baseDao.selectAllGridsByUserId(userId);
return new Result<List<String>>().ok(gridList);
}
}

21
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java

@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.annotation.DataFilter;
import com.epmet.commons.mybatis.entity.DataScope;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
@ -29,6 +30,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.StaffRoleDao;
import com.epmet.dto.StaffRoleDTO;
import com.epmet.dto.form.CommonUserFormDTO;
import com.epmet.dto.form.RolesUsersListFormDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.dto.result.StaffRolesResultDTO;
import com.epmet.entity.StaffRoleEntity;
@ -39,6 +41,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -136,4 +139,22 @@ public class StaffRoleServiceImpl extends BaseServiceImpl<StaffRoleDao, StaffRol
return new Result<StaffRolesResultDTO>().ok(baseDao.getStaffRoles(userParam));
}
/**
* @Description 查找具有特定角色的人员Id(可用)
* @param rolesUsersListFormDTO
* @return Result<String>
* @author wangc
* @date 2020.04.29 23:44
**/
@Override
public Result<List<String>> getSpecificRolesStaffs(RolesUsersListFormDTO rolesUsersListFormDTO) {
if(null != rolesUsersListFormDTO.getRoleKeys() && null != rolesUsersListFormDTO.getUserIds()
&& rolesUsersListFormDTO.getRoleKeys().size() > NumConstant.ZERO
&& rolesUsersListFormDTO.getUserIds().size() > NumConstant.ZERO){
return new Result<List<String>>().ok(
baseDao.selectSpecificRolesStaffs(rolesUsersListFormDTO.getRoleKeys(),rolesUsersListFormDTO.getUserIds(),rolesUsersListFormDTO.getCustomerId()));
}
return new Result<List<String>>().ok(new ArrayList<>());
}
}

10
epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml

@ -71,4 +71,14 @@
gl.LATEST_TIME DESC
LIMIT 1
</select>
<select id="selectAllGridsByUserId" resultType="string">
SELECT DISTINCT
grid_id
FROM
grid_latest
WHERE
del_flag = '0'
AND customer_user_id = #{userId}
</select>
</mapper>

34
epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml

@ -68,4 +68,38 @@
AND staff.USER_ID = #{userId}
AND staff.CUSTOMER_ID = #{customerId}
</select>
<!-- 查询具有特定角色的工作人员Id -->
<select id="selectSpecificRolesStaffs" resultType="string">
SELECT
staffrole.STAFF_ID
FROM
`staff_role` staffrole
LEFT JOIN `customer_staff` staff ON staffrole.STAFF_ID = staff.USER_ID
LEFT JOIN `gov_staff_role` role ON staffrole.ROLE_ID = ROLE.ID
<where>
staffrole.DEL_FLAG = '0'
AND staff.DEL_FLAG = '0'
AND role.DEL_FLAG = '0'
AND staff.ENABLE_FLAG = 'enable'
AND staffrole.ROLE_ID IN (
SELECT
ID
FROM
GOV_STAFF_ROLE
WHERE
ROLE_KEY IN
<foreach item="roleKey" collection="rolekeys" open="(" separator="," close=")">
#{rolekey}
</foreach>
AND DEL_FLAG = '0' )
AND staffrole.STAFF_ID IN
<foreach item="userId" collection="userIds" open="(" separator="," close=")">
#{userId}
</foreach>
<if test='null != customerId and "" != customerId'>
AND staff.CUSTOMER_ID = #{customerId}
</if>
</where>
</select>
</mapper>
Loading…
Cancel
Save