退租和取消退租接口优化
This commit is contained in:
@@ -14,6 +14,7 @@ import com.gxwebsoft.apps.result.*;
|
|||||||
import com.gxwebsoft.apps.service.HualalaFoodService;
|
import com.gxwebsoft.apps.service.HualalaFoodService;
|
||||||
import com.gxwebsoft.apps.service.HualalaService;
|
import com.gxwebsoft.apps.service.HualalaService;
|
||||||
import com.gxwebsoft.apps.service.HualalaShopService;
|
import com.gxwebsoft.apps.service.HualalaShopService;
|
||||||
|
import com.gxwebsoft.common.core.constants.OrderConstants;
|
||||||
import com.gxwebsoft.common.core.utils.CacheClient;
|
import com.gxwebsoft.common.core.utils.CacheClient;
|
||||||
import com.gxwebsoft.common.core.utils.JSONUtil;
|
import com.gxwebsoft.common.core.utils.JSONUtil;
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
@@ -97,7 +98,7 @@ public class HualalaCart extends BaseController {
|
|||||||
order.setUserId(loginUser.getUserId());
|
order.setUserId(loginUser.getUserId());
|
||||||
}
|
}
|
||||||
order.setMerchantCode(order.getShopId().toString());
|
order.setMerchantCode(order.getShopId().toString());
|
||||||
order.setPayMethod("通联支付");
|
order.setPayMethod(OrderConstants.PAY_METHOD_OTHER);
|
||||||
if (orderService.save(order)) {
|
if (orderService.save(order)) {
|
||||||
// 添加订单商品
|
// 添加订单商品
|
||||||
List<Object> hValues = cacheClient.hValues(key);
|
List<Object> hValues = cacheClient.hValues(key);
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ public class OrderConstants {
|
|||||||
public static final Integer DELIVERY_STATUS_ACCEPT = 40; // 已绑定
|
public static final Integer DELIVERY_STATUS_ACCEPT = 40; // 已绑定
|
||||||
|
|
||||||
// 收货状态
|
// 收货状态
|
||||||
public static final Integer RECEIPT_STATUS_NO = 10; // 未收货
|
public static final int RECEIPT_STATUS_NO = 10; // 未收货
|
||||||
public static final Integer RECEIPT_STATUS_YES = 20; // 已收货
|
public static final int RECEIPT_STATUS_YES = 20; // 已收货
|
||||||
public static final Integer RECEIPT_STATUS_APPLY = 21; // 申请退租
|
public static final int RECEIPT_STATUS_APPLY = 21; // 申请退租
|
||||||
public static final Integer RECEIPT_STATUS_RETURN = 30; // 已退货
|
public static final int RECEIPT_STATUS_RETURN = 30; // 已退货
|
||||||
|
|
||||||
// 订单状态
|
// 订单状态
|
||||||
public static final Integer ORDER_STATUS_DOING = 10; // 待付款
|
public static final Integer ORDER_STATUS_DOING = 10; // 待付款
|
||||||
|
|||||||
@@ -267,11 +267,6 @@ public class OpenEquipmentController extends BaseController {
|
|||||||
order.setExpirationTime(DateUtil.nextMonth());
|
order.setExpirationTime(DateUtil.nextMonth());
|
||||||
order.setEquipmentId(one.getEquipmentId());
|
order.setEquipmentId(one.getEquipmentId());
|
||||||
|
|
||||||
if(order.getOrderSource() == 10) {
|
|
||||||
order.setOrderStatus(ORDER_STATUS_OVER);
|
|
||||||
}
|
|
||||||
orderService.updateById(order);
|
|
||||||
|
|
||||||
JSONObject param = new JSONObject();
|
JSONObject param = new JSONObject();
|
||||||
param.put("userId", loginUser.getUserId());
|
param.put("userId", loginUser.getUserId());
|
||||||
param.put("userName", loginUser.getNickname());
|
param.put("userName", loginUser.getNickname());
|
||||||
@@ -285,6 +280,11 @@ public class OpenEquipmentController extends BaseController {
|
|||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(order.getOrderSource() == 10) {
|
||||||
|
order.setOrderStatus(ORDER_STATUS_OVER);
|
||||||
|
}
|
||||||
|
orderService.updateById(order);
|
||||||
|
|
||||||
orderPayService.lambdaUpdate().set(OrderPay::getEquipmentId, one.getEquipmentId()).update();
|
orderPayService.lambdaUpdate().set(OrderPay::getEquipmentId, one.getEquipmentId()).update();
|
||||||
return success("绑定成功");
|
return success("绑定成功");
|
||||||
}
|
}
|
||||||
@@ -471,22 +471,26 @@ public class OpenEquipmentController extends BaseController {
|
|||||||
OrderRefund refund = orderRefundService.getOne(new LambdaQueryWrapper<OrderRefund>()
|
OrderRefund refund = orderRefundService.getOne(new LambdaQueryWrapper<OrderRefund>()
|
||||||
.eq(OrderRefund::getOrderId, order.getOrderId()).last("limit 1"));
|
.eq(OrderRefund::getOrderId, order.getOrderId()).last("limit 1"));
|
||||||
// 已有记录 取消退租
|
// 已有记录 取消退租
|
||||||
|
Integer isRefund = order.getIsRefund();
|
||||||
if (refund != null) {
|
if (refund != null) {
|
||||||
|
if(isRefund == 1){
|
||||||
|
return fail("已申请退租!");
|
||||||
|
}
|
||||||
|
|
||||||
Integer auditStatus = refund.getAuditStatus();
|
Integer auditStatus = refund.getAuditStatus();
|
||||||
if(auditStatus == 10){
|
if(auditStatus != 10){
|
||||||
orderRefundService.removeById(refund.getOrderRefundId());
|
return fail("未申请退租!");
|
||||||
// Order updateOrder = new Order();
|
|
||||||
// updateOrder.setReceiptStatus(RECEIPT_STATUS_YES);
|
|
||||||
// updateOrder.setOrderId(order.getOrderId());
|
|
||||||
// orderService.updateById(updateOrder);
|
|
||||||
order.setReceiptStatus(RECEIPT_STATUS_YES);
|
|
||||||
orderService.updateById(order);
|
|
||||||
return success("已申请退租");
|
|
||||||
}
|
|
||||||
if (auditStatus != 30) {
|
|
||||||
return fail("申请成功,请等待客服人员审核");
|
|
||||||
}
|
}
|
||||||
|
orderRefundService.removeById(refund.getOrderRefundId());
|
||||||
|
order.setReceiptStatus(RECEIPT_STATUS_YES);
|
||||||
|
orderService.updateById(order);
|
||||||
|
return success("取消退租成功");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
if(isRefund == 2){
|
||||||
|
return fail("找不到申请退租记录!");
|
||||||
|
}
|
||||||
|
|
||||||
refund = new OrderRefund();
|
refund = new OrderRefund();
|
||||||
refund.setOrderId(order.getOrderId());
|
refund.setOrderId(order.getOrderId());
|
||||||
refund.setOrderNo(order.getOrderNo());
|
refund.setOrderNo(order.getOrderNo());
|
||||||
|
|||||||
@@ -374,6 +374,9 @@ public class PaymentController extends BaseController {
|
|||||||
order.setOrderNo(outTradeNo);
|
order.setOrderNo(outTradeNo);
|
||||||
|
|
||||||
Order parentOrder = orderService.getById(order.getRentOrderId());
|
Order parentOrder = orderService.getById(order.getRentOrderId());
|
||||||
|
if(StrUtil.isBlank(parentOrder.getPayMethod())){
|
||||||
|
parentOrder.setPayMethod(PAY_METHOD_ALIPAY);
|
||||||
|
}
|
||||||
parentOrder.setCurrPeriods(parentOrder.getCurrPeriods() + 1);
|
parentOrder.setCurrPeriods(parentOrder.getCurrPeriods() + 1);
|
||||||
parentOrder.setPayStatus(PAY_STATUS_SUCCESS);
|
parentOrder.setPayStatus(PAY_STATUS_SUCCESS);
|
||||||
// 更新过期时间延长一个月
|
// 更新过期时间延长一个月
|
||||||
@@ -461,6 +464,10 @@ public class PaymentController extends BaseController {
|
|||||||
// 处理主订单
|
// 处理主订单
|
||||||
|
|
||||||
Order parentOrder = orderService.getById(order.getRentOrderId());
|
Order parentOrder = orderService.getById(order.getRentOrderId());
|
||||||
|
|
||||||
|
if(StrUtil.isBlank(parentOrder.getPayMethod())){
|
||||||
|
parentOrder.setPayMethod(PAY_METHOD_BALANCE);
|
||||||
|
}
|
||||||
parentOrder.setCurrPeriods(parentOrder.getCurrPeriods() + 1);
|
parentOrder.setCurrPeriods(parentOrder.getCurrPeriods() + 1);
|
||||||
order.setCurrPeriods(parentOrder.getCurrPeriods());
|
order.setCurrPeriods(parentOrder.getCurrPeriods());
|
||||||
order.setBatteryRent(parentOrder.getBatteryRent());
|
order.setBatteryRent(parentOrder.getBatteryRent());
|
||||||
@@ -545,6 +552,10 @@ public class PaymentController extends BaseController {
|
|||||||
// 主订单
|
// 主订单
|
||||||
Order parentOrder = orderService.getById(d.getRentOrderId());
|
Order parentOrder = orderService.getById(d.getRentOrderId());
|
||||||
// 更新过期时间延长一个月
|
// 更新过期时间延长一个月
|
||||||
|
if(StrUtil.isBlank(parentOrder.getPayMethod())){
|
||||||
|
parentOrder.setPayMethod(PAY_METHOD_BALANCE);
|
||||||
|
}
|
||||||
|
|
||||||
Date expirationTime = parentOrder.getExpirationTime();
|
Date expirationTime = parentOrder.getExpirationTime();
|
||||||
DateTime nextMonthTime = DateUtil.offsetMonth(expirationTime, 1);
|
DateTime nextMonthTime = DateUtil.offsetMonth(expirationTime, 1);
|
||||||
parentOrder.setExpirationTime(nextMonthTime);
|
parentOrder.setExpirationTime(nextMonthTime);
|
||||||
@@ -598,14 +609,11 @@ public class PaymentController extends BaseController {
|
|||||||
@ApiModelProperty("测试")
|
@ApiModelProperty("测试")
|
||||||
@GetMapping("/mp-alipay/test")
|
@GetMapping("/mp-alipay/test")
|
||||||
public String test() {
|
public String test() {
|
||||||
System.out.println("开始>>>>>");
|
|
||||||
Order order = orderService.getByOutTradeNo("2023213225911618");
|
Order order = orderService.getByOutTradeNo("2023213225911618");
|
||||||
System.out.println("order = " + order);
|
|
||||||
order.setPayPrice(new BigDecimal("0.11"));
|
order.setPayPrice(new BigDecimal("0.11"));
|
||||||
order.setTotalPrice(new BigDecimal("0.11"));
|
order.setTotalPrice(new BigDecimal("0.11"));
|
||||||
order.setPayStatus(PAY_STATUS_SUCCESS);
|
order.setPayStatus(PAY_STATUS_SUCCESS);
|
||||||
final boolean b = orderService.updateByIdRel(order);
|
final boolean b = orderService.updateByIdRel(order);
|
||||||
System.out.println("b = " + b);
|
|
||||||
|
|
||||||
// params.put("gmt_create", "2022-12-16 21:32:33");
|
// params.put("gmt_create", "2022-12-16 21:32:33");
|
||||||
// params.put("charset", "UTF-8");
|
// params.put("charset", "UTF-8");
|
||||||
|
|||||||
@@ -328,6 +328,10 @@ public class Order implements Serializable {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Date insuranceExpireDate;
|
private Date insuranceExpireDate;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否申请退租,1为申请,2为取消")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer isRefund;
|
||||||
|
|
||||||
public Integer getRestDay() {
|
public Integer getRestDay() {
|
||||||
if(null != orderStatus){
|
if(null != orderStatus){
|
||||||
switch(orderStatus){
|
switch(orderStatus){
|
||||||
|
|||||||
Reference in New Issue
Block a user