|
|
@@ -2,12 +2,18 @@ package com.travel.config;
|
|
|
|
|
|
import com.travel.model.*;
|
|
|
import com.travel.service.*;
|
|
|
+import com.travel.util.AmountUtil;
|
|
|
import com.travel.util.SnowflakeUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
+import org.springframework.scheduling.TaskScheduler;
|
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
+import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -40,6 +46,17 @@ public class SaticScheduleTask {
|
|
|
@Autowired
|
|
|
private CommissionService commissionService;
|
|
|
|
|
|
+ /**
|
|
|
+ * 定时任务线程自定义
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Bean
|
|
|
+ public TaskScheduler taskScheduler() {
|
|
|
+ ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
|
|
|
+ taskScheduler.setPoolSize(50);
|
|
|
+ return taskScheduler;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 定时删除无效用户 每月底23:59触发方法
|
|
|
*/
|
|
|
@@ -132,26 +149,35 @@ public class SaticScheduleTask {
|
|
|
public void updatePrivateFourSomeFarm(){
|
|
|
//查询那些行程结束且已到达给供应商付款的时间的定制单
|
|
|
List<PrivateOrder> list1 = privateOrderService.updatePrivateFourSomeFarm();
|
|
|
- for(PrivateOrder privateOrder2 : list1){
|
|
|
+ for (PrivateOrder privateOrder2 : list1) {
|
|
|
PrivateOrder privateOrder3 = new PrivateOrder().setUuid(privateOrder2.getUuid()).setSupplieName(privateOrder2.getSupplieName());
|
|
|
Release release = privateOrderService.getReleaseVal(privateOrder3);//查询报价单编号
|
|
|
Map<String, Object> mapPay = wxPayService.getPay(release.getUuid());//查询付款信息
|
|
|
Map<String, Object> mapRefund = wxPayService.getRefund(release.getUuid());//查询退款信息
|
|
|
Map<String, Object> mapCommis = indexService.getSitesInfo();//查询系统配置
|
|
|
//支付金额 - 退款金额
|
|
|
- Double price = Double.parseDouble((String) mapPay.get("totalFee")) - Double.parseDouble((String) mapRefund.get("refundFee"));
|
|
|
+ BigDecimal totalFee = new BigDecimal("0");
|
|
|
+ BigDecimal refundFee = new BigDecimal("0");
|
|
|
+ //可能支付或退款返回是null 这里做特殊处理 默认都是0
|
|
|
+ if(null != mapPay){
|
|
|
+ totalFee = new BigDecimal(String.valueOf(mapPay.get("total_fee")));
|
|
|
+ }
|
|
|
+ if(null != mapRefund){
|
|
|
+ refundFee = new BigDecimal(String.valueOf(mapRefund.get("refund_fee")));
|
|
|
+ }
|
|
|
+ BigDecimal price = AmountUtil.moneySub(totalFee, refundFee);
|
|
|
//手续费
|
|
|
- Double poundage = price * Double.parseDouble((String) mapCommis.get("percentageFee"));
|
|
|
+ String poundage = AmountUtil.moneyMul(String.valueOf(price), String.valueOf(mapCommis.get("percentage_fee")));
|
|
|
//实际金额 - 手续费 = 供应商收入
|
|
|
- price = price - poundage;
|
|
|
+ price = new BigDecimal(AmountUtil.moneySub(String.valueOf(price), poundage));
|
|
|
Supplier supplier = new Supplier()
|
|
|
- .setBalanceOf(price + "")
|
|
|
+ .setBalanceOf(String.valueOf(price))
|
|
|
.setCode(privateOrder2.getSupplieName());
|
|
|
//佣金对象
|
|
|
Commission commission = new Commission()
|
|
|
.setReleaseUuid(release.getUuid())
|
|
|
.setUuid(snowflakeUtil.nextId() + "")
|
|
|
- .setCommission((poundage * Double.parseDouble((String) mapCommis.get("percentageBrokerage"))) + "")
|
|
|
+ .setCommission(AmountUtil.moneyMul(poundage, String.valueOf(mapCommis.get("percentage_brokerage"))))
|
|
|
.setCode(privateOrder2.getTravelUser());
|
|
|
commissionService.addCommiss(commission);//新增反佣金记录
|
|
|
loginService.updateEntryBlanceOf(commission);//佣金录入个人用户账号
|