Procházet zdrojové kódy

去掉旧业务增加已缴费

qzyReal před 3 roky
rodič
revize
e557002f68

+ 61 - 0
sp-server/src/main/java/com/pj/api/jh/service/TestTask.java

@@ -0,0 +1,61 @@
+package com.pj.api.jh.service;
+
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
+import cn.hutool.log.StaticLog;
+import com.pj.api.wx.bo.Attach;
+import com.pj.project.tb_business.TbBusiness;
+import com.pj.project.tb_business.TbBusinessService;
+import com.pj.project.tb_business_car.TbBusinessCar;
+import com.pj.project.tb_business_car.TbBusinessCarService;
+import com.pj.project.tb_fee_details.TbFeeDetails;
+import com.pj.project.tb_fee_details.TbFeeDetailsService;
+import com.pj.project.tb_order.TbOrder;
+import com.pj.project.tb_order.TbOrderService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+//@Component
+//@Slf4j
+public class TestTask {
+
+    @Resource
+    private TbBusinessCarService tbBusinessCarService;
+
+    @Resource
+    private TbBusinessService tbBusinessService;
+    @Resource
+    private TbFeeDetailsService tbFeeDetailsService;
+
+
+    @Resource
+    private JhService jhService;
+
+    @Resource
+    private TbOrderService tbOrderService;
+
+//    @Scheduled(fixedDelay = 20000)
+    public void test() {
+        List<TbOrder> orderList = tbOrderService.list();
+        List<String> bIds = new ArrayList<>();
+        orderList.stream().filter(tbOrder -> !tbOrder.getOrderStatus().equals("SUCCESS")).forEach(tbOrder -> {
+          JSONObject result= jhService.checkPayResult(tbOrder.getOutTradeNo());
+          StaticLog.error("info:{}",JSONUtil.toJsonStr(result));
+            Attach attach = JSONUtil.toBean(tbOrder.getAttach(), Attach.class);
+            StrUtil.splitTrim(attach.getB(), ",").forEach(id -> {
+                if (bIds.contains(id)) {
+                    System.out.println(id);
+                }
+                bIds.add(id);
+            });
+        });
+    }
+}

+ 0 - 6
sp-server/src/main/java/com/pj/api/wx/service/WxService.java

@@ -242,12 +242,6 @@ public class WxService {
                 }
                 car.setPay(1).setMoney(car.getMoney().add(price)).setPayTime(payTime).setPayType(TbBusinessCar.PayTypeEnum.HAS_PAY_TYPE.getType());
                 tbBusinessCarService.updateById(car);
-                TbBusiness business = tbBusinessService.getById(car.getBusinessId());
-                if (business != null) {
-                    business.setPayMoney(business.getPayMoney().add(price));
-                    business.setPayStatus(business.getPayMoney().equals(business.getItemPrice()) ? 3 : 4);
-                    tbBusinessService.updateById(business);
-                }
             }
             tbFeeDetailsService.chargeParkFee(cars, transactionId, outTradeNo);//添加cars的收费明细
             String businessId = attach.getB();

+ 7 - 1
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java

@@ -461,7 +461,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     public Map<String, Object> getBusinessMoney(String businessCarId, String state) {
         Map<String, Object> result = new HashMap<>();
         List<TbBusiness> businessList = this.findOtherBusinessByCarId(businessCarId);
-        businessList=businessList.stream().filter(tbBusiness -> 3 != tbBusiness.getPayStatus()).collect(Collectors.toList());
+        businessList=businessList.stream().filter(tbBusiness -> 3 > tbBusiness.getPayStatus()).collect(Collectors.toList());
         Set<TbBusinessCar> cars = new HashSet<>();
         //越南车是否需要支付
         int vietnamCarPay = businessList.stream().anyMatch(tbBusiness -> {
@@ -984,4 +984,10 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         List<TbBusiness> list = this.list(ew);
         return list.isEmpty() ? null : list.get(0);
     }
+
+    public List<TbBusiness> getPay(String day) {
+        QueryWrapper<TbBusiness> ew = new QueryWrapper<>();
+        ew.eq("date_format(pay_time,'%Y-%m-%d')",day).orderByDesc("id");
+        return this.list(ew);
+    }
 }

+ 7 - 0
sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarService.java

@@ -403,4 +403,11 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
     public CarStatics staticsCar() {
         return tbBusinessCarMapper.staticsCar(TbItem.ItemTypeEnum.WEIGHT_TYPE.getType(),TbItem.ItemTypeEnum.EMPTY_TYPE.getType());
     }
+
+    public List<TbBusinessCar> getPay(String day) {
+        QueryWrapper<TbBusinessCar>ew=new QueryWrapper<>();
+        ew.eq("pay",1);
+        ew.eq("date_format(pay_time,'%Y-%m-%d')",day);
+        return list(ew);
+    }
 }

+ 6 - 0
sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetailsService.java

@@ -574,4 +574,10 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
 
         return tbFeeDetailsMapper.getTotalMoney(so);
     }
+
+    public List<TbFeeDetails> findByBusinessNo(String businessNo) {
+        QueryWrapper<TbFeeDetails>ew=new QueryWrapper<>();
+        ew.eq("business_no",businessNo);
+       return list(ew);
+    }
 }

+ 2 - 2
sp-server/src/main/resources/application-dev.yml

@@ -6,9 +6,9 @@ spring:
     # 数据源配置
     datasource:
         type: com.alibaba.druid.pool.DruidDataSource
-        url: jdbc:mysql://47.101.143.145:3306/pco?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
+        url: jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
         username: root
-        password: 1qaz@WSX
+        password: 123456
         # 是否打开sql监控台  (生产环境请务必关闭此选项)
         druid:
             stat-view-servlet: