Browse Source

Merge remote-tracking branch 'remotes/origin/dev_bugfix_ljj' into 市北master

feature/teamB_zz_wgh
jianjun 3 years ago
parent
commit
f1e40ac7ca
  1. 20
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aop/NoRepeatSubmitAop.java
  2. 7
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java

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

@ -1,11 +1,13 @@
package com.epmet.commons.tools.aop;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.distributedlock.DistributedLock;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.RedisKeys;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
@ -46,10 +48,13 @@ public class NoRepeatSubmitAop {
Object result = null;
RLock lock = null;
try {
long leaseTime = noRepeatSubmit.leaseTime();
//如果获取不到锁等待0秒直接返回 持锁时间为leaseTime
lock = distributedLock.getLock(RedisKeys.getNoRepeatSubmitKey(key), leaseTime, NumConstant.ZERO_L, TimeUnit.MILLISECONDS);
//因为getLock如果获取失败抛异常 所以不做锁状态的判断
//key 为空则直接跳过 不加锁
if (key != null){
long leaseTime = noRepeatSubmit.leaseTime();
//如果获取不到锁等待0秒直接返回 持锁时间为leaseTime
lock = distributedLock.getLock(RedisKeys.getNoRepeatSubmitKey(key), leaseTime, NumConstant.ZERO_L, TimeUnit.MILLISECONDS);
//因为getLock如果获取失败抛异常 所以不做锁状态的判断
}
result = pjp.proceed();
} catch (Exception e) {
log.warn("noRepeatSubmit key:{},msg:{}", key, e.getMessage());
@ -64,7 +69,12 @@ public class NoRepeatSubmitAop {
}
private String getKey(String keyExpress, String token) {
return keyExpress + token;
log.debug("getKey param keyExpress:{},token:{}",keyExpress,token);
if (StringUtils.isBlank(token)) {
return null;
}
return keyExpress + StrConstant.UNDER_LINE + token;
}
}

7
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java

@ -881,7 +881,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
//2、查询分类名称
List<String> categoryCodes=demandList.stream().map(DemandRecResultDTO::getCategoryCode).collect(Collectors.toList());
List<IcResiDemandDictEntity> dictList=demandDictService.listByCodes(customerId,categoryCodes);
Map<String, String> dictMap = dictList.stream().collect(Collectors.toMap(IcResiDemandDictEntity::getCategoryCode, IcResiDemandDictEntity::getCategoryName));
Map<String, String> dictMap = dictList.stream().filter(d->StringUtils.isNotBlank(d.getCategoryName())).collect(Collectors.toMap(IcResiDemandDictEntity::getCategoryCode, IcResiDemandDictEntity::getCategoryName));
//3、查询爱心互助志愿者
// 服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit;
@ -1772,7 +1772,10 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
List<DemandRecResultDTO> list = baseDao.pageListAnalysis(queryForm);
// 填充信息
fillDemandsInfo(list, customerId);
if(CollectionUtils.isNotEmpty(list)){
fillDemandsInfo(list, customerId);
}
return new PageData<>(list, new PageInfo<>(list).getTotal());
}

Loading…
Cancel
Save