Commit 5de05ec2 authored by zhangfeng's avatar zhangfeng

Merge branch 'refs/heads/feature_member_score_zhangfeng' into feature_member_score

parents 86e0d0bb f1e1f168
......@@ -94,25 +94,39 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper,
@Override
public Boolean updateRecord(RewardRedeemUpdateReqVO request) {
updateValidateParam(request);
Long rewardId = updateValidateParam(request);
RewardDO rewardDO = rewardService.getById(rewardId);
if (rewardDO == null) {
throw exception(ErrorCodeConstants.REWARD_NOT_EXISTS);
}
if (!Arrays.asList(rewardDO.getPickMethod().split(",")).contains(request.getRedeemType().toString())) {
throw exception(ErrorCodeConstants.REWARD_PICK_METHOD_NOT_ALLOW);
}
LambdaUpdateWrapper<RewardRedeemDO> wrapper = Wrappers.lambdaUpdate();
wrapper.eq(RewardRedeemDO::getId, request.getId());
wrapper.set(RewardRedeemDO::getRedeemType, request.getRedeemType());
wrapper.set(RewardRedeemDO::getExpenses, request.getExpenses());
wrapper.set(RewardRedeemDO::getCurrency, request.getCurrency());
wrapper.set(RewardRedeemDO::getRecipientName, request.getRecipientName());
wrapper.set(RewardRedeemDO::getRecipientAddress, request.getRecipientAddress());
wrapper.set(RewardRedeemDO::getRecipientPhoneNum, request.getRecipientPhoneNum());
wrapper.set(RewardRedeemDO::getRedeemer, request.getRedeemer());
wrapper.set(RewardRedeemDO::getRedemptionTime, request.getRedemptionTime());
wrapper.set(RewardRedeemDO::getCourierCompany, request.getCourierCompany());
wrapper.set(RewardRedeemDO::getExpressNo, request.getExpressNo());
wrapper.set(RewardRedeemDO::getExpressDate, request.getExpressDate());
wrapper.set(RewardRedeemDO::getExpressSender, request.getExpressSender());
wrapper.set(RewardRedeemDO::getAnnex, request.getAnnex());
wrapper.set(RewardRedeemDO::getRemark, request.getRemark());
wrapper.set(RewardRedeemDO::getUpdater, SecurityFrameworkUtils.getLoginUserId());
wrapper.set(RewardRedeemDO::getUpdateTime, new Date());
if (request.getRedeemType() == RewardPickMethedEnum.SELF_PICKUP.getValue()) {
wrapper.set(RewardRedeemDO::getRecipientAddress, "");
wrapper.set(RewardRedeemDO::getCourierCompany, null);
wrapper.set(RewardRedeemDO::getExpressNo, null);
wrapper.set(RewardRedeemDO::getExpressDate, null);
} else {
wrapper.set(StringUtils.isNotBlank(request.getRecipientAddress()), RewardRedeemDO::getRecipientAddress, request.getRecipientAddress());
wrapper.set(RewardRedeemDO::getCourierCompany, request.getCourierCompany());
wrapper.set(RewardRedeemDO::getExpressNo, request.getExpressNo());
wrapper.set(RewardRedeemDO::getExpressDate, request.getExpressDate());
}
rewardRedeemMapper.update(null, wrapper);
return true;
}
......@@ -461,7 +475,7 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper,
return true;
}
private void updateValidateParam(RewardRedeemUpdateReqVO request) {
private Long updateValidateParam(RewardRedeemUpdateReqVO request) {
RewardRedeemDO rewardRedeemDO = getById(request.getId());
if (rewardRedeemDO == null) {
throw exception(ErrorCodeConstants.REWARD_REDEEM_NOT_EXIST);
......@@ -469,5 +483,6 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper,
if (rewardRedeemDO.getStatus() != RewardRedeemStatusEnum.REDEEMING.getValue()) {
throw exception(ErrorCodeConstants.REWARD_REDEEM_STATUS_ERROR);
}
return rewardRedeemDO.getRewardId();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment