最后更新的代码
This commit is contained in:
@@ -166,7 +166,7 @@ public class OrderTask {
|
|||||||
|
|
||||||
orderPayService.save(newRenewOrder);
|
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);
|
long between = DateUtil.between(item.getStartTime(), now, DateUnit.DAY);
|
||||||
if (item.getExpirationDay() != between) {
|
if (item.getExpirationDay() != between) {
|
||||||
// 更新逾期时间
|
// 更新逾期时间
|
||||||
@@ -195,13 +195,14 @@ public class OrderTask {
|
|||||||
/**
|
/**
|
||||||
* 计算分润
|
* 计算分润
|
||||||
*/
|
*/
|
||||||
// @Scheduled(cron="0 0/1 * * * ? ")
|
@Scheduled(cron="0 0/1 * * * ? ")
|
||||||
@Transactional
|
@Transactional
|
||||||
public void CalcProfit() {
|
public void CalcProfit() {
|
||||||
log.info("开始计算分润");
|
log.info("开始计算分润");
|
||||||
// 查询所有未结算订单
|
// 查询所有未结算订单
|
||||||
LambdaQueryWrapper<OrderPay> wrapper = Wrappers.lambdaQuery(OrderPay.class)
|
LambdaQueryWrapper<OrderPay> wrapper = Wrappers.lambdaQuery(OrderPay.class)
|
||||||
.eq(OrderPay::getIsSettled, ORDER_SETTLED_NO)
|
.eq(OrderPay::getIsSettled, ORDER_SETTLED_NO)
|
||||||
|
.gt(OrderPay::getEquipmentId, 0)
|
||||||
.eq(OrderPay::getPayStatus, PAY_STATUS_SUCCESS);
|
.eq(OrderPay::getPayStatus, PAY_STATUS_SUCCESS);
|
||||||
|
|
||||||
List<OrderPay> orderList = orderPayService.list(wrapper);
|
List<OrderPay> orderList = orderPayService.list(wrapper);
|
||||||
@@ -317,7 +318,7 @@ public class OrderTask {
|
|||||||
}
|
}
|
||||||
Equipment equipment = equipmentMap.get(order.getEquipmentId());
|
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());
|
User touziUser = touziUserMap.get(equipment.getTouziUserId());
|
||||||
if (touziUser != null) {
|
if (touziUser != null) {
|
||||||
@@ -332,7 +333,7 @@ public class OrderTask {
|
|||||||
profitLog.setComments("投资设备:" + equipment.getEquipmentCode());
|
profitLog.setComments("投资设备:" + equipment.getEquipmentCode());
|
||||||
profitLog.setEquipmentCode(equipment.getEquipmentCode());
|
profitLog.setEquipmentCode(equipment.getEquipmentCode());
|
||||||
profitLog.setMerchantName(merchant.getMerchantName());
|
profitLog.setMerchantName(merchant.getMerchantName());
|
||||||
profitLog.setOrderSource(order.getGoodsId());
|
profitLog.setOrderSource(order.getOrderSource());
|
||||||
// profitLog.setIsRenew(order.getIsRenew());
|
// profitLog.setIsRenew(order.getIsRenew());
|
||||||
profitLogService.save(profitLog);
|
profitLogService.save(profitLog);
|
||||||
}
|
}
|
||||||
@@ -353,7 +354,7 @@ public class OrderTask {
|
|||||||
profitLog.setComments("推广收益:" + order.getUserId());
|
profitLog.setComments("推广收益:" + order.getUserId());
|
||||||
profitLog.setEquipmentCode(equipment.getEquipmentCode());
|
profitLog.setEquipmentCode(equipment.getEquipmentCode());
|
||||||
profitLog.setMerchantName(merchant.getMerchantName());
|
profitLog.setMerchantName(merchant.getMerchantName());
|
||||||
profitLog.setOrderSource(order.getGoodsId());
|
profitLog.setOrderSource(order.getOrderSource());
|
||||||
// profitLog.setIsRenew(order.getIsRenew());
|
// profitLog.setIsRenew(order.getIsRenew());
|
||||||
profitLogService.save(profitLog);
|
profitLogService.save(profitLog);
|
||||||
}
|
}
|
||||||
@@ -375,7 +376,7 @@ public class OrderTask {
|
|||||||
profitLog.setComments("门店收益:" + order.getMerchantCode());
|
profitLog.setComments("门店收益:" + order.getMerchantCode());
|
||||||
profitLog.setEquipmentCode(equipment.getEquipmentCode());
|
profitLog.setEquipmentCode(equipment.getEquipmentCode());
|
||||||
profitLog.setMerchantName(merchant.getMerchantName());
|
profitLog.setMerchantName(merchant.getMerchantName());
|
||||||
profitLog.setOrderSource(order.getGoodsId());
|
profitLog.setOrderSource(order.getOrderSource());
|
||||||
// profitLog.setIsRenew(order.getIsRenew());
|
// profitLog.setIsRenew(order.getIsRenew());
|
||||||
profitLogService.save(profitLog);
|
profitLogService.save(profitLog);
|
||||||
}
|
}
|
||||||
@@ -405,7 +406,7 @@ public class OrderTask {
|
|||||||
profitLog.setComments("区域经理收益:" + order.getMerchantCode());
|
profitLog.setComments("区域经理收益:" + order.getMerchantCode());
|
||||||
profitLog.setEquipmentCode(equipment.getEquipmentCode());
|
profitLog.setEquipmentCode(equipment.getEquipmentCode());
|
||||||
profitLog.setMerchantName(merchant.getMerchantName());
|
profitLog.setMerchantName(merchant.getMerchantName());
|
||||||
profitLog.setOrderSource(order.getGoodsId());
|
profitLog.setOrderSource(order.getOrderSource());
|
||||||
// profitLog.setIsRenew(order.getIsRenew());
|
// profitLog.setIsRenew(order.getIsRenew());
|
||||||
profitLogService.save(profitLog);
|
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);
|
LambdaUpdateWrapper<OrderPay> updateWrapper = Wrappers.lambdaUpdate(OrderPay.class).in(OrderPay::getId, orderIds).set(OrderPay::getIsSettled, 1);
|
||||||
orderService.update(updateWrapper);
|
orderPayService.update(updateWrapper);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,10 @@ import com.gxwebsoft.common.system.entity.User;
|
|||||||
import com.gxwebsoft.oa.service.IdcardService;
|
import com.gxwebsoft.oa.service.IdcardService;
|
||||||
import com.gxwebsoft.oa.vo.IdcardRespVO;
|
import com.gxwebsoft.oa.vo.IdcardRespVO;
|
||||||
import com.gxwebsoft.shop.entity.Order;
|
import com.gxwebsoft.shop.entity.Order;
|
||||||
|
import com.gxwebsoft.shop.entity.OrderPay;
|
||||||
import com.gxwebsoft.shop.entity.OrderRefund;
|
import com.gxwebsoft.shop.entity.OrderRefund;
|
||||||
import com.gxwebsoft.shop.param.OrderParam;
|
import com.gxwebsoft.shop.param.OrderParam;
|
||||||
|
import com.gxwebsoft.shop.service.OrderPayService;
|
||||||
import com.gxwebsoft.shop.service.OrderRefundService;
|
import com.gxwebsoft.shop.service.OrderRefundService;
|
||||||
import com.gxwebsoft.shop.service.OrderService;
|
import com.gxwebsoft.shop.service.OrderService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@@ -65,6 +67,9 @@ public class OpenEquipmentController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private OrderRefundService orderRefundService;
|
private OrderRefundService orderRefundService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OrderPayService orderPayService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IdcardService idcardService;
|
private IdcardService idcardService;
|
||||||
|
|
||||||
@@ -275,6 +280,8 @@ public class OpenEquipmentController extends BaseController {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
orderPayService.lambdaUpdate().set(OrderPay::getEquipmentId, one.getEquipmentId()).update();
|
||||||
return success("绑定成功");
|
return success("绑定成功");
|
||||||
}
|
}
|
||||||
return fail("绑定失败");
|
return fail("绑定失败");
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ public class OrderPayController extends BaseController {
|
|||||||
one.setMerchantName(order.getMerchantName());
|
one.setMerchantName(order.getMerchantName());
|
||||||
one.setOutRequestNo(order.getOutRequestNo());
|
one.setOutRequestNo(order.getOutRequestNo());
|
||||||
one.setBatteryRent(order.getBatteryRent());
|
one.setBatteryRent(order.getBatteryRent());
|
||||||
|
one.setOrderSource(order.getOrderSource());
|
||||||
if(order.getOrderSource() == 20) {
|
if(order.getOrderSource() == 20) {
|
||||||
// 每期还款+手续费
|
// 每期还款+手续费
|
||||||
one.setTotalPrice(eg.getRepayment().add(eg.getServiceCharges()));
|
one.setTotalPrice(eg.getRepayment().add(eg.getServiceCharges()));
|
||||||
|
|||||||
@@ -301,10 +301,7 @@ public class TestMain {
|
|||||||
public void close() throws AlipayApiException {
|
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;
|
DefaultAlipayClient alipayClient = null;
|
||||||
try {
|
try {
|
||||||
alipayClient = alipayConfig.alipayClient(6);
|
alipayClient = alipayConfig.alipayClient(6);
|
||||||
@@ -312,17 +309,16 @@ public class TestMain {
|
|||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
DefaultAlipayClient finalAlipayClient = alipayClient;
|
DefaultAlipayClient finalAlipayClient = alipayClient;
|
||||||
freeze.forEach(item -> {
|
|
||||||
List<FreezeOrder> freezeOrders = collect.get(item.getOutOrderNo());
|
|
||||||
if(CollectionUtils.isEmpty(freezeOrders)) {
|
|
||||||
|
|
||||||
AlipayFundAuthOrderUnfreezeRequest request = new AlipayFundAuthOrderUnfreezeRequest();
|
AlipayFundAuthOrderUnfreezeRequest request = new AlipayFundAuthOrderUnfreezeRequest();
|
||||||
// request.setNotifyUrl("https://yxw.wsdns.cn/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");
|
// request.setNotifyUrl("http://1.14.132.108:10090/api/shop/freeze-order/notify");
|
||||||
JSONObject bizContent = new JSONObject();
|
JSONObject bizContent = new JSONObject();
|
||||||
bizContent.put("auth_no", item.getAuthNo());
|
bizContent.put("auth_no", "2023102510002001070541674772");
|
||||||
bizContent.put("out_request_no", IdUtil.getSnowflakeNextId());
|
bizContent.put("out_request_no", IdUtil.getSnowflakeNextId());
|
||||||
bizContent.put("amount", item.getAmount());
|
bizContent.put("amount", "300.00");
|
||||||
// bizContent.put("amount", .99);
|
// bizContent.put("amount", .99);
|
||||||
bizContent.put("remark", "解冻资金");
|
bizContent.put("remark", "解冻资金");
|
||||||
|
|
||||||
@@ -346,8 +342,6 @@ public class TestMain {
|
|||||||
} else {
|
} else {
|
||||||
System.out.println("调用失败");
|
System.out.println("调用失败");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user