Parcourir la source

Merge remote-tracking branch 'origin/master'

zyp il y a 2 heures
Parent
commit
8caaee57f6

+ 61 - 0
fs-admin/src/main/java/com/fs/his/task/Task.java

@@ -57,6 +57,12 @@ import com.fs.his.service.impl.FsPackageOrderServiceImpl;
 import com.fs.his.utils.ConfigUtil;
 import com.fs.his.vo.FsSubOrderResultVO;
 import com.fs.hisStore.domain.FsStoreOrderScrm;
+import com.fs.hisStore.domain.FsStorePaymentScrm;
+import com.fs.hisStore.mapper.FsStorePaymentScrmMapper;
+import com.fs.hisStore.service.IFsStorePaymentScrmService;
+import com.fs.huifuPay.domain.HuiFuQueryOrderResult;
+import com.fs.huifuPay.sdk.opps.core.request.V2TradePaymentScanpayQueryRequest;
+import com.fs.huifuPay.service.HuiFuService;
 import com.fs.im.dto.*;
 import com.fs.im.service.IImService;
 import com.fs.im.service.OpenIMService;
@@ -81,6 +87,8 @@ import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 import org.springframework.stereotype.Component;
 
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.util.*;
@@ -1069,6 +1077,59 @@ public class Task {
         System.out.println(msgResponseDTO);
     }
 
+    @Autowired
+    FsStorePaymentScrmMapper fsStorePaymentScrmMapper;
+
+    @Autowired
+    HuiFuService huiFuService;
+
+    /**
+     * 查询同步商城订单的支付转台
+     */
+    public void syncOrderPayStatus(){
+        //查询支付状态是待支付的数据
+        FsStorePaymentScrm paymentScrm = new FsStorePaymentScrm();
+        SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
+        paymentScrm.setStatus(0);
+        List<FsStorePaymentScrm> fsStorePaymentScrms = fsStorePaymentScrmMapper.selectFsStorePaymentList(paymentScrm);
+        if(null != fsStorePaymentScrms && !fsStorePaymentScrms.isEmpty()){
+            for (FsStorePaymentScrm payment : fsStorePaymentScrms) {
+                if(StringUtils.isBlank(payment.getTradeNo())){
+                    continue;
+                }
+                V2TradePaymentScanpayQueryRequest request = new V2TradePaymentScanpayQueryRequest();
+                request.setOrgReqDate(new SimpleDateFormat("yyyyMMdd").format(payment.getCreateTime()));
+                request.setOrgHfSeqId(payment.getTradeNo());
+                HuiFuQueryOrderResult o = null;
+                try {
+                    o = huiFuService.queryOrder(request);
+                } catch (Exception e) {
+                    log.error("查询失败:"+e.getMessage());
+                    continue;
+                }
+                log.info("汇付返回" + o);
+                if ("00000000".equals(o.getResp_code()) && "S".equals(o.getTrans_stat())) {
+                    try {
+                        Date payTime = formatter.parse(o.getEnd_time());
+                        FsStorePaymentScrm payUpdate = new FsStorePaymentScrm();
+                        payUpdate.setPaymentId(payment.getPaymentId());
+                        payUpdate.setPayTime(payTime);
+                        payUpdate.setStatus(1);
+                        payUpdate.setTradeNo(o.getOrg_hf_seq_id());
+                        payUpdate.setBankSerialNo(o.getParty_order_id());
+                        payUpdate.setBankTransactionId(o.getOut_trans_id());
+                        fsStorePaymentScrmMapper.updateFsStorePayment(payUpdate);
+                    } catch (ParseException e) {
+                        log.error("更新失败 payment:{}",payment ,e);
+//                        throw new RuntimeException(e);
+                    }
+
+
+                }
+            }
+        }
+    }
+
 //    @Autowired
 //    private FsStoreMapper fsStoreMapper;
 //    @Autowired

+ 32 - 21
fs-company/src/main/java/com/fs/company/controller/live/LiveController.java

@@ -134,7 +134,8 @@ public class LiveController extends BaseController
     {
         // 设置企业ID和企业用户ID
         setCompanyId(live);
-        return toAjax(liveService.insertLive(live));
+        return toAjax(1);
+//        return toAjax(liveService.insertLive(live));
     }
 
     /**
@@ -146,7 +147,8 @@ public class LiveController extends BaseController
         CompanyUser user = SecurityUtils.getLoginUser().getUser();
         live.setCompanyUserId(user.getUserId());
         live.setCompanyId(user.getCompanyId());
-        return liveService.finishLive(live);
+        return R.ok();
+//        return liveService.finishLive(live);
     }
 
     /**
@@ -158,7 +160,8 @@ public class LiveController extends BaseController
         CompanyUser user = SecurityUtils.getLoginUser().getUser();
         live.setCompanyUserId(user.getUserId());
         live.setCompanyId(user.getCompanyId());
-        return liveService.copyLive(live);
+        return R.ok();
+//        return liveService.copyLive(live);
     }
 
     /**
@@ -170,7 +173,8 @@ public class LiveController extends BaseController
         CompanyUser user = SecurityUtils.getLoginUser().getUser();
         live.setCompanyUserId(user.getUserId());
         live.setCompanyId(user.getCompanyId());
-        return liveService.startLive(live);
+        return R.ok();
+//        return liveService.startLive(live);
     }
 
     /**
@@ -181,10 +185,12 @@ public class LiveController extends BaseController
     @PutMapping
     public AjaxResult edit(@RequestBody Live live)
     {
-        CompanyUser user = SecurityUtils.getLoginUser().getUser();
-        live.setCompanyUserId(user.getUserId());
-        live.setCompanyId(user.getCompanyId());
-        return toAjax(liveService.updateLive(live));
+        return AjaxResult.success();
+//        CompanyUser user = SecurityUtils.getLoginUser().getUser();
+//        live.setCompanyUserId(user.getUserId());
+//        live.setCompanyId(user.getCompanyId());
+//
+//        return toAjax(liveService.updateLive(live));
     }
 
     /**
@@ -195,11 +201,12 @@ public class LiveController extends BaseController
 	@DeleteMapping("/{liveIds}")
     public AjaxResult remove(@PathVariable Long[] liveIds)
     {
-        Live live = new Live();
-        CompanyUser user = SecurityUtils.getLoginUser().getUser();
-        live.setCompanyUserId(user.getUserId());
-        live.setCompanyId(user.getCompanyId());
-        return toAjax(liveService.deleteLiveByLiveIds(liveIds, live));
+        return AjaxResult.success();
+//        Live live = new Live();
+//        CompanyUser user = SecurityUtils.getLoginUser().getUser();
+//        live.setCompanyUserId(user.getUserId());
+//        live.setCompanyId(user.getCompanyId());
+//        return toAjax(liveService.deleteLiveByLiveIds(liveIds, live));
     }
 
     @PreAuthorize("@ss.hasPermi('live:live:query')")
@@ -217,9 +224,10 @@ public class LiveController extends BaseController
     @PreAuthorize("@ss.hasPermi('live:live:edit')")
     @PostMapping("/closeLiving")
     public R closeLiving(@RequestBody Map<String, String> payload) {
-        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
-        payload.put("userId", loginUser.getUser().getUserId().toString());
-        return liveService.closeLiving(payload);
+        return R.ok();
+//        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+//        payload.put("userId", loginUser.getUser().getUserId().toString());
+//        return liveService.closeLiving(payload);
     }
 
     @PreAuthorize("@ss.hasPermi('live:live:insert')")
@@ -247,7 +255,8 @@ public class LiveController extends BaseController
     @PreAuthorize("@ss.hasPermi('live:live:edit')")
     @PostMapping("/startLoopPlay")
     public R startLoopPlay(@RequestBody Live live) {
-        return liveService.startLoopPlay(live);
+        return R.ok();
+//        return liveService.startLoopPlay(live);
     }
 
     /**
@@ -265,8 +274,9 @@ public class LiveController extends BaseController
     @PreAuthorize("@ss.hasPermi('live:live:edit')")
     @PostMapping("/handleShelfOrUn")
     public R handleShelfOrUn(@RequestBody LiveListVo listVo) {
-        setListCompanyId(listVo);
-        return liveService.handleShelfOrUn(listVo);
+        return R.ok();
+//        setListCompanyId(listVo);
+//        return liveService.handleShelfOrUn(listVo);
     }
 
     /**
@@ -275,8 +285,9 @@ public class LiveController extends BaseController
     @PreAuthorize("@ss.hasPermi('live:live:edit')")
     @PostMapping("/handleDeleteSelected")
     public R handleDeleteSelected(@RequestBody LiveListVo listVo) {
-        setListCompanyId(listVo);
-        return liveService.handleDeleteSelected(listVo);
+        return R.ok();
+//        setListCompanyId(listVo);
+//        return liveService.handleDeleteSelected(listVo);
     }
 
 

+ 1 - 0
fs-live-app/src/main/java/com/fs/live/websocket/service/WebSocketServer.java

@@ -585,6 +585,7 @@ public class WebSocketServer {
         lastLikeCountCache.keySet().removeIf(liveId -> !activeLiveIds.contains(liveId));
     }
 
+
     /**
      * 广播点赞消息
      * @param liveId   直播间ID

+ 2 - 0
fs-service/src/main/java/com/fs/hisStore/mapper/FsStorePaymentScrmMapper.java

@@ -383,4 +383,6 @@ public interface FsStorePaymentScrmMapper
      * 批量更新发货状态
      * **/
     void batchUpadte(@Param("list") List<String> list);
+
+    void batchUpadteFailed(@Param("list") List<String> list);
 }

+ 5 - 3
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStorePaymentScrmServiceImpl.java

@@ -979,6 +979,7 @@ public class FsStorePaymentScrmServiceImpl implements IFsStorePaymentScrmService
                 Map<String, List<FsStorePaymentUsetVo>> paymentUsetVoMap = paymentList.stream().collect(Collectors.groupingBy(FsStorePaymentUsetVo::getAppId));
                 for (Map.Entry<String, List<FsStorePaymentUsetVo>> entry : paymentUsetVoMap.entrySet()) {
                     List<String> successList = new ArrayList<>();
+                    List<String> failedList = new ArrayList<>();
                     String appId = entry.getKey();
                     List<FsStorePaymentUsetVo> userPayments = entry.getValue();
                     final WxMaService wxService = WxMaConfiguration.getMaService(appId);
@@ -988,18 +989,19 @@ public class FsStorePaymentScrmServiceImpl implements IFsStorePaymentScrmService
                             if (uploadShippingInfoToWechat(wxService, v, uploadTime)) {
                                 successList.add(v.getBankTransactionId());
                             }else {
-                                successList.add(v.getBankTransactionId());
+                                failedList.add(v.getBankTransactionId());
                             }
                         }
                         //批量更新数据
                         if (!successList.isEmpty()) {
                             fsStorePaymentMapper.batchUpadte(successList);
                         }
+                        if(!failedList.isEmpty()){
+                            fsStorePaymentMapper.batchUpadteFailed(failedList);
+                        }
                     }
                 }
             }
-
-
             return R.ok(builder.toString().equals("") ? "操作成功!" : builder.toString());
         } catch (Exception e) {
             log.error("导入发货单快递信息失败", e);

+ 4 - 0
fs-service/src/main/java/com/fs/live/domain/LiveWatchUser.java

@@ -62,4 +62,8 @@ public class LiveWatchUser extends BaseEntity {
     @Excel(name = "用户所在位置")
     private String location;
 
+
+    private Integer pageNum;
+    private Integer pageSize;
+
 }

+ 2 - 2
fs-service/src/main/java/com/fs/live/mapper/LiveAfterSalesMapper.java

@@ -119,9 +119,9 @@ public interface LiveAfterSalesMapper {
             "and sales_status = 3 " +
             "</if>" +
             "<if test = 'maps.userId != null    '> " +
-            "and user_id = #{maps.userId} " +
+            "and las.user_id = #{maps.userId} " +
             "</if>" +
-            "order by create_time desc "+
+            "order by las.create_time desc "+
             "</script>"})
     List<LiveAfterSalesQueryVO> selectLiveAfterSalesListQuery(@Param("maps") LiveAfterSalesQueryParam param);
 

+ 9 - 1
fs-service/src/main/resources/mapper/hisStore/FsStorePaymentScrmMapper.xml

@@ -216,7 +216,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             fs_store_payment_scrm sp
                 LEFT JOIN fs_user fu ON sp.user_id = fu.user_id
         WHERE
-            sp.status = 1 and sp.is_shipment = 0 and sp.business_type = 1 AND sp.pay_time > '2025-11-27 00:00:00' LIMIT 500
+            sp.status = 1  and sp.app_id is not null  and sp.is_shipment = 0 and sp.business_type = 1 AND sp.pay_time > '2025-11-27 00:00:00'
+            order by sp.pay_time desc LIMIT 500
     </select>
 
     <update id="batchUpadte">
@@ -225,4 +226,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{bankTransactionId}
         </foreach>
     </update>
+
+    <update id="batchUpadteFailed">
+        update fs_store_payment_scrm set is_shipment = -1 where bank_transaction_id in
+        <foreach item="bankTransactionId" collection="list" open="(" separator="," close=")">
+            #{bankTransactionId}
+        </foreach>
+    </update>
 </mapper>

+ 5 - 4
fs-user-app/src/main/java/com/fs/app/controller/live/LiveOrderController.java

@@ -722,6 +722,11 @@ public class LiveOrderController extends AppBaseController
     @PostMapping("/editPayType")
     @Transactional
     public R editPayType(HttpServletRequest request, @Validated @RequestBody FsStoreOrderPayParam param) {
+
+        String orderId=redisCache.getCacheObject("isPaying:"+param.getOrderId());
+        if(StringUtils.isNotEmpty(orderId)&&orderId.equals(param.getOrderId().toString())){
+            return R.error("正在支付中...");
+        }
         LiveOrder order=orderService.selectLiveOrderByOrderId(String.valueOf(param.getOrderId()));
         if(order==null){
             return R.error("订单不存在");
@@ -729,10 +734,6 @@ public class LiveOrderController extends AppBaseController
         if(order.getStatus()!= OrderInfoEnum.STATUS_0.getValue()){
             return R.error("订单状态不正确");
         }
-        String orderId=redisCache.getCacheObject("isPaying:"+order.getOrderId());
-        if(StringUtils.isNotEmpty(orderId)&&orderId.equals(order.getOrderId().toString())){
-            return R.error("正在支付中...");
-        }
         List<LiveOrderPayment> payments = liveOrderPaymentMapper.selectLiveOrderPaymentByOrderId(order.getOrderId());
         if(payments.size()>0){
             for(LiveOrderPayment payment : payments){

+ 1 - 0
fs-user-app/src/main/java/com/fs/app/controller/live/LiveWatchUserController.java

@@ -5,6 +5,7 @@ import com.fs.app.facade.LiveFacadeService;
 import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.R;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
 import com.fs.live.domain.LiveWatchUser;

+ 1 - 0
fs-user-app/src/main/java/com/fs/app/facade/LiveFacadeService.java

@@ -22,4 +22,5 @@ public interface LiveFacadeService {
     R redClaim(RedPO red);
 
     R couponClaim(CouponPO coupon);
+
 }

+ 23 - 19
fs-user-app/src/main/java/com/fs/app/facade/impl/LiveFacadeServiceImpl.java

@@ -90,27 +90,30 @@ public class LiveFacadeServiceImpl extends BaseController implements LiveFacadeS
 
     @Override
     public TableDataInfo watchUserList(LiveWatchUser param) {
-        List<LiveWatchUserVO> liveWatchUserVOS;
-        String setKey = String.format(LiveKeysConstant.LIVE_WATCH_USERS, param.getLiveId());
-        Map<Object, Object> hashEntries = redisCache.hashEntries(setKey);
-        if (CollUtil.isEmpty(hashEntries)) {
-            liveWatchUserVOS = liveWatchUserService.asyncToCache(param.getLiveId());
-        } else {
-            liveWatchUserVOS = hashEntries.values().stream()
-                    .map(value -> {
-                        try {
-                            return JSONUtil.toBean(JSONUtil.parseObj(value), LiveWatchUserVO.class);
-                        } catch (Exception e) {
-                            log.error("反序列化LiveWatchUserVO失败: {}", value, e);
-                            return null;
-                        }
-                    })
-                    .filter(Objects::nonNull)
-                    .collect(Collectors.toList());
-        }
-        return getDataTable(liveWatchUserVOS);
+//        List<LiveWatchUserVO> liveWatchUserVOS;
+//        String setKey = String.format(LiveKeysConstant.LIVE_WATCH_USERS, param.getLiveId());
+//        Map<Object, Object> hashEntries = redisCache.hashEntries(setKey);
+//        if (CollUtil.isEmpty(hashEntries)) {
+//            liveWatchUserVOS = liveWatchUserService.asyncToCache(param.getLiveId());
+//        } else {
+//            liveWatchUserVOS = hashEntries.values().stream()
+//                    .map(value -> {
+//                        try {
+//                            return JSONUtil.toBean(JSONUtil.parseObj(value), LiveWatchUserVO.class);
+//                        } catch (Exception e) {
+//                            log.error("反序列化LiveWatchUserVO失败: {}", value, e);
+//                            return null;
+//                        }
+//                    })
+//                    .filter(Objects::nonNull)
+//                    .collect(Collectors.toList());
+//        }
+//        return getDataTable(liveWatchUserVOS);
+        return null;
     }
 
+
+
     @Override
     public R liveDetail(Long id) {
         Object o = redisCache.hashGet(LiveKeysConstant.LIVE_HOME_PAGE_DETAIL, String.valueOf(id));
@@ -174,6 +177,7 @@ public class LiveFacadeServiceImpl extends BaseController implements LiveFacadeS
         return iLiveCouponService.claimCoupon(coupon);
     }
 
+
     @Override
     @DistributeLock(keyExpression = "#lottery.liveId +'_'+#lottery.userId", scene = "draw_claim")
     public R drawClaim(LotteryPO lottery) {