|
|
@ -27,6 +27,7 @@ import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.dao.UserPointTotalDao; |
|
|
|
import com.epmet.dto.UserPointTotalDTO; |
|
|
|
import com.epmet.dto.form.CommonUserFormDTO; |
|
|
|
import com.epmet.dto.form.ResiCommonUserIdFormDTO; |
|
|
|
import com.epmet.dto.form.ResiPointRankFormDTO; |
|
|
|
import com.epmet.dto.result.*; |
|
|
@ -36,6 +37,7 @@ import com.epmet.service.UserPointTotalService; |
|
|
|
import com.epmet.utils.DimIdGenerator; |
|
|
|
import com.epmet.utils.ModuleConstant; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.ibatis.annotations.Param; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -52,8 +54,10 @@ import java.util.stream.Collectors; |
|
|
|
* @since v1.0.0 2020-07-20 |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
@Slf4j |
|
|
|
public class UserPointTotalServiceImpl extends BaseServiceImpl<UserPointTotalDao, UserPointTotalEntity> implements UserPointTotalService { |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
|
|
|
|
@ -111,14 +115,14 @@ public class UserPointTotalServiceImpl extends BaseServiceImpl<UserPointTotalDao |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 获取指定居民的积分信息 |
|
|
|
* @param userId |
|
|
|
* @param param |
|
|
|
* @return |
|
|
|
* @author wangc |
|
|
|
* @date 2020.07.22 15:58 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public ResiPointDetailResultDTO getMyPoint(ResiCommonUserIdFormDTO userId) { |
|
|
|
ResiPointDetailResultDTO result = baseDao.selectPointByUserId(userId.getUserId()); |
|
|
|
public ResiPointDetailResultDTO getMyPoint(CommonUserFormDTO param) { |
|
|
|
ResiPointDetailResultDTO result = baseDao.selectPointByCustomerUserId(param.getUserId(),param.getCustomerId()); |
|
|
|
if(null == result) return new ResiPointDetailResultDTO(); |
|
|
|
if(null == result.getUsablePoint() || null == result.getAccumulatedPoint()) return new ResiPointDetailResultDTO(); |
|
|
|
return result; |
|
|
@ -145,6 +149,8 @@ public class UserPointTotalServiceImpl extends BaseServiceImpl<UserPointTotalDao |
|
|
|
epmetUserOpenFeignClient.queryUserBaseInfo(userIdParam); |
|
|
|
if(myResiInfoResult.success() && null != myResiInfoResult.getData() && !myResiInfoResult.getData().isEmpty()){ |
|
|
|
if(StringUtils.isBlank(pointRankFormDTO.getCustomerId())) { |
|
|
|
//缓存中的customerId是不准确的,前端一定会传customerId,所以不会执行此代码
|
|
|
|
log.warn("com.epmet.service.impl.UserPointTotalServiceImpl.getPointRanking,传参缺失客户Id,参数:{}",pointRankFormDTO); |
|
|
|
pointRankFormDTO.setCustomerId(myResiInfoResult.getData().get(NumConstant.ZERO).getCustomerId()); |
|
|
|
} |
|
|
|
//微信昵称
|
|
|
@ -169,7 +175,7 @@ public class UserPointTotalServiceImpl extends BaseServiceImpl<UserPointTotalDao |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
//如果当前请求不是第一页
|
|
|
|
//如果当前请求是第一页
|
|
|
|
if(NumConstant.ONE == pointRankFormDTO.getPageNo()) { |
|
|
|
ResiPointRankResultDTO myself = null; |
|
|
|
Optional<ResiPointRankResultDTO> opt = rankList.stream().filter(obj -> StringUtils.equals(obj.getUserId(), pointRankFormDTO.getUserId())).findFirst(); |
|
|
@ -244,4 +250,20 @@ public class UserPointTotalServiceImpl extends BaseServiceImpl<UserPointTotalDao |
|
|
|
baseDao.insertOrUpdate(entity); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 获取指定居民的积分信息 - 使用客户Id匹配,兼容多客户情况 |
|
|
|
* @param customerUserParam |
|
|
|
* @return |
|
|
|
* @author wangc |
|
|
|
* @date 2020.07.22 15:58 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public ResiPointDetailResultDTO getMyPointGroupByCustomer(CommonUserFormDTO customerUserParam) { |
|
|
|
ResiPointDetailResultDTO result = baseDao.selectPointByUserId(customerUserParam.getUserId()); |
|
|
|
if(null == result) return new ResiPointDetailResultDTO(); |
|
|
|
if(null == result.getUsablePoint() || null == result.getAccumulatedPoint()) return new ResiPointDetailResultDTO(); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
} |