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

Commit 9d085ed3 authored by 胡佳晨's avatar 胡佳晨

提交 再次申请退款接口

parent aaa10d09
...@@ -23,6 +23,8 @@ public interface IGoblinOrderAppService { ...@@ -23,6 +23,8 @@ public interface IGoblinOrderAppService {
ResponseDto<Boolean> applyRefund(GoblinAppOrderRefundParam param); ResponseDto<Boolean> applyRefund(GoblinAppOrderRefundParam param);
ResponseDto<Boolean> againRefund(String orderBackId);
ResponseDto<List<GoblinBackOrderVo>> refundDetails(String orderId); ResponseDto<List<GoblinBackOrderVo>> refundDetails(String orderId);
String huiFuSync(HttpServletRequest request); String huiFuSync(HttpServletRequest request);
......
...@@ -75,6 +75,15 @@ public class GoblinOrderAppController { ...@@ -75,6 +75,15 @@ public class GoblinOrderAppController {
return goblinOrderAppService.applyRefund(param); return goblinOrderAppService.applyRefund(param);
} }
@PostMapping("againRefund")
@ApiOperation("再次退款申请")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "orderBackId", value = "退款订单id", example = "1"),
})
public ResponseDto<Boolean> applyRefund(@RequestBody String orderBackId) {
return goblinOrderAppService.againRefund(orderBackId);
}
@PostMapping("refundDetails") @PostMapping("refundDetails")
@ApiOperation("退款详情") @ApiOperation("退款详情")
@ApiImplicitParams({ @ApiImplicitParams({
......
...@@ -242,10 +242,10 @@ public class GoblinOrderAppServiceImpl implements IGoblinOrderAppService { ...@@ -242,10 +242,10 @@ public class GoblinOrderAppServiceImpl implements IGoblinOrderAppService {
backOrder.setSkuIdNums(Joiner.on(",").join(orderVo.getOrderSkuVoIds())); backOrder.setSkuIdNums(Joiner.on(",").join(orderVo.getOrderSkuVoIds()));
} else if (orderVo.getStatus() == GoblinStatusConst.Status.ORDER_STATUS_3.getValue()) {//已发货 } else if (orderVo.getStatus() == GoblinStatusConst.Status.ORDER_STATUS_3.getValue()) {//已发货
GoblinOrderSkuVo orderSkuVo = redisUtils.getGoblinOrderSkuVo(param.getOrderSkuId()); GoblinOrderSkuVo orderSkuVo = redisUtils.getGoblinOrderSkuVo(param.getOrderSkuId());
if(orderVo.getPriceRefund().add(orderSkuVo.getSkuPriceActual()).add(orderVo.getPriceExpress()).compareTo(orderVo.getPriceActual())>=0){ if (orderVo.getPriceRefund().add(orderSkuVo.getSkuPriceActual()).add(orderVo.getPriceExpress()).compareTo(orderVo.getPriceActual()) >= 0) {
backOrder.setRealBackPrice(orderSkuVo.getSkuPriceActual().add(orderVo.getPriceExpress())); backOrder.setRealBackPrice(orderSkuVo.getSkuPriceActual().add(orderVo.getPriceExpress()));
backOrder.setBackPriceExpress(orderVo.getPriceExpress()); backOrder.setBackPriceExpress(orderVo.getPriceExpress());
}else{ } else {
backOrder.setRealBackPrice(orderSkuVo.getSkuPriceActual()); backOrder.setRealBackPrice(orderSkuVo.getSkuPriceActual());
backOrder.setBackPriceExpress(BigDecimal.ZERO); backOrder.setBackPriceExpress(BigDecimal.ZERO);
} }
...@@ -349,6 +349,58 @@ public class GoblinOrderAppServiceImpl implements IGoblinOrderAppService { ...@@ -349,6 +349,58 @@ public class GoblinOrderAppServiceImpl implements IGoblinOrderAppService {
return ResponseDto.success(); return ResponseDto.success();
} }
@Override
public ResponseDto<Boolean> againRefund(String orderBackId) {
LinkedList<String> sqls = CollectionUtil.linkedListString();
sqls.add(SqlMapping.get("goblin_order.user.againRefund"));
sqls.add(SqlMapping.get("goblin_order.store.refundLog"));
LinkedList<Object[]> applyRefund = CollectionUtil.linkedListObjectArr();
LinkedList<Object[]> refundLog = CollectionUtil.linkedListObjectArr();
String uid = CurrentUtil.getCurrentUid();
LocalDateTime now = LocalDateTime.now();
GoblinBackOrderVo backOrder = redisUtils.getBackOrderVo(orderBackId);
GoblinStoreOrderVo orderVo = redisUtils.getGoblinOrder(backOrder.getOrderId());
if (!orderVo.getUserId().equals(uid)) {
return ResponseDto.failure("无权操作");
}
if (!(orderVo.getStatus() == GoblinStatusConst.Status.ORDER_STATUS_2.getValue() ||
orderVo.getStatus() == GoblinStatusConst.Status.ORDER_STATUS_4.getValue())) {
return ResponseDto.failure("不可操作");
}
//判断7天
LocalDateTime canRefundTime = getCanRefundTime(orderVo);
if (canRefundTime == null) {
return ResponseDto.failure("申请失败");
} else {
if (LocalDateTime.now().isAfter(canRefundTime)) {
return ResponseDto.failure("申请失败");
}
}
backOrder.setStatus(GoblinStatusConst.Status.ORDER_BACK_STATUS_1.getValue());
//添加日志
GoblinBackOrderLog backOrderLog = initBackLog(backOrder.getOrderId(), uid, now);
backOrderLog.setStatus(GoblinStatusConst.Status.ORDER_LOG_STATUS_21.getValue());
backOrderLog.setOperationType(GoblinStatusConst.Type.OPERATION_TYPE_1.getValue());
backOrderLog.setMessage("用户再次发起退款:" + backOrder);
//redis
redisUtils.setBackOrderVo(backOrder.getBackOrderId(), backOrder);
//mongo
mongoUtils.updateGoblinBackOrderVo(backOrder.getBackOrderId(), backOrder);
//mysql
applyRefund.add(new Object[]{
backOrder.getStatus(), now, backOrder.getBackOrderId()
});
//添加日志
refundLog.add(new Object[]{
backOrderLog.getBackOrderLogId(), backOrderLog.getBackOrderId(), backOrderLog.getOperationType(),
backOrderLog.getMessage(), backOrderLog.getOperationName(), backOrderLog.getStatus(), now
});
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.GOBLIN_USER_ORDER_OPERA.getKey(), SqlMapping.gets(sqls, applyRefund, refundLog));
return ResponseDto.success();
}
@Override @Override
public ResponseDto<List<GoblinBackOrderVo>> refundDetails(String orderId) { public ResponseDto<List<GoblinBackOrderVo>> refundDetails(String orderId) {
List<GoblinBackOrderVo> vos = ObjectUtil.goblinBackOrderVoArrayList(); List<GoblinBackOrderVo> vos = ObjectUtil.goblinBackOrderVoArrayList();
......
...@@ -105,6 +105,8 @@ goblin_order.store.orderStatus=UPDATE goblin_store_order SET status = ? , update ...@@ -105,6 +105,8 @@ goblin_order.store.orderStatus=UPDATE goblin_store_order SET status = ? , update
goblin_order.store.applyRefund=UPDATE goblin_back_order SET status = ? ,reason=?,audit_at=?, updated_at = ? WHERE back_order_id = ? and (updated_at <= ? or created_at = ? or updated_at is null) goblin_order.store.applyRefund=UPDATE goblin_back_order SET status = ? ,reason=?,audit_at=?, updated_at = ? WHERE back_order_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
#---- 用户订单操作 #---- 用户订单操作
goblin_order.user.applyRefund=INSERT INTO goblin_back_order (`back_order_id`,`back_code`,`order_id`,`order_code`,`store_id`,`user_id`,`sku_id_nums`,`type`,`reason`,`describes`,`real_back_price`,`back_price_express`,`status`,`logis_company_name`,`mail_no`,`created_at`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) goblin_order.user.applyRefund=INSERT INTO goblin_back_order (`back_order_id`,`back_code`,`order_id`,`order_code`,`store_id`,`user_id`,`sku_id_nums`,`type`,`reason`,`describes`,`real_back_price`,`back_price_express`,`status`,`logis_company_name`,`mail_no`,`created_at`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
goblin_order.user.againRefund=UPDATE goblin_back_order SET status = ? , updated_at=? where back_order_id=?
#---- 购物车操作 #---- 购物车操作
goblin_shop.cart.delete=UPDATE goblin_shopping_cart set del_tag=? where user_id=? and sku_id=? goblin_shop.cart.delete=UPDATE goblin_shopping_cart set del_tag=? where user_id=? and sku_id=?
goblin_shop.cart.insert=insert into goblin_shopping_cart (car_id, user_id, store_id,spu_id, sku_id, `number`,marketing_id, del_tag, `comment`,`type`) values (?,?,?,?,?,?,?,?,?,?) goblin_shop.cart.insert=insert into goblin_shopping_cart (car_id, user_id, store_id,spu_id, sku_id, `number`,marketing_id, del_tag, `comment`,`type`) 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