退款功能增加
This commit is contained in:
@@ -25,6 +25,9 @@ import cn.pluss.platform.yt.YtLogistHandler;
|
|||||||
import cn.pluss.platform.yt.YtStatusEnum;
|
import cn.pluss.platform.yt.YtStatusEnum;
|
||||||
import cn.pluss.platform.yt.constant.YtConstant;
|
import cn.pluss.platform.yt.constant.YtConstant;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
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.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
@@ -35,6 +38,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -91,6 +95,18 @@ public class MercOrderDetailServiceImpl extends ServiceImpl<MercOrderDetailMappe
|
|||||||
@Resource
|
@Resource
|
||||||
private OpenAccountRecordService openAccountRecordService;
|
private OpenAccountRecordService openAccountRecordService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 阿里云key
|
||||||
|
*/
|
||||||
|
@Value("${aliyun.keyid}")
|
||||||
|
private String ACCESSKEYID;
|
||||||
|
/**
|
||||||
|
* 阿里云secret
|
||||||
|
*/
|
||||||
|
@Value("${aliyun.keysecret}")
|
||||||
|
private String ACCESSKEYSECRET;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receiving(Long id) {
|
public void receiving(Long id) {
|
||||||
MercOrderDetail detail = baseMapper.selectById(id);
|
MercOrderDetail detail = baseMapper.selectById(id);
|
||||||
@@ -101,6 +117,7 @@ public class MercOrderDetailServiceImpl extends ServiceImpl<MercOrderDetailMappe
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看物流信息
|
* 查看物流信息
|
||||||
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -123,6 +140,7 @@ public class MercOrderDetailServiceImpl extends ServiceImpl<MercOrderDetailMappe
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据订单号查询订单详情
|
* 根据订单号查询订单详情
|
||||||
|
*
|
||||||
* @param orderNo
|
* @param orderNo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -148,6 +166,7 @@ public class MercOrderDetailServiceImpl extends ServiceImpl<MercOrderDetailMappe
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备订单退款
|
* 设备订单退款
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -198,6 +217,7 @@ public class MercOrderDetailServiceImpl extends ServiceImpl<MercOrderDetailMappe
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置退款单号
|
* 设置退款单号
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -210,6 +230,7 @@ public class MercOrderDetailServiceImpl extends ServiceImpl<MercOrderDetailMappe
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 审核退款
|
* 审核退款
|
||||||
|
*
|
||||||
* @param orderDetail
|
* @param orderDetail
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -241,16 +262,20 @@ public class MercOrderDetailServiceImpl extends ServiceImpl<MercOrderDetailMappe
|
|||||||
order.convert(orderByNo, orderDetail.getRefundAmt(), SettleTypeEnum.D1.getValue(), detail.getRefundReason());
|
order.convert(orderByNo, orderDetail.getRefundAmt(), SettleTypeEnum.D1.getValue(), detail.getRefundReason());
|
||||||
switch (channel) {
|
switch (channel) {
|
||||||
case 1:
|
case 1:
|
||||||
|
MerchantChannelStatus channelInfo = merchantChannelStatusMapper.getByMerchantCode(orderByNo.getMerchantCode(), 1);
|
||||||
|
MsgException.checkNull(channelInfo, "收款商户通道信息异常!");
|
||||||
|
result = ysPayOldService.refundPay(order, channelInfo.getMerchantId());
|
||||||
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
MsgException.throwException("当前订单所属通道不支持退款");
|
MsgException.throwException("当前订单所属通道不支持退款");
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
//银盛退款
|
/* //银盛退款
|
||||||
MerchantChannelStatus channelInfo = merchantChannelStatusMapper.getByMerchantCode(orderByNo.getMerchantCode(), 4);
|
MerchantChannelStatus channelInfo = merchantChannelStatusMapper.getByMerchantCode(orderByNo.getMerchantCode(), 4);
|
||||||
MsgException.checkNull(channelInfo, "收款商户通道信息异常!");
|
MsgException.checkNull(channelInfo, "收款商户通道信息异常!");
|
||||||
result = ysPayOldService.refundPay(order, channelInfo.getMerchantId());
|
result = ysPayOldService.refundPay(order, channelInfo.getMerchantId());
|
||||||
break;
|
break;*/
|
||||||
case 5:
|
case 5:
|
||||||
//原生通道退款 TODO 不支持微信支付 因为微信支付走对公账户 所以这里加一个验证
|
//原生通道退款 TODO 不支持微信支付 因为微信支付走对公账户 所以这里加一个验证
|
||||||
MsgException.check(!Constant.PAY_TYPE_ALIPAY.equals(orderByNo.getPayType()), "当前订单支付方式不支持退款!");
|
MsgException.check(!Constant.PAY_TYPE_ALIPAY.equals(orderByNo.getPayType()), "当前订单支付方式不支持退款!");
|
||||||
@@ -283,20 +308,56 @@ public class MercOrderDetailServiceImpl extends ServiceImpl<MercOrderDetailMappe
|
|||||||
@Override
|
@Override
|
||||||
public Result<Object> getVerifyCode(PhoneValidateCode phoneValidateCode) {
|
public Result<Object> getVerifyCode(PhoneValidateCode phoneValidateCode) {
|
||||||
MsgException.checkBlank(phoneValidateCode.getPhone(), "获取失败,手机号为空");
|
MsgException.checkBlank(phoneValidateCode.getPhone(), "获取失败,手机号为空");
|
||||||
String checkCode = StringUtil.random(4);
|
String checkCode = StringUtil.random(6);
|
||||||
phoneValidateCode.setCode(checkCode);
|
phoneValidateCode.setCode(checkCode);
|
||||||
JSONObject result = validateCodeUtil.requestManageValidateCode(phoneValidateCode.getPhone(),checkCode);
|
//JSONObject result = validateCodeUtil.requestManageValidateCode(phoneValidateCode.getPhone(), checkCode);
|
||||||
if(result.getIntValue("code") != ResultCode.SUCCESS.code()){
|
/*if (result.getIntValue("code") != ResultCode.SUCCESS.code()) {
|
||||||
return ResultGenerator.genFailResult(result.getString("msg"));
|
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.setSendDt(DateUtils.currentDate());
|
||||||
phoneValidateCode.setStatus("1");
|
phoneValidateCode.setStatus("1");
|
||||||
phoneValidateCodeService.savePhoneValidateCode(phoneValidateCode);
|
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
|
* @param ids
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -338,6 +399,7 @@ public class MercOrderDetailServiceImpl extends ServiceImpl<MercOrderDetailMappe
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询
|
* 分页查询
|
||||||
|
*
|
||||||
* @param page
|
* @param page
|
||||||
* @param condition
|
* @param condition
|
||||||
* @return
|
* @return
|
||||||
@@ -364,6 +426,7 @@ public class MercOrderDetailServiceImpl extends ServiceImpl<MercOrderDetailMappe
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 填写快递单号
|
* 填写快递单号
|
||||||
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @param expressNo
|
* @param expressNo
|
||||||
* @return
|
* @return
|
||||||
@@ -394,6 +457,7 @@ public class MercOrderDetailServiceImpl extends ServiceImpl<MercOrderDetailMappe
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据订单号和code查询订单信息
|
* 根据订单号和code查询订单信息
|
||||||
|
*
|
||||||
* @param orderNo
|
* @param orderNo
|
||||||
* @param code
|
* @param code
|
||||||
* @return
|
* @return
|
||||||
|
|||||||
Reference in New Issue
Block a user