Commit f1e1f168 authored by zhangfeng's avatar zhangfeng

兑换记录更新流程修改

parent e78b1b1b
...@@ -94,25 +94,39 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper, ...@@ -94,25 +94,39 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper,
@Override @Override
public Boolean updateRecord(RewardRedeemUpdateReqVO request) { 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(); LambdaUpdateWrapper<RewardRedeemDO> wrapper = Wrappers.lambdaUpdate();
wrapper.eq(RewardRedeemDO::getId, request.getId()); wrapper.eq(RewardRedeemDO::getId, request.getId());
wrapper.set(RewardRedeemDO::getRedeemType, request.getRedeemType()); wrapper.set(RewardRedeemDO::getRedeemType, request.getRedeemType());
wrapper.set(RewardRedeemDO::getExpenses, request.getExpenses()); wrapper.set(RewardRedeemDO::getExpenses, request.getExpenses());
wrapper.set(RewardRedeemDO::getCurrency, request.getCurrency()); wrapper.set(RewardRedeemDO::getCurrency, request.getCurrency());
wrapper.set(RewardRedeemDO::getRecipientName, request.getRecipientName()); wrapper.set(RewardRedeemDO::getRecipientName, request.getRecipientName());
wrapper.set(RewardRedeemDO::getRecipientAddress, request.getRecipientAddress());
wrapper.set(RewardRedeemDO::getRecipientPhoneNum, request.getRecipientPhoneNum()); wrapper.set(RewardRedeemDO::getRecipientPhoneNum, request.getRecipientPhoneNum());
wrapper.set(RewardRedeemDO::getRedeemer, request.getRedeemer()); wrapper.set(RewardRedeemDO::getRedeemer, request.getRedeemer());
wrapper.set(RewardRedeemDO::getRedemptionTime, request.getRedemptionTime()); 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::getExpressSender, request.getExpressSender());
wrapper.set(RewardRedeemDO::getAnnex, request.getAnnex()); wrapper.set(RewardRedeemDO::getAnnex, request.getAnnex());
wrapper.set(RewardRedeemDO::getRemark, request.getRemark()); wrapper.set(RewardRedeemDO::getRemark, request.getRemark());
wrapper.set(RewardRedeemDO::getUpdater, SecurityFrameworkUtils.getLoginUserId()); wrapper.set(RewardRedeemDO::getUpdater, SecurityFrameworkUtils.getLoginUserId());
wrapper.set(RewardRedeemDO::getUpdateTime, new Date()); 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); rewardRedeemMapper.update(null, wrapper);
return true; return true;
} }
...@@ -461,7 +475,7 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper, ...@@ -461,7 +475,7 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper,
return true; return true;
} }
private void updateValidateParam(RewardRedeemUpdateReqVO request) { private Long updateValidateParam(RewardRedeemUpdateReqVO request) {
RewardRedeemDO rewardRedeemDO = getById(request.getId()); RewardRedeemDO rewardRedeemDO = getById(request.getId());
if (rewardRedeemDO == null) { if (rewardRedeemDO == null) {
throw exception(ErrorCodeConstants.REWARD_REDEEM_NOT_EXIST); throw exception(ErrorCodeConstants.REWARD_REDEEM_NOT_EXIST);
...@@ -469,5 +483,6 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper, ...@@ -469,5 +483,6 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper,
if (rewardRedeemDO.getStatus() != RewardRedeemStatusEnum.REDEEMING.getValue()) { if (rewardRedeemDO.getStatus() != RewardRedeemStatusEnum.REDEEMING.getValue()) {
throw exception(ErrorCodeConstants.REWARD_REDEEM_STATUS_ERROR); 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