Browse Source

Merge branch 'dev_staff_info' of http://git.elinkit.com.cn:7070/r/epmet-cloud into develop

dev_shibei_match
jianjun 4 years ago
parent
commit
d73fa9db81
  1. 56
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aop/NoRepeatSubmitAop.java
  2. 24
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/UserMessageTypeConstant.java
  3. 1
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/constant/UserMessageConstans.java
  4. 3
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoGroupReceiversDao.java
  5. 3
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/InfoServiceImpl.java
  6. 8
      epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoGroupReceiversDao.xml
  7. 4
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/MineResultDTO.java
  8. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java

56
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aop/NoRepeatSubmitAop.java

@ -35,41 +35,35 @@ public class NoRepeatSubmitAop {
private DistributedLock distributedLock; private DistributedLock distributedLock;
@Around("@annotation(noRepeatSubmit)") @Around("@annotation(noRepeatSubmit)")
public Object around(ProceedingJoinPoint pjp, NoRepeatSubmit noRepeatSubmit) { public Object around(ProceedingJoinPoint pjp, NoRepeatSubmit noRepeatSubmit) throws Throwable {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
assert attributes != null;
HttpServletRequest request = attributes.getRequest();
String internalToken = request.getHeader(AUTHORIZATION_TOKEN_HEADER_KEY);
String key = getKey(request.getRequestURI(), internalToken);
// 如果缓存中有这个url视为重复提交
Object result = null;
RLock lock = null;
try { try {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); long leaseTime = noRepeatSubmit.leaseTime();
assert attributes != null; //如果获取不到锁等待0秒直接返回 持锁时间为leaseTime
HttpServletRequest request = attributes.getRequest(); lock = distributedLock.getLock(RedisKeys.getNoRepeatSubmitKey(key), leaseTime, NumConstant.ZERO_L, TimeUnit.MILLISECONDS);
String internalToken = request.getHeader(AUTHORIZATION_TOKEN_HEADER_KEY); } catch (Exception e) {
String key = getKey(request.getRequestURI(), internalToken); log.warn("noRepeatSubmit key:{},msg:{}", key, e.getMessage());
// 如果缓存中有这个url视为重复提交 //"未获取到锁,重复提交了
Object result = null; throw new RenException(EpmetErrorCode.REPEAT_SUBMIT.getCode());
RLock lock = null; }
try { try {
long leaseTime = noRepeatSubmit.leaseTime(); //因为getLock如果获取失败抛异常 所以不做锁状态的判断
//如果获取不到锁等待0秒直接返回 持锁时间为leaseTime result = pjp.proceed();
lock = distributedLock.getLock(RedisKeys.getNoRepeatSubmitKey(key), leaseTime, NumConstant.ZERO_L, TimeUnit.MILLISECONDS); } finally {
} catch (Exception e) { distributedLock.unLock(lock);
log.warn("noRepeatSubmit key:{},msg:{}", key, e.getMessage()); }
//"未获取到锁,重复提交了
throw new RenException(EpmetErrorCode.REPEAT_SUBMIT.getCode());
}
try {
//因为getLock如果获取失败抛异常 所以不做锁状态的判断
result = pjp.proceed();
} finally {
distributedLock.unLock(lock);
}
return result; return result;
} catch (RenException e) {
throw e;
} catch (Throwable e) {
log.error("验证重复提交时出现未知异常!");
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
}
} }
private String getKey(String keyExpress, String token) { private String getKey(String keyExpress, String token) {

24
epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/UserMessageTypeConstant.java

@ -0,0 +1,24 @@
package com.epmet.constant;
/**
* @author yinzuomei
* @dscription
* @date 2021/08/27 14:22
*/
public interface UserMessageTypeConstant {
//上传下达
/**
* 工作端发送消息,通知接收人
*/
String INFO="info";
/**
* 居民端提交热心居民申请通知网格长
*/
String WARMHEARTED_APPLY="warmhearted_apply";
}

1
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/constant/UserMessageConstans.java

@ -20,6 +20,5 @@ public interface UserMessageConstans {
String INFO_TITLE="您有一条新消息"; String INFO_TITLE="您有一条新消息";
String MESSAGE_TYPE_INFO="info";
String INFO_CONTENT_TEMP="您有一条【%s】的新消息,请您查看"; String INFO_CONTENT_TEMP="您有一条【%s】的新消息,请您查看";
} }

3
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoGroupReceiversDao.java

@ -20,6 +20,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.InfoGroupReceiversEntity; import com.epmet.entity.InfoGroupReceiversEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Set; import java.util.Set;
@ -40,5 +41,5 @@ public interface InfoGroupReceiversDao extends BaseDao<InfoGroupReceiversEntity>
* @author yinzuomei * @author yinzuomei
* @date 2021/8/19 10:51 上午 * @date 2021/8/19 10:51 上午
*/ */
Set<String> selectStaffIds(Set<String> groupIdList); Set<String> selectStaffIds(@Param("groupIdList") Set<String> groupIdList);
} }

3
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/InfoServiceImpl.java

@ -27,6 +27,7 @@ import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.UserMessageConstans; import com.epmet.constant.UserMessageConstans;
import com.epmet.constant.UserMessageTypeConstant;
import com.epmet.dao.*; import com.epmet.dao.*;
import com.epmet.dto.form.*; import com.epmet.dto.form.*;
import com.epmet.dto.result.AddReceiverGroupResultDTO; import com.epmet.dto.result.AddReceiverGroupResultDTO;
@ -159,7 +160,7 @@ public class InfoServiceImpl extends BaseServiceImpl<InfoDao, InfoEntity> implem
infoEntity.getContent().length() > NumConstant.FIFTY ? infoEntity.getContent().length() > NumConstant.FIFTY ?
StringUtils.substring(infoEntity.getContent(), NumConstant.ZERO,NumConstant.FORTY_NINE) : infoEntity.getContent())); StringUtils.substring(infoEntity.getContent(), NumConstant.ZERO,NumConstant.FORTY_NINE) : infoEntity.getContent()));
userMessageEntity.setReadFlag(UserMessageConstans.UNREAD); userMessageEntity.setReadFlag(UserMessageConstans.UNREAD);
userMessageEntity.setMessageType(UserMessageConstans.MESSAGE_TYPE_INFO); userMessageEntity.setMessageType(UserMessageTypeConstant.INFO);
userMessageEntity.setTargetId(infoEntity.getId()); userMessageEntity.setTargetId(infoEntity.getId());
userMessageEntity.setCreatedBy(formDTO.getUserId()); userMessageEntity.setCreatedBy(formDTO.getUserId());
userMessageEntity.setUpdatedBy(formDTO.getUserId()); userMessageEntity.setUpdatedBy(formDTO.getUserId());

8
epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoGroupReceiversDao.xml

@ -11,9 +11,13 @@
info_group_receivers igr info_group_receivers igr
WHERE WHERE
igr.DEL_FLAG = '0' igr.DEL_FLAG = '0'
AND igr.info_receiver_group_id IN ( <if test="groupIdList != null and groupIdList.size() > 0">
'1','2' AND igr.info_receiver_group_id IN
<foreach collection="groupIdList" item="groupId" separator="," open="(" close=")">
#{groupId}
</foreach>
) )
</if>
</select> </select>

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

@ -55,4 +55,8 @@ public class MineResultDTO implements Serializable {
* 手机号 * 手机号
*/ */
private String mobile; private String mobile;
/**
* 根组织
*/
private String rootAgencyId;
} }

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

@ -1,6 +1,7 @@
package com.epmet.service.impl; package com.epmet.service.impl;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
@ -229,6 +230,15 @@ public class StaffServiceImpl implements StaffService {
//用户所属机关名称 //用户所属机关名称
result.setMyAgencyName(customerAgencyDTO.getOrganizationName()); result.setMyAgencyName(customerAgencyDTO.getOrganizationName());
} }
//2021.08.27 zhaoqf start
//获取根组织
CustomerAgencyDTO agency = customerAgencyService.get(customerStaffAgency.getAgencyId());
if (StringUtils.isNotBlank(agency.getPids())) {
result.setRootAgencyId(agency.getPids().split(StrConstant.COLON)[0]);
} else {
result.setRootAgencyId(customerStaffAgency.getAgencyId());
}
//2021.08.27 zhaoqf end
return result; return result;
} }

Loading…
Cancel
Save