Browse Source

Merge remote-tracking branch 'origin/dev_personal_center' into dev_temp

dev_shibei_match
zxc 5 years ago
parent
commit
50ded670bb
  1. 56
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/validator/ValidatorUtils.java
  2. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/constant/BadgeConstant.java
  3. 1
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CertificationAddFormDTO.java
  4. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserBadgeListResultDTO.java
  5. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserOperListResultDTO.java
  6. 3
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  7. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  8. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/constant/BadgeMessageConstant.java
  9. 1
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java
  10. 19
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/BadgeDao.java
  11. 20
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/BadgeEntity.java
  12. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java
  13. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java
  14. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java
  15. 132
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java
  16. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/util/ModuleConstant.java
  17. 25
      epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml
  18. 4
      epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml

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

@ -8,9 +8,13 @@
package com.epmet.commons.tools.validator;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.epmet.commons.tools.dto.form.DingTalkTextMsg;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ValidateException;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.context.support.ResourceBundleMessageSource;
@ -50,8 +54,8 @@ public class ValidatorUtils {
List<Class<?>> customerShowGroups = new ArrayList<>();
List<Class<?>> internalGroups = new ArrayList<>();
if (groups == null || groups.length ==0){
validate(EpmetErrorCode.CUSTOMER_VALIDATE_ERROR ,object,groups);
if (groups == null || groups.length == 0) {
validate(EpmetErrorCode.CUSTOMER_VALIDATE_ERROR, object, groups);
return;
}
Arrays.asList(groups).forEach(g -> {
@ -65,7 +69,7 @@ public class ValidatorUtils {
// 1.校验客户端显示分组
if (!CollectionUtils.isEmpty(customerShowGroups)) {
validate(EpmetErrorCode.CUSTOMER_VALIDATE_ERROR ,object, customerShowGroups.toArray(new Class<?>[customerShowGroups.size()]));
validate(EpmetErrorCode.CUSTOMER_VALIDATE_ERROR, object, customerShowGroups.toArray(new Class<?>[customerShowGroups.size()]));
}
// 2.内部校验分组
@ -86,6 +90,7 @@ public class ValidatorUtils {
/**
* 真正的校验方法
*
* @param object
* @param errorCode
* @param groups
@ -103,7 +108,50 @@ public class ValidatorUtils {
int lastDouhaoIndex = sb.lastIndexOf(",");
sb.replace(lastDouhaoIndex, lastDouhaoIndex + 1, "");
throw new ValidateException(errorCode.getCode(),sb.toString());
throw new ValidateException(errorCode.getCode(), sb.toString());
}
}
/**
* desc: 校验对象json串必填字段是否有值
*
* @param jsonString
* @param requiredColumns
* @return java.lang.String 返回未必填的字段
* @author LiuJanJun
* @date 2020/11/19 9:47 上午
*/
public static List<String> hasAllRequired(final String jsonString, Set<String> requiredColumns) {
List<String> missColList = new ArrayList<>();
if (!CollectionUtils.isEmpty(requiredColumns)) {
//验证字段非空
requiredColumns.forEach(column -> {
//按照必填字段取前台传过来的参数
Object val = null;
if (StringUtils.isNotBlank(jsonString)) {
JSONObject jsonObject = JSONObject.parseObject(jsonString);
val = jsonObject.get(column.trim());
}
//如果没有查到那个值,就代表着传过来的字段少了
if (val == null || StringUtils.isBlank(val.toString())) {
missColList.add(column);
}
});
}
return missColList;
}
public static void main(String[] args) {
DingTalkTextMsg form = new DingTalkTextMsg();
form.setWebHook("1");
form.setContent("2");
//form.setAtMobiles();
//form.setAtAll();
//form.setSecret();
Set<String> requiredColumns = new HashSet<>();
requiredColumns.add("content");
requiredColumns.add("secret");
List<String> s = ValidatorUtils.hasAllRequired(JSON.toJSONString(form), requiredColumns);
System.out.println(s);
}
}

2
epmet-user/epmet-user-client/src/main/java/com/epmet/constant/BadgeConstant.java

@ -36,7 +36,7 @@ public interface BadgeConstant {
String GET_BADGE_NAME_FAILURE = "获取徽章名称失败......";
String MESSAGE_CONTENT = "您好,您的%s因认证失败未成功点亮,请查看";
String MESSAGE_CONTENT = "%s申请认证%s,请审核";
String READ_FLAG = "unread";

1
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CertificationAddFormDTO.java

@ -27,6 +27,7 @@ public class CertificationAddFormDTO implements Serializable {
/**
* 徽章ID
*/
@NotBlank(message = "徽章ID不能为空", groups = {CertificationAdd.class})
private String badgeId;
/**

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

@ -39,6 +39,8 @@ public class UserBadgeListResultDTO implements Serializable {
private String fixationBadgeType;
@JsonIgnore
private Boolean status;
@JsonIgnore
private Integer sort;
public UserBadgeListResultDTO() {
this.badgeId = "";

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

@ -55,6 +55,8 @@ public class UserOperListResultDTO implements Serializable {
private String isOpened;
@JsonIgnore
private String auditStatus;
@JsonIgnore
private Integer sort;
public UserOperListResultDTO() {
this.badgeId = "";

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

@ -466,4 +466,7 @@ public interface EpmetUserOpenFeignClient {
**/
@PostMapping(value = "/epmetuser/more/badge/initbadge")
Result<Boolean> initBadge(@RequestParam String userId);
@PostMapping(value = "epmetuser/staffrole/specificrolesstaffs", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<List<String>> specificRolesStaffs(RolesUsersListFormDTO rolesUsersListFormDTO);
}

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

@ -326,4 +326,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
public Result<Boolean> initBadge(String partyUserId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "initBadge", partyUserId);
}
@Override
public Result<List<String>> specificRolesStaffs(RolesUsersListFormDTO rolesUsersListFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "specificRolesStaffs", rolesUsersListFormDTO);
}
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/constant/BadgeMessageConstant.java

@ -15,7 +15,7 @@ public interface BadgeMessageConstant {
/**
* 审核通过消息模板
*/
String APPROVED_MSG = "您好,您提交的%s申请已通过,请查看。";
String APPROVED_MSG = "您好,您的%s认证通过并点亮,请查看。";
/**
* 审核驳回消息模板
*/

1
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java

@ -56,6 +56,7 @@ public class UserBadgeController {
*/
@PostMapping("authbadgerecord")
public Result authBadgeRecord(@RequestBody CertificationAddFormDTO certificationAddFormDTO){
ValidatorUtils.validateEntity(certificationAddFormDTO, CertificationAddFormDTO.CertificationAdd.class);
return userBadgeService.authBadgeRecord(certificationAddFormDTO);
}

19
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/BadgeDao.java

@ -177,4 +177,23 @@ public interface BadgeDao extends BaseDao<BadgeEntity> {
* @date 2020/11/18 10:43 上午
*/
String getPartyBadgeId(@Param("customerId") String customerId);
/**
* @Description 查询徽章名称
* @Param customerId
* @Param badgeId
* @author zxc
* @date 2020/11/19 上午9:49
*/
String selectBadgeName(@Param("customerId") String customerId,@Param("badgeId") String badgeId);
/**
* desc: 获取下一次排序号
*
* @param customerId
* @return int
* @author LiuJanJun
* @date 2020/11/19 10:18 上午
*/
int selectNextSort(@Param("customerId") String customerId);
}

20
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/BadgeEntity.java

@ -18,13 +18,10 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 徽章
*
@ -53,14 +50,19 @@ public class BadgeEntity extends BaseEpmetEntity {
*/
private String badgeIcon;
/**
* 固有徽章类型 前端页面跳转标识党员徽章party;none
*/
/**
* 固有徽章类型 前端页面跳转标识党员徽章party;none
*/
private String fixationBadgeType;
/**
* 状态 上线:online;下线:offline;
*/
/**
* 状态 上线:online;下线:offline;
*/
private String badgeStatus;
/**
* 排序
*/
private Integer sort;
}

14
epmet-user/epmet-user-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java

@ -3,10 +3,14 @@ package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.CommonGridIdFormDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.feign.fallback.GovOrgFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* @Description 居民端陌生人导览 调用gov-org服务
@ -25,4 +29,14 @@ public interface GovOrgFeignClient {
@PostMapping("/gov/org/customergrid/getcustomergridbygridid")
Result<CustomerGridDTO> getCustomerGridByGridId(CustomerGridFormDTO formDTO);
/**
* @Description 查询一个网格下的所有工作人员[copy wangc]
* @param gridIdFormDTO
* @return Result<List<String>>
* @author zxc
* @date 2020.04.29 22:59
**/
@PostMapping("/gov/org/customerstaffgrid/getgridstaffs")
Result<List<String>> getGridStaffs(@RequestBody CommonGridIdFormDTO gridIdFormDTO);
}

8
epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java

@ -4,10 +4,13 @@ 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.CustomerGridDTO;
import com.epmet.dto.form.CommonGridIdFormDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.feign.GovOrgFeignClient;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @Description 居民端-陌生人导览 调用gov-org服务
* @Author sun
@ -20,4 +23,9 @@ public class GovOrgFeignClientFallBack implements GovOrgFeignClient {
public Result<CustomerGridDTO> getCustomerGridByGridId(CustomerGridFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getcustomergridbygridid", formDTO);
}
@Override
public Result<List<String>> getGridStaffs(CommonGridIdFormDTO gridIdFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridStaffs", gridIdFormDTO);
}
}

4
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java

@ -163,9 +163,11 @@ public class BadgeServiceImpl extends BaseServiceImpl<BadgeDao, BadgeEntity> imp
if (CollectionUtils.isNotEmpty(list)) {
throw new RenException(EpmetErrorCode.DUPLICATE_BADGE_NAME.getCode());
}
int nextSort = baseDao.selectNextSort(tokenDto.getCustomerId());
BadgeEntity entity = ConvertUtils.sourceToTarget(formDTO, BadgeEntity.class);
entity.setCustomerId(tokenDto.getCustomerId());
entity.setFixationBadgeType(BadgeConstant.NONE);
entity.setSort(nextSort);
insert(entity);
//保存徽章认证配置
List<BadgeCertificationConfigEntity> badgeList = new ArrayList<>();
@ -220,7 +222,7 @@ public class BadgeServiceImpl extends BaseServiceImpl<BadgeDao, BadgeEntity> imp
BadgeEntity badgeEntity = baseDao.selectBadgeInfo(tokenDto.getCustomerId(), formDTO.getBadgeId());
if (null == badgeEntity) {
badgeEntity = baseDao.selectBadgeInfo("default", formDTO.getBadgeId());
badgeEntity = baseDao.selectBadgeInfo(BadgeConstant.DEFAULT_CUSTOMER, formDTO.getBadgeId());
badgeEntity.setCustomerId(tokenDto.getCustomerId());
badgeEntity.setBadgeName(formDTO.getBadgeName());
badgeEntity.setBadgeIcon(formDTO.getBadgeIcon());

132
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java

@ -8,20 +8,22 @@ import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.PhoneValidatorUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.constant.BadgeConstant;
import com.epmet.constant.ReadFlagConstant;
import com.epmet.constant.SmsTemplateConstant;
import com.epmet.dao.BadgeDao;
import com.epmet.dao.ResiUserBadgeDao;
import com.epmet.dao.UserBadgeDao;
import com.epmet.dao.UserRoleDao;
import com.epmet.dao.*;
import com.epmet.dto.ResiUserBadgeDTO;
import com.epmet.dto.UserBadgeCertificateRecordDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgFeignClient;
import com.epmet.redis.UserBadgeRedis;
import com.epmet.service.UserBadgeService;
import com.epmet.service.UserBaseInfoService;
import com.epmet.util.ModuleConstant;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -57,9 +59,15 @@ public class UserBadgeServiceImpl implements UserBadgeService {
private ResiUserBadgeDao resiUserBadgeDao;
@Autowired
private BadgeDao badgeDao;
@Autowired
private GovOrgFeignClient govOrgFeignClient;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private BadgeCertificationConfigDao badgeCertificationConfigDao;
/**
* @Description 查询已经点亮的徽章
* @Description 查询已经点亮的徽章
* @Param userBadgeListFormDTO
* @author zxc
* @date 2020/11/3 1:33 下午
@ -74,7 +82,7 @@ public class UserBadgeServiceImpl implements UserBadgeService {
List<UserBadgeListResultDTO> redisUserBadgeList = JSON.parseArray(userBadge.toString(), UserBadgeListResultDTO.class);
List<UserBadgeListResultDTO> userBadgeListResultDTOS = userBadgeDao.selectBadgeList(userBadgeListFormDTO);
if (CollectionUtils.isEmpty(userBadgeListResultDTOS)){
return redisUserBadgeList;
return redisUserBadgeList.stream().sorted(Comparator.comparing(UserBadgeListResultDTO::getSort)).collect(Collectors.toList());
}
redisUserBadgeList.forEach(u -> {
userBadgeListResultDTOS.forEach(badge -> {
@ -84,11 +92,13 @@ public class UserBadgeServiceImpl implements UserBadgeService {
}
});
});
List<UserBadgeListResultDTO> noOpenBadge = new ArrayList<>();
redisUserBadgeList.forEach(u -> {
if (!u.getStatus()){
userBadgeListResultDTOS.add(u);
noOpenBadge.add(u);
}
});
userBadgeListResultDTOS.addAll(noOpenBadge.stream().sorted(Comparator.comparing(UserBadgeListResultDTO::getSort)).collect(Collectors.toList()));
return userBadgeListResultDTOS;
}
@ -121,7 +131,14 @@ public class UserBadgeServiceImpl implements UserBadgeService {
}
});
});
return userOperListResultDTOS.stream().sorted(Comparator.comparing(UserOperListResultDTO::getBadgeName)).collect(Collectors.toList());
Map<String, List<UserOperListResultDTO>> collect = userOperListResultDTOS.stream().collect(Collectors.groupingBy(UserOperListResultDTO::getIsLighted));
List<UserOperListResultDTO> result = collect.get(BadgeConstant.YES);
List<UserOperListResultDTO> noLight = collect.get(BadgeConstant.NO);
if (CollectionUtils.isEmpty(noLight)){
return result;
}
result.addAll(noLight.stream().sorted(Comparator.comparing(UserOperListResultDTO::getSort)).collect(Collectors.toList()));
return result;
}
/**
@ -215,9 +232,14 @@ public class UserBadgeServiceImpl implements UserBadgeService {
@Transactional(rollbackFor = Exception.class)
public Result authBadgeRecord(CertificationAddFormDTO certificationAddFormDTO) {
log.info(JSON.toJSONString(certificationAddFormDTO));
if (StringUtils.isNotBlank(certificationAddFormDTO.getMobile())){
AuthFieldFormDTO authFieldFormDTO = new AuthFieldFormDTO();
authFieldFormDTO.setCustomerId(certificationAddFormDTO.getCustomerId());
authFieldFormDTO.setBadgeId(certificationAddFormDTO.getBadgeId());
validateParams(certificationAddFormDTO, authFieldFormDTO);
if (StringUtils.isNotBlank(certificationAddFormDTO.getMobile())) {
String smsCode = userBadgeRedis.getBadgeSmsCode(certificationAddFormDTO.getMobile());
if (!StringUtils.isNotBlank(smsCode)){
if (!StringUtils.isNotBlank(smsCode)) {
return new Result().error(EpmetErrorCode.MOBILE_CODE_ERROR.getCode());
}
}
@ -225,7 +247,7 @@ public class UserBadgeServiceImpl implements UserBadgeService {
List<String> userIds = new ArrayList<>();
userIds.add(certificationAddFormDTO.getUserId());
List<UserBaseInfoResultDTO> userBaseInfoResultDTOS = userBaseInfoService.queryUserBaseInfo(userIds);
if (CollectionUtils.isEmpty(userBaseInfoResultDTOS)){
if (CollectionUtils.isEmpty(userBaseInfoResultDTOS)) {
throw new RenException("查询用户基本信息集合为空......");
}
userBadgeDao.updateCertificateRecordIsLast(form.getBadgeId(),form.getUserId());
@ -236,19 +258,34 @@ public class UserBadgeServiceImpl implements UserBadgeService {
log.info(JSON.toJSONString(form));
userBadgeDao.insertUserBadgeCertificateRecord(form);
//TODO 站内信发送 您好,您的xxx徽章因认证失败未成功点亮,请查看
this.sendMessageByUser(form);
//TODO 站内信发送
String badgeName = badgeDao.selectBadgeName(form.getCustomerId(), form.getBadgeId());
sendMessage(BadgeConstant.AUTH_TITLE,String.format(BadgeConstant.READ_FLAG,userBaseInfoResultDTOS.get(NumConstant.ZERO).getDistrict().concat(userBaseInfoResultDTOS.get(NumConstant.ZERO).getRealName()),badgeName),form.getGridId(),form.getUserId(),form.getCustomerId());
return new Result();
}
private void validateParams(CertificationAddFormDTO certificationAddFormDTO, AuthFieldFormDTO authFieldFormDTO) {
List<AuthFieldResultDTO> authFieldResultDTOS = this.authField(authFieldFormDTO);
if (CollectionUtils.isEmpty(authFieldResultDTOS)) {
throw new RenException("该徽章配置配置错误");
}
Set<String> requiredColumns = authFieldResultDTOS.stream()
.filter(o -> NumConstant.ONE_STR.equals(o.getIsRequired()))
.map(AuthFieldResultDTO::getEnName).collect(Collectors.toSet());
List<String> missColumns = ValidatorUtils.hasAllRequired(JSON.toJSONString(certificationAddFormDTO), requiredColumns);
if (!CollectionUtils.isEmpty(missColumns)) {
throw new RenException(JSON.toJSONString(missColumns).concat("不能为空"));
}
}
/**
* @Description 站内信发送提交徽章认证
* @Description 站内信发送提交徽章认证
* @Param form
* @author zxc
* @date 2020/11/10 9:04 上午
*/
public void sendMessageByUser(UserBadgeCertificateRecordDTO form){
public void sendMessageByUser(UserBadgeCertificateRecordDTO form) {
List<UserMessageFormDTO> msgList = new ArrayList<>();
UserMessageFormDTO formDTO = new UserMessageFormDTO();
formDTO.setApp(BadgeConstant.RESI);
@ -388,4 +425,69 @@ public class UserBadgeServiceImpl implements UserBadgeService {
return badges.stream().collect(Collectors.groupingBy(UserBadgeInfoResultDTO::getUserId));
}
/**
* @Description 发送站内信
* @Param title 标题
* @Param msg 信息
* @Param gridId 网格ID
* @Param userId 用户ID
* @Param customerId 客户ID
* @author zxc
* @date 2020/11/19 上午9:16
*/
public void sendMessage(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 =
epmetUserOpenFeignClient.specificRolesStaffs(rolesUsersListFormDTO);
//3.发送消息
if(staffRoles.success() && null != staffRoles.getData() && staffRoles.getData().size() > 0){
List<UserMessageFormDTO> msgList = new ArrayList<>();
List<WxSubscribeMessageFormDTO> subscribeList = 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);
//微信订阅
WxSubscribeMessageFormDTO subscribeDTO = new WxSubscribeMessageFormDTO();
subscribeDTO.setClientType(ModuleConstant.APP_GOV);
subscribeDTO.setGridId(gridId);
subscribeDTO.setCustomerId(customerId);
subscribeDTO.setUserId(to);
subscribeDTO.setBehaviorType(ModuleConstant.BADGE_AUDIT_MESSAGE);
subscribeDTO.setMessageContent(msg);
subscribeDTO.setMessageTime(new Date());
subscribeList.add(subscribeDTO);
}
if (subscribeList.size() > NumConstant.ZERO){
epmetMessageOpenFeignClient.sendWxSubscribeMessage(subscribeList);
}
Result result = epmetMessageOpenFeignClient.saveUserMessageList(msgList);
if(result.success()){
return;
}
}
}
}
}

12
epmet-user/epmet-user-server/src/main/java/com/epmet/util/ModuleConstant.java

@ -34,4 +34,16 @@ public interface ModuleConstant {
String GENDER_UNKNOWN = "未知";
/**
* 工作人员角色key网格长
* */
String STAFF_ROLE_GRID_MANAGER = "grid_manager";
/**
* APP 政府端
* */
String APP_GOV = "gov";
String BADGE_AUDIT_MESSAGE = "徽章审核消息";
}

25
epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml

@ -75,7 +75,7 @@
AND NOT EXISTS
( SELECT ID FROM badge b WHERE CUSTOMER_ID = #{customerId} AND a.ID = b.ID)) t
ORDER BY
CREATED_TIME DESC
SORT
</select>
<select id="getDuplicateName" resultType="com.epmet.dto.result.BadgeListResultDTO">
SELECT
@ -138,7 +138,7 @@
WHERE BADGE_NAME = #{badgeName} AND badgeId != #{badgeId}
</select>
<select id="selectBadgeInfo" resultType="com.epmet.entity.BadgeEntity">
select * from badge where DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} AND ID = #{badgeId}
select CUSTOMER_ID,BADGE_NAME,BADGE_ICON,FIXATION_BADGE_TYPE,SORT,BADGE_STATUS from badge where DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} AND ID = #{badgeId}
</select>
<select id="selectAuditingList" resultType="com.epmet.dto.result.BadgeAuditingResultDTO">
SELECT
@ -284,4 +284,25 @@
AND FIXATION_BADGE_TYPE = 'party'
order by CREATED_TIME desc LIMIT 1
</select>
<select id="selectNextSort" resultType="int">
SELECT
ifnull(max(sort),0)+1
FROM
badge
WHERE
DEL_FLAG = '0'
AND (CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} OR CUSTOMER_ID = 'default')
</select>
<!-- 查询徽章名称 -->
<select id="selectBadgeName" resultType="java.lang.String">
SELECT
BADGE_NAME
FROM badge
WHERE DEL_FLAG = 0
AND (CUSTOMER_ID = 'default' OR CUSTOMER_ID = #{customerId})
ORDER BY CREATED_TIME DESC
LIMIT 1
</select>
</mapper>

4
epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml

@ -46,7 +46,8 @@
CUSTOMER_ID,
BADGE_NAME,
BADGE_ICON,
FIXATION_BADGE_TYPE AS badgeType
FIXATION_BADGE_TYPE AS badgeType,
sort
FROM (
SELECT * FROM badge
WHERE CUSTOMER_ID = #{customerId} AND DEL_FLAG = '0'
@ -70,6 +71,7 @@
WHERE DEL_FLAG = 0
AND CERTIFICATION_AUTID_STATUS = 'approved'
AND USER_ID = #{userId}
order by created_time desc
</select>
<!-- 根据UserId查询个人徽章点亮信息 -->

Loading…
Cancel
Save