修正订单租金数据
This commit is contained in:
@@ -217,7 +217,8 @@ public class MainController extends BaseController {
|
||||
// User user = getLoginUser();
|
||||
// param.setTenantId(user.getTenantId());
|
||||
|
||||
String code = RandomStringUtils.randomNumeric(6);
|
||||
int iCode = new Random().nextInt(999999) + 1000000;
|
||||
String code = String.valueOf(iCode).substring(1);
|
||||
param.setTemplateParam("{\"code\":" + code + "}");
|
||||
ApiResult ret = aliSmsService.sendSms(param);
|
||||
if(ret.isOk()){
|
||||
|
||||
@@ -482,7 +482,7 @@ public class OpenEquipmentController extends BaseController {
|
||||
if (auditStatus != 30) {
|
||||
return fail("申请成功,请等待客服人员审核");
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
refund = new OrderRefund();
|
||||
refund.setOrderId(order.getOrderId());
|
||||
refund.setOrderNo(order.getOrderNo());
|
||||
@@ -494,6 +494,7 @@ public class OpenEquipmentController extends BaseController {
|
||||
refund.setMerchantCode(order.getMerchantCode());
|
||||
}
|
||||
refund.setAuditStatus(10);
|
||||
refund.setOrderNo(order.getOrderNo());
|
||||
orderRefundService.saveOrUpdate(refund);
|
||||
// 更新订单状态
|
||||
Order updateOrder = new Order();
|
||||
|
||||
@@ -256,41 +256,50 @@ public class FreezeOrderController extends BaseController {
|
||||
boolean delRet = freezeOrderService.remove(fWrapper);
|
||||
log.info("删除无效冻结订单结果{}!冻结单号{}", delRet, out_order_no);
|
||||
|
||||
BigDecimal bAmount = freezeOrder.getAmount();
|
||||
LambdaQueryWrapper<Order> orderWrapper = Wrappers.lambdaQuery();
|
||||
orderWrapper.eq(Order::getFreezeOrderNo, out_order_no).last("limit 1");
|
||||
Order order = orderService.getOne(orderWrapper);
|
||||
order.setBatteryRent(bAmount);
|
||||
orderService.updateById(order);
|
||||
log.info("更新冻结金额!冻结单号{}", out_order_no);
|
||||
if(null == order){
|
||||
log.error("冻结订单{}对应的产品订单不存在!", out_order_no);
|
||||
} else {
|
||||
BigDecimal rent = order.getBatteryRent();
|
||||
BigDecimal totalPrice = order.getTotalPrice();
|
||||
if(rent == null || !rent.equals(totalPrice)){
|
||||
order.setBatteryRent(totalPrice);
|
||||
orderService.updateById(order);
|
||||
log.info("更新冻结金额!冻结单号{}", out_order_no);
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<OrderPay> orderPayWrapper = Wrappers.lambdaQuery();
|
||||
orderPayWrapper.eq(OrderPay::getRentOrderId, order.getOrderId()).eq(OrderPay::getPayStatus, PAY_STATUS_NO_PAY).last("limit 1");
|
||||
OrderPay orderPay = orderPayService.getOne(orderPayWrapper);
|
||||
if(null != orderPay){
|
||||
orderPay.setBatteryRent(bAmount);
|
||||
boolean bOrderRet = orderPayService.updateById(orderPay);
|
||||
log.info("更新冻结支付订单结果{}!冻结单号{}", bOrderRet, out_order_no);
|
||||
}
|
||||
LambdaQueryWrapper<OrderPay> orderPayWrapper = Wrappers.lambdaQuery();
|
||||
orderPayWrapper.eq(OrderPay::getRentOrderId, order.getOrderId()).eq(OrderPay::getPayStatus, PAY_STATUS_NO_PAY).last("limit 1");
|
||||
OrderPay orderPay = orderPayService.getOne(orderPayWrapper);
|
||||
if(null != orderPay){
|
||||
BigDecimal bRent = order.getBatteryRent();
|
||||
if(bRent == null || !bRent.equals(totalPrice)){
|
||||
orderPay.setBatteryRent(totalPrice);
|
||||
boolean bOrderRet = orderPayService.updateById(orderPay);
|
||||
log.info("更新冻结支付订单结果{}!冻结单号{}", bOrderRet, out_order_no);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
writer = response.getWriter();
|
||||
writer.write("success"); //一定要打印success
|
||||
writer.flush();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
if (writer != null) {
|
||||
writer.close();
|
||||
try {
|
||||
writer = response.getWriter();
|
||||
writer.write("success"); //一定要打印success
|
||||
writer.flush();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
if (writer != null) {
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// return "success";
|
||||
}
|
||||
else {
|
||||
log.warn("解冻消息{}已处理!", notify_id);
|
||||
}
|
||||
|
||||
|
||||
// return "fail";
|
||||
}
|
||||
|
||||
|
||||
@@ -351,17 +351,17 @@ public class PaymentController extends BaseController {
|
||||
// 1. 验证appId是否一致
|
||||
final String app_id = params.get("app_id");
|
||||
if (!config.getString("alipayAppId").equals(app_id)) {
|
||||
System.out.println("支付宝appId不一致 = " + app_id);
|
||||
log.warn("支付宝appId不一致 = " + app_id);
|
||||
throw new BusinessException("支付宝appId不一致");
|
||||
}
|
||||
// 2. 订单金额
|
||||
if (!payPrice.equals(receipt_amount)) {
|
||||
System.out.println("订单金额是不一致 = " + receipt_amount);
|
||||
log.warn("订单金额是不一致 = " + receipt_amount);
|
||||
throw new BusinessException("订单金额是不一致");
|
||||
}
|
||||
// 3. 判断交易状态
|
||||
if (!"TRADE_SUCCESS".equals(tradeStatus)) {
|
||||
System.out.println("支付失败 = " + tradeStatus);
|
||||
log.warn("支付失败 = " + tradeStatus);
|
||||
throw new BusinessException("支付失败");
|
||||
}
|
||||
// 4. 修改支付状态
|
||||
@@ -375,7 +375,8 @@ public class PaymentController extends BaseController {
|
||||
|
||||
Order parentOrder = orderService.getById(order.getRentOrderId());
|
||||
parentOrder.setCurrPeriods(parentOrder.getCurrPeriods() + 1);
|
||||
order.setCurrPeriods(parentOrder.getCurrPeriods() + 1);
|
||||
order.setCurrPeriods(parentOrder.getCurrPeriods());
|
||||
order.setBatteryRent(parentOrder.getBatteryRent());
|
||||
|
||||
parentOrder.setPayStatus(PAY_STATUS_SUCCESS);
|
||||
// 更新过期时间延长一个月
|
||||
@@ -397,7 +398,6 @@ public class PaymentController extends BaseController {
|
||||
parentOrder.setExpirationTime(order.getExpirationTime());
|
||||
}
|
||||
|
||||
|
||||
orderPayService.updateById(order);
|
||||
orderService.updateById(parentOrder);
|
||||
return "success";
|
||||
@@ -461,7 +461,8 @@ public class PaymentController extends BaseController {
|
||||
|
||||
Order parentOrder = orderService.getById(order.getRentOrderId());
|
||||
parentOrder.setCurrPeriods(parentOrder.getCurrPeriods() + 1);
|
||||
order.setCurrPeriods(parentOrder.getCurrPeriods() + 1);
|
||||
order.setCurrPeriods(parentOrder.getCurrPeriods());
|
||||
order.setBatteryRent(parentOrder.getBatteryRent());
|
||||
|
||||
parentOrder.setPayStatus(PAY_STATUS_SUCCESS);
|
||||
// 更新过期时间延长一个月
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.alipay.api.response.*;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.apps.entity.EquipmentGoods;
|
||||
import com.gxwebsoft.apps.service.EquipmentGoodsService;
|
||||
import com.gxwebsoft.common.core.exception.BusinessException;
|
||||
import com.gxwebsoft.common.core.utils.AlipayConfigUtil;
|
||||
import com.gxwebsoft.shop.entity.Order;
|
||||
import com.gxwebsoft.shop.mapper.FreezeOrderMapper;
|
||||
@@ -85,6 +86,9 @@ public class FreezeOrderServiceImpl extends ServiceImpl<FreezeOrderMapper, Freez
|
||||
FreezeOrder freezeOrder = this.lambdaQuery().eq(FreezeOrder::getOutOrderNo, order.getFreezeOrderNo())
|
||||
.eq(FreezeOrder::getStatus, "SUCCESS").orderByDesc(FreezeOrder::getCreateTime).last("limit 1").one();
|
||||
|
||||
if(null == freezeOrder){
|
||||
throw new BusinessException("没有冻结订单!");
|
||||
}
|
||||
if(null == unFreezeAmount || unFreezeAmount.compareTo(BigDecimal.ZERO) == 0){
|
||||
unFreezeAmount = freezeOrder.getAmount();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user