Browse Source

积分相关修改

feature/teamB_zz_wgh
zhaoqifeng 3 years ago
parent
commit
dd11282ad9
  1. 4
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/MyTotalPointResultDTO.java
  2. 4
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/CommonConstant.java
  3. 6
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java
  4. 6
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointTotalService.java
  5. 109
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointTotalServiceImpl.java

4
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/MyTotalPointResultDTO.java

@ -12,10 +12,6 @@ import java.io.Serializable;
@Data @Data
public class MyTotalPointResultDTO implements Serializable { public class MyTotalPointResultDTO implements Serializable {
private static final long serialVersionUID = 15299506166024546L; private static final long serialVersionUID = 15299506166024546L;
/**
* 德育积分moral_education党建积分party_building活跃积分active
*/
private String categoryCode;
/** /**
* 总积分 * 总积分
*/ */

4
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/CommonConstant.java

@ -29,6 +29,10 @@ public interface CommonConstant extends Constant {
* 活跃积分 * 活跃积分
*/ */
String ACTIVE = "active"; String ACTIVE = "active";
/**
* 活跃积分
*/
String TOTAL = "total";
/** /**
* 积分申请 * 积分申请
*/ */

6
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java

@ -233,8 +233,10 @@ public class ResiPointController {
} }
@PostMapping("total") @PostMapping("total")
public Result<List<MyTotalPointResultDTO>> totalPoint(@LoginUser TokenDto tokenDto) { public Result<MyTotalPointResultDTO> totalPoint(@LoginUser TokenDto tokenDto, @RequestBody CommonPageUserFormDTO formDTO) {
return new Result<List<MyTotalPointResultDTO>>().ok(userPointTotalService.totalPoint(tokenDto)); formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
return new Result<MyTotalPointResultDTO>().ok(userPointTotalService.totalPoint(formDTO));
} }
/** /**

6
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointTotalService.java

@ -18,7 +18,7 @@
package com.epmet.service; package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.form.CommonPageUserFormDTO;
import com.epmet.dto.form.CommonUserFormDTO; import com.epmet.dto.form.CommonUserFormDTO;
import com.epmet.dto.form.ResiPointRankFormDTO; import com.epmet.dto.form.ResiPointRankFormDTO;
import com.epmet.dto.result.MyTotalPointResultDTO; import com.epmet.dto.result.MyTotalPointResultDTO;
@ -75,10 +75,10 @@ public interface UserPointTotalService extends BaseService<UserPointTotalEntity>
/** /**
* 积分总分 * 积分总分
* *
* @Param tokenDto * @Param formDTO
* @Return {@link MyTotalPointResultDTO} * @Return {@link MyTotalPointResultDTO}
* @Author zhaoqifeng * @Author zhaoqifeng
* @Date 2022/6/14 15:46 * @Date 2022/6/14 15:46
*/ */
List<MyTotalPointResultDTO> totalPoint(TokenDto tokenDto); MyTotalPointResultDTO totalPoint(CommonPageUserFormDTO formDTO);
} }

109
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointTotalServiceImpl.java

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

Loading…
Cancel
Save