Kaynağa Gözat

新建立机构的时候如果是0元则默认缴费成功
增加第一次开通机构的时候验证企业信息 跳过dev环境

hgw 3 yıl önce
ebeveyn
işleme
9c1612ba52

+ 16 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantInfoServiceImpl.java

@@ -36,6 +36,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.dao.DuplicateKeyException;
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 import org.springframework.stereotype.Service;
@@ -95,6 +96,9 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
     @Autowired
     private ContractService contractService;
 
+    @Value("${spring.profiles.active:dev}")
+    private String profiles;
+
     /**
      * 新增机构
      */
@@ -125,6 +129,14 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         //添加机构产品信息
         setIdByApply(tenantId, dto.getProductInfo(), dto.getProductInfo()::setTenantId,
                 tenantProductInfoService::addTenantProduct);
+        //新建机构是0元时,直接默认支付成功
+        if (dto.getProductInfo().getPayAmount().compareTo(BigDecimal.ZERO) == 0) {
+            //修机构相关的改付款时间
+            tenantOpen(tenantId);
+            String orderNo = idGenerator.generatorId("payment") + "";
+            //写入付款记录
+            createOrderRecord(tenantId, BigDecimal.ZERO, orderNo, TenantOrderRecordEnum.TENANT_OPEN, 1, null);
+        }
         //添加机构配置
         setIdByApply(tenantId, dto.getConfig(), dto.getConfig()::setTenantId, tenantConfigService::addConfig);
         //释放
@@ -336,8 +348,10 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         //建立角色和菜单关系数据
         Lists.partition(collectMenuId, 50)
                 .forEach(idList -> employeeService.batchInsertRoleMenu(roleId, idList, tenantId));
-        //添加签章信息
-        contractService.addTsign(tenantInfo.getTsignCode(), tenantInfo.getTsignName());
+        if (!profiles.equals("dev")) {
+            //添加签章信息
+            contractService.addTsign(tenantInfo.getTsignCode(), tenantInfo.getTsignName());
+        }
 
         Date now = new Date();