浏览代码

修改订单支付

hgw 3 年之前
父节点
当前提交
38aa9dd383

+ 18 - 8
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantInfoServiceImpl.java

@@ -140,8 +140,10 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
             //校验营业执照信息
             checkTsign(dto.getTsignCode());
             //修改产品
-            setIdByApply(tenantId, dto.getProductInfo(), dto.getProductInfo()::setTenantId,
-                    tenantProductInfoService::updateTenantProduct);
+            if (Objects.nonNull(dto.getProductInfo())) {
+                setIdByApply(tenantId, dto.getProductInfo(), dto.getProductInfo()::setTenantId,
+                        tenantProductInfoService::updateTenantProduct);
+            }
         }
 
         Date now = new Date();
@@ -151,7 +153,9 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         this.updateById(tenantInfo);
 
         //修改机构配置
-        setIdByApply(tenantId, dto.getConfig(), dto.getConfig()::setTenantId, tenantConfigService::updateConfig);
+        if (Objects.nonNull(dto.getConfig())) {
+            setIdByApply(tenantId, dto.getConfig(), dto.getConfig()::setTenantId, tenantConfigService::updateConfig);
+        }
     }
 
     /**
@@ -267,8 +271,8 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         // 创建账号、用户信息、用户和角色关系
         createUser(tenantInfo, orgId, Lists.newArrayList(roleId));
         //建立角色和菜单关系数据
-         Lists.partition(collectMenuId, 50)
-                         .forEach(idList -> employeeService.batchInsertRoleMenu(roleId, idList, tenantId));
+        Lists.partition(collectMenuId, 50)
+                .forEach(idList -> employeeService.batchInsertRoleMenu(roleId, idList, tenantId));
         //创建资产信息
         TenantAssetsInfo assetsInfo = new TenantAssetsInfo();
         assetsInfo.setTenantId(tenantId);
@@ -489,9 +493,15 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
      * @param action    需要执行的操作
      */
     private <T> void setIdByApply(Integer tenantId, T clazz, Consumer<Integer> setOption, Consumer<T> action) {
-        Optional.ofNullable(tenantId)
-                .ifPresent(setOption);
-        action.accept(clazz);
+        Optional.ofNullable(clazz)
+                .filter(c -> Objects.nonNull(setOption))
+                .filter(c -> Objects.nonNull(action))
+                .filter(c -> Objects.nonNull(tenantId))
+                .map(c -> {
+                    setOption.accept(tenantId);
+                    return c;
+                })
+                .ifPresent(action);
     }
 
     /**

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantOrderRecordServiceImpl.java

@@ -71,7 +71,11 @@ public class TenantOrderRecordServiceImpl extends ServiceImpl<TenantOrderRecordD
                         //确保订单已经创建
                         flag = true;
                     }
+                } else {
+                    //没有异常
+                    flag = true;
                 }
+                log.info("checkTenantOrder  payment >>>>> {} flag {}", payment, flag);
                 //确保订单已经创建 再 判断状态是成功还是失败
                 if (flag && Objects.nonNull(payment.get("status"))) {
                     String status = (String) payment.get("status");