Commit 19bbf09b authored by zhaobiyan's avatar zhaobiyan

兑换记录核准接口

parent 22858836
...@@ -23,5 +23,8 @@ public interface ErrorCodeConstants { ...@@ -23,5 +23,8 @@ public interface ErrorCodeConstants {
ErrorCode REWARD_REDEEM_FAIL = new ErrorCode(1001011015, "批量兑换失败"); ErrorCode REWARD_REDEEM_FAIL = new ErrorCode(1001011015, "批量兑换失败");
ErrorCode REWARD_REDEEM_COUNT_NOT_ALLOW = new ErrorCode(1001011016, "批量兑换每次最多十条"); ErrorCode REWARD_REDEEM_COUNT_NOT_ALLOW = new ErrorCode(1001011016, "批量兑换每次最多十条");
ErrorCode REWARD_REDEEM_ALLOW_COUNT_ERROR = new ErrorCode(1001011017, "超出允许兑换次数"); ErrorCode REWARD_REDEEM_ALLOW_COUNT_ERROR = new ErrorCode(1001011017, "超出允许兑换次数");
ErrorCode REWARD_REDEEM_NOT_EXIST = new ErrorCode(1001011018, "reward.redeem.not.exist");
ErrorCode REWARD_REDEEM_STATUS_ERROR = new ErrorCode(1001011018, "reward.redeem.status.error");
ErrorCode REWARD_REDEEM_VERIFY_NO_PARAM = new ErrorCode(1001011018, "reward.redeem.verify.no.param");
} }
...@@ -6,10 +6,7 @@ import cn.iocoder.yudao.module.reward.api.reward.RedeemRewardApi; ...@@ -6,10 +6,7 @@ import cn.iocoder.yudao.module.reward.api.reward.RedeemRewardApi;
import cn.iocoder.yudao.module.reward.api.reward.dto.RedeemRewardReqVO; import cn.iocoder.yudao.module.reward.api.reward.dto.RedeemRewardReqVO;
import cn.iocoder.yudao.module.reward.api.reward.dto.RedeemRewardRespDTO; import cn.iocoder.yudao.module.reward.api.reward.dto.RedeemRewardRespDTO;
import cn.iocoder.yudao.module.reward.service.redeem.RewardRedeemService; import cn.iocoder.yudao.module.reward.service.redeem.RewardRedeemService;
import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemBaseVO; import cn.iocoder.yudao.module.reward.vo.reward.*;
import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageReqVO;
import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageRespVO;
import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemUpdateVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
...@@ -54,6 +51,12 @@ public class RedeemRewardController { ...@@ -54,6 +51,12 @@ public class RedeemRewardController {
return success(rewardRedeemService.updateRecord(request)); return success(rewardRedeemService.updateRecord(request));
} }
@PostMapping("record/verify")
@ApiOperation("兑换记录核销")
public CommonResult<Boolean> verify(@Valid @RequestBody RewardRedeemVerifyVO request) {
return success(rewardRedeemService.verify(request));
}
@PostMapping("/single") @PostMapping("/single")
@ApiOperation("兑换礼品") @ApiOperation("兑换礼品")
......
...@@ -76,7 +76,7 @@ public class RewardRedeemDO extends BaseDO { ...@@ -76,7 +76,7 @@ public class RewardRedeemDO extends BaseDO {
/** /**
* 快递公司 * 快递公司
*/ */
private String courierCompany; private Integer courierCompany;
/** /**
* 快递单号 * 快递单号
*/ */
...@@ -84,7 +84,7 @@ public class RewardRedeemDO extends BaseDO { ...@@ -84,7 +84,7 @@ public class RewardRedeemDO extends BaseDO {
/** /**
* 快递日期 * 快递日期
*/ */
private String expressDate; private Date expressDate;
/** /**
* 快递寄出人 * 快递寄出人
*/ */
...@@ -97,4 +97,8 @@ public class RewardRedeemDO extends BaseDO { ...@@ -97,4 +97,8 @@ public class RewardRedeemDO extends BaseDO {
* 备注 * 备注
*/ */
private String remark; private String remark;
private String verifyUser;
private Date verifyTime;
} }
...@@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.reward.dal.dataobject.redeem.RewardRedeemDO; ...@@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.reward.dal.dataobject.redeem.RewardRedeemDO;
import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageReqVO; import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageReqVO;
import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageRespVO; import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageRespVO;
import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemUpdateVO; import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemUpdateVO;
import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemVerifyVO;
/** /**
* 礼品兑换 Service 接口 * 礼品兑换 Service 接口
...@@ -19,4 +20,6 @@ public interface RewardRedeemService extends IService<RewardRedeemDO> { ...@@ -19,4 +20,6 @@ public interface RewardRedeemService extends IService<RewardRedeemDO> {
RewardRedeemPageRespVO detail(Long id); RewardRedeemPageRespVO detail(Long id);
Boolean updateRecord(RewardRedeemUpdateVO request); Boolean updateRecord(RewardRedeemUpdateVO request);
Boolean verify(RewardRedeemVerifyVO request);
} }
...@@ -6,13 +6,16 @@ import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; ...@@ -6,13 +6,16 @@ import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.reward.dal.dataobject.redeem.RewardRedeemDO; import cn.iocoder.yudao.module.reward.dal.dataobject.redeem.RewardRedeemDO;
import cn.iocoder.yudao.module.reward.dal.mysql.redeem.RewardRedeemMapper; import cn.iocoder.yudao.module.reward.dal.mysql.redeem.RewardRedeemMapper;
import cn.iocoder.yudao.module.reward.enums.ErrorCodeConstants; import cn.iocoder.yudao.module.reward.enums.ErrorCodeConstants;
import cn.iocoder.yudao.module.reward.enums.RewardPickMethedEnum;
import cn.iocoder.yudao.module.reward.enums.RewardRedeemStatusEnum; import cn.iocoder.yudao.module.reward.enums.RewardRedeemStatusEnum;
import cn.iocoder.yudao.module.reward.service.reward.RewardService; import cn.iocoder.yudao.module.reward.service.reward.RewardService;
import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageReqVO; import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageReqVO;
import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageRespVO; import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageRespVO;
import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemUpdateVO; import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemUpdateVO;
import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemVerifyVO;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.micrometer.core.instrument.util.StringUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -54,7 +57,7 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper, ...@@ -54,7 +57,7 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper,
@Override @Override
public Boolean updateRecord(RewardRedeemUpdateVO request) { public Boolean updateRecord(RewardRedeemUpdateVO request) {
validateParam(request); updateValidateParam(request);
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());
...@@ -77,15 +80,62 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper, ...@@ -77,15 +80,62 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper,
return true; return true;
} }
private void validateParam(RewardRedeemUpdateVO request) { @Override
public Boolean verify(RewardRedeemVerifyVO request) {
verifyValidateParam(request);
LambdaUpdateWrapper<RewardRedeemDO> wrapper = Wrappers.lambdaUpdate();
wrapper.eq(RewardRedeemDO::getId, request.getId());
wrapper.set(RewardRedeemDO::getStatus, RewardRedeemStatusEnum.REDEEMED.getValue());
wrapper.set(RewardRedeemDO::getRecipientName, request.getRecipientName());
wrapper.set(RewardRedeemDO::getRecipientPhoneNum, request.getRecipientPhoneNum());
wrapper.set(RewardRedeemDO::getRecipientAddress, request.getRecipientAddress());
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::getVerifyUser, request.getVerifyUser());
wrapper.set(RewardRedeemDO::getVerifyTime, request.getVerifyTime());
wrapper.set(RewardRedeemDO::getUpdater, SecurityFrameworkUtils.getLoginUserId());
wrapper.set(RewardRedeemDO::getUpdateTime, new Date());
rewardRedeemMapper.update(null, wrapper);
return true;
}
private void verifyValidateParam(RewardRedeemVerifyVO request) {
RewardRedeemDO rewardRedeemDO = getById(request.getId());
if (rewardRedeemDO == null) {
throw exception(ErrorCodeConstants.REWARD_REDEEM_NOT_EXIST);
}
if (rewardRedeemDO.getStatus() != RewardRedeemStatusEnum.REDEEMING.getValue()) {
throw exception(ErrorCodeConstants.REWARD_REDEEM_STATUS_ERROR);
}
if (rewardRedeemDO.getRedeemType() != RewardPickMethedEnum.PICKUP.getValue()) {
//除上门领取状态外,其他方式需要验证 courierCompany, expressNo, expressDate, expressSender, recipientAddress 不能为空
if (request.getCourierCompany() == null) {
throw exception(ErrorCodeConstants.REWARD_REDEEM_VERIFY_NO_PARAM);
}
if (StringUtils.isBlank(request.getExpressNo())) {
throw exception(ErrorCodeConstants.REWARD_REDEEM_VERIFY_NO_PARAM);
}
if (request.getExpressDate() == null) {
throw exception(ErrorCodeConstants.REWARD_REDEEM_VERIFY_NO_PARAM);
}
if (StringUtils.isBlank(request.getExpressSender())) {
throw exception(ErrorCodeConstants.REWARD_REDEEM_VERIFY_NO_PARAM);
}
if (StringUtils.isBlank(request.getRecipientAddress())) {
throw exception(ErrorCodeConstants.REWARD_REDEEM_VERIFY_NO_PARAM);
}
}
}
private void updateValidateParam(RewardRedeemUpdateVO request) {
RewardRedeemDO rewardRedeemDO = getById(request.getId()); RewardRedeemDO rewardRedeemDO = getById(request.getId());
if (rewardRedeemDO == null) { if (rewardRedeemDO == null) {
//todo 提示修改 throw exception(ErrorCodeConstants.REWARD_REDEEM_NOT_EXIST);
throw exception(ErrorCodeConstants.REWARD_ENDTIME_ERROR);
} }
if (rewardRedeemDO.getStatus() != RewardRedeemStatusEnum.REDEEMING.getValue()) { if (rewardRedeemDO.getStatus() != RewardRedeemStatusEnum.REDEEMING.getValue()) {
//todo 提示修改 throw exception(ErrorCodeConstants.REWARD_REDEEM_STATUS_ERROR);
throw exception(ErrorCodeConstants.REWARD_ENDTIME_ERROR);
} }
} }
} }
...@@ -78,7 +78,7 @@ public class RewardRedeemBaseVO { ...@@ -78,7 +78,7 @@ public class RewardRedeemBaseVO {
* 快递公司 * 快递公司
*/ */
@ApiModelProperty(value = "快递公司") @ApiModelProperty(value = "快递公司")
private String courierCompany; private Integer courierCompany;
/** /**
* 快递单号 * 快递单号
*/ */
...@@ -114,4 +114,14 @@ public class RewardRedeemBaseVO { ...@@ -114,4 +114,14 @@ public class RewardRedeemBaseVO {
private String updateTime; private String updateTime;
@ApiModelProperty(value = "是否删除") @ApiModelProperty(value = "是否删除")
private Boolean deleted; private Boolean deleted;
/**
* 核销人
*/
@ApiModelProperty(value = "核销人")
private String verifyUser;
/**
* 核销时间
*/
@ApiModelProperty(value = "核销时间")
private String verifyTime;
} }
...@@ -19,10 +19,10 @@ public class RewardRedeemUpdateVO { ...@@ -19,10 +19,10 @@ public class RewardRedeemUpdateVO {
private BigDecimal expenses; private BigDecimal expenses;
@ApiModelProperty(value = "币种") @ApiModelProperty(value = "币种")
private Integer currency; private Integer currency;
@NotNull(message = "recipientName is not null")
/** /**
* 收件人姓名 * 收件人姓名
*/ */
@NotNull(message = "recipientName is not null")
@ApiModelProperty(value = "收件人姓名") @ApiModelProperty(value = "收件人姓名")
private String recipientName; private String recipientName;
/** /**
...@@ -34,7 +34,6 @@ public class RewardRedeemUpdateVO { ...@@ -34,7 +34,6 @@ public class RewardRedeemUpdateVO {
/** /**
* 收件人地址 * 收件人地址
*/ */
@NotNull(message = "recipientAddress is not null")
@ApiModelProperty(value = "收件人地址") @ApiModelProperty(value = "收件人地址")
private String recipientAddress; private String recipientAddress;
/** /**
......
package cn.iocoder.yudao.module.reward.vo.reward;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.Date;
@Data
public class RewardRedeemVerifyVO {
@NotNull(message = "id is not null")
@ApiModelProperty(value = "id")
private Long id;
/**
* 收件人姓名
*/
@NotNull(message = "recipientName is not null")
@ApiModelProperty(value = "收件人姓名")
private String recipientName;
/**
* 收件人电话
*/
@NotNull(message = "recipientPhoneNum is not null")
@ApiModelProperty(value = "收件人电话")
private String recipientPhoneNum;
@ApiModelProperty(value = "快递公司")
private Integer courierCompany;
/**
* 收件人地址
*/
@ApiModelProperty(value = "收件人地址")
private String recipientAddress;
/**
* 快递单号
*/
@ApiModelProperty(value = "快递单号")
private String expressNo;
/**
* 快递日期
*/
@ApiModelProperty(value = "快递日期")
private Date expressDate;
/**
* 快递寄出人
*/
@ApiModelProperty(value = "快递寄出人")
private String expressSender;
/**
* 核销人
*/
@ApiModelProperty(value = "核销人")
@NotNull(message = "verifyUser is not null")
private String verifyUser;
/**
* 核销时间
*/
@NotNull(message = "verify time is not null")
@ApiModelProperty(value = "核销时间")
private Date verifyTime;
}
...@@ -74,6 +74,8 @@ ...@@ -74,6 +74,8 @@
err.creator as creator, err.creator as creator,
err.updater as updater, err.updater as updater,
err.deleted as deleted, err.deleted as deleted,
err.verify_user as verifyUser,
err.verify_time as verifyTime,
mu.nickname as memberName, mu.nickname as memberName,
er.code as rewardCode, er.code as rewardCode,
er.title_zh as rewardTitleZh, er.title_zh as rewardTitleZh,
......
...@@ -1010,4 +1010,7 @@ reward.status.change.error=The reward status change error ...@@ -1010,4 +1010,7 @@ reward.status.change.error=The reward status change error
reward.status.not.allow.delay=Only enable status can delay reward.status.not.allow.delay=Only enable status can delay
reward.status.not.allow.create=Only enabled or disabled reward status can be created reward.status.not.allow.create=Only enabled or disabled reward status can be created
reward.time.not.allow=The reward time is not allow reward.time.not.allow=The reward time is not allow
get.lock.failed = The service is busy, please try again later get.lock.failed = The service is busy, please try again later
\ No newline at end of file reward.redeem.not.exist = reward redeem record does not exist
reward.redeem.status.error = reward redeem record that is redeeming can edit or verify
reward.redeem.verify.no.param = In addition to collect at home, the delivery company/delivery number/delivery time/delivery sender/recipient address must be filled in
\ No newline at end of file
...@@ -1014,4 +1014,7 @@ reward.status.change.error=\u793C\u54C1\u72B6\u6001\u64CD\u4F5C\u4E0D\u7B26\u540 ...@@ -1014,4 +1014,7 @@ reward.status.change.error=\u793C\u54C1\u72B6\u6001\u64CD\u4F5C\u4E0D\u7B26\u540
reward.status.not.allow.delay=\u53EA\u5141\u8BB8\u5EF6\u671F\u542F\u7528\u72B6\u6001\u793C\u54C1 reward.status.not.allow.delay=\u53EA\u5141\u8BB8\u5EF6\u671F\u542F\u7528\u72B6\u6001\u793C\u54C1
reward.status.not.allow.create=\u521B\u5EFA\u7684\u793C\u54C1\u72B6\u6001\u53EA\u80FD\u662F\u542F\u7528\u6216\u672A\u542F\u7528 reward.status.not.allow.create=\u521B\u5EFA\u7684\u793C\u54C1\u72B6\u6001\u53EA\u80FD\u662F\u542F\u7528\u6216\u672A\u542F\u7528
reward.time.not.allow=\u6D3B\u52A8\u65F6\u95F4\u4E0D\u5408\u6CD5 reward.time.not.allow=\u6D3B\u52A8\u65F6\u95F4\u4E0D\u5408\u6CD5
get.lock.failed = \u670D\u52A1\u7E41\u5FD9\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5 get.lock.failed = \u670D\u52A1\u7E41\u5FD9\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5
\ No newline at end of file reward.redeem.not.exist = \u793C\u54C1\u5151\u6362\u8BB0\u5F55\u4E0D\u5B58\u5728
reward.redeem.status.error = \u53EA\u6709\u5151\u6362\u4E2D\u72B6\u6001\u7684\u8BB0\u5F55\u624D\u5141\u8BB8\u7F16\u8F91\u6216\u6838\u9500
reward.redeem.verify.no.param = \u9664\u4E0A\u95E8\u9886\u53D6\u5916\uFF0C\u5FEB\u9012\u516C\u53F8/\u5FEB\u9012\u5355\u53F7/\u5FEB\u9012\u65F6\u95F4/\u5FEB\u9012\u53D1\u9001\u4EBA/\u6536\u4EF6\u4EBA\u5730\u5740\uFF0C\u5FC5\u987B\u586B\u5199
\ No newline at end of file
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