Browse Source

积分审核修改

master
zhaoqifeng 3 years ago
parent
commit
9c72469971
  1. 49
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointApplyServiceImpl.java
  2. 2
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointApplyDao.xml

49
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointApplyServiceImpl.java

@ -154,6 +154,7 @@ public class PointApplyServiceImpl extends BaseServiceImpl<PointApplyDao, PointA
* @Date 2022/6/14 14:14 * @Date 2022/6/14 14:14
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class)
public void submit(PointApplyFormDTO formDTO) { public void submit(PointApplyFormDTO formDTO) {
PointApplyEntity entity = ConvertUtils.sourceToTarget(formDTO, PointApplyEntity.class); PointApplyEntity entity = ConvertUtils.sourceToTarget(formDTO, PointApplyEntity.class);
//从缓存获取网格信息 //从缓存获取网格信息
@ -214,6 +215,7 @@ public class PointApplyServiceImpl extends BaseServiceImpl<PointApplyDao, PointA
* @Date 2022/6/15 15:20 * @Date 2022/6/15 15:20
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class)
public void audit(TokenDto tokenDto, PointAuditFormDTO formDTO) { public void audit(TokenDto tokenDto, PointAuditFormDTO formDTO) {
if (StringUtils.isBlank(formDTO.getId()) && CollectionUtils.isEmpty(formDTO.getIds())) { if (StringUtils.isBlank(formDTO.getId()) && CollectionUtils.isEmpty(formDTO.getIds())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "请选择待审核的申请", "请选择待审核的申请"); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "请选择待审核的申请", "请选择待审核的申请");
@ -230,6 +232,7 @@ public class PointApplyServiceImpl extends BaseServiceImpl<PointApplyDao, PointA
if (NumConstant.ZERO_STR.equals(dto.getStatus())) { if (NumConstant.ZERO_STR.equals(dto.getStatus())) {
//更新审核状态 //更新审核状态
PointApplyEntity entity = ConvertUtils.sourceToTarget(formDTO, PointApplyEntity.class); PointApplyEntity entity = ConvertUtils.sourceToTarget(formDTO, PointApplyEntity.class);
entity.setId(id);
baseDao.updateById(entity); baseDao.updateById(entity);
String subjectId; String subjectId;
@ -244,31 +247,37 @@ public class PointApplyServiceImpl extends BaseServiceImpl<PointApplyDao, PointA
record.setCustomerId(tokenDto.getCustomerId()); record.setCustomerId(tokenDto.getCustomerId());
record.setTitle(dto.getTitle()); record.setTitle(dto.getTitle());
record.setStatement(dto.getStatement()); record.setStatement(dto.getStatement());
record.setPointValue(dto.getPointValue()); if (NumConstant.TWO_STR.equals(formDTO.getStatus())) {
record.setPointValue(dto.getPointValue());
} else {
record.setPointValue(NumConstant.ZERO);
}
record.setCategoryCode(dto.getCategoryCode()); record.setCategoryCode(dto.getCategoryCode());
record.setSubjectId(subjectId); record.setSubjectId(subjectId);
record.setBusinessId(dto.getId()); record.setBusinessId(dto.getId());
record.setBusinessCode(CommonConstant.POINT_APPLY); record.setBusinessCode(CommonConstant.POINT_APPLY);
pointAditiveRecordDao.insert(record); pointAditiveRecordDao.insert(record);
//重新计算总分 if (NumConstant.TWO_STR.equals(formDTO.getStatus())) {
LambdaQueryWrapper<PointAditiveCalcEntity> wrapper = new LambdaQueryWrapper<>(); //重新计算总分
wrapper.eq(PointAditiveCalcEntity::getCustomerId, tokenDto.getCustomerId()); LambdaQueryWrapper<PointAditiveCalcEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(PointAditiveCalcEntity::getSubjectId, subjectId); wrapper.eq(PointAditiveCalcEntity::getCustomerId, tokenDto.getCustomerId());
wrapper.eq(PointAditiveCalcEntity::getCategoryCode, dto.getCategoryCode()); wrapper.eq(PointAditiveCalcEntity::getSubjectId, subjectId);
PointAditiveCalcEntity calc = pointAditiveCalcDao.selectOne(wrapper); wrapper.eq(PointAditiveCalcEntity::getCategoryCode, dto.getCategoryCode());
if (null != calc) { PointAditiveCalcEntity calc = pointAditiveCalcDao.selectOne(wrapper);
calc.setUpdatedBy(null); if (null != calc) {
calc.setUpdatedTime(null); calc.setUpdatedBy(null);
calc.setTotal(calc.getTotal() + dto.getPointValue()); calc.setUpdatedTime(null);
pointAditiveCalcDao.updateById(calc); calc.setTotal(calc.getTotal() + dto.getPointValue());
} else { pointAditiveCalcDao.updateById(calc);
calc = new PointAditiveCalcEntity(); } else {
calc.setCustomerId(tokenDto.getCustomerId()); calc = new PointAditiveCalcEntity();
calc.setCategoryCode(dto.getCategoryCode()); calc.setCustomerId(tokenDto.getCustomerId());
calc.setSubjectId(subjectId); calc.setCategoryCode(dto.getCategoryCode());
calc.setSpend(NumConstant.ZERO); calc.setSubjectId(subjectId);
calc.setTotal(dto.getPointValue()); calc.setSpend(NumConstant.ZERO);
pointAditiveCalcDao.insert(calc); calc.setTotal(dto.getPointValue());
pointAditiveCalcDao.insert(calc);
}
} }
} }
}); });

2
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointApplyDao.xml

@ -51,7 +51,7 @@
<result property="userId" column="USER_ID"/> <result property="userId" column="USER_ID"/>
<result property="createdTime" column="CREATED_TIME"/> <result property="createdTime" column="CREATED_TIME"/>
<result property="ruleName" column="RULE_NAME"/> <result property="ruleName" column="RULE_NAME"/>
<result property="pointValue" column="POINT"/> <result property="pointValue" column="POINT_VALUE"/>
<collection property="annexList" ofType="java.lang.String"> <collection property="annexList" ofType="java.lang.String">
<result column="URL"/> <result column="URL"/>
</collection> </collection>

Loading…
Cancel
Save