记得上下班打卡 | git大法好,push需谨慎

Commit 3faf53ec authored by jiangxiulong's avatar jiangxiulong

前端提交退款接口新增纸质票号字段、增加票全退完退快递费的逻辑

parent ebca4978
...@@ -64,6 +64,9 @@ public class KylinOrderRefundsVo implements Serializable,Cloneable { ...@@ -64,6 +64,9 @@ public class KylinOrderRefundsVo implements Serializable,Cloneable {
@ApiModelProperty(value = "退款扣除的手续费金额") @ApiModelProperty(value = "退款扣除的手续费金额")
private BigDecimal priceCharges; private BigDecimal priceCharges;
@ApiModelProperty(value = "纸质票号")
private String ticketNum;
@ApiModelProperty(value = "退款状态: 0请求退款 2取消退款 1审核通过 5驳回退款 7等待退款 3正在退款 4完成退款 6退款失败") @ApiModelProperty(value = "退款状态: 0请求退款 2取消退款 1审核通过 5驳回退款 7等待退款 3正在退款 4完成退款 6退款失败")
private Integer status; private Integer status;
......
...@@ -72,6 +72,11 @@ public class KylinOrderRefunds implements Serializable, Cloneable{ ...@@ -72,6 +72,11 @@ public class KylinOrderRefunds implements Serializable, Cloneable{
private BigDecimal priceExpress; private BigDecimal priceExpress;
private BigDecimal priceCharges; private BigDecimal priceCharges;
/**
* 纸质票号
*/
private String ticketNum;
/** /**
* 退款状态: 0请求退款 2取消退款 1审核通过 5驳回退款 7等待退款 3正在退款 4完成退款 6退款失败 * 退款状态: 0请求退款 2取消退款 1审核通过 5驳回退款 7等待退款 3正在退款 4完成退款 6退款失败
*/ */
......
...@@ -46,6 +46,7 @@ public class KylinOrderTicketsRefundController { ...@@ -46,6 +46,7 @@ public class KylinOrderTicketsRefundController {
@ApiImplicitParam(type = "form", dataType = "String", name = "orderTicketEntitiesId", value = "订单入场人ID", required = true), @ApiImplicitParam(type = "form", dataType = "String", name = "orderTicketEntitiesId", value = "订单入场人ID", required = true),
@ApiImplicitParam(type = "form", dataType = "String", name = "reason", value = "退款申请备注", required = true), @ApiImplicitParam(type = "form", dataType = "String", name = "reason", value = "退款申请备注", required = true),
@ApiImplicitParam(type = "form", dataType = "String", name = "picList", value = "图片"), @ApiImplicitParam(type = "form", dataType = "String", name = "picList", value = "图片"),
@ApiImplicitParam(type = "form", dataType = "String", name = "ticketNum", value = "纸质票号"),
@ApiImplicitParam(type = "form", dataType = "Integer", name = "sendExpressType", value = "快递方式 1上门取件 2自主发货"), @ApiImplicitParam(type = "form", dataType = "Integer", name = "sendExpressType", value = "快递方式 1上门取件 2自主发货"),
@ApiImplicitParam(type = "form", dataType = "String", name = "expressNumber", value = "自主发货的顺丰订单号"), @ApiImplicitParam(type = "form", dataType = "String", name = "expressNumber", value = "自主发货的顺丰订单号"),
@ApiImplicitParam(type = "form", dataType = "String", name = "expressContacts", value = "发货人姓名"), @ApiImplicitParam(type = "form", dataType = "String", name = "expressContacts", value = "发货人姓名"),
...@@ -58,6 +59,7 @@ public class KylinOrderTicketsRefundController { ...@@ -58,6 +59,7 @@ public class KylinOrderTicketsRefundController {
@RequestParam(value = "orderTicketEntitiesId", required = true) @NotNull(message = "票单ID不能为空") String orderTicketEntitiesId, @RequestParam(value = "orderTicketEntitiesId", required = true) @NotNull(message = "票单ID不能为空") String orderTicketEntitiesId,
@RequestParam(value = "reason", required = true) @NotNull(message = "退款原因不能为空") String reason, @RequestParam(value = "reason", required = true) @NotNull(message = "退款原因不能为空") String reason,
@RequestParam(value = "picList", required = false) String picList, @RequestParam(value = "picList", required = false) String picList,
@RequestParam(value = "ticketNum", required = false) String ticketNum,
@RequestParam(value = "sendExpressType", required = false) Integer sendExpressType, @RequestParam(value = "sendExpressType", required = false) Integer sendExpressType,
@RequestParam(value = "expressNumber", required = false) String expressNumber, @RequestParam(value = "expressNumber", required = false) String expressNumber,
...@@ -69,7 +71,7 @@ public class KylinOrderTicketsRefundController { ...@@ -69,7 +71,7 @@ public class KylinOrderTicketsRefundController {
) { ) {
// 退款 // 退款
return kylinOrderTicketsRefundService.sendOrderRefund( return kylinOrderTicketsRefundService.sendOrderRefund(
orderId, orderTicketEntitiesId, reason, picList, orderId, orderTicketEntitiesId, reason, picList, ticketNum,
sendExpressType, expressNumber, expressContacts, expressPhone, sendExpressAddress, appointmentTime sendExpressType, expressNumber, expressContacts, expressPhone, sendExpressAddress, appointmentTime
); );
} }
......
...@@ -143,38 +143,7 @@ public class KylinOrderTicketsRefundServiceImpl { ...@@ -143,38 +143,7 @@ public class KylinOrderTicketsRefundServiceImpl {
} }
} }
public ResponseDto<OrderRefundVo> orderRefundDetails(String orderId, String orderRefundId) { public ResponseDto sendOrderRefund(String orderId, String orderTicketEntitiesId, String reason, String picList, String ticketNum, Integer sendExpressType, String expressNumber, String expressContacts, String expressPhone, String sendExpressAddress, String appointmentTime) {
try {
OrderRefundVo vo = OrderRefundVo.getNew();
String uid = CurrentUtil.getCurrentUid();
KylinOrderTicketVo orderTicketVo = dataUtils.getOrderTicketVo(orderId);
KylinPerformanceVo performanceVo = dataUtils.getPerformanceVo(orderTicketVo.getPerformanceId());
if (uid.equals("809406") || uid.equals("773650")) {
} else {
if (!orderTicketVo.getUserId().equals(uid)) {
return ResponseDto.failure(ErrorMapping.get("20003"));
}
}
orderTicketVo.setFieldName(performanceVo.getFieldName());
if (orderTicketVo.getOrderCode().length() > 20) {
orderTicketVo.setOrderCode(orderTicketVo.getOrderCode().substring(orderTicketVo.getOrderCode().length() - 10));
}
KylinOrderRefundsVo kylinOrderRefundsVoBase = dataUtils.getOrderRefundVo(orderRefundId);
if (kylinOrderRefundsVoBase.getOrderRefundCode().length() > 20) {
kylinOrderRefundsVoBase.setOrderRefundCode(kylinOrderRefundsVoBase.getOrderRefundCode().substring(kylinOrderRefundsVoBase.getOrderRefundCode().length() - 10));
}
vo.setKylinOrderRefundsVoBaseList(kylinOrderRefundsVoBase);
vo.setOrderTicketVo(orderTicketVo);
vo.setKylinOrderExpressVo(dataUtils.getOrderRefundExpressInfo(orderId));
return ResponseDto.success(vo);
} catch (Exception e) {
e.printStackTrace();
return ResponseDto.failure(ErrorMapping.get("20030"));
}
}
public ResponseDto sendOrderRefund(String orderId, String orderTicketEntitiesId, String reason, String picList, Integer sendExpressType, String expressNumber, String expressContacts, String expressPhone, String sendExpressAddress, String appointmentTime) {
KylinOrderTicketEntitiesVo orderTicketEntitiesVo = null; KylinOrderTicketEntitiesVo orderTicketEntitiesVo = null;
try { try {
String uid = CurrentUtil.getCurrentUid(); String uid = CurrentUtil.getCurrentUid();
...@@ -241,13 +210,15 @@ public class KylinOrderTicketsRefundServiceImpl { ...@@ -241,13 +210,15 @@ public class KylinOrderTicketsRefundServiceImpl {
return ResponseDto.failure("申请金额不得小于0哦~"); return ResponseDto.failure("申请金额不得小于0哦~");
} }
// 快递费 现在只有到付 不作处理 // 快递费 判断是否是最后一张入场人票 减去已经退的快递费
// 如果后期有这种情况 需要判断是否是最后一张入场人票 然后减去已经退的快递费 计算进来即可
BigDecimal priceExpress = BigDecimal.valueOf(0); BigDecimal priceExpress = BigDecimal.valueOf(0);
if (orderTicketVo.getRefundNumber() + 1 == orderTicketVo.getNumber()) {
priceExpress = orderTicketVo.getPriceExpress().subtract(dataUtils.getCanRefundPriceExpress(kylinOrderRefundsVoBaseList));
}
Map token = CurrentUtil.getTokenClaims(); Map token = CurrentUtil.getTokenClaims();
String username = StringUtils.defaultString(((String) token.get("nickname")), ""); String username = StringUtils.defaultString(((String) token.get("nickname")), "");
String orderRefundId = refundsStatusService.userOrderTicketRefunding(orderTicketVo, refundSinglePrice, priceExpress, priceCharges, orderTicketEntitiesId, reason, picList, uid, username, kylinOrderRefundsVoBaseList.size(), sendExpressType); String orderRefundId = refundsStatusService.userOrderTicketRefunding(orderTicketVo, refundSinglePrice, priceExpress, priceCharges, orderTicketEntitiesId, reason, picList, ticketNum, uid, username, kylinOrderRefundsVoBaseList.size(), sendExpressType);
if (!orderRefundId.isEmpty()) { if (!orderRefundId.isEmpty()) {
// 退款申请成功 异步去快递下单 // 退款申请成功 异步去快递下单
if (orderTicketVo.getGetTicketType().equals("express") && sendExpressType > 0) {// 快递票 if (orderTicketVo.getGetTicketType().equals("express") && sendExpressType > 0) {// 快递票
...@@ -266,6 +237,37 @@ public class KylinOrderTicketsRefundServiceImpl { ...@@ -266,6 +237,37 @@ public class KylinOrderTicketsRefundServiceImpl {
} }
} }
public ResponseDto<OrderRefundVo> orderRefundDetails(String orderId, String orderRefundId) {
try {
OrderRefundVo vo = OrderRefundVo.getNew();
String uid = CurrentUtil.getCurrentUid();
KylinOrderTicketVo orderTicketVo = dataUtils.getOrderTicketVo(orderId);
KylinPerformanceVo performanceVo = dataUtils.getPerformanceVo(orderTicketVo.getPerformanceId());
if (uid.equals("809406") || uid.equals("773650")) {
} else {
if (!orderTicketVo.getUserId().equals(uid)) {
return ResponseDto.failure(ErrorMapping.get("20003"));
}
}
orderTicketVo.setFieldName(performanceVo.getFieldName());
if (orderTicketVo.getOrderCode().length() > 20) {
orderTicketVo.setOrderCode(orderTicketVo.getOrderCode().substring(orderTicketVo.getOrderCode().length() - 10));
}
KylinOrderRefundsVo kylinOrderRefundsVoBase = dataUtils.getOrderRefundVo(orderRefundId);
if (kylinOrderRefundsVoBase.getOrderRefundCode().length() > 20) {
kylinOrderRefundsVoBase.setOrderRefundCode(kylinOrderRefundsVoBase.getOrderRefundCode().substring(kylinOrderRefundsVoBase.getOrderRefundCode().length() - 10));
}
vo.setKylinOrderRefundsVoBaseList(kylinOrderRefundsVoBase);
vo.setOrderTicketVo(orderTicketVo);
vo.setKylinOrderExpressVo(dataUtils.getOrderRefundExpressInfo(orderId));
return ResponseDto.success(vo);
} catch (Exception e) {
e.printStackTrace();
return ResponseDto.failure(ErrorMapping.get("20030"));
}
}
// 返回手续费比例 // 返回手续费比例
private BigDecimal getChargesRatio(String useStart, Integer isRefundPoundage) { private BigDecimal getChargesRatio(String useStart, Integer isRefundPoundage) {
ArrayList<OrderRefundPoundage> refundPoundage = dataUtils.getRefundPoundage(isRefundPoundage); ArrayList<OrderRefundPoundage> refundPoundage = dataUtils.getRefundPoundage(isRefundPoundage);
...@@ -307,86 +309,113 @@ public class KylinOrderTicketsRefundServiceImpl { ...@@ -307,86 +309,113 @@ public class KylinOrderTicketsRefundServiceImpl {
} }
} }
return chargesRatio; return chargesRatio;
} else{ // 无手续费 } else { // 无手续费
return chargesRatio; return chargesRatio;
} }
} }
@Async @Async
public void expressPlace(Integer sendExpressType, String expressNumber, String expressContacts, String expressPhone, String sendExpressAddress, String appointmentTime, KylinOrderTicketVo orderTicketVo, KylinPerformanceVo performanceVo, String orderRefundId) { public void expressPlace(Integer sendExpressType, String expressNumber, String expressContacts, String expressPhone, String sendExpressAddress, String appointmentTime, KylinOrderTicketVo orderTicketVo, KylinPerformanceVo performanceVo, String orderRefundId) {
expressContacts = (null == expressContacts) ? "" : expressContacts; try {
expressPhone = (null == expressPhone) ? "" : expressPhone; expressContacts = (null == expressContacts) ? "" : expressContacts;
sendExpressAddress = (null == sendExpressAddress) ? "" : sendExpressAddress; expressPhone = (null == expressPhone) ? "" : expressPhone;
appointmentTime = (null == appointmentTime) ? "" : appointmentTime; sendExpressAddress = (null == sendExpressAddress) ? "" : sendExpressAddress;
if (sendExpressType == 1) { // 上门取件 appointmentTime = (null == appointmentTime) ? "" : appointmentTime;
// 请求下单数据 if (sendExpressType == 1) { // 上门取件
Map<String, String> hBody = new HashMap<>(); // 请求下单数据
hBody.put("custid", custid); Map<String, String> hBody = new HashMap<>();
hBody.put("jContact", expressContacts); hBody.put("custid", custid);
hBody.put("jMobile", expressPhone); hBody.put("jContact", expressContacts);
hBody.put("jAddress", sendExpressAddress); hBody.put("jMobile", expressPhone);
hBody.put("sendStartTime", appointmentTime); hBody.put("jAddress", sendExpressAddress);
hBody.put("sendStartTime", appointmentTime);
Integer isRefundExpress = performanceVo.getIsRefundExpress();
if (isRefundExpress == 1) { // 1用户承担 0无 公司月结 Integer isRefundExpress = performanceVo.getIsRefundExpress();
hBody.put("payMethod", "1");// 运费付款方式:0-寄付月结;1-寄付现结;2-收方付;3-第三方付; if (isRefundExpress == 1) { // 1用户承担 0无 公司月结
} else { hBody.put("payMethod", "1");// 运费付款方式:0-寄付月结;1-寄付现结;2-收方付;3-第三方付;
hBody.put("payMethod", "2");// 运费付款方式:0-寄付月结;1-寄付现结;2-收方付;3-第三方付;
}
hBody.put("expressType", expressType.toString());// 顺丰特快
hBody.put("depositumInfo", depositumInfo);
hBody.put("isDoCall", "1"); // 是否通过手持终端通知顺丰收派员上门收件,支持以下值:1-要求;0-不要求
String orderExpressId = IDGenerator.nextSnowId();
String OrderExpressCode = "NOWUR" + orderExpressId;
hBody.put("orderId", OrderExpressCode);
hBody.put("depositumNo", orderTicketVo.getNumber().toString());
OrderRefundAddress refundAddress = dataUtils.getRefundAddress(orderTicketVo.getGetTicketType());
hBody.put("dContact", refundAddress.getName());
hBody.put("dTel", refundAddress.getPhone());
hBody.put("dAddress", refundAddress.getAddress());
// 生成签名并请求
String result = shunfengSignUtils.generateSignatureAndRequestNew(hBody, "/public/order/v1/placeOrder");
log.info("expressPlaceResult result:[{}]", result);
HashMap hashMap = new HashMap();
try {
hashMap = JsonUtils.fromJson(result, HashMap.class);
} catch (Exception e) {
log.info("expressPlaceParams sendExpressType:[{}], expressNumber:[{}], expressContacts:[{}], expressPhone:[{}], sendExpressAddress:[{}], appointmentTime:[{}], orderTicketVo:[{}], performanceVo:[{}]",
sendExpressType, expressNumber, expressContacts, expressPhone, sendExpressAddress, appointmentTime, orderTicketVo, performanceVo);
log.error("expressPlaceFromJsonException e:[{}]", e);
}
if (null == hashMap.get("succ") || hashMap.get("succ").equals("fail")) {
String msg = "";
if (null == hashMap.get("succ")) {
msg = result;
} else { } else {
msg = (String) hashMap.get("msg"); hBody.put("payMethod", "2");// 运费付款方式:0-寄付月结;1-寄付现结;2-收方付;3-第三方付;
} }
log.info("expressPlaceParams sendExpressType:[{}], expressNumber:[{}], expressContacts:[{}], expressPhone:[{}], sendExpressAddress:[{}], appointmentTime:[{}], orderTicketVo:[{}], performanceVo:[{}]", hBody.put("expressType", expressType.toString());// 顺丰特快
sendExpressType, expressNumber, expressContacts, expressPhone, sendExpressAddress, appointmentTime, orderTicketVo, performanceVo); hBody.put("depositumInfo", depositumInfo);
log.error("expressPlaceResultError msg:[{}]", msg); hBody.put("isDoCall", "1"); // 是否通过手持终端通知顺丰收派员上门收件,支持以下值:1-要求;0-不要求
} else {
HashMap hashMapResult = (HashMap) hashMap.get("result"); String orderExpressId = IDGenerator.nextSnowId();
String OrderExpressCode = "NOWUR" + orderExpressId;
hBody.put("orderId", OrderExpressCode);
hBody.put("depositumNo", orderTicketVo.getNumber().toString());
OrderRefundAddress refundAddress = dataUtils.getRefundAddress(orderTicketVo.getGetTicketType());
hBody.put("dContact", refundAddress.getName());
hBody.put("dTel", refundAddress.getPhone());
hBody.put("dAddress", refundAddress.getAddress());
// 生成签名并请求
String result = shunfengSignUtils.generateSignatureAndRequestNew(hBody, "/public/order/v1/placeOrder");
log.info("expressPlaceResult result:[{}]", result);
HashMap hashMap = new HashMap();
try {
hashMap = JsonUtils.fromJson(result, HashMap.class);
} catch (Exception e) {
log.info("expressPlaceParams sendExpressType:[{}], expressNumber:[{}], expressContacts:[{}], expressPhone:[{}], sendExpressAddress:[{}], appointmentTime:[{}], orderTicketVo:[{}], performanceVo:[{}]",
sendExpressType, expressNumber, expressContacts, expressPhone, sendExpressAddress, appointmentTime, orderTicketVo, performanceVo);
log.error("expressPlaceFromJsonException e:[{}]", e);
}
if (null == hashMap.get("succ") || hashMap.get("succ").equals("fail")) {
String msg = "";
if (null == hashMap.get("succ")) {
msg = result;
} else {
msg = (String) hashMap.get("msg");
}
log.info("expressPlaceParams sendExpressType:[{}], expressNumber:[{}], expressContacts:[{}], expressPhone:[{}], sendExpressAddress:[{}], appointmentTime:[{}], orderTicketVo:[{}], performanceVo:[{}]",
sendExpressType, expressNumber, expressContacts, expressPhone, sendExpressAddress, appointmentTime, orderTicketVo, performanceVo);
log.error("expressPlaceResultError msg:[{}]", msg);
} else {
HashMap hashMapResult = (HashMap) hashMap.get("result");
// 生成预快递单 REDIS 队列入数据库
LocalDateTime now = LocalDateTime.now();
LinkedList<String> sqls = CollectionUtil.linkedListString();
sqls.add(SqlMapping.get("kylin_order_refund.refundOrderExpress"));
LinkedList<Object[]> sqlsDataA = CollectionUtil.linkedListObjectArr();
String remark = (String) hashMapResult.get("remark");
String proName = (String) hashMapResult.get("proName");
String goodsValueTotal = (String) hashMapResult.get("goodsValueTotal");
String goodsNumber = (String) hashMapResult.get("goodsNumber");
remark = (null == remark) ? "" : remark;
proName = (null == proName) ? "" : proName;
goodsValueTotal = (null == goodsValueTotal) ? "" : goodsValueTotal;
goodsNumber = (null == goodsNumber) ? "" : goodsNumber;
sqlsDataA.add(new Object[]{
orderExpressId, orderTicketVo.getPerformanceId(), orderTicketVo.getOrderTicketsId(), orderRefundId, OrderExpressCode, hashMapResult.get("mailno"), expressType, hashMapResult.get("filter_result"), remark, KylinTableStatusConst.ORDER_EXPRESS_STATUS2
, 2, sendExpressType, expressContacts, expressPhone, sendExpressAddress, appointmentTime
, proName, hashMapResult.get("cargoTypeCode"), hashMapResult.get("limitTypeCode"), hashMapResult.get("expressTypeCode"), goodsValueTotal, goodsNumber
, now
});
queueUtils.sendMsgByRedis(MQConst.KylinQueue.SQL_ORDER_REFUND_EXPRESS.getKey(),
SqlMapping.gets(sqls, sqlsDataA));
KylinOrderExpressVo kylinOrderExpressVo = KylinOrderExpressVo.getNew();
kylinOrderExpressVo.setOrderExpressId(orderExpressId);
kylinOrderExpressVo.setOrderTicketsId(orderTicketVo.getOrderTicketsId());
kylinOrderExpressVo.setOrderExpressCode(OrderExpressCode);
kylinOrderExpressVo.setMailno((String) hashMapResult.get("mailno"));
kylinOrderExpressVo.setExpressStatus(KylinTableStatusConst.ORDER_EXPRESS_STATUS2);
kylinOrderExpressVo.setSendExpressType(sendExpressType);
dataUtils.setOrderRefundExpressInfo(orderTicketVo.getOrderTicketsId(), kylinOrderExpressVo);
}
} else if (sendExpressType == 2) { // 自主发货
// 生成预快递单 REDIS 队列入数据库 // 生成预快递单 REDIS 队列入数据库
String orderExpressId = IDGenerator.nextSnowId();
String OrderExpressCode = "NOWUR" + orderExpressId;
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
LinkedList<String> sqls = CollectionUtil.linkedListString(); LinkedList<String> sqls = CollectionUtil.linkedListString();
sqls.add(SqlMapping.get("kylin_order_refund.refundOrderExpress")); sqls.add(SqlMapping.get("kylin_order_refund.refundOrderExpress"));
LinkedList<Object[]> sqlsDataA = CollectionUtil.linkedListObjectArr(); LinkedList<Object[]> sqlsDataA = CollectionUtil.linkedListObjectArr();
String remark = (String) hashMapResult.get("remark");
String proName = (String) hashMapResult.get("proName");
String goodsValueTotal = (String) hashMapResult.get("goodsValueTotal");
String goodsNumber = (String) hashMapResult.get("goodsNumber");
remark = (null == remark) ? "" : remark;
proName = (null == proName) ? "" : proName;
goodsValueTotal = (null == goodsValueTotal) ? "" : goodsValueTotal;
goodsNumber = (null == goodsNumber) ? "" : goodsNumber;
sqlsDataA.add(new Object[]{ sqlsDataA.add(new Object[]{
orderExpressId, orderTicketVo.getPerformanceId(), orderTicketVo.getOrderTicketsId(), orderRefundId, OrderExpressCode, hashMapResult.get("mailno"), expressType, hashMapResult.get("filter_result"), remark, KylinTableStatusConst.ORDER_EXPRESS_STATUS2 orderExpressId, orderTicketVo.getPerformanceId(), orderTicketVo.getOrderTicketsId(), orderRefundId, OrderExpressCode, expressNumber, expressType, "", "", KylinTableStatusConst.ORDER_EXPRESS_STATUS2
, 2, sendExpressType, expressContacts, expressPhone, sendExpressAddress, appointmentTime , 2, sendExpressType, expressContacts, expressPhone, sendExpressAddress, appointmentTime
, proName, hashMapResult.get("cargoTypeCode"), hashMapResult.get("limitTypeCode"), hashMapResult.get("expressTypeCode"), goodsValueTotal, goodsNumber , "", "", "", "", "", ""
, now , now
}); });
queueUtils.sendMsgByRedis(MQConst.KylinQueue.SQL_ORDER_REFUND_EXPRESS.getKey(), queueUtils.sendMsgByRedis(MQConst.KylinQueue.SQL_ORDER_REFUND_EXPRESS.getKey(),
...@@ -396,36 +425,13 @@ public class KylinOrderTicketsRefundServiceImpl { ...@@ -396,36 +425,13 @@ public class KylinOrderTicketsRefundServiceImpl {
kylinOrderExpressVo.setOrderExpressId(orderExpressId); kylinOrderExpressVo.setOrderExpressId(orderExpressId);
kylinOrderExpressVo.setOrderTicketsId(orderTicketVo.getOrderTicketsId()); kylinOrderExpressVo.setOrderTicketsId(orderTicketVo.getOrderTicketsId());
kylinOrderExpressVo.setOrderExpressCode(OrderExpressCode); kylinOrderExpressVo.setOrderExpressCode(OrderExpressCode);
kylinOrderExpressVo.setMailno((String) hashMapResult.get("mailno")); kylinOrderExpressVo.setMailno(expressNumber);
kylinOrderExpressVo.setExpressStatus(KylinTableStatusConst.ORDER_EXPRESS_STATUS2); kylinOrderExpressVo.setExpressStatus(KylinTableStatusConst.ORDER_EXPRESS_STATUS2);
kylinOrderExpressVo.setSendExpressType(sendExpressType); kylinOrderExpressVo.setSendExpressType(sendExpressType);
dataUtils.setOrderRefundExpressInfo(orderTicketVo.getOrderTicketsId(), kylinOrderExpressVo); dataUtils.setOrderRefundExpressInfo(orderTicketVo.getOrderTicketsId(), kylinOrderExpressVo);
} }
} else if (sendExpressType == 2) { // 自主发货 } catch (Exception e) {
// 生成预快递单 REDIS 队列入数据库 log.error("expressPlaceError e:{}", e);
String orderExpressId = IDGenerator.nextSnowId();
String OrderExpressCode = "NOWUR" + orderExpressId;
LocalDateTime now = LocalDateTime.now();
LinkedList<String> sqls = CollectionUtil.linkedListString();
sqls.add(SqlMapping.get("kylin_order_refund.refundOrderExpress"));
LinkedList<Object[]> sqlsDataA = CollectionUtil.linkedListObjectArr();
sqlsDataA.add(new Object[]{
orderExpressId, orderTicketVo.getPerformanceId(), orderTicketVo.getOrderTicketsId(), orderRefundId, OrderExpressCode, expressNumber, expressType, "", "", KylinTableStatusConst.ORDER_EXPRESS_STATUS2
, 2, sendExpressType, expressContacts, expressPhone, sendExpressAddress, appointmentTime
, "", "", "", "", "", ""
, now
});
queueUtils.sendMsgByRedis(MQConst.KylinQueue.SQL_ORDER_REFUND_EXPRESS.getKey(),
SqlMapping.gets(sqls, sqlsDataA));
KylinOrderExpressVo kylinOrderExpressVo = KylinOrderExpressVo.getNew();
kylinOrderExpressVo.setOrderExpressId(orderExpressId);
kylinOrderExpressVo.setOrderTicketsId(orderTicketVo.getOrderTicketsId());
kylinOrderExpressVo.setOrderExpressCode(OrderExpressCode);
kylinOrderExpressVo.setMailno(expressNumber);
kylinOrderExpressVo.setExpressStatus(KylinTableStatusConst.ORDER_EXPRESS_STATUS2);
kylinOrderExpressVo.setSendExpressType(sendExpressType);
dataUtils.setOrderRefundExpressInfo(orderTicketVo.getOrderTicketsId(), kylinOrderExpressVo);
} }
} }
...@@ -598,4 +604,4 @@ public class KylinOrderTicketsRefundServiceImpl { ...@@ -598,4 +604,4 @@ public class KylinOrderTicketsRefundServiceImpl {
} }
} }
} }
\ No newline at end of file
...@@ -12,7 +12,6 @@ import com.liquidnet.service.kylin.utils.DataUtils; ...@@ -12,7 +12,6 @@ import com.liquidnet.service.kylin.utils.DataUtils;
import com.liquidnet.service.kylin.utils.OrderUtils; import com.liquidnet.service.kylin.utils.OrderUtils;
import com.liquidnet.service.kylin.utils.QueueUtils; import com.liquidnet.service.kylin.utils.QueueUtils;
import com.mongodb.BasicDBObject; import com.mongodb.BasicDBObject;
import com.mongodb.client.result.UpdateResult;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -25,7 +24,6 @@ import org.springframework.stereotype.Service; ...@@ -25,7 +24,6 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List;
/** /**
* <p> * <p>
...@@ -58,6 +56,7 @@ public class KylinRefundsStatusServiceImpl { ...@@ -58,6 +56,7 @@ public class KylinRefundsStatusServiceImpl {
String orderEntitiesId, String orderEntitiesId,
String reason, String reason,
String picList, String picList,
String ticketNum,
String uid, String uid,
String username, String username,
int refundCount, int refundCount,
...@@ -110,6 +109,7 @@ public class KylinRefundsStatusServiceImpl { ...@@ -110,6 +109,7 @@ public class KylinRefundsStatusServiceImpl {
kylinOrderRefunds.setPrice(refundPrice); kylinOrderRefunds.setPrice(refundPrice);
kylinOrderRefunds.setPriceExpress(priceExpress); kylinOrderRefunds.setPriceExpress(priceExpress);
kylinOrderRefunds.setPriceCharges(priceCharges); kylinOrderRefunds.setPriceCharges(priceCharges);
kylinOrderRefunds.setTicketNum(ticketNum);
kylinOrderRefunds.setStatus(KylinTableStatusConst.ORDER_REFUND_STATUS_APPLY); kylinOrderRefunds.setStatus(KylinTableStatusConst.ORDER_REFUND_STATUS_APPLY);
if (orderInfo.getGetTicketType().equals("express") && sendExpressType > 0) {// 快递票 if (orderInfo.getGetTicketType().equals("express") && sendExpressType > 0) {// 快递票
kylinOrderRefunds.setType(KylinTableStatusConst.ORDER_REFUND_TYPE_APPLY3); kylinOrderRefunds.setType(KylinTableStatusConst.ORDER_REFUND_TYPE_APPLY3);
...@@ -180,7 +180,7 @@ public class KylinRefundsStatusServiceImpl { ...@@ -180,7 +180,7 @@ public class KylinRefundsStatusServiceImpl {
}); });
sqlsDataC.add(new Object[]{ sqlsDataC.add(new Object[]{
kylinOrderRefunds.getOrderRefundsId(), kylinOrderRefunds.getOrderTicketsId(), kylinOrderRefunds.getOrderRefundCode(), kylinOrderRefunds.getOrderRefundsId(), kylinOrderRefunds.getOrderTicketsId(), kylinOrderRefunds.getOrderRefundCode(),
kylinOrderRefunds.getPrice(), kylinOrderRefunds.getPriceExpress(), kylinOrderRefunds.getPriceCharges(), kylinOrderRefunds.getStatus(), kylinOrderRefunds.getPrice(), kylinOrderRefunds.getPriceExpress(), kylinOrderRefunds.getPriceCharges(), ticketNum, kylinOrderRefunds.getStatus(),
kylinOrderRefunds.getType(), kylinOrderRefunds.getApplicantId(), kylinOrderRefunds.getApplicantName(), kylinOrderRefunds.getType(), kylinOrderRefunds.getApplicantId(), kylinOrderRefunds.getApplicantName(),
kylinOrderRefunds.getApplicantAt(), kylinOrderRefunds.getReason(), kylinOrderRefunds.getCreatedAt() kylinOrderRefunds.getApplicantAt(), kylinOrderRefunds.getReason(), kylinOrderRefunds.getCreatedAt()
}); });
...@@ -356,4 +356,4 @@ public class KylinRefundsStatusServiceImpl { ...@@ -356,4 +356,4 @@ public class KylinRefundsStatusServiceImpl {
} }
} }
} }
\ No newline at end of file
...@@ -25,6 +25,7 @@ import org.springframework.data.mongodb.core.MongoTemplate; ...@@ -25,6 +25,7 @@ import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -799,4 +800,18 @@ public class DataUtils { ...@@ -799,4 +800,18 @@ public class DataUtils {
// return data.get(0); // return data.get(0);
// } // }
} }
/**
* 获取已经退了的快递费
* @return
*/
public BigDecimal getCanRefundPriceExpress(List<KylinOrderRefundsVo> kylinOrderRefundsVoBaseList) {
BigDecimal priceExpress = BigDecimal.valueOf(0);
if (!CollectionUtils.isEmpty(kylinOrderRefundsVoBaseList)) {
kylinOrderRefundsVoBaseList.forEach(r -> {
priceExpress.add(r.getPriceExpress());
});
}
return priceExpress;
}
} }
...@@ -16,7 +16,7 @@ kylin_order_ticket_entities.synPay=UPDATE kylin_order_ticket_entities SET is_pay ...@@ -16,7 +16,7 @@ kylin_order_ticket_entities.synPay=UPDATE kylin_order_ticket_entities SET is_pay
# ------------------------用户发起订单退款---------------------------- # ------------------------用户发起订单退款----------------------------
kylin_order_ticket_status.refund=UPDATE kylin_order_ticket_status SET status = ? ,updated_at = ? WHERE order_id = ? and (updated_at <= ? or created_at = ? or updated_at is null) kylin_order_ticket_status.refund=UPDATE kylin_order_ticket_status SET status = ? ,updated_at = ? WHERE order_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
kylin_order_ticket_entities.refund=UPDATE kylin_order_ticket_entities SET is_payment = ? ,updated_at = ? WHERE order_ticket_entities_id = ? and (updated_at <= ? or created_at = ? or updated_at is null) kylin_order_ticket_entities.refund=UPDATE kylin_order_ticket_entities SET is_payment = ? ,updated_at = ? WHERE order_ticket_entities_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
kylin_order_refund.refund=INSERT INTO kylin_order_refunds (order_refunds_id,order_tickets_id,order_refund_code,price,price_express,price_charges,status,type,applicant_id,applicant_name,applicant_at,reason,created_at) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?) kylin_order_refund.refund=INSERT INTO kylin_order_refunds (order_refunds_id,order_tickets_id,order_refund_code,price,price_express,price_charges,ticket_num,status,type,applicant_id,applicant_name,applicant_at,reason,created_at) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)
kylin_order_refund_entities.refund=INSERT INTO kylin_order_refund_entities (order_refunds_entities_id,order_refunds_id,refund_price,order_ticket_entities_id,created_at) VALUES(?,?,?,?,?) kylin_order_refund_entities.refund=INSERT INTO kylin_order_refund_entities (order_refunds_entities_id,order_refunds_id,refund_price,order_ticket_entities_id,created_at) VALUES(?,?,?,?,?)
kylin_order_refund_pic.refund=INSERT INTO kylin_order_refund_pic (refund_pic_id,order_refunds_id,pic_url,created_at) VALUES (?,?,?,?) kylin_order_refund_pic.refund=INSERT INTO kylin_order_refund_pic (refund_pic_id,order_refunds_id,pic_url,created_at) VALUES (?,?,?,?)
kylin_order_refund.refundOrderExpress=INSERT INTO kylin_order_express (order_express_id,performances_id,order_tickets_id,order_refunds_id,order_express_code,mailno,express_type,filter_result,remark,express_status,send_type,send_express_type,express_contacts,express_phone,send_express_address,appointment_time,pro_name,cargo_type_code,limit_type_code,express_type_code,goods_value_total,goods_number,created_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) kylin_order_refund.refundOrderExpress=INSERT INTO kylin_order_express (order_express_id,performances_id,order_tickets_id,order_refunds_id,order_express_code,mailno,express_type,filter_result,remark,express_status,send_type,send_express_type,express_contacts,express_phone,send_express_address,appointment_time,pro_name,cargo_type_code,limit_type_code,express_type_code,goods_value_total,goods_number,created_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
......
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