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