|
|
@ -24,11 +24,11 @@ import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
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.dao.PointAditiveCalcDao; |
|
|
|
import com.epmet.dao.UserPointTotalDao; |
|
|
|
import com.epmet.dto.form.CommonPageUserFormDTO; |
|
|
|
import com.epmet.dto.form.CommonUserFormDTO; |
|
|
|
import com.epmet.dto.form.ResiPointRankFormDTO; |
|
|
|
import com.epmet.dto.result.*; |
|
|
@ -215,28 +215,53 @@ public class UserPointTotalServiceImpl extends BaseServiceImpl<UserPointTotalDao |
|
|
|
/** |
|
|
|
* 积分总分 |
|
|
|
* |
|
|
|
* @param tokenDto |
|
|
|
* @param formDTO |
|
|
|
* @Param tokenDto |
|
|
|
* @Return {@link MyTotalPointResultDTO} |
|
|
|
* @Author zhaoqifeng |
|
|
|
* @Date 2022/6/14 15:46 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<MyTotalPointResultDTO> totalPoint(TokenDto tokenDto) { |
|
|
|
List<MyTotalPointResultDTO> list = new ArrayList<MyTotalPointResultDTO>(); |
|
|
|
public MyTotalPointResultDTO totalPoint(CommonPageUserFormDTO formDTO) { |
|
|
|
MyTotalPointResultDTO resultDTO = new MyTotalPointResultDTO(); |
|
|
|
switch (formDTO.getCategoryCode()) { |
|
|
|
case CommonConstant.MORAL_EDUCATION: |
|
|
|
//德育积分
|
|
|
|
resultDTO = getEducationTotal(formDTO); |
|
|
|
break; |
|
|
|
case CommonConstant.PARTY_BUILDING: |
|
|
|
//党建积分
|
|
|
|
resultDTO = getPartyTotal(formDTO); |
|
|
|
break; |
|
|
|
case CommonConstant.ACTIVE: |
|
|
|
//活跃度积分
|
|
|
|
MyTotalPointResultDTO active = new MyTotalPointResultDTO(); |
|
|
|
active.setCategoryCode(CommonConstant.ACTIVE); |
|
|
|
ResiPointDetailResultDTO activeTotal = baseDao.selectPointByCustomerUserId(tokenDto.getUserId(), tokenDto.getCustomerId()); |
|
|
|
if (null != activeTotal) { |
|
|
|
active.setTotal(activeTotal.getAccumulatedPoint()); |
|
|
|
active.setUsable(activeTotal.getUsablePoint()); |
|
|
|
active.setSpend(activeTotal.getAccumulatedPoint() - activeTotal.getUsablePoint()); |
|
|
|
resultDTO = getActiveTotal(formDTO); |
|
|
|
break; |
|
|
|
case CommonConstant.TOTAL: |
|
|
|
MyTotalPointResultDTO education = getEducationTotal(formDTO); |
|
|
|
MyTotalPointResultDTO party = getPartyTotal(formDTO); |
|
|
|
MyTotalPointResultDTO active = getActiveTotal(formDTO); |
|
|
|
resultDTO.setTotal(education.getTotal() + party.getTotal() + active.getTotal()); |
|
|
|
resultDTO.setSpend(education.getSpend() + party.getSpend() + active.getSpend()); |
|
|
|
resultDTO.setUsable(education.getUsable() + party.getUsable() + active.getUsable()); |
|
|
|
break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
list.add(active); |
|
|
|
|
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 德育积分 |
|
|
|
* @Param formDTO |
|
|
|
* @Return {@link MyTotalPointResultDTO} |
|
|
|
* @Author zhaoqifeng |
|
|
|
* @Date 2022/6/17 9:58 |
|
|
|
*/ |
|
|
|
private MyTotalPointResultDTO getEducationTotal(CommonPageUserFormDTO formDTO) { |
|
|
|
MyTotalPointResultDTO resultDTO = new MyTotalPointResultDTO(); |
|
|
|
//德育积分
|
|
|
|
MyTotalPointResultDTO education = new MyTotalPointResultDTO(); |
|
|
|
education.setCategoryCode(CommonConstant.MORAL_EDUCATION); |
|
|
|
//获取居民绑定的家庭
|
|
|
|
Result<HomeInfoResultDTO> result = epmetUserOpenFeignClient.getHomeInfo(); |
|
|
|
if (!result.success() || null == result.getData()) { |
|
|
@ -244,34 +269,58 @@ public class UserPointTotalServiceImpl extends BaseServiceImpl<UserPointTotalDao |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(result.getData().getHouseId())) { |
|
|
|
LambdaQueryWrapper<PointAditiveCalcEntity> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
wrapper.eq(PointAditiveCalcEntity::getCustomerId, tokenDto.getCustomerId()); |
|
|
|
wrapper.eq(PointAditiveCalcEntity::getCustomerId, formDTO.getCustomerId()); |
|
|
|
wrapper.eq(PointAditiveCalcEntity::getSubjectId, result.getData().getHouseId()); |
|
|
|
wrapper.eq(PointAditiveCalcEntity::getCategoryCode, CommonConstant.MORAL_EDUCATION); |
|
|
|
PointAditiveCalcEntity entity = pointAditiveCalcDao.selectOne(wrapper); |
|
|
|
if (null != entity) { |
|
|
|
education.setTotal(entity.getTotal()); |
|
|
|
education.setSpend(entity.getSpend()); |
|
|
|
education.setUsable(entity.getTotal() - entity.getSpend()); |
|
|
|
resultDTO.setTotal(entity.getTotal()); |
|
|
|
resultDTO.setSpend(entity.getSpend()); |
|
|
|
resultDTO.setUsable(entity.getTotal() - entity.getSpend()); |
|
|
|
} |
|
|
|
} |
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
list.add(education); |
|
|
|
|
|
|
|
//党建积分
|
|
|
|
MyTotalPointResultDTO party = new MyTotalPointResultDTO(); |
|
|
|
party.setCategoryCode(CommonConstant.PARTY_BUILDING); |
|
|
|
/** |
|
|
|
* 党建积分 |
|
|
|
* @Param formDTO |
|
|
|
* @Return {@link MyTotalPointResultDTO} |
|
|
|
* @Author zhaoqifeng |
|
|
|
* @Date 2022/6/17 9:58 |
|
|
|
*/ |
|
|
|
private MyTotalPointResultDTO getPartyTotal(CommonPageUserFormDTO formDTO) { |
|
|
|
MyTotalPointResultDTO resultDTO = new MyTotalPointResultDTO(); |
|
|
|
LambdaQueryWrapper<PointAditiveCalcEntity> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
wrapper.eq(PointAditiveCalcEntity::getCustomerId, tokenDto.getCustomerId()); |
|
|
|
wrapper.eq(PointAditiveCalcEntity::getSubjectId, tokenDto.getUserId()); |
|
|
|
wrapper.eq(PointAditiveCalcEntity::getCustomerId, formDTO.getCustomerId()); |
|
|
|
wrapper.eq(PointAditiveCalcEntity::getSubjectId, formDTO.getUserId()); |
|
|
|
wrapper.eq(PointAditiveCalcEntity::getCategoryCode, CommonConstant.PARTY_BUILDING); |
|
|
|
PointAditiveCalcEntity entity = pointAditiveCalcDao.selectOne(wrapper); |
|
|
|
if (null != entity) { |
|
|
|
party.setTotal(entity.getTotal()); |
|
|
|
party.setSpend(entity.getSpend()); |
|
|
|
party.setUsable(entity.getTotal() - entity.getSpend()); |
|
|
|
resultDTO.setTotal(entity.getTotal()); |
|
|
|
resultDTO.setSpend(entity.getSpend()); |
|
|
|
resultDTO.setUsable(entity.getTotal() - entity.getSpend()); |
|
|
|
} |
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
list.add(party); |
|
|
|
|
|
|
|
return list; |
|
|
|
/** |
|
|
|
* 活跃积分 |
|
|
|
* |
|
|
|
* @Param formDTO |
|
|
|
* @Return {@link MyTotalPointResultDTO} |
|
|
|
* @Author zhaoqifeng |
|
|
|
* @Date 2022/6/17 9:58 |
|
|
|
*/ |
|
|
|
private MyTotalPointResultDTO getActiveTotal(CommonPageUserFormDTO formDTO) { |
|
|
|
MyTotalPointResultDTO resultDTO = new MyTotalPointResultDTO(); |
|
|
|
ResiPointDetailResultDTO activeTotal = baseDao.selectPointByCustomerUserId(formDTO.getUserId(), formDTO.getCustomerId()); |
|
|
|
if (null != activeTotal) { |
|
|
|
resultDTO.setTotal(activeTotal.getAccumulatedPoint()); |
|
|
|
resultDTO.setUsable(activeTotal.getUsablePoint()); |
|
|
|
resultDTO.setSpend(activeTotal.getAccumulatedPoint() - activeTotal.getUsablePoint()); |
|
|
|
} |
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|