最后更新的代码

This commit is contained in:
weicw
2023-12-19 22:03:55 +08:00
parent 1b842a9ea5
commit 12fa7348cb
4 changed files with 24 additions and 21 deletions

View File

@@ -166,7 +166,7 @@ public class OrderTask {
orderPayService.save(newRenewOrder);
// 已生成订单未付款
} else if (item.getPayStatus().equals(PAY_STATUS_NO_PAY)) {
} else if (item.getPayStatus().equals(PAY_STATUS_NO_PAY) && now.isAfter(item.getStartTime())) {
long between = DateUtil.between(item.getStartTime(), now, DateUnit.DAY);
if (item.getExpirationDay() != between) {
// 更新逾期时间
@@ -195,13 +195,14 @@ public class OrderTask {
/**
* 计算分润
*/
// @Scheduled(cron="0 0/1 * * * ? ")
@Scheduled(cron="0 0/1 * * * ? ")
@Transactional
public void CalcProfit() {
log.info("开始计算分润");
// 查询所有未结算订单
LambdaQueryWrapper<OrderPay> wrapper = Wrappers.lambdaQuery(OrderPay.class)
.eq(OrderPay::getIsSettled, ORDER_SETTLED_NO)
.gt(OrderPay::getEquipmentId, 0)
.eq(OrderPay::getPayStatus, PAY_STATUS_SUCCESS);
List<OrderPay> orderList = orderPayService.list(wrapper);
@@ -317,7 +318,7 @@ public class OrderTask {
}
Equipment equipment = equipmentMap.get(order.getEquipmentId());
// 投资人收益
if (touziProfit.compareTo(BigDecimal.ZERO) > 0) {
if (touziProfit.compareTo(BigDecimal.ZERO) > 0 && equipment!= null) {
User touziUser = touziUserMap.get(equipment.getTouziUserId());
if (touziUser != null) {
@@ -332,7 +333,7 @@ public class OrderTask {
profitLog.setComments("投资设备:" + equipment.getEquipmentCode());
profitLog.setEquipmentCode(equipment.getEquipmentCode());
profitLog.setMerchantName(merchant.getMerchantName());
profitLog.setOrderSource(order.getGoodsId());
profitLog.setOrderSource(order.getOrderSource());
// profitLog.setIsRenew(order.getIsRenew());
profitLogService.save(profitLog);
}
@@ -353,7 +354,7 @@ public class OrderTask {
profitLog.setComments("推广收益:" + order.getUserId());
profitLog.setEquipmentCode(equipment.getEquipmentCode());
profitLog.setMerchantName(merchant.getMerchantName());
profitLog.setOrderSource(order.getGoodsId());
profitLog.setOrderSource(order.getOrderSource());
// profitLog.setIsRenew(order.getIsRenew());
profitLogService.save(profitLog);
}
@@ -375,7 +376,7 @@ public class OrderTask {
profitLog.setComments("门店收益:" + order.getMerchantCode());
profitLog.setEquipmentCode(equipment.getEquipmentCode());
profitLog.setMerchantName(merchant.getMerchantName());
profitLog.setOrderSource(order.getGoodsId());
profitLog.setOrderSource(order.getOrderSource());
// profitLog.setIsRenew(order.getIsRenew());
profitLogService.save(profitLog);
}
@@ -405,7 +406,7 @@ public class OrderTask {
profitLog.setComments("区域经理收益:" + order.getMerchantCode());
profitLog.setEquipmentCode(equipment.getEquipmentCode());
profitLog.setMerchantName(merchant.getMerchantName());
profitLog.setOrderSource(order.getGoodsId());
profitLog.setOrderSource(order.getOrderSource());
// profitLog.setIsRenew(order.getIsRenew());
profitLogService.save(profitLog);
}
@@ -415,8 +416,8 @@ public class OrderTask {
}
// 设置为已结算
LambdaUpdateWrapper<Order> updateWrapper = Wrappers.lambdaUpdate(Order.class).in(Order::getOrderId, orderIds).set(Order::getIsSettled, 1);
orderService.update(updateWrapper);
LambdaUpdateWrapper<OrderPay> updateWrapper = Wrappers.lambdaUpdate(OrderPay.class).in(OrderPay::getId, orderIds).set(OrderPay::getIsSettled, 1);
orderPayService.update(updateWrapper);
}
}

View File

@@ -21,8 +21,10 @@ import com.gxwebsoft.common.system.entity.User;
import com.gxwebsoft.oa.service.IdcardService;
import com.gxwebsoft.oa.vo.IdcardRespVO;
import com.gxwebsoft.shop.entity.Order;
import com.gxwebsoft.shop.entity.OrderPay;
import com.gxwebsoft.shop.entity.OrderRefund;
import com.gxwebsoft.shop.param.OrderParam;
import com.gxwebsoft.shop.service.OrderPayService;
import com.gxwebsoft.shop.service.OrderRefundService;
import com.gxwebsoft.shop.service.OrderService;
import io.swagger.annotations.Api;
@@ -65,6 +67,9 @@ public class OpenEquipmentController extends BaseController {
@Resource
private OrderRefundService orderRefundService;
@Resource
private OrderPayService orderPayService;
@Resource
private IdcardService idcardService;
@@ -275,6 +280,8 @@ public class OpenEquipmentController extends BaseController {
e.printStackTrace();
}
orderPayService.lambdaUpdate().set(OrderPay::getEquipmentId, one.getEquipmentId()).update();
return success("绑定成功");
}
return fail("绑定失败");

View File

@@ -113,6 +113,7 @@ public class OrderPayController extends BaseController {
one.setMerchantName(order.getMerchantName());
one.setOutRequestNo(order.getOutRequestNo());
one.setBatteryRent(order.getBatteryRent());
one.setOrderSource(order.getOrderSource());
if(order.getOrderSource() == 20) {
// 每期还款+手续费
one.setTotalPrice(eg.getRepayment().add(eg.getServiceCharges()));

View File

@@ -301,10 +301,7 @@ public class TestMain {
public void close() throws AlipayApiException {
List<FreezeOrder> freeze = freezeOrderService.lambdaQuery().eq(FreezeOrder::getOperationType, "FREEZE").list();
List<FreezeOrder> unfreeze = freezeOrderService.lambdaQuery().eq(FreezeOrder::getOperationType, "UNFREEZE").list();
Map<String, List<FreezeOrder>> collect = unfreeze.stream().collect(Collectors.groupingBy(FreezeOrder::getOutOrderNo));
DefaultAlipayClient alipayClient = null;
try {
alipayClient = alipayConfig.alipayClient(6);
@@ -312,17 +309,16 @@ public class TestMain {
throw new RuntimeException(e);
}
DefaultAlipayClient finalAlipayClient = alipayClient;
freeze.forEach(item -> {
List<FreezeOrder> freezeOrders = collect.get(item.getOutOrderNo());
if(CollectionUtils.isEmpty(freezeOrders)) {
AlipayFundAuthOrderUnfreezeRequest request = new AlipayFundAuthOrderUnfreezeRequest();
// request.setNotifyUrl("https://yxw.wsdns.cn/api/shop/freeze-order/notify");
request.setNotifyUrl("http://1.14.132.108:10090/api/shop/freeze-order/notify");
request.setNotifyUrl("https://yxw.wsdns.cn/api/shop/freeze-order/notify");
// request.setNotifyUrl("http://1.14.132.108:10090/api/shop/freeze-order/notify");
JSONObject bizContent = new JSONObject();
bizContent.put("auth_no", item.getAuthNo());
bizContent.put("auth_no", "2023102510002001070541674772");
bizContent.put("out_request_no", IdUtil.getSnowflakeNextId());
bizContent.put("amount", item.getAmount());
bizContent.put("amount", "300.00");
// bizContent.put("amount", .99);
bizContent.put("remark", "解冻资金");
@@ -346,8 +342,6 @@ public class TestMain {
} else {
System.out.println("调用失败");
}
}
});
}
}