退款功能增加
This commit is contained in:
parent
4fd5d1dbaa
commit
c095746fba
|
|
@ -25,6 +25,9 @@ import cn.pluss.platform.yt.YtLogistHandler;
|
|||
import cn.pluss.platform.yt.YtStatusEnum;
|
||||
import cn.pluss.platform.yt.constant.YtConstant;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aliyun.dysmsapi20170525.Client;
|
||||
import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
|
||||
import com.aliyun.teaopenapi.models.Config;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
|
|
@ -35,6 +38,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import lombok.Setter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
|
@ -91,30 +95,43 @@ public class MercOrderDetailServiceImpl extends ServiceImpl<MercOrderDetailMappe
|
|||
@Resource
|
||||
private OpenAccountRecordService openAccountRecordService;
|
||||
|
||||
|
||||
/**
|
||||
* 阿里云key
|
||||
*/
|
||||
@Value("${aliyun.keyid}")
|
||||
private String ACCESSKEYID;
|
||||
/**
|
||||
* 阿里云secret
|
||||
*/
|
||||
@Value("${aliyun.keysecret}")
|
||||
private String ACCESSKEYSECRET;
|
||||
|
||||
@Override
|
||||
public void receiving(Long id) {
|
||||
MercOrderDetail detail = baseMapper.selectById(id);
|
||||
MsgException.checkNull(detail,"订单数据异常");
|
||||
MsgException.checkNull(detail, "订单数据异常");
|
||||
detail.setStatus(DeviceOrderStatus.COMPLETED.getStatus());
|
||||
baseMapper.updateById(detail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看物流信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public MercOrderExpressVO getOrderExpressInfo(Long id) {
|
||||
MercOrderDetail detail = baseMapper.selectById(id);
|
||||
MsgException.checkNull(detail,"订单详情数据异常");
|
||||
MsgException.checkNull(detail, "订单详情数据异常");
|
||||
MercOrderExpressVO vo = moeMapper.getByExpressNo(detail.getExpressNo());
|
||||
|
||||
if(vo != null){
|
||||
if (vo != null) {
|
||||
vo.setServiceTelephone(YtConstant.YT_CUSTOMER_TELEPHONE);
|
||||
List<MercOrderExpressDetail> list = moedMapper.getByExpressNo(detail.getExpressNo());
|
||||
vo.setExpressDetailList(list);
|
||||
if(!list.isEmpty()){
|
||||
if (!list.isEmpty()) {
|
||||
vo.setLogisticProvider(list.get(0).getLogisticProvider());
|
||||
}
|
||||
}
|
||||
|
|
@ -123,23 +140,24 @@ public class MercOrderDetailServiceImpl extends ServiceImpl<MercOrderDetailMappe
|
|||
|
||||
/**
|
||||
* 根据订单号查询订单详情
|
||||
*
|
||||
* @param orderNo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<MercOrderDetail> getDetailByOrderNo(String orderNo,String status) {
|
||||
public List<MercOrderDetail> getDetailByOrderNo(String orderNo, String status) {
|
||||
QueryWrapper<MercOrderDetail> queryWrapper = new QueryWrapper<MercOrderDetail>()
|
||||
.eq("orderNo",orderNo).orderByDesc("id");
|
||||
if(StringUtil.isNotEmpty(status) && !"-1".equals(status)){
|
||||
switch (status){
|
||||
.eq("orderNo", orderNo).orderByDesc("id");
|
||||
if (StringUtil.isNotEmpty(status) && !"-1".equals(status)) {
|
||||
switch (status) {
|
||||
case "1":
|
||||
queryWrapper.eq("status",DeviceOrderStatus.COMPLETED.getStatus());
|
||||
queryWrapper.eq("status", DeviceOrderStatus.COMPLETED.getStatus());
|
||||
break;
|
||||
case "2":
|
||||
queryWrapper.eq("status",DeviceOrderStatus.RECEIV_ING.getStatus());
|
||||
queryWrapper.eq("status", DeviceOrderStatus.RECEIV_ING.getStatus());
|
||||
break;
|
||||
case "3":
|
||||
queryWrapper.in("status",DeviceOrderStatus.REFUND_ING.getStatus(),DeviceOrderStatus.REFUND_SUCC.getStatus(),DeviceOrderStatus.REFUND_FAIL.getStatus());
|
||||
queryWrapper.in("status", DeviceOrderStatus.REFUND_ING.getStatus(), DeviceOrderStatus.REFUND_SUCC.getStatus(), DeviceOrderStatus.REFUND_FAIL.getStatus());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -148,40 +166,41 @@ public class MercOrderDetailServiceImpl extends ServiceImpl<MercOrderDetailMappe
|
|||
|
||||
/**
|
||||
* 设备订单退款
|
||||
*
|
||||
* @param dto
|
||||
*/
|
||||
@Override
|
||||
public void refund(MercOrderDetailDTO dto) {
|
||||
MsgException.checkNull(dto.getId(),"退款详情订单ID为空");
|
||||
MsgException.checkNull(dto.getRefundAmt(),"退款金额不能为空");
|
||||
MsgException.checkBlank(dto.getRefundReason(),"退款原因不能为空");
|
||||
if(dto.getPicList() == null || dto.getPicList().size() == 0){
|
||||
MsgException.checkNull(dto.getId(), "退款详情订单ID为空");
|
||||
MsgException.checkNull(dto.getRefundAmt(), "退款金额不能为空");
|
||||
MsgException.checkBlank(dto.getRefundReason(), "退款原因不能为空");
|
||||
if (dto.getPicList() == null || dto.getPicList().size() == 0) {
|
||||
MsgException.throwException("请先上传图片");
|
||||
}
|
||||
MercOrderDetail detail = baseMapper.selectById(dto.getId());
|
||||
MsgException.checkNull(detail,"订单数据异常");
|
||||
MsgException.checkNull(detail, "订单数据异常");
|
||||
//暂无物流信息 可以直接退款
|
||||
BigDecimal totalAmt = detail.getPrice().multiply(BigDecimal.valueOf(detail.getNum()));
|
||||
if(StringUtil.isEmpty(detail.getExpressNo())){
|
||||
if (StringUtil.isEmpty(detail.getExpressNo())) {
|
||||
totalAmt = totalAmt.add(detail.getPostage());
|
||||
}else{
|
||||
} else {
|
||||
MercOrderExpressVO express = moeMapper.getByExpressNo(detail.getExpressNo());
|
||||
if(express == null){
|
||||
if (express == null) {
|
||||
totalAmt = totalAmt.add(detail.getPostage());
|
||||
}else{
|
||||
if(YtStatusEnum.ACCEPT.getValue().equals(express.getStatus()) || YtStatusEnum.WAIT.getValue().equals(express.getStatus())){
|
||||
} else {
|
||||
if (YtStatusEnum.ACCEPT.getValue().equals(express.getStatus()) || YtStatusEnum.WAIT.getValue().equals(express.getStatus())) {
|
||||
totalAmt = totalAmt.add(detail.getPostage());
|
||||
}
|
||||
}
|
||||
}
|
||||
MsgException.check(dto.getRefundAmt().compareTo(totalAmt) > 0,"退款金额超出商品金额");
|
||||
if(DeviceOrderStatus.SUCC_PAY.getStatus().equals(detail.getStatus())
|
||||
MsgException.check(dto.getRefundAmt().compareTo(totalAmt) > 0, "退款金额超出商品金额");
|
||||
if (DeviceOrderStatus.SUCC_PAY.getStatus().equals(detail.getStatus())
|
||||
|| DeviceOrderStatus.RECEIV_ING.getStatus().equals(detail.getStatus())
|
||||
|| DeviceOrderStatus.REFUND_FAIL.getStatus().equals(detail.getStatus())
|
||||
|| DeviceOrderStatus.COMPLETED.getStatus().equals(detail.getStatus())){
|
||||
|| DeviceOrderStatus.COMPLETED.getStatus().equals(detail.getStatus())) {
|
||||
List<MercDeviceRefundImage> list = new ArrayList<>(16);
|
||||
for (String picUrl:dto.getPicList()) {
|
||||
MercDeviceRefundImage image = new MercDeviceRefundImage(detail,picUrl);
|
||||
for (String picUrl : dto.getPicList()) {
|
||||
MercDeviceRefundImage image = new MercDeviceRefundImage(detail, picUrl);
|
||||
list.add(image);
|
||||
}
|
||||
mdriService.saveBatch(list);
|
||||
|
|
@ -198,72 +217,78 @@ public class MercOrderDetailServiceImpl extends ServiceImpl<MercOrderDetailMappe
|
|||
|
||||
/**
|
||||
* 设置退款单号
|
||||
*
|
||||
* @param dto
|
||||
*/
|
||||
@Override
|
||||
public void setRefundExpressNo(MercOrderDetailDTO dto) {
|
||||
MsgException.checkNull(dto.getId(),"退款详情订单ID为空");
|
||||
MsgException.checkBlank(dto.getRefundExpressNo(),"退款物流单号不能为空");
|
||||
MsgException.checkNull(dto.getId(), "退款详情订单ID为空");
|
||||
MsgException.checkBlank(dto.getRefundExpressNo(), "退款物流单号不能为空");
|
||||
dto.setStatus(MercOrderDetail.STATUS_REFUND_AGREE);
|
||||
baseMapper.updateById(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核退款
|
||||
*
|
||||
* @param orderDetail
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result<Object> auditRefund(MercOrderDetail orderDetail) {
|
||||
MsgException.checkNull(orderDetail.getId(),"退款详情订单ID为空");
|
||||
MsgException.checkBlank(orderDetail.getStatus(),"状态不能为空");
|
||||
MsgException.checkNull(orderDetail.getRefundAmt(),"退款金额不能为空");
|
||||
if(MercOrderDetail.STATUS_REFUND_FAIL.equals(orderDetail.getStatus())){
|
||||
MsgException.checkBlank(orderDetail.getRejectRemark(),"退款驳回,驳回原因不能为空!");
|
||||
MsgException.checkNull(orderDetail.getId(), "退款详情订单ID为空");
|
||||
MsgException.checkBlank(orderDetail.getStatus(), "状态不能为空");
|
||||
MsgException.checkNull(orderDetail.getRefundAmt(), "退款金额不能为空");
|
||||
if (MercOrderDetail.STATUS_REFUND_FAIL.equals(orderDetail.getStatus())) {
|
||||
MsgException.checkBlank(orderDetail.getRejectRemark(), "退款驳回,驳回原因不能为空!");
|
||||
}
|
||||
MercOrderDetail detail = baseMapper.selectById(orderDetail.getId());
|
||||
MsgException.checkNull(detail,"退款详情ID有误!");
|
||||
MsgException.checkNull(detail, "退款详情ID有误!");
|
||||
// MsgException.check(!MercOrderDetail.STATUS_REFUND_AGREE.equals(detail.getStatus()),"只能处理退货退款中的订单!");
|
||||
BigDecimal useRefundAmt = baseMapper.getUseRefundAmtByOrderNo(detail.getOrderNo());
|
||||
BigDecimal totalOrderAmt = detail.getPrice().multiply(BigDecimal.valueOf(detail.getNum())).add(detail.getPostage());
|
||||
if(orderDetail.getRefundAmt().add(useRefundAmt).compareTo(totalOrderAmt) > 0){
|
||||
if (orderDetail.getRefundAmt().add(useRefundAmt).compareTo(totalOrderAmt) > 0) {
|
||||
MsgException.throwException("退款金额超出当前订单可退款总额");
|
||||
}
|
||||
if(MercOrderDetail.STATUS_REFUND_SUCCESS.equals(orderDetail.getStatus())){
|
||||
phoneValidateCodeService.checkSmsVerifyCode(orderDetail.getPhone(),orderDetail.getVerifyCode());
|
||||
if (MercOrderDetail.STATUS_REFUND_SUCCESS.equals(orderDetail.getStatus())) {
|
||||
phoneValidateCodeService.checkSmsVerifyCode(orderDetail.getPhone(), orderDetail.getVerifyCode());
|
||||
MercOrderNew orderByNo = mercOrderNewMapper.getOrderByNo(detail.getOrderNo());
|
||||
MsgException.checkNull(orderByNo,"订单有误!");
|
||||
MsgException.checkNull(orderByNo, "订单有误!");
|
||||
Integer channel = orderByNo.getChannel();
|
||||
MsgException.checkNull(channel,"通道未知,退款失败");
|
||||
MsgException.checkNull(channel, "通道未知,退款失败");
|
||||
Map<String, Object> result = null;
|
||||
MerchantOrder order = new MerchantOrder();
|
||||
order.convert(orderByNo,orderDetail.getRefundAmt(), SettleTypeEnum.D1.getValue(), detail.getRefundReason());
|
||||
switch (channel){
|
||||
order.convert(orderByNo, orderDetail.getRefundAmt(), SettleTypeEnum.D1.getValue(), detail.getRefundReason());
|
||||
switch (channel) {
|
||||
case 1:
|
||||
MerchantChannelStatus channelInfo = merchantChannelStatusMapper.getByMerchantCode(orderByNo.getMerchantCode(), 1);
|
||||
MsgException.checkNull(channelInfo, "收款商户通道信息异常!");
|
||||
result = ysPayOldService.refundPay(order, channelInfo.getMerchantId());
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
MsgException.throwException("当前订单所属通道不支持退款");
|
||||
break;
|
||||
case 4:
|
||||
//银盛退款
|
||||
/* //银盛退款
|
||||
MerchantChannelStatus channelInfo = merchantChannelStatusMapper.getByMerchantCode(orderByNo.getMerchantCode(), 4);
|
||||
MsgException.checkNull(channelInfo,"收款商户通道信息异常!");
|
||||
MsgException.checkNull(channelInfo, "收款商户通道信息异常!");
|
||||
result = ysPayOldService.refundPay(order, channelInfo.getMerchantId());
|
||||
break;
|
||||
break;*/
|
||||
case 5:
|
||||
//原生通道退款 TODO 不支持微信支付 因为微信支付走对公账户 所以这里加一个验证
|
||||
MsgException.check(!Constant.PAY_TYPE_ALIPAY.equals(orderByNo.getPayType()),"当前订单支付方式不支持退款!");
|
||||
MsgException.check(!Constant.PAY_TYPE_ALIPAY.equals(orderByNo.getPayType()), "当前订单支付方式不支持退款!");
|
||||
result = aliService.refundV2(detail);
|
||||
break;
|
||||
default:
|
||||
MsgException.throwException("未知通道");
|
||||
break;
|
||||
}
|
||||
int code = (int)result.get("code");
|
||||
int code = (int) result.get("code");
|
||||
String msg = (String) result.get("msg");
|
||||
String refundNo = (String) result.get("refundNo");
|
||||
if(code != ResultCode.SUCCESS.code()){
|
||||
if (code != ResultCode.SUCCESS.code()) {
|
||||
return ResultGenerator.genFailResult(msg);
|
||||
}
|
||||
detail.setRefundTime(DateUtils.currentDate());
|
||||
|
|
@ -277,74 +302,111 @@ public class MercOrderDetailServiceImpl extends ServiceImpl<MercOrderDetailMappe
|
|||
detail.setStatus(orderDetail.getStatus());
|
||||
detail.setRejectRemark(orderDetail.getRejectRemark());
|
||||
baseMapper.updateById(detail);
|
||||
return ResultGenerator.genSuccessResult("处理成功",null);
|
||||
return ResultGenerator.genSuccessResult("处理成功", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Object> getVerifyCode(PhoneValidateCode phoneValidateCode) {
|
||||
MsgException.checkBlank(phoneValidateCode.getPhone(),"获取失败,手机号为空");
|
||||
String checkCode = StringUtil.random(4);
|
||||
MsgException.checkBlank(phoneValidateCode.getPhone(), "获取失败,手机号为空");
|
||||
String checkCode = StringUtil.random(6);
|
||||
phoneValidateCode.setCode(checkCode);
|
||||
JSONObject result = validateCodeUtil.requestManageValidateCode(phoneValidateCode.getPhone(),checkCode);
|
||||
if(result.getIntValue("code") != ResultCode.SUCCESS.code()){
|
||||
//JSONObject result = validateCodeUtil.requestManageValidateCode(phoneValidateCode.getPhone(), checkCode);
|
||||
/*if (result.getIntValue("code") != ResultCode.SUCCESS.code()) {
|
||||
return ResultGenerator.genFailResult(result.getString("msg"));
|
||||
}*/
|
||||
|
||||
Client client = null;
|
||||
try {
|
||||
|
||||
client = createClient();
|
||||
// 1.发送短信
|
||||
com.aliyun.dysmsapi20170525.models.SendSmsRequest sendSmsRequest = new com.aliyun.dysmsapi20170525.models.SendSmsRequest()
|
||||
.setSignName("超掌柜")
|
||||
.setTemplateCode("SMS_244665149")
|
||||
.setTemplateParam("{\"code\":" + "'" + checkCode + "'" + "}")
|
||||
.setPhoneNumbers(phoneValidateCode.getPhone());
|
||||
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
|
||||
SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime);
|
||||
|
||||
if (sendSmsResponse.getStatusCode() != 200) {
|
||||
return ResultGenerator.genFailResult(sendSmsResponse.getBody().getMessage());
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
phoneValidateCode.setSendDt(DateUtils.currentDate());
|
||||
phoneValidateCode.setStatus("1");
|
||||
phoneValidateCodeService.savePhoneValidateCode(phoneValidateCode);
|
||||
return ResultGenerator.genSuccessResult("获取成功",null);
|
||||
return ResultGenerator.genSuccessResult("获取成功", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送短信(阿里云)
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Client createClient() throws Exception {
|
||||
Config config = new Config();
|
||||
config.accessKeyId = ACCESSKEYID;
|
||||
config.accessKeySecret = ACCESSKEYSECRET;
|
||||
return new com.aliyun.dysmsapi20170525.Client(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送物流信息
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public Result<Object> printLogistInfo(List<Long> ids) {
|
||||
MsgException.check(ids.isEmpty(),"未选中订单数据!");
|
||||
MsgException.check(ids.isEmpty(), "未选中订单数据!");
|
||||
List<MercOrderDetail> list = baseMapper.selectBatchIds(ids);
|
||||
MsgException.check(list.isEmpty(),"订单数据异常!");
|
||||
MsgException.check(list.isEmpty(), "订单数据异常!");
|
||||
boolean flag = false;
|
||||
for (MercOrderDetail detail:list) {
|
||||
if(!MercOrderDetail.STATUS_PAYED.equals(detail.getStatus())){
|
||||
for (MercOrderDetail detail : list) {
|
||||
if (!MercOrderDetail.STATUS_PAYED.equals(detail.getStatus())) {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
MsgException.check(flag,"只能处理已支付的订单!");
|
||||
MsgException.check(flag, "只能处理已支付的订单!");
|
||||
MercOrderDetail detail = list.get(0);
|
||||
MercOrderNew order = mercOrderNewMapper.getOrderByNo(detail.getOrderNo());
|
||||
MsgException.checkNull(order,"订单数据异常!");
|
||||
JSONObject result = ytLogistHandler.createYtOrderV2(list,order);
|
||||
if(result.getIntValue("code") != ResultCode.SUCCESS.code()){
|
||||
MsgException.checkNull(order, "订单数据异常!");
|
||||
JSONObject result = ytLogistHandler.createYtOrderV2(list, order);
|
||||
if (result.getIntValue("code") != ResultCode.SUCCESS.code()) {
|
||||
MsgException.throwException(result.getString("message"));
|
||||
}
|
||||
JSONObject data = result.getJSONObject("data");
|
||||
UpdateWrapper<MercOrderDetail> updateWrapper = new UpdateWrapper<MercOrderDetail>().in("id",ids)
|
||||
.set("logistNo",data.getString("logistNo")).set("expressNo",data.getString("expressNo"))
|
||||
.set("status",MercOrderDetail.STATUS_UN_RECEIVED);
|
||||
UpdateWrapper<MercOrderDetail> updateWrapper = new UpdateWrapper<MercOrderDetail>().in("id", ids)
|
||||
.set("logistNo", data.getString("logistNo")).set("expressNo", data.getString("expressNo"))
|
||||
.set("status", MercOrderDetail.STATUS_UN_RECEIVED);
|
||||
update(updateWrapper);
|
||||
MercOrderExpress orderExpress = new MercOrderExpress();
|
||||
MercOrderExpress orderExpress = new MercOrderExpress();
|
||||
orderExpress.setOrderNo(order.getOrderNo());
|
||||
orderExpress.setLogistNo(data.getString("logistNo"));
|
||||
orderExpress.setExpressNo(data.getString("expressNo"));
|
||||
orderExpress.setType(MercOrderExpress.EXPRESS_TYPE_HAIR);
|
||||
orderExpress.setStatus(YtStatusEnum.ACCEPT.getValue());
|
||||
mercOrderExpressService.save(orderExpress);
|
||||
return ResultGenerator.genSuccessResult("处理成功",null);
|
||||
return ResultGenerator.genSuccessResult("处理成功", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page
|
||||
* @param condition
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<MercOrderDetail> pageInfo(Page<MercOrderDetail> page, MercOrderDetail condition) {
|
||||
return baseMapper.pageInfo(page,condition);
|
||||
return baseMapper.pageInfo(page, condition);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -364,22 +426,23 @@ public class MercOrderDetailServiceImpl extends ServiceImpl<MercOrderDetailMappe
|
|||
|
||||
/**
|
||||
* 填写快递单号
|
||||
*
|
||||
* @param id
|
||||
* @param expressNo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Result<Object> inputExpressNo(Long id, String expressNo) {
|
||||
MsgException.checkNull(id,"订单ID不能为空!");
|
||||
MsgException.checkBlank(expressNo,"快递单号不能为空!");
|
||||
MsgException.checkNull(id, "订单ID不能为空!");
|
||||
MsgException.checkBlank(expressNo, "快递单号不能为空!");
|
||||
MercOrderDetail detail = baseMapper.selectById(id);
|
||||
MsgException.checkNull(detail,"订单数据异常!");
|
||||
MsgException.check(!MercOrderDetail.STATUS_PAYED.equals(detail.getStatus()),"只能处理已支付的订单数据");
|
||||
MsgException.check(StringUtil.isNotEmpty(detail.getExpressNo()),"当前订单已存在物流单号,请勿重复填写");
|
||||
MsgException.checkNull(detail, "订单数据异常!");
|
||||
MsgException.check(!MercOrderDetail.STATUS_PAYED.equals(detail.getStatus()), "只能处理已支付的订单数据");
|
||||
MsgException.check(StringUtil.isNotEmpty(detail.getExpressNo()), "当前订单已存在物流单号,请勿重复填写");
|
||||
detail.setStatus(MercOrderDetail.STATUS_UN_RECEIVED);
|
||||
detail.setExpressNo(expressNo);
|
||||
MercOrderExpress express = mercOrderExpressService.getByExpressNo(expressNo);
|
||||
if(express == null){
|
||||
if (express == null) {
|
||||
express = new MercOrderExpress();
|
||||
express.setLogistNo(detail.getLogistNo());
|
||||
express.setOrderNo(detail.getOrderNo());
|
||||
|
|
@ -389,17 +452,18 @@ public class MercOrderDetailServiceImpl extends ServiceImpl<MercOrderDetailMappe
|
|||
mercOrderExpressService.save(express);
|
||||
}
|
||||
baseMapper.updateById(detail);
|
||||
return ResultGenerator.genSuccessResult("操作成功",null);
|
||||
return ResultGenerator.genSuccessResult("操作成功", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单号和code查询订单信息
|
||||
*
|
||||
* @param orderNo
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<MercOrderDetail> listByOrderNoAndCode(String orderNo, String code) {
|
||||
return baseMapper.listByOrderNoAndCode(orderNo,code);
|
||||
return baseMapper.listByOrderNoAndCode(orderNo, code);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue