Pārlūkot izejas kodu

feat: 售后修复

xdd 16 stundas atpakaļ
vecāks
revīzija
b2edd84313

+ 979 - 5
fs-admin/src/test/java/com/fs/store/controller/FsStorePaymentControllerTest.java

@@ -1,24 +1,34 @@
 package com.fs.store.controller;
 
+import com.alibaba.fastjson.JSON;
 import com.fs.FSAdminApplication;
 import com.fs.common.core.domain.R;
 import com.fs.common.exception.CustomException;
 import com.fs.huifuPay.dto.*;
-import com.fs.store.domain.FsCouponSchedule;
-import com.fs.store.domain.FsMiniprogramSubNotifyTask;
-import com.fs.store.domain.FsStorePayment;
-import com.fs.store.domain.TzConfigInfoDTO;
+import com.fs.pay.pay.domain.OrderResult;
+import com.fs.pay.pay.dto.OrderQueryDTO;
+import com.fs.pay.pay.service.PayService;
+import com.fs.store.domain.*;
 import com.fs.store.enums.IcgProcessStatusEnum;
 import com.fs.store.mapper.FsMiniprogramSubNotifyTaskMapper;
+import com.fs.store.mapper.FsStoreDeliversMapper;
+import com.fs.store.mapper.FsStoreOrderMapper;
+import com.fs.store.mapper.FsStorePaymentMapper;
 import com.fs.store.service.IFsCouponScheduleService;
 import com.fs.store.service.IFsStorePaymentService;
+import com.fs.store.service.channel.YbPaymentHandler;
+import com.fs.store.service.channel.param.PayProcessContext;
+import com.fs.system.service.ISysConfigService;
 import com.fs.task.ExpressTask;
 import com.fs.task.MiniProgramSubTask;
 import com.fs.task.StoreTask;
 import com.fs.tzBank.TzBankService;
 import com.fs.tzBank.utils.TzConfigUtils;
+import com.fs.wx.domain.FsWxExpressTask;
+import com.fs.wx.mapper.FsWxExpressTaskMapper;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -32,8 +42,10 @@ import org.springframework.test.context.junit4.SpringRunner;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.time.LocalDateTime;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.Date;
+import java.util.List;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest(classes = FSAdminApplication.class)
@@ -50,6 +62,947 @@ public class FsStorePaymentControllerTest {
     @Autowired
     IFsStorePaymentService fsStorePaymentService;
 
+    @Autowired
+    FsStorePaymentMapper fsStorePaymentMapper;
+
+    @Autowired
+    PayService payService;
+
+    @Autowired
+    private FsWxExpressTaskMapper fsWxExpressTaskMapper;
+
+    @Autowired
+    private FsStoreDeliversMapper fsStoreDeliversMapper;
+
+    @Autowired
+    private FsStoreOrderMapper fsStoreOrderMapper;
+
+    /**
+     * 补事务id
+     */
+    @Test
+    public void fixTransactionNull(){
+        List<FsStorePayment> list = fsStorePaymentMapper.queryNormalData();
+        for (FsStorePayment fsStorePayment : list) {
+            String json = configService.selectConfigByKey("store.pay");
+            FsPayConfig fsPayConfig = JSON.parseObject(json, FsPayConfig.class);
+            OrderQueryDTO orderQueryDTO = new OrderQueryDTO();
+            orderQueryDTO.setAccount(fsPayConfig.getYbAccount());
+            orderQueryDTO.setUpOrderId(fsStorePayment.getTradeNo());
+            OrderResult order = payService.getOrder(orderQueryDTO);
+            if(order != null) {
+                fsStorePayment.setBankTransactionId(order.getBankTrxId());
+            }
+
+            fsStorePaymentMapper.updateFsStorePayment(fsStorePayment);
+        }
+    }
+
+    /**
+     * 修复微信发货
+     */
+    @Test
+    public void fixWxExpress(){
+        List<String> bankTrxIds = Arrays.asList(
+                "4200002720202506077978988641",
+                "4200002645202506070470882166",
+                "4200002740202506071680592135",
+                "4200002644202506077185324063",
+                "4200002645202506073421159997",
+                "4200002725202506070903535144",
+                "4200002721202506074099363854",
+                "4200002731202506079075619809",
+                "4200002661202506077381060248",
+                "4200002647202506078512678419",
+                "4200002723202506076858630267",
+                "4200002662202506067276982964",
+                "4200002740202506062183325772",
+                "4200002743202506061807681167",
+                "4200002666202506068424818830",
+                "4200002737202506062549196528",
+                "4200002734202506066265161290",
+                "4200002637202506068021822950",
+                "4200002635202506064048856987",
+                "4200002734202506063849257496",
+                "4200002725202506061449646691",
+                "4200002742202506065790078218",
+                "4200002633202506066549210352",
+                "4200002649202506063412728760",
+                "4200002735202506062635252502",
+                "4200002644202506065578036424",
+                "4200002655202506062241247154",
+                "4200002726202506066460593069",
+                "4200002649202506068149359275",
+                "4200002744202506060617875280",
+                "4200002719202506069717790050",
+                "4200002668202506062317953098",
+                "4200002644202506069563641253",
+                "4200002661202506063127739743",
+                "4200002738202506065512671841",
+                "4200002718202506062121093498",
+                "4200002738202506066259224799",
+                "4200002733202506064585937202",
+                "4200002737202506065246846028",
+                "4200002719202506065608398651",
+                "4200002639202506069889353279",
+                "4200002721202506060448557667",
+                "4200002667202506066245549650",
+                "4200002723202506068575044198",
+                "4200002653202506062523617667",
+                "4200002728202506061543627466",
+                "4200002650202506065615240014",
+                "4200002723202506063276538996",
+                "4200002722202506065887932239",
+                "4200002738202506060745399694",
+                "4200002730202506063279438976",
+                "4200002736202506067675598376",
+                "4200002722202506066848254166",
+                "4200002720202506064821287818",
+                "4200002667202506066590223760",
+                "4200002634202506064133048305",
+                "4200002635202506068766741346",
+                "4200002735202506061833053261",
+                "4200002654202506068929881962",
+                "4200002645202506065113338987",
+                "4200002655202506063518382190",
+                "4200002737202506068339467124",
+                "4200002726202506064422562229",
+                "4200002725202506062434721603",
+                "4200002653202506064701136194",
+                "4200002731202506066885690028",
+                "4200002659202506069143205093",
+                "4200002634202506064795117358",
+                "4200002719202506066230792859",
+                "4200002640202506068999717662",
+                "4200002664202506063685252806",
+                "4200002743202506068349880637",
+                "4200002650202506065252073833",
+                "4200002656202506067307655446",
+                "4200002662202506062645258603",
+                "4200002640202506066606768474",
+                "4200002665202506068121157253",
+                "4200002718202506065080998534",
+                "4200002649202506067727722648",
+                "4200002635202506066601527073",
+                "4200002717202506067280009687",
+                "4200002659202506066240780316",
+                "4200002638202506063771002672",
+                "4200002665202506066330650837",
+                "4200002658202506064240074463",
+                "4200002637202506067106192414",
+                "4200002651202506062153015046",
+                "4200002744202506064964196324",
+                "4200002725202506060119673538",
+                "4200002662202506064121184309",
+                "4200002650202506061720340127",
+                "4200002736202506057802581478",
+                "4200002721202506057902801131",
+                "4200002660202506052210215774",
+                "4200002652202506050850240609",
+                "4200002723202506051268823056",
+                "4200002654202506056195496615",
+                "4200002743202506040103405295",
+                "4200002667202506041765566723",
+                "4200002667202506041794591863",
+                "4200002729202506040025279573",
+                "4200002742202506047753414644",
+                "4200002646202506049909053988",
+                "4200002656202506047565380731",
+                "4200002661202506047170762307",
+                "4200002648202506049772535282",
+                "4200002735202506043209522924",
+                "4200002663202506043785994301",
+                "4200002741202506040618595222",
+                "4200002726202506049629284962",
+                "4200002733202506047676315276",
+                "4200002719202506042113553282",
+                "4200002717202506044669102518",
+                "4200002644202506031196471261",
+                "4200002644202506034516480769",
+                "4200002642202506039907038183",
+                "4200002727202506032063319585",
+                "4200002720202506030660817994",
+                "4200002726202506039828637940",
+                "4200002635202506031802768000",
+                "4200002639202506032663828806",
+                "4200002740202506037139463840",
+                "4200002636202506033722375221",
+                "4200002718202506030635984285",
+                "4200002667202506039905548458",
+                "4200002638202506036507960564",
+                "4200002730202506037085924940",
+                "4200002651202506034473256793",
+                "4200002636202506033098724196",
+                "4200002664202506039181649007",
+                "4200002644202506034315884863",
+                "4200002726202506034294478099",
+                "4200002726202506038017938568",
+                "4200002656202506030748864618",
+                "4200002733202506031545911066",
+                "4200002634202506031911947577",
+                "4200002653202506032450528022",
+                "4200002636202506036542939338",
+                "4200002642202506033189781635",
+                "4200002736202506038418168960",
+                "4200002641202506033138673447",
+                "4200002646202506036991679363",
+                "4200002651202506039374728907",
+                "4200002661202506033195993071",
+                "4200002645202506034738533179",
+                "4200002657202506031103433441",
+                "4200002733202506033434228345",
+                "4200002644202506035839688417",
+                "4200002734202506037911214201",
+                "4200002741202506035615655640",
+                "4200002652202506032250143306",
+                "4200002732202506034382848130",
+                "4200002743202506038628725101",
+                "4200002727202506034267794614",
+                "4200002738202506030748493175",
+                "4200002722202506033661586784",
+                "4200002667202506039478688381",
+                "4200002732202506032992587344",
+                "4200002742202506039692858762",
+                "4200002722202506032775548998",
+                "4200002725202506031078797066",
+                "4200002642202506034332127808",
+                "4200002742202506034717232135",
+                "4200002656202506034465947829",
+                "4200002725202506037156486981",
+                "4200002735202506036396063921",
+                "4200002735202506033640484340",
+                "4200002649202506035429627078",
+                "4200002662202506035840925703",
+                "4200002721202506033698846913",
+                "4200002744202506037595341651",
+                "4200002723202506038186931750",
+                "4200002645202506038938720546",
+                "4200002667202506038347229211",
+                "4200002657202506035152897917",
+                "4200002652202506038408142735",
+                "4200002661202506031572208018",
+                "4200002735202506035628252279",
+                "4200002741202506034317829127",
+                "4200002744202506030987960508",
+                "4200002726202506036001301239",
+                "4200002734202506038963466291",
+                "4200002724202506035628498018",
+                "4200002727202506035871982704",
+                "4200002659202506037075133085",
+                "4200002635202506036927813683",
+                "4200002647202506039092748170",
+                "4200002717202506039589966303",
+                "4200002722202506033444162677",
+                "4200002722202506038666508537",
+                "4200002644202506031631074119",
+                "4200002648202506030536210294",
+                "4200002642202506034829694154",
+                "4200002648202506035454082125",
+                "4200002741202506032777600144",
+                "4200002637202506033406308352",
+                "4200002728202506034259245207",
+                "4200002727202506034435519745",
+                "4200002720202506031729906812",
+                "4200002644202506030044626140",
+                "4200002637202506038321358232",
+                "4200002736202506030768145614",
+                "4200002730202506031789117230",
+                "4200002731202506034992881512",
+                "4200002732202506033515080295",
+                "4200002727202506039805650020",
+                "4200002654202506036711513328",
+                "4200002642202506035431885840",
+                "4200002733202506037317196944",
+                "4200002667202506033033138256",
+                "4200002633202506039307922723",
+                "4200002644202506036634517171",
+                "4200002738202506034551352619",
+                "4200002732202506037902499563",
+                "4200002731202506033442431597",
+                "4200002732202506033400241662",
+                "4200002636202506036956774317",
+                "4200002648202506032675814538",
+                "4200002725202506030587801189",
+                "4200002727202506037752420906",
+                "4200002646202506030431426956",
+                "4200002722202506035167990254",
+                "4200002741202506035058396769",
+                "4200002725202506035151511070",
+                "4200002722202506036388015605",
+                "4200002729202506031826510492",
+                "4200002656202506031959726178",
+                "4200002717202506032981248715",
+                "4200002646202506035253762843",
+                "4200002721202506031933398525",
+                "4200002718202506036946120513",
+                "4200002652202506034870081304",
+                "4200002657202506037293700147",
+                "4200002653202506035311473575",
+                "4200002736202506034305692239",
+                "4200002732202506034404409744",
+                "4200002731202506036674597605",
+                "4200002659202506032653057075",
+                "4200002651202506039499124770",
+                "4200002661202506033722376506",
+                "4200002720202506023775034445",
+                "4200002739202506022396903555",
+                "4200002733202506029943366015",
+                "4200002741202506024264722507",
+                "4200002654202506025963623049",
+                "4200002660202506025278963001",
+                "4200002643202506022162148652",
+                "4200002661202506020885994712",
+                "4200002738202506026184853622",
+                "4200002642202506021639778535",
+                "4200002726202506023609567850",
+                "4200002662202506024747935557",
+                "4200002660202506025084342755",
+                "4200002733202506027526014224",
+                "4200002662202506025259334131",
+                "4200002728202506023971638555",
+                "4200002656202506024342346272",
+                "4200002661202506029019696048",
+                "4200002719202506021192218530",
+                "4200002737202506020030597819",
+                "4200002648202506025541850080",
+                "4200002651202506022554698193",
+                "4200002663202506020302814952",
+                "4200002739202506026599259313",
+                "4200002642202506021648469040",
+                "4200002719202506021446542546",
+                "4200002723202506020615986565",
+                "4200002742202506027373423269",
+                "4200002650202506027151418890",
+                "4200002644202506025416835970",
+                "4200002664202506024388025031",
+                "4200002641202506029561940800",
+                "4200002655202506024389031108",
+                "4200002731202506021956653770",
+                "4200002641202506026932000380",
+                "4200002727202506023611490654",
+                "4200002735202506028408004155",
+                "4200002735202506026695087119",
+                "4200002730202506025397316676",
+                "4200002660202506020910567881",
+                "4200002653202506027307217116",
+                "4200002721202506024445630356",
+                "4200002652202506024010551346",
+                "4200002648202506023289219444",
+                "4200002741202506026967904119",
+                "4200002722202506029588030737",
+                "4200002651202506025106819865",
+                "4200002653202506020264676160",
+                "4200002652202506023056600978",
+                "4200002644202506027802972979",
+                "4200002741202506022271309943",
+                "4200002732202506027246756345",
+                "4200002733202506027187004978",
+                "4200002741202506022205273189",
+                "4200002648202506027593457176",
+                "4200002719202506023302392297",
+                "4200002732202506023293377953",
+                "4200002664202506024586041284",
+                "4200002744202506025567276168",
+                "4200002735202506025381022396",
+                "4200002635202506022408303255",
+                "4200002731202506023986191902",
+                "4200002640202506020277878748",
+                "4200002736202506027940959738",
+                "4200002727202506021947493873",
+                "4200002656202506021587359974",
+                "4200002727202506027570199632",
+                "4200002657202506025715817658",
+                "4200002720202506025869867021",
+                "4200002729202506028340306290",
+                "4200002721202506026605821635",
+                "4200002644202506024521655380",
+                "4200002639202506029271227681",
+                "4200002652202506028438900688",
+                "4200002662202506029654372595",
+                "4200002642202506023251306536",
+                "4200002642202506027679045225",
+                "4200002653202506023925682854",
+                "4200002734202506025299791464",
+                "4200002656202506021715903383",
+                "4200002655202506028288988801",
+                "4200002648202506022558434221",
+                "4200002742202506029965722659",
+                "4200002737202506020343318936",
+                "4200002652202506029576682315",
+                "4200002641202506022868913716",
+                "4200002653202506022225880111",
+                "4200002738202506029055840708",
+                "4200002730202506025929338296",
+                "4200002721202506020465371338",
+                "4200002639202506022007031112",
+                "4200002730202506015833084387",
+                "4200002724202506011415875957",
+                "4200002741202506010225429295",
+                "4200002720202505318926638602",
+                "4200002647202505306223604082",
+                "4200002731202505297469535491",
+                "4200002667202505296263452797",
+                "4200002668202505284960560898",
+                "4200002641202505263461436209",
+                "4200002721202505268011239814",
+                "4200002737202505268760163362",
+                "4200002656202505250482230519",
+                "4200002634202505259512383515",
+                "4200002653202505259152342388",
+                "4200002736202505258587681943",
+                "4200002665202505254235013985",
+                "4200002645202505257865292035",
+                "4200002656202505259944294604",
+                "4200002717202505251997827939",
+                "4200002659202505252011643840",
+                "4200002737202505250779088323",
+                "4200002663202505252623082307",
+                "4200002646202505255926837720",
+                "4200002723202505253726241027",
+                "4200002658202505250143245067",
+                "4200002742202505259590202977",
+                "4200002656202505255884316773",
+                "4200002634202505256184602390",
+                "4200002733202505253154579350",
+                "4200002739202505258541375338",
+                "4200002647202505254765330093",
+                "4200002720202505251691554237",
+                "4200002640202505256912654694",
+                "4200002724202505256802983382",
+                "4200002640202505259791787645",
+                "4200002738202505258132919130",
+                "4200002634202505254537500397",
+                "4200002652202505259854770295",
+                "4200002719202505250077368880",
+                "4200002651202505250235109517",
+                "4200002658202505252437471377",
+                "4200002657202505257330007586",
+                "4200002725202505258937742457",
+                "4200002650202505252071014433",
+                "4200002663202505251883358706",
+                "4200002659202505255124477718",
+                "4200002664202505257614347717",
+                "4200002651202505250939719172",
+                "4200002646202505251560626081",
+                "4200002641202505250083250309",
+                "4200002650202505251655003721",
+                "4200002647202505257827265427",
+                "4200002655202505256337810254",
+                "4200002663202505257579584231",
+                "4200002646202505255274361024",
+                "4200002655202505250601410103",
+                "4200002740202505253703706971",
+                "4200002741202505254809146292",
+                "4200002728202505255749715635",
+                "4200002656202505259351273952",
+                "4200002633202505259586237258",
+                "4200002655202505252074337747",
+                "4200002731202505250616051982",
+                "4200002740202505252063941917",
+                "4200002635202505258653829991",
+                "4200002658202505257767625251",
+                "4200002652202505251112432064",
+                "4200002638202505250360431636",
+                "4200002641202505255439167797",
+                "4200002666202505254406388805",
+                "4200002717202505250768614930",
+                "4200002641202505250464373718",
+                "4200002633202505254312860343",
+                "4200002728202505244265878328",
+                "4200002664202505242773011850",
+                "4200002741202505241114521297",
+                "4200002732202505245993785614",
+                "4200002732202505245599074133",
+                "4200002666202505244446703074",
+                "4200002739202505243838155751",
+                "4200002721202505240366803329",
+                "4200002662202505243508429261",
+                "4200002742202505243816773525",
+                "4200002663202505240829386469",
+                "4200002640202505240992456576",
+                "4200002654202505247381863096",
+                "4200002648202505241204252465",
+                "4200002744202505240905345943",
+                "4200002718202505243504715075",
+                "4200002634202505242669857616",
+                "4200002633202505249158849974",
+                "4200002660202505244821896482",
+                "4200002739202505245717047946",
+                "4200002638202505247975035202",
+                "4200002720202505243592959951",
+                "4200002660202505243223171117",
+                "4200002743202505241053797071",
+                "4200002639202505247505454733",
+                "4200002633202505244431079687",
+                "4200002736202505243517666886",
+                "4200002639202505247394516105",
+                "4200002634202505248994959880",
+                "4200002660202505249368636760",
+                "4200002729202505243173468431",
+                "4200002638202505249055096843",
+                "4200002665202505242471119637",
+                "4200002652202505244927624753",
+                "4200002725202505248237894706",
+                "4200002733202505243817950286",
+                "4200002723202505240570154553",
+                "4200002744202505246047765484",
+                "4200002653202505249674402110",
+                "4200002662202505246844195919",
+                "4200002649202505241099620902",
+                "4200002660202505247423779018",
+                "4200002735202505244511829210",
+                "4200002665202505248479334596",
+                "4200002742202505248798445454",
+                "4200002729202505246523885396",
+                "4200002653202505246230126732",
+                "4200002639202505249745365447",
+                "4200002654202505240186313152",
+                "4200002719202505245315764791",
+                "4200002725202505245630732978",
+                "4200002656202505242577092600",
+                "4200002658202505249837161596",
+                "4200002644202505248429401838",
+                "4200002663202505246519083707",
+                "4200002726202505246442114081",
+                "4200002649202505248988734030",
+                "4200002646202505247656653520",
+                "4200002664202505246642975043",
+                "4200002735202505242343438888",
+                "4200002637202505244737487197",
+                "4200002660202505243631733489",
+                "4200002668202505243276433084",
+                "4200002651202505240776615731",
+                "4200002662202505240593375311",
+                "4200002639202505245821217612",
+                "4200002644202505241868869674",
+                "4200002731202505245286756273",
+                "4200002729202505244876650833",
+                "4200002737202505243788642015",
+                "4200002728202505244026624095",
+                "4200002645202505240660461690",
+                "4200002637202505248688721654",
+                "4200002721202505248668980961",
+                "4200002645202505246584022895",
+                "4200002727202505241649208321",
+                "4200002653202505241039850945",
+                "4200002668202505243019857956",
+                "4200002741202505244292458153",
+                "4200002733202505247947114161",
+                "4200002637202505245770719510",
+                "4200002641202505249267778782",
+                "4200002646202505244633099592",
+                "4200002633202505246748271004",
+                "4200002722202505241262827547",
+                "4200002726202505246918762586",
+                "4200002644202505241172146296",
+                "4200002732202505247277102683",
+                "4200002732202505245198474681",
+                "4200002638202505241818850750",
+                "4200002661202505244116265616",
+                "4200002645202505245615833297",
+                "4200002655202505248059704573",
+                "4200002732202505245625786463",
+                "4200002725202505247218848556",
+                "4200002645202505245452736917",
+                "4200002634202505244655981054",
+                "4200002653202505249213959459",
+                "4200002726202505240907236237",
+                "4200002722202505241103663647",
+                "4200002738202505249308915023",
+                "4200002646202505240433753712",
+                "4200002734202505244335437807",
+                "4200002728202505244025595430",
+                "4200002740202505240489178396",
+                "4200002635202505249819120255",
+                "4200002643202505241348542596",
+                "4200002735202505248325902060",
+                "4200002666202505248572521505",
+                "4200002634202505244051620729",
+                "4200002645202505245751734640",
+                "4200002668202505247699985114",
+                "4200002635202505241584943960",
+                "4200002634202505242345669849",
+                "4200002649202505243340469368",
+                "4200002666202505246357344824",
+                "4200002667202505241476644865",
+                "4200002644202505244191787266",
+                "4200002720202505246586938540",
+                "4200002726202505248102244217",
+                "4200002724202505242279227503",
+                "4200002647202505241253569676",
+                "4200002719202505244599899408",
+                "4200002735202505243112026549",
+                "4200002737202505247497138042",
+                "4200002651202505241386199483",
+                "4200002640202505242868355852",
+                "4200002646202505247985099007",
+                "4200002652202505242504045808",
+                "4200002731202505240010913949",
+                "4200002666202505240712275248",
+                "4200002654202505245232640059",
+                "4200002653202505245259743255",
+                "4200002648202505240479073897",
+                "4200002663202505242404898224",
+                "4200002722202505245183398397",
+                "4200002643202505249665405157",
+                "4200002732202505245809864676",
+                "4200002665202505248540878206",
+                "4200002656202505242115166418",
+                "4200002723202505248589932656",
+                "4200002653202505249039881340",
+                "4200002657202505243190316124",
+                "4200002645202505248988871818",
+                "4200002648202505243087971726",
+                "4200002659202505236131327295",
+                "4200002662202505239768837762",
+                "4200002647202505235970703003",
+                "4200002664202505236217125770",
+                "4200002733202505235270683191",
+                "4200002647202505232099836779",
+                "4200002654202505233232589816",
+                "4200002736202505236183233024",
+                "4200002652202505235388771050",
+                "4200002721202505233680782035",
+                "4200002633202505239443246349",
+                "4200002635202505233852003308",
+                "4200002658202505235093009119",
+                "4200002664202505239412645374",
+                "4200002718202505231579290198",
+                "4200002656202505237777777172",
+                "4200002638202505237929310436",
+                "4200002665202505233732286434",
+                "4200002742202505235875874438",
+                "4200002742202505236444901253",
+                "4200002743202505235120016842",
+                "4200002635202505231348344970",
+                "4200002652202505233431545031",
+                "4200002721202505235059487345",
+                "4200002726202505233304205707",
+                "4200002719202505230099844839",
+                "4200002666202505231208223183",
+                "4200002719202505238153220768",
+                "4200002736202505231937837157",
+                "4200002648202505236935575847",
+                "4200002650202505235648869696",
+                "4200002653202505230661319129",
+                "4200002634202505239503011847",
+                "4200002742202505233469414067",
+                "4200002639202505237637373686",
+                "4200002717202505237127845706",
+                "4200002653202505236846051434",
+                "4200002657202505236318852217",
+                "4200002642202505238747412515",
+                "4200002734202505232265047839",
+                "4200002721202505239178205258",
+                "4200002659202505232860178937",
+                "4200002653202505230545439864",
+                "4200002636202505236326095973",
+                "4200002640202505234836374417",
+                "4200002651202505239806074421",
+                "4200002719202505236825454621",
+                "4200002740202505233678031049",
+                "4200002739202505231912653581",
+                "4200002660202505234058068713",
+                "4200002659202505231697329113",
+                "4200002636202505234553679882",
+                "4200002720202505233013103750",
+                "4200002637202505234964407711",
+                "4200002650202505237086781342",
+                "4200002734202505239493313267",
+                "4200002740202505230420512251",
+                "4200002637202505231352234610",
+                "4200002647202505231926663993",
+                "4200002739202505230300248347",
+                "4200002664202505234150825196",
+                "4200002662202505230244852464",
+                "4200002732202505230637198680",
+                "4200002651202505236761790514",
+                "4200002633202505238694391199",
+                "4200002659202505236578433324",
+                "4200002641202505235899680053",
+                "4200002722202505233806736842",
+                "4200002735202505236255144424",
+                "4200002652202505237019798518",
+                "4200002730202505235520814716",
+                "4200002646202505239061280085",
+                "4200002667202505230884175186",
+                "4200002647202505231705668012",
+                "4200002650202505238243765212",
+                "4200002736202505238814158336",
+                "4200002664202505231718503615",
+                "4200002744202505239328342449",
+                "4200002732202505230097745339",
+                "4200002730202505237464074851",
+                "4200002644202505232917884094",
+                "4200002646202505237000490567",
+                "4200002635202505233004882159",
+                "4200002649202505237691049012",
+                "4200002722202505233837987015",
+                "4200002647202505237215349552",
+                "4200002718202505234703063752",
+                "4200002666202505238592783731",
+                "4200002655202505231061884960",
+                "4200002720202505238880387287",
+                "4200002719202505230187612776",
+                "4200002665202505230507748327",
+                "4200002731202505230399488179",
+                "4200002659202505235060942855",
+                "4200002662202505231086289931",
+                "4200002719202505236370907377",
+                "4200002663202505239902659766",
+                "4200002736202505236655137986",
+                "4200002732202505236093131627",
+                "4200002662202505234888924212",
+                "4200002737202505237390172046",
+                "4200002721202505239003073071",
+                "4200002662202505235141279048",
+                "4200002637202505234710543217",
+                "4200002640202505237874025509",
+                "4200002717202505231823871379",
+                "4200002738202505235358698574",
+                "4200002664202505239834024030",
+                "4200002664202505235105521403",
+                "4200002719202505236963549382",
+                "4200002734202505239522332557",
+                "4200002645202505239967505659",
+                "4200002667202505232869819782",
+                "4200002636202505236328099769",
+                "4200002722202505232341040532",
+                "4200002666202505234415966044",
+                "4200002719202505234811531711",
+                "4200002727202505239033881333",
+                "4200002647202505234686618079",
+                "4200002656202505237449317689",
+                "4200002727202505231416176828",
+                "4200002726202505238161914216",
+                "4200002722202505238438311330",
+                "4200002739202505231934545645",
+                "4200002648202505239790787370",
+                "4200002668202505238860368398",
+                "4200002648202505235469717169",
+                "4200002636202505238465996481",
+                "4200002642202505238227723572",
+                "4200002724202505237133730922",
+                "4200002656202505239529002776",
+                "4200002718202505234979304344",
+                "4200002722202505237284139335",
+                "4200002643202505238949774996",
+                "4200002649202505233843083779",
+                "4200002742202505236053916821",
+                "4200002742202505239924382364",
+                "4200002655202505234325558535",
+                "4200002653202505235717205510",
+                "4200002727202505234810909390",
+                "4200002738202505234626193690",
+                "4200002736202505231062551995",
+                "4200002742202505238547755240",
+                "4200002731202505231134393227",
+                "4200002646202505231292391765",
+                "4200002662202505236730197810",
+                "4200002663202505233012870665",
+                "4200002645202505233943566939",
+                "4200002652202505237254875419",
+                "4200002727202505232010801653",
+                "4200002723202505231661864816",
+                "4200002734202505233405369632",
+                "4200002645202505233210852156",
+                "4200002634202505232047019880",
+                "4200002719202505239879626368",
+                "4200002733202505238715756974",
+                "4200002735202505232192730952",
+                "4200002726202505235589382910",
+                "4200002666202505232344386786",
+                "4200002729202505236705724712",
+                "4200002743202505237338202948",
+                "4200002736202505236614473953",
+                "4200002654202505232777546892",
+                "4200002646202505234646263735",
+                "4200002662202505234525262412",
+                "4200002653202505239734096160",
+                "4200002652202505238817144263",
+                "4200002651202505232044746200",
+                "4200002660202505234614924199",
+                "4200002723202505233030839501",
+                "4200002650202505236299723751",
+                "4200002633202505236362591228",
+                "4200002721202505239886113844",
+                "4200002664202505237507043186",
+                "4200002733202505232987180445",
+                "4200002652202505230898662286",
+                "4200002734202505232615096190",
+                "4200002642202505232787872161",
+                "4200002660202505238391360592",
+                "4200002740202505233772246878",
+                "4200002659202505238298465010",
+                "4200002732202505231156129103",
+                "4200002660202505235667880865",
+                "4200002659202505236830561806",
+                "4200002741202505233838268149",
+                "4200002643202505236314811018",
+                "4200002633202505238836908781",
+                "4200002646202505239830088743",
+                "4200002662202505239553933063",
+                "4200002651202505237459409297",
+                "4200002739202505231714130406",
+                "4200002648202505234516563134",
+                "4200002645202505237203616882",
+                "4200002727202505237018019041",
+                "4200002635202505235317934802",
+                "4200002740202505230223707163",
+                "4200002658202505237358226608",
+                "4200002743202505231826317421",
+                "4200002722202505230794813550",
+                "4200002718202505231006183344",
+                "4200002645202505231791381422",
+                "4200002667202505231948848413",
+                "4200002739202505236075595309",
+                "4200002726202505234953984293",
+                "4200002644202505233900738097",
+                "4200002635202505230850009474",
+                "4200002663202505239163201751",
+                "4200002726202505230418173638",
+                "4200002725202505235393269908",
+                "4200002726202505235365388759",
+                "4200002667202505237606562643",
+                "4200002731202505233642417178",
+                "4200002739202505236617617457",
+                "4200002729202505239040510916",
+                "4200002740202505234487683591",
+                "4200002726202505235899863136",
+                "4200002718202505238643057620",
+                "4200002741202505238518373215",
+                "4200002656202505236590789848",
+                "4200002734202505234161212920",
+                "4200002724202505232469938360",
+                "4200002663202505235486746621",
+                "4200002732202505236203164879",
+                "4200002656202505234513686654",
+                "4200002725202505231834959909",
+                "4200002729202505230922584846",
+                "4200002744202505237691294790",
+                "4200002656202505237541318348",
+                "4200002738202505233797339240",
+                "4200002667202505235760861879",
+                "4200002667202505233393743521",
+                "4200002735202505235127559449",
+                "4200002645202505233729680450",
+                "4200002717202505231992978898",
+                "4200002729202505236649744366",
+                "4200002667202505233527092015",
+                "4200002646202505237954005374",
+                "4200002656202505238407355854",
+                "4200002722202505231783274116",
+                "4200002667202505234084984902",
+                "4200002652202505238322562193",
+                "4200002739202505230143660717",
+                "4200002658202505235310810922",
+                "4200002743202505236349316236",
+                "4200002718202505238985357082",
+                "4200002732202505231791503720",
+                "4200002723202505234665513907",
+                "4200002653202505235348741867",
+                "4200002735202505239412802366",
+                "4200002726202505231072554452",
+                "4200002649202505238565792506",
+                "4200002662202505237173417784",
+                "4200002664202505237179247609",
+                "4200002725202505234770968053",
+                "4200002640202505238942371740",
+                "4200002651202505232151218281",
+                "4200002726202505234168780603",
+                "4200002731202505230286219825",
+                "4200002738202505238471838459",
+                "4200002717202505235260942019",
+                "4200002661202505233355643170",
+                "4200002659202505237263236345",
+                "4200002641202505235488349782",
+                "4200002723202505235314237910",
+                "4200002655202505234442690493",
+                "4200002721202505233711951078",
+                "4200002729202505235741562696",
+                "4200002641202505239905089900",
+                "4200002655202505237336810592",
+                "4200002742202505230571467104",
+                "4200002654202505237770009696",
+                "4200002721202505236287735181",
+                "4200002717202505236222805059",
+                "4200002719202505239465532922",
+                "4200002648202505236503161973",
+                "4200002741202505234147225734",
+                "4200002735202505236467596603",
+                "4200002665202505237103870016",
+                "4200002648202505231301975429",
+                "4200002661202505236535355491",
+                "4200002636202505231106120461",
+                "4200002648202505235574837545",
+                "4200002635202505238342767831",
+                "4200002729202505235791602262",
+                "4200002730202505237050795037",
+                "4200002741202505233377167852",
+                "4200002640202505232735574702",
+                "4200002655202505230967342813",
+                "4200002640202505239374757475",
+                "4200002658202505238360671228",
+                "4200002634202505238516300894",
+                "4200002644202505237032121422",
+                "4200002729202505234395797331",
+                "4200002737202505237515067362",
+                "4200002737202505239313869341",
+                "4200002653202505235417544570",
+                "4200002727202505235590633102",
+                "4200002641202505230751205463",
+                "4200002633202505234380626136",
+                "4200002727202505231062379246",
+                "4200002724202505237031838367",
+                "4200002723202505231548675241",
+                "4200002742202505232646475370",
+                "4200002740202505239610119857",
+                "4200002636202505232145087500",
+                "4200002647202505235780062863",
+                "4200002644202505231524804627",
+                "4200002650202505232600524378",
+                "4200002652202505233800738563",
+                "4200002743202505238714298346",
+                "4200002734202505232774764390",
+                "4200002650202505238470615787",
+                "4200002662202505230958636497",
+                "4200002658202505237990978204",
+                "4200002650202505233707158153",
+                "4200002723202505230910645159",
+                "4200002662202505239481794644",
+                "4200002744202505236604817600"
+
+
+        );
+        List<FsStorePayment> fsStorePaymentList = fsStorePaymentService.queryByBankTrxId(bankTrxIds);
+        for (FsStorePayment fsStorePayment : fsStorePaymentList) {
+            FsStoreOrder order = fsStoreOrderMapper.selectFsStoreOrderById(fsStorePayment.getOrderId());
+            List<FsStoreDelivers> byOrderId = fsStoreDeliversMapper.findByOrderId(order.getId());
+            if(CollectionUtils.isEmpty(byOrderId)) {
+                log.info("该单无物流信息 单号:{}",order.getId());
+                continue;
+            }
+            FsStoreDelivers delivers = byOrderId.get(0);
+
+            FsWxExpressTask fsWxExpressTask = new FsWxExpressTask();
+            fsWxExpressTask.setUserId(order.getUserId());
+            fsWxExpressTask.setStatus(0);
+            fsWxExpressTask.setRetryCount(0);
+            fsWxExpressTask.setCreateTime(LocalDateTime.now());
+            fsWxExpressTask.setUpdateTime(LocalDateTime.now());
+            fsWxExpressTask.setOrderCode(order.getOrderCode());
+            fsWxExpressTask.setExpressCompany(delivers.getDeliverSn());
+            fsWxExpressTask.setExpressNo(delivers.getDeliverId());
+            fsWxExpressTask.setPayCode(fsStorePayment.getPayCode());
+
+            try {
+                fsWxExpressTaskMapper.insert(fsWxExpressTask);
+            }catch (Exception e) {
+
+            }
+        }
+
+    }
     @Test
     public void testTestPaymentSync() {
         fsStorePaymentService.paymentSync();
@@ -126,13 +1079,34 @@ public class FsStorePaymentControllerTest {
     @Autowired
     private TzBankService tzBankService;
 
+    @Autowired
+    private YbPaymentHandler ybPaymentHandler;
+
+    @Autowired
+    private ISysConfigService configService;
+    @Test
+    public void ybRefund(){
+        PayProcessContext processContext = new PayProcessContext();
+        processContext.setOrderId(null);
+        processContext.setPayType(null);
+        processContext.setPaymentId(1334828L);
+        processContext.setPayCode("1929745734509264897");
+        String json = configService.selectConfigByKey("store.pay");
+        FsPayConfig fsPayConfig = JSON.parseObject(json, FsPayConfig.class);
+        processContext.setFsPayConfig(fsPayConfig);
+        processContext.setUserId(null);
+        processContext.setGoodsInfo("商城订单支付");
+        processContext.setOrderPrefix("store-");
+        ybPaymentHandler.refundOrder(processContext);
+    }
+
     /**
      * 手动退款
      */
     @Test
     public void refund(){
         String[] data = new String[]{
-                "1909907673596297216"
+                "91929745738172076032"
         };
         TzConfigInfoDTO tzConfigInfoDTO = TzConfigUtils.getConfig();
 

+ 5 - 0
fs-service-system/src/main/java/com/fs/store/mapper/FsStorePaymentMapper.java

@@ -377,4 +377,9 @@ public interface FsStorePaymentMapper
 
     @Select("select count(1) from fs_store_payment where order_id=${orderId} limit 1")
     Integer selectFsStorePaymentByOrderIdExists(Long orderId);
+
+    @Select("select * from fs_store_payment where business_type=2 and status =1 and pay_mode='yb' and bank_transaction_id is null ")
+    List<FsStorePayment> queryNormalData();
+
+    List<FsStorePayment> queryByBankTrxId(@Param("list") List<String> bankTrxIds);
 }

+ 2 - 0
fs-service-system/src/main/java/com/fs/store/service/IFsStorePaymentService.java

@@ -112,4 +112,6 @@ public interface IFsStorePaymentService
     boolean queryYb(FsStorePayment fsStorePayment);
 
     boolean updateYbBankSerial(FsStorePayment fsStorePayment);
+
+    List<FsStorePayment> queryByBankTrxId(List<String> bankTrxIds);
 }

+ 6 - 0
fs-service-system/src/main/java/com/fs/store/service/impl/FsStorePaymentServiceImpl.java

@@ -1,6 +1,7 @@
 package com.fs.store.service.impl;
 
 import java.math.BigDecimal;
+import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -448,4 +449,9 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService
         }
         return false;
     }
+
+    @Override
+    public List<FsStorePayment> queryByBankTrxId(List<String> bankTrxIds) {
+        return fsStorePaymentMapper.queryByBankTrxId(bankTrxIds);
+    }
 }

+ 6 - 0
fs-service-system/src/main/resources/mapper/store/FsStorePaymentMapper.xml

@@ -178,6 +178,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ) t
         GROUP BY t.type
     </select>
+    <select id="queryByBankTrxId" resultType="com.fs.store.domain.FsStorePayment">
+        select * from fs_store_payment where bank_transaction_id in
+           <foreach collection="list" item="item" open="(" separator="," close=")">
+               #{item}
+           </foreach>
+    </select>
 
 
 </mapper>