Browse Source

积分相关修改

dev
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. 107
      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
public class MyTotalPointResultDTO implements Serializable {
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 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")
public Result<List<MyTotalPointResultDTO>> totalPoint(@LoginUser TokenDto tokenDto) {
return new Result<List<MyTotalPointResultDTO>>().ok(userPointTotalService.totalPoint(tokenDto));
public Result<MyTotalPointResultDTO> totalPoint(@LoginUser TokenDto tokenDto, @RequestBody CommonPageUserFormDTO formDTO) {
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;
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.ResiPointRankFormDTO;
import com.epmet.dto.result.MyTotalPointResultDTO;
@ -75,10 +75,10 @@ public interface UserPointTotalService extends BaseService<UserPointTotalEntity>
/**
* 积分总分
*
* @Param tokenDto
* @Param formDTO
* @Return {@link MyTotalPointResultDTO}
* @Author zhaoqifeng
* @Date 2022/6/14 15:46
*/
List<MyTotalPointResultDTO> totalPoint(TokenDto tokenDto);
MyTotalPointResultDTO totalPoint(CommonPageUserFormDTO formDTO);
}

107
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.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;
}
}

Loading…
Cancel
Save