yangdamao před 2 roky
rodič
revize
9ac98646f4

+ 26 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/service/impl/ITopInstSettleServiceImpl.java

@@ -906,6 +906,8 @@ public class ITopInstSettleServiceImpl extends ServiceImpl<TopInstSettleMapper,
         if (ObjectUtils.isNull(settle)){
             throw new CustomException("结算单信息获取失败!");
         }
+        //支付权限校验
+        settlePayCheck(bo,settle);
         if (ObjectUtils.isNotNull(settle.getSettleMoney()) && settle.getSettleMoney().compareTo(BigDecimal.ZERO) > 0){
             TopInstitution institution = topInstitutionService.getById(settle.getInstId());
             //打款
@@ -969,6 +971,30 @@ public class ITopInstSettleServiceImpl extends ServiceImpl<TopInstSettleMapper,
         return updateById(settle);
     }
 
+    private void settlePayCheck(SettlePayBo bo,TopInstSettle settle) {
+        TopOldOrderCheckLog checkLog = topOldOrderCheckLogService.getOne(new LambdaQueryWrapper<TopOldOrderCheckLog>()
+                .eq(TopOldOrderCheckLog::getOrderSn, settle.getSettleSn())
+                .eq(TopOldOrderCheckLog::getStatus, 1)
+                .eq(TopOldOrderCheckLog::getCheckSign, 1)
+                .last("limit 1"));
+        if (ObjectUtils.isNull(checkLog)){
+            throw new CustomException("当前订单不在支付流程中,请检查!");
+        }
+        if (ObjectUtils.isNull(checkLog.getCheckStatus()) && checkLog.getCheckStatus() != 2){
+            throw new CustomException("当前订单不在支付流程中,请检查!");
+        }
+        List<TopSysUserRole> roleList = topSysUserRoleService
+                .list(new LambdaQueryWrapper<TopSysUserRole>()
+                .eq(TopSysUserRole::getUserId, bo.getLoginId()));
+        if (CollectionUtils.isEmpty(roleList)){
+            throw new CustomException("当前账号没有审核权限!");
+        }
+        List<Long> collect = roleList.stream().map(TopSysUserRole::getRoleId).collect(Collectors.toList());
+        if (!collect.contains(checkLog.getRoleId())){
+            throw new CustomException("当前账号没有审核权限!");
+        }
+    }
+
     @Override
     public SettleReceiptsVo getSettleReceipts(Long settleId) {
         TopInstSettle instSettle = getById(settleId);