czh 2 년 전
부모
커밋
230485d487
21개의 변경된 파일518개의 추가작업 그리고 81개의 파일을 삭제
  1. 4 0
      sckw-common/sckw-common-core/pom.xml
  2. 49 30
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/BeanUtils.java
  3. 93 2
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/OkHttpUtils.java
  4. 17 1
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/RegularUtils.java
  5. 2 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/constant/HttpStatus.java
  6. 4 0
      sckw-modules/sckw-contract/pom.xml
  7. 1 0
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/controller/KwcCheckedController.java
  8. 56 0
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/model/dto/req/EsignGetFlowReqDto.java
  9. 3 6
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/model/vo/req/LogisticsGoodsInfoReqVo.java
  10. 3 0
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/model/vo/req/TradeBaseInfoReqVo.java
  11. 3 0
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/model/vo/req/TradeGoodsInfoReqVo.java
  12. 11 0
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/model/vo/res/TradeBaseInfoResVo.java
  13. 131 15
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/service/KwcContractLogisticsService.java
  14. 61 8
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/service/KwcContractTradeService.java
  15. 5 0
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/model/dto/req/CooperateManageQueryReqDto.java
  16. 0 2
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/CommonBusinessService.java
  17. 15 0
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmCooperateApplyService.java
  18. 15 3
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmCooperateManageService.java
  19. 19 3
      sckw-modules/sckw-manage/src/main/resources/mapper/KwmCooperateMapper.xml
  20. 25 10
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java
  21. 1 1
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsUserService.java

+ 4 - 0
sckw-common/sckw-common-core/pom.xml

@@ -174,5 +174,9 @@
             <groupId>com.squareup.okhttp3</groupId>
             <artifactId>okhttp</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents.client5</groupId>
+            <artifactId>httpclient5</artifactId>
+        </dependency>
     </dependencies>
 </project>

+ 49 - 30
sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/BeanUtils.java

@@ -6,7 +6,9 @@ import java.beans.PropertyDescriptor;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.lang.reflect.Type;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author zk
@@ -65,8 +67,9 @@ public class BeanUtils extends BeanUtil {
             return null;
         }
         int startIndex = 0;
-        if (fieldName.charAt(0) == UNDERLINE){
-            startIndex = 1;}
+        if (fieldName.charAt(0) == UNDERLINE) {
+            startIndex = 1;
+        }
         return "get"
                 + fieldName.substring(startIndex, startIndex + 1).toUpperCase()
                 + fieldName.substring(startIndex + 1);
@@ -98,41 +101,41 @@ public class BeanUtils extends BeanUtil {
      * @return: boolean 有则反之true 反之false
      *
     public static boolean isProperty(Object bean, String propertyName){
-        if (bean == null) {
-            return false;
-        }
-        Class<?> cls = bean.getClass();
-        PropertyDescriptor[] propertys = org.springframework.beans.BeanUtils.getPropertyDescriptors(cls);
-        for (PropertyDescriptor property : propertys){
-            String fieldName = property.getName();
-            if(fieldName != null && propertyName != null && fieldName.equals(propertyName)){
-                return true;
-            }
-        }
-        return false;
+    if (bean == null) {
+    return false;
+    }
+    Class<?> cls = bean.getClass();
+    PropertyDescriptor[] propertys = org.springframework.beans.BeanUtils.getPropertyDescriptors(cls);
+    for (PropertyDescriptor property : propertys){
+    String fieldName = property.getName();
+    if(fieldName != null && propertyName != null && fieldName.equals(propertyName)){
+    return true;
+    }
+    }
+    return false;
     }*/
 
 
     /**
+     * @param object
+     * @return boolean
      * @description 判断当前对象是否为空
      * @author jiangwei
      * @date 2020/9/18 14:40
-     * @param object
-     * @return boolean
      **/
-    public static boolean objCheckIsNull(Object object){
-        return objCheckIsNull(object,null,null);
+    public static boolean objCheckIsNull(Object object) {
+        return objCheckIsNull(object, null, null);
     }
 
     /**
+     * @param object           入参对象
+     * @param excludeNameList  要剔除的属性名称,没有就传空集合或者null
+     * @param excludeValueList 要剔除的数值,没有就传空集合或者null
+     * @return boolean
      * @description 判断当前对象是否为空(包括所有属性为空)
      * 可选则在判断规则中剔除某一字段,或者某一值
      * @author jiangwei
      * @date 2020/5/22 10:14
-     * @param object 入参对象
-     * @param excludeNameList 要剔除的属性名称,没有就传空集合或者null
-     * @param excludeValueList 要剔除的数值,没有就传空集合或者null
-     * @return boolean
      **/
     public static boolean objCheckIsNull(Object object, List<String> excludeNameList, List<Object> excludeValueList) {
 
@@ -194,23 +197,22 @@ public class BeanUtils extends BeanUtil {
     }
 
     /**
-     *
-     * @Title: isProperty
-     * @Description: 判断对象是否存在某属性
-     * @param bean 对象
+     * @param bean         对象
      * @param propertyName 属性
      * @return
+     * @Title: isProperty
+     * @Description: 判断对象是否存在某属性
      * @return: boolean 有则反之true 反之false
-     * */
-    public static boolean isProperty(Object bean, String propertyName){
+     */
+    public static boolean isProperty(Object bean, String propertyName) {
         if (bean == null) {
             return false;
         }
         Class<?> cls = bean.getClass();
         PropertyDescriptor[] propertys = org.springframework.beans.BeanUtils.getPropertyDescriptors(cls);
-        for (PropertyDescriptor property : propertys){
+        for (PropertyDescriptor property : propertys) {
             String fieldName = property.getName();
-            if(fieldName != null && propertyName != null && fieldName.equals(propertyName)){
+            if (fieldName != null && propertyName != null && fieldName.equals(propertyName)) {
                 return true;
             }
         }
@@ -239,4 +241,21 @@ public class BeanUtils extends BeanUtil {
             }
         }
     }
+
+    public static Map<String, Object> convertToMap(Object yourObject) {
+        Map<String, Object> map = new HashMap<>();
+        try {
+            Field[] fields = yourObject.getClass().getDeclaredFields();
+            for (Field field : fields) {
+                field.setAccessible(true);
+                String fieldName = field.getName();
+                Object fieldValue = field.get(yourObject);
+                map.put(fieldName, fieldValue);
+            }
+        } catch (IllegalAccessException e) {
+            throw new RuntimeException(e);
+        }
+        return map;
+    }
+
 }

+ 93 - 2
sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/OkHttpUtils.java

@@ -4,6 +4,16 @@ import com.alibaba.fastjson2.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import okhttp3.*;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.hc.client5.http.classic.methods.HttpPost;
+import org.apache.hc.client5.http.entity.mime.FileBody;
+import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder;
+import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
+import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
+import org.apache.hc.client5.http.impl.classic.HttpClients;
+import org.apache.hc.core5.http.ContentType;
+import org.apache.hc.core5.http.HttpEntity;
+import org.apache.hc.core5.http.io.entity.EntityUtils;
+import org.apache.http.client.methods.HttpRequestBase;
 import org.jetbrains.annotations.NotNull;
 import org.springframework.util.CollectionUtils;
 
@@ -11,13 +21,13 @@ import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLSocketFactory;
 import javax.net.ssl.TrustManager;
 import javax.net.ssl.X509TrustManager;
+import java.io.File;
 import java.io.IOException;
 import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
 import java.security.SecureRandom;
 import java.security.cert.X509Certificate;
-import java.util.LinkedHashMap;
-import java.util.Map;
+import java.util.*;
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
 
@@ -399,7 +409,88 @@ public class OkHttpUtils {
                 .postForm(tmp, file)
                 .sync();
         log.info("交易确认异步通知中台返回->{}", sync);
+    }
+
+    /**
+     * post请求提交form-data上传文件
+     * @param url
+     * @return
+     */
+    public static String doPostUploadFile(String url, Map<String, Object> param) {
+        HttpPost httpPost = new HttpPost(url);
+        CloseableHttpResponse response = null;
+
+        String respContent = null;
+
+        long startTime = System.currentTimeMillis();
+
+        // 设置请求头 boundary边界不可重复,重复会导致提交失败
+        String boundary = "-------------------------" + UUIDUtils.get32UUID();
+        httpPost.setHeader("Content-Type", "multipart/form-data; boundary=" + boundary);
+
+        // 创建MultipartEntityBuilder
+        MultipartEntityBuilder builder = MultipartEntityBuilder.create();
+        // 设置字符编码
+        builder.setCharset(StandardCharsets.UTF_8);
+        // 设置边界
+        builder.setBoundary(boundary);
+        for (String key : param.keySet()) {
+            Object value = param.get(key);
+            if (value instanceof File) {
+                File file = (File) value;
+                builder.addPart(key, new FileBody(file));
+                builder.addBinaryBody("media", file, ContentType.create("application/octet-stream"), file.getName());
+            } else {
+                builder.addTextBody(key, String.valueOf(value));
+            }
+        }
+        HttpEntity entity = builder.build();
+        httpPost.setEntity(entity);
+        CloseableHttpClient httpClient = HttpClients.createDefault();
+        try {
+            response = httpClient.execute(httpPost);
+            if (response != null) {
+                HttpEntity he = response.getEntity();
+                if (he != null) {
+                    respContent = EntityUtils.toString(he, "UTF-8");
+                }
+            } else {
+                log.error("对方响应的状态码不在符合的范围内!");
+                throw new RuntimeException();
+            }
+            return respContent;
+        } catch (Exception e) {
+            log.error("网络访问异常,请求url地址={},响应体={},error={}", url, response, e);
+            throw new RuntimeException();
+        } finally {
+            log.info("统一外网请求参数打印,post请求url地址={},响应={},耗时={}毫秒", url, respContent, (System.currentTimeMillis() - startTime));
+            try {
+                if (response != null) {
+                    response.close();
+                }
+                if(null != httpClient){
+                    httpClient.close();
+                }
+            } catch (IOException e) {
+                log.error("请求链接释放异常", e);
+            }
+        }
+    }
 
 
+    /**
+     * 封装请求头
+     *
+     * @param paramsHeads
+     * @param httpMethod
+     */
+    private static void packageHeader(Map<String, String> paramsHeads, HttpRequestBase httpMethod) {
+        if (null!= paramsHeads && paramsHeads.size()>0) {
+            Set<Map.Entry<String, String>> entrySet = paramsHeads.entrySet();
+            for (Map.Entry<String, String> entry : entrySet) {
+                httpMethod.setHeader(entry.getKey(), entry.getValue());
+            }
+        }
     }
+
 }

+ 17 - 1
sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/RegularUtils.java

@@ -1,5 +1,6 @@
 package com.sckw.core.utils;
 
+import java.math.BigDecimal;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -23,6 +24,7 @@ public class RegularUtils {
      * 非负浮点型(包括0)
      */
     public static final String DECIMAL_REG1 = "^\\d+(\\.\\d+)?$";
+
     /**
      * 数字和字母
      */
@@ -126,8 +128,22 @@ public class RegularUtils {
         return m.matches();
     }
 
+    /**
+     * @param str 数值 numLength 整数长度  fractionLenth小数长度
+     * @desc: 校验(限制固定长度)
+     * @author: czh
+     * @date: 2023/7/25
+     */
+    public static boolean matchNumberWithFix(String str, Integer numLength, Integer fractionLenth) {
+        StringBuilder stringBuilder = new StringBuilder();
+        stringBuilder.append("\\d{1,").append(numLength).append("}([\\.]\\d{0,").append(fractionLenth).append("})?");
+        Pattern p = Pattern.compile(stringBuilder.toString());
+        Matcher m = p.matcher(str);
+        return m.matches();
+    }
+
 
     public static void main(String[] args) {
-        System.out.println(matchs("(^\\d{12})", "123456789112"));
+        System.out.println(matchs("\\d{1,8}([\\.]\\d{0,2})?", new BigDecimal("99999999.00").toString()));
     }
 }

+ 2 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/constant/HttpStatus.java

@@ -171,5 +171,7 @@ public class HttpStatus {
     public static final String MSG_026 = "资质认证审核中,请等待审核后再提交!";
     public static final String MSG_027 = "一级机构不能删除!";
     public static final String MSG_028 = "合同未签约,不能手动完结!";
+    public static final String MSG_029 = "合同编号超长!";
+    public static final String MSG_030 = "合同名称超长!";
 
 }

+ 4 - 0
sckw-modules/sckw-contract/pom.xml

@@ -72,6 +72,10 @@
             <groupId>com.sckw</groupId>
             <artifactId>sckw-order-api</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-test</artifactId>
+        </dependency>
 
     </dependencies>
     <build>

+ 1 - 0
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/controller/KwcCheckedController.java

@@ -7,6 +7,7 @@ import com.sckw.core.model.enums.EntTypeEnum;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.response.HttpResult;
 import jakarta.validation.Valid;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;

+ 56 - 0
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/model/dto/req/EsignGetFlowReqDto.java

@@ -0,0 +1,56 @@
+package com.sckw.contract.model.dto.req;
+
+import lombok.Data;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * @author czh
+ * @desc e签宝签署入参
+ * @date 2023/8/9
+ */
+@Data
+public class EsignGetFlowReqDto implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = -2326873428898155564L;
+
+    /**
+     * 文件
+     */
+    private File file;
+
+    /**
+     * id
+     */
+    private String seqId;
+
+    /**
+     * 合同名
+     */
+    private String signFlowTitle;
+
+    /**
+     * 发起方企业名
+     */
+    private String orgFirstName;
+
+    /**
+     * 发起方签约电话
+     */
+    private String psnFirstAccount;
+
+    /**
+     * 对方企业名
+     */
+    private String orgSecondName;
+
+    /**
+     * 对方签约电话
+     */
+    private String psnSecondAccount;
+
+}

+ 3 - 6
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/model/vo/req/LogisticsGoodsInfoReqVo.java

@@ -1,9 +1,6 @@
 package com.sckw.contract.model.vo.req;
 
-import jakarta.validation.constraints.DecimalMax;
-import jakarta.validation.constraints.DecimalMin;
-import jakarta.validation.constraints.NotNull;
-import jakarta.validation.constraints.Size;
+import jakarta.validation.constraints.*;
 import lombok.Data;
 
 import java.io.Serial;
@@ -57,7 +54,7 @@ public class LogisticsGoodsInfoReqVo implements Serializable {
     /**
      * 合理损耗
      */
-    @DecimalMax(value = "10000000", message = "合理损耗超长")
+    @Digits(integer = 5, fraction = 2, message = "合理损耗超长")
     private BigDecimal loss;
 
     /**
@@ -68,7 +65,7 @@ public class LogisticsGoodsInfoReqVo implements Serializable {
     /**
      * 扣亏货值
      */
-    @DecimalMax(value = "100000", message = "扣亏货值超长")
+    @Digits(integer = 3, fraction = 2, message = "扣亏货值超长")
     private BigDecimal deficitPrice;
 
     /**

+ 3 - 0
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/model/vo/req/TradeBaseInfoReqVo.java

@@ -3,6 +3,7 @@ package com.sckw.contract.model.vo.req;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import jakarta.validation.constraints.NotBlank;
 import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
 import lombok.Data;
 import org.springframework.format.annotation.DateTimeFormat;
 
@@ -55,12 +56,14 @@ public class TradeBaseInfoReqVo implements Serializable {
      * 合同编号
      */
     @NotBlank(message = "合同编号不能为空")
+    @Size(max = 20, message = "合同编号超长")
     private String contractCode;
 
     /**
      * 合同名称
      */
     @NotBlank(message = "合同名称不能为空")
+    @Size(max = 50, message = "合同编号超长")
     private String contractName;
 
     /**

+ 3 - 0
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/model/vo/req/TradeGoodsInfoReqVo.java

@@ -1,5 +1,6 @@
 package com.sckw.contract.model.vo.req;
 
+import jakarta.validation.constraints.Digits;
 import jakarta.validation.constraints.NotNull;
 import lombok.Data;
 
@@ -27,11 +28,13 @@ public class TradeGoodsInfoReqVo implements Serializable {
     /**
      * 采购数量
      */
+    @Digits(integer = 10, fraction = 2, message = "采购数量超长")
     private BigDecimal amount;
 
     /**
      * 单价
      */
+    @Digits(integer = 10, fraction = 2, message = "单价超长")
     private BigDecimal price;
 
     /**

+ 11 - 0
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/model/vo/res/TradeBaseInfoResVo.java

@@ -4,6 +4,7 @@ import lombok.Data;
 
 import java.io.Serial;
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.Date;
 
 /**
@@ -97,4 +98,14 @@ public class TradeBaseInfoResVo implements Serializable {
      */
     private String trading;
 
+    /**
+     * 总量
+     */
+    private BigDecimal amount;
+
+    /**
+     * 已履约量
+     */
+    private BigDecimal performedAmount;
+
 }

+ 131 - 15
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/service/KwcContractLogisticsService.java

@@ -1,17 +1,21 @@
 package com.sckw.contract.service;
 
+import java.io.*;
+import java.net.URL;
 import java.util.Date;
 
-import java.io.IOException;
 import java.math.BigDecimal;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.sckw.contract.dao.KwcContractLogisticsMapper;
 import com.sckw.contract.dubbo.RemoteContractServiceImpl;
+import com.sckw.contract.model.dto.req.EsignGetFlowReqDto;
 import com.sckw.contract.model.dto.req.QueryListReqDto;
 import com.sckw.contract.model.dto.res.QueryListResDto;
 import com.sckw.contract.model.entity.KwcContractLogistics;
@@ -81,6 +85,10 @@ public class KwcContractLogisticsService {
      */
     @Transactional(rollbackFor = {})
     public Long addCheckedContract(ContractLogisticsReqVo reqVo) {
+        LogisticsBaseInfoReqVo baseInfo = reqVo.getBaseInfo();
+        List<LogisticsGoodsInfoReqVo> goodsInfo = reqVo.getGoodsInfo();
+        //参数校验
+        checkParam(baseInfo, goodsInfo);
         Long id = reqVo.getId();
         //不为空时是修改
         if (Objects.nonNull(id)) {
@@ -88,8 +96,6 @@ public class KwcContractLogisticsService {
             return id;
         }
 
-        LogisticsBaseInfoReqVo baseInfo = reqVo.getBaseInfo();
-        List<LogisticsGoodsInfoReqVo> goodsInfo = reqVo.getGoodsInfo();
         //创建合同
         KwcContractLogistics kwcContractLogistics = getKwcContractLogistics(baseInfo, goodsInfo, reqVo.getRemark(), reqVo.getPid());
         long contactId = new IdWorker(1L).nextId();
@@ -108,6 +114,34 @@ public class KwcContractLogisticsService {
         return contactId;
     }
 
+    private void checkParam(LogisticsBaseInfoReqVo baseInfo, List<LogisticsGoodsInfoReqVo> goodsInfo) {
+        if(Objects.nonNull(baseInfo)) {
+            if(StringUtils.isNotBlank(baseInfo.getContractCode()) && baseInfo.getContractCode().length() > 20) {
+                throw new SystemException("合同编号超长!");
+            }
+
+            if(StringUtils.isNotBlank(baseInfo.getContractName()) && baseInfo.getContractName().length() > 20) {
+                throw new SystemException("合同名称超长!");
+            }
+        }
+
+        if (CollectionUtils.isNotEmpty(goodsInfo)) {
+            for (LogisticsGoodsInfoReqVo logisticsGoodsInfoReqVo : goodsInfo) {
+                if (StringUtils.isNotBlank(logisticsGoodsInfoReqVo.getGoodsName()) && logisticsGoodsInfoReqVo.getGoodsName().length() > 50) {
+                    throw new SystemException("商品名称超长!");
+                }
+
+                if(Objects.nonNull(logisticsGoodsInfoReqVo.getLoss()) && !RegularUtils.matchNumberWithFix(logisticsGoodsInfoReqVo.getLoss().toString(), 5, 2)) {
+                    throw new SystemException("合理损耗超长!");
+                }
+
+                if(Objects.nonNull(logisticsGoodsInfoReqVo.getDeficitPrice()) && !RegularUtils.matchNumberWithFix(logisticsGoodsInfoReqVo.getDeficitPrice().toString(), 5, 2)) {
+                    throw new SystemException("扣亏货值超长!");
+                }
+            }
+        }
+    }
+
     public KwcContractLogistics getKwcContractLogistics(LogisticsBaseInfoReqVo baseInfo, List<LogisticsGoodsInfoReqVo> goodsInfo, String remark, Long pid) {
         Date date = new Date();
         KwcContractLogistics kwcContractLogistics = new KwcContractLogistics();
@@ -121,12 +155,11 @@ public class KwcContractLogisticsService {
         kwcContractLogistics.setPerformedAmount(new BigDecimal("0"));
         kwcContractLogistics.setContractPid(pid);
         kwcContractLogistics.setRemark(remark);
+        kwcContractLogistics.setDelFlag(Global.NO);
         kwcContractLogistics.setCreateBy(LoginUserHolder.getUserId());
         kwcContractLogistics.setCreateTime(date);
         kwcContractLogistics.setUpdateBy(LoginUserHolder.getUserId());
         kwcContractLogistics.setUpdateTime(date);
-        kwcContractLogistics.setDelFlag(Global.NO);
-
         BigDecimal amountTotal = new BigDecimal(Global.NUMERICAL_ZERO);
         if (CollectionUtils.isNotEmpty(goodsInfo)) {
             for (LogisticsGoodsInfoReqVo logisticsGoodsInfoReqVo : goodsInfo) {
@@ -146,7 +179,7 @@ public class KwcContractLogisticsService {
      * @author: czh
      * @date: 2023/7/14
      */
-    public void supplement(ContractLogisticsReqVo reqVo) {
+    public void supplement(ContractLogisticsReqVo reqVo) throws SystemException {
         Long id = reqVo.getPid();
         KwcContractLogistics kwcContractLogistics = kwcContractLogisticsMapper.selectById(id);
         if (Objects.isNull(kwcContractLogistics)) {
@@ -306,7 +339,7 @@ public class KwcContractLogisticsService {
      * @date 2023/7/17
      */
     @Transactional(rollbackFor = {})
-    public Long submit(ContractLogisticsReqVo reqVo) {
+    public Long submit(ContractLogisticsReqVo reqVo) throws SystemException {
         Long id = reqVo.getId();
         //直接签约先存草稿再修改状态
         if (Objects.isNull(id)) {
@@ -316,9 +349,72 @@ public class KwcContractLogisticsService {
         }
         update(reqVo);
         changeToSubmit(id);
+
+        if (DictEnum.SIGNING_WAY_1.getValue().equals(String.valueOf(reqVo.getBaseInfo().getSigningWay()))) {
+            postToEsign(reqVo, id);
+        }
         return id;
     }
 
+    private void postToEsign(ContractLogisticsReqVo reqVo, Long id) {
+        EsignGetFlowReqDto esignGetFlowReqDto = new EsignGetFlowReqDto();
+        JSONArray jsonArray = JSONArray.parseArray(reqVo.getContractFile());
+        JSONObject jsonObject = jsonArray.getJSONObject(0);
+        String fileName = jsonObject.getString("name");
+        String url = jsonObject.getString("url");
+        File file = getFileByHttpURL(url, fileName);
+
+        Long carrierEntId = reqVo.getBaseInfo().getCarrierEntId();
+        Long checkedEntId = reqVo.getBaseInfo().getCheckedEntId();
+
+
+        esignGetFlowReqDto.setFile(file);
+        esignGetFlowReqDto.setSeqId(String.valueOf(id));
+        esignGetFlowReqDto.setSignFlowTitle(reqVo.getBaseInfo().getContractName());
+        esignGetFlowReqDto.setOrgFirstName("");
+        esignGetFlowReqDto.setPsnFirstAccount("");
+        esignGetFlowReqDto.setOrgSecondName("");
+        esignGetFlowReqDto.setPsnSecondAccount("");
+        Map<String, Object> map = BeanUtils.convertToMap(esignGetFlowReqDto);
+        String res = OkHttpUtils.doPostUploadFile("http://10.10.10.149:8840/v1/sign/getFlow", map);
+    }
+
+    public static File getFileByHttpURL(String newUrl, String fileName){
+        String[] suffix = newUrl.split("/");
+        //得到最后一个分隔符后的名字
+        File file = null;
+        InputStream inputStream = null;
+        OutputStream outputStream = null;
+        try{
+            file = File.createTempFile("", fileName);
+            URL urlFile = new URL(newUrl);
+            inputStream = urlFile.openStream();
+            outputStream = new FileOutputStream(file);
+
+            int bytesRead = 0;
+            byte[] buffer = new byte[8192];
+            while ((bytesRead=inputStream.read(buffer,0,8192))!=-1) {
+                outputStream.write(buffer, 0, bytesRead);
+            }
+        }catch (Exception e) {
+            e.printStackTrace();
+        }finally {
+            try {
+                if (null != outputStream) {
+                    outputStream.close();
+                }
+                if (null != inputStream) {
+                    inputStream.close();
+                }
+
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        return file;
+    }
+
+
     /**
      * @param id 合同id
      * @desc: 更新合同为发起
@@ -350,13 +446,33 @@ public class KwcContractLogisticsService {
             throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.CONTRACT_NOT_EXISTS);
         }
 
-        KwcContractLogistics param = getKwcContractLogistics(reqVo.getBaseInfo(), reqVo.getGoodsInfo(), reqVo.getRemark(), reqVo.getPid());
-        param.setId(contractId);
-        param.setSigningUrl(reqVo.getContractFile());
-        param.setStatus(ContractStatusEnum.SAVE.getCode());
-        param.setUpdateBy(LoginUserHolder.getUserId());
-        param.setUpdateTime(date);
-        if (kwcContractLogisticsMapper.updateById(param) <= 0) {
+        LogisticsBaseInfoReqVo baseInfo = reqVo.getBaseInfo();
+        kwcContractLogistics.setEntId(LoginUserHolder.getEntId());
+        kwcContractLogistics.setContractNo(baseInfo.getContractCode());
+        kwcContractLogistics.setName(baseInfo.getContractName());
+        kwcContractLogistics.setSigningWay(baseInfo.getSigningWay());
+        kwcContractLogistics.setCharging(baseInfo.getCharging());
+        kwcContractLogistics.setStartTime(baseInfo.getStartTime());
+        kwcContractLogistics.setEndTime(baseInfo.getEndTime());
+        kwcContractLogistics.setPerformedAmount(new BigDecimal("0"));
+        kwcContractLogistics.setContractPid(reqVo.getPid());
+        kwcContractLogistics.setRemark(reqVo.getRemark());
+
+        List<LogisticsGoodsInfoReqVo> goodsInfo = reqVo.getGoodsInfo();
+        BigDecimal amountTotal = new BigDecimal(Global.NUMERICAL_ZERO);
+        if (CollectionUtils.isNotEmpty(goodsInfo)) {
+            for (LogisticsGoodsInfoReqVo logisticsGoodsInfoReqVo : goodsInfo) {
+                if (Objects.nonNull(logisticsGoodsInfoReqVo.getAmount())) {
+                    amountTotal = amountTotal.add(logisticsGoodsInfoReqVo.getAmount());
+                }
+            }
+        }
+        kwcContractLogistics.setAmount(amountTotal);
+        kwcContractLogistics.setSigningUrl(reqVo.getContractFile());
+        kwcContractLogistics.setStatus(ContractStatusEnum.SAVE.getCode());
+        kwcContractLogistics.setUpdateBy(LoginUserHolder.getUserId());
+        kwcContractLogistics.setUpdateTime(date);
+        if (kwcContractLogisticsMapper.updateById(kwcContractLogistics) <= 0) {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
         }
 
@@ -520,7 +636,7 @@ public class KwcContractLogisticsService {
         try {
             EasyExcelUtil.writeSingleExcel("物流合同.xlsx", "sheet1", queryListResVos, QueryListResVo.class);
         } catch (IOException e) {
-            log.error("导出失败:", e);
+//            log.error("导出失败:", e);
             throw new SystemException(HttpStatus.CODE_10301, HttpStatus.MSG_014);
         }
     }

+ 61 - 8
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/service/KwcContractTradeService.java

@@ -140,6 +140,11 @@ public class KwcContractTradeService {
 
     @Transactional(rollbackFor = {})
     public Long addTradeContract(ContractTradeReqVo reqVo) {
+        TradeBaseInfoReqVo baseInfo = reqVo.getBaseInfo();
+        List<TradeGoodsInfoReqVo> goodsInfoList = reqVo.getGoodsInfo();
+        //校验
+        checkParam(baseInfo, goodsInfoList);
+
         Long id = reqVo.getId();
         //不为空时是修改
         if (Objects.nonNull(id)) {
@@ -147,8 +152,6 @@ public class KwcContractTradeService {
             return id;
         }
 
-        TradeBaseInfoReqVo baseInfo = reqVo.getBaseInfo();
-        List<TradeGoodsInfoReqVo> goodsInfoList = reqVo.getGoodsInfo();
         //创建合同
         KwcContractTrade kwcContractTrade = getKwcContractTrade(baseInfo, reqVo.getGoodsInfo(), reqVo.getRemark(), reqVo.getPid());
         long contactId = new IdWorker(1L).nextId();
@@ -167,6 +170,32 @@ public class KwcContractTradeService {
         return contactId;
     }
 
+
+    private void checkParam(TradeBaseInfoReqVo baseInfo, List<TradeGoodsInfoReqVo> goodsInfo) {
+        if(Objects.nonNull(baseInfo)) {
+            if(StringUtils.isNotBlank(baseInfo.getContractCode()) && baseInfo.getContractCode().length() > 20) {
+                throw new SystemException("合同编号超长!");
+            }
+
+            if(StringUtils.isNotBlank(baseInfo.getContractName()) && baseInfo.getContractName().length() > 20) {
+                throw new SystemException("合同名称超长!");
+            }
+        }
+
+        if (CollectionUtils.isNotEmpty(goodsInfo)) {
+            for (TradeGoodsInfoReqVo goodsInfoReqVo : goodsInfo) {
+                if(Objects.nonNull(goodsInfoReqVo.getPrice()) && !RegularUtils.matchNumberWithFix(goodsInfoReqVo.getPrice().toString(), 10, 2)) {
+                    throw new SystemException("单价超长!");
+                }
+
+                if(Objects.nonNull(goodsInfoReqVo.getAmount()) && !RegularUtils.matchNumberWithFix(goodsInfoReqVo.getAmount().toString(), 10, 2)) {
+                    throw new SystemException("采购数量超长!");
+                }
+            }
+        }
+    }
+
+
     /**
      * @param baseInfo 贸易基本信息 remark备注  pid父id
      * @return KwcContractTrade
@@ -259,6 +288,8 @@ public class KwcContractTradeService {
         tradeBaseInfoResVo.setStartTime(kwcContractTrade.getStartTime());
         tradeBaseInfoResVo.setTradingName(DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), String.valueOf(kwcContractTrade.getTrading())));
         tradeBaseInfoResVo.setTrading(StringUtils.objectStr(kwcContractTrade.getTrading()));
+        tradeBaseInfoResVo.setAmount(kwcContractTrade.getAmount());
+        tradeBaseInfoResVo.setPerformedAmount(kwcContractTrade.getPerformedAmount());
 
         ContractTradeDetailResVo contractTradeDetailResVo = new ContractTradeDetailResVo();
         contractTradeDetailResVo.setStatus(kwcContractTrade.getStatus());
@@ -402,12 +433,34 @@ public class KwcContractTradeService {
             throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.CONTRACT_NOT_EXISTS);
         }
         KwcContractTrade param = getKwcContractTrade(reqVo.getBaseInfo(), reqVo.getGoodsInfo(), reqVo.getRemark(), reqVo.getPid());
-        param.setId(contractId);
-        param.setSigningUrl(reqVo.getContractFile());
-        param.setStatus(ContractStatusEnum.SAVE.getCode());
-        param.setUpdateBy(LoginUserHolder.getUserId());
-        param.setUpdateTime(date);
-        if (kwcContractTradeMapper.updateById(param) <= 0) {
+
+        TradeBaseInfoReqVo baseInfo = reqVo.getBaseInfo();
+        kwcContractTrade.setEntId(LoginUserHolder.getEntId());
+        kwcContractTrade.setContractNo(baseInfo.getContractCode());
+        kwcContractTrade.setName(baseInfo.getContractName());
+        kwcContractTrade.setSigningWay(baseInfo.getSigningWay());
+        kwcContractTrade.setTrading(baseInfo.getTrading());
+        kwcContractTrade.setStartTime(baseInfo.getStartTime());
+        kwcContractTrade.setEndTime(baseInfo.getEndTime());
+        kwcContractTrade.setPerformedAmount(new BigDecimal("0"));
+        kwcContractTrade.setContractPid(reqVo.getPid());
+        kwcContractTrade.setRemark(reqVo.getRemark());
+
+        List<TradeGoodsInfoReqVo> goodsInfo = reqVo.getGoodsInfo();
+        BigDecimal amountTotal = new BigDecimal(Global.NUMERICAL_ZERO);
+        if (CollectionUtils.isNotEmpty(goodsInfo)) {
+            for (TradeGoodsInfoReqVo tradeGoodsInfoReqVo : goodsInfo) {
+                if (Objects.nonNull(tradeGoodsInfoReqVo.getAmount())) {
+                    amountTotal = amountTotal.add(tradeGoodsInfoReqVo.getAmount());
+                }
+            }
+        }
+        kwcContractTrade.setAmount(amountTotal);
+        kwcContractTrade.setSigningUrl(reqVo.getContractFile());
+        kwcContractTrade.setStatus(ContractStatusEnum.SAVE.getCode());
+        kwcContractTrade.setUpdateBy(LoginUserHolder.getUserId());
+        kwcContractTrade.setUpdateTime(date);
+        if (kwcContractTradeMapper.updateById(kwcContractTrade) <= 0) {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
         }
 

+ 5 - 0
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/model/dto/req/CooperateManageQueryReqDto.java

@@ -43,6 +43,11 @@ public class CooperateManageQueryReqDto {
      */
     private Long currentEntId;
 
+    /**
+     * 当前企业id包括下面的主体单位id
+     */
+    private List<Long> currentEntIdList;
+
     /**
      * 申请状态
      */

+ 0 - 2
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/CommonBusinessService.java

@@ -142,8 +142,6 @@ public class CommonBusinessService {
      * @date: 2023/7/10
      */
     public List<CooperateManageQueryResVo> findList(CooperateManageQueryReqDto reqDto) {
-        Long entId = LoginUserHolder.getEntId();
-        reqDto.setCurrentEntId(entId);
         List<CooperateManageQueryResDto> list = kwmCooperateMapper.findList(reqDto);
         if (CollectionUtils.isEmpty(list)) {
             return Collections.emptyList();

+ 15 - 0
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmCooperateApplyService.java

@@ -31,6 +31,7 @@ import com.sckw.manage.model.vo.req.InitiateReqVo;
 import com.sckw.manage.model.vo.res.CooperateManageQueryResVo;
 import com.sckw.manage.model.vo.res.FindListGroupResVo;
 import com.sckw.system.api.RemoteSystemService;
+import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.UserCacheResDto;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
@@ -112,6 +113,20 @@ public class KwmCooperateApplyService {
             status.add(CooperateStatusEnum.CANCEL.getCode());
         }
         cooperateManageQueryReqDto.setStatus(status);
+
+
+        Long entId = LoginUserHolder.getEntId();
+        List<Long> currentEntIdList = new ArrayList<>();
+        currentEntIdList.add(entId);
+        Map<Long, List<EntCacheResDto>> longListMap = remoteSystemService.queryEntDeptCacheByIds(Collections.singletonList(entId));
+        if (!longListMap.isEmpty()) {
+            List<EntCacheResDto> entCacheResDtos = longListMap.get(entId);
+            if (CollectionUtils.isNotEmpty(entCacheResDtos)) {
+                currentEntIdList.addAll(entCacheResDtos.stream().map(EntCacheResDto::getId).toList());
+            }
+        }
+        cooperateManageQueryReqDto.setCurrentEntIdList(currentEntIdList);
+
         return cooperateManageQueryReqDto;
     }
 

+ 15 - 3
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmCooperateManageService.java

@@ -77,8 +77,6 @@ public class KwmCooperateManageService {
 
 
     private List<CooperateManageQueryResVo> findList(CooperateManageQueryReqDto reqDto) {
-        Long entId = LoginUserHolder.getEntId();
-        reqDto.setCurrentEntId(entId);
         List<CooperateManageQueryResDto> list = kwmCooperateMapper.findManageList(reqDto);
         if (CollectionUtils.isEmpty(list)) {
             return Collections.emptyList();
@@ -118,11 +116,24 @@ public class KwmCooperateManageService {
         }
         cooperateManageQueryReqDto.setStatus(status);
 
-
         List<Long> ids = reqVo.getIds();
         if (!CollectionUtils.isEmpty(ids)) {
             cooperateManageQueryReqDto.setIds(ids);
         }
+
+
+        Long entId = LoginUserHolder.getEntId();
+        List<Long> currentEntIdList = new ArrayList<>();
+        currentEntIdList.add(entId);
+        Map<Long, List<EntCacheResDto>> longListMap = remoteSystemService.queryEntDeptCacheByIds(Collections.singletonList(entId));
+        if (!longListMap.isEmpty()) {
+            List<EntCacheResDto> entCacheResDtos = longListMap.get(entId);
+            if (CollectionUtils.isNotEmpty(entCacheResDtos)) {
+                currentEntIdList.addAll(entCacheResDtos.stream().map(EntCacheResDto::getId).toList());
+            }
+        }
+        cooperateManageQueryReqDto.setCurrentEntIdList(currentEntIdList);
+
         return cooperateManageQueryReqDto;
     }
 
@@ -289,6 +300,7 @@ public class KwmCooperateManageService {
         LambdaQueryWrapper<KwmCooperateType> kwmCooperateTypeLambdaQueryWrapper = new LambdaQueryWrapper<>();
         kwmCooperateTypeLambdaQueryWrapper.in(KwmCooperateType::getCooperateId, kwmCooperates.stream().map(KwmCooperate::getId).toList());
         kwmCooperateTypeLambdaQueryWrapper.eq(KwmCooperateType::getDelFlag, Global.NO);
+        kwmCooperateTypeLambdaQueryWrapper.eq(KwmCooperateType::getStatus, CooperateStatusEnum.OK.getCode());
         kwmCooperateTypeLambdaQueryWrapper.eq(KwmCooperateType::getType, cooperateType);
         List<KwmCooperateType> kwmCooperateTypes = kwmCooperateTypeMapper.selectList(kwmCooperateTypeLambdaQueryWrapper);
         if (CollectionUtils.isEmpty(kwmCooperateTypes)) {

+ 19 - 3
sckw-modules/sckw-manage/src/main/resources/mapper/KwmCooperateMapper.xml

@@ -53,7 +53,15 @@
           FROM kwm_cooperate a
           LEFT JOIN kwm_cooperate_type b ON a.id = b.cooperate_id
          WHERE a.del_flag = 0
-           and (a.invitee_ent_id = #{reqDto.currentEntId} OR a.inviter_ent_id = #{reqDto.currentEntId})
+           and (a.invitee_ent_id in
+                <foreach collection="reqDto.currentEntIdList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+                OR a.inviter_ent_id in
+                <foreach collection="reqDto.currentEntIdList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+               )
            <if test="reqDto.startTime != null">
                and b.create_time >= #{reqDto.startTime}
            </if>
@@ -70,7 +78,7 @@
                and exists (select 1
                              from kwm_cooperate_type c
                             where c.cooperate_id = a.id
-                               and c.status = 1
+                               and c.status = b.status
                                and c.del_flag = 0
                               and c.type in
                             <foreach collection="reqDto.cooperateTypes" item="item" open="(" close=")" separator=",">
@@ -134,7 +142,15 @@
         FROM kwm_cooperate a
         LEFT JOIN kwm_cooperate_type b ON a.id = b.cooperate_id and b.status = 1 and b.del_flag = 0
         WHERE a.del_flag = 0
-        and (a.invitee_ent_id = #{reqDto.currentEntId} OR a.inviter_ent_id = #{reqDto.currentEntId})
+        and (a.invitee_ent_id in
+            <foreach collection="reqDto.currentEntIdList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+            OR a.inviter_ent_id in
+            <foreach collection="reqDto.currentEntIdList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+            )
         <if test="reqDto.startTime != null">
             and b.create_time >= #{reqDto.startTime}
         </if>

+ 25 - 10
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java

@@ -183,7 +183,7 @@ public class KwsEnterpriseService {
             BeanUtils.copyProperties(item, entFindPageResVo);
             entFindPageResVo.setApprovalTime(item.getApprovalTime());
             entFindPageResVo.setEntTypes(item.getType());
-            entFindPageResVo.setEntryType(item.getSystemType() == SystemTypeEnum.MANAGE.getCode() ? EntryTypeEnum.PLATFORM.getCode() : EntryTypeEnum.SELF.getCode());
+            entFindPageResVo.setEntryType(item.getSystemType().equals(SystemTypeEnum.MANAGE.getCode()) ? EntryTypeEnum.PLATFORM.getCode() : EntryTypeEnum.SELF.getCode());
             entFindPageResVo.setEntryTypeStr(EntryTypeEnum.getName(entFindPageResVo.getEntryType()).getName());
             result.add(entFindPageResVo);
         }
@@ -507,19 +507,34 @@ public class KwsEnterpriseService {
 
         checkAddEntSettleParam(reqVo);
 
-        /*1、存用户信息*/
-        RegisterReqDto registerReqDto = new RegisterReqDto();
-        registerReqDto.setEntName(reqVo.getFirmName());
-        registerReqDto.setName(reqVo.getContacts());
-        registerReqDto.setPhone(reqVo.getPhone());
-        registerReqDto.setIsMain(Global.YES);
-        registerReqDto.setSystemType(SystemTypeEnum.COMPANY.getCode());
-        RegisterResDto register = kwsUserService.register(registerReqDto);
+//        /*1、存用户信息*/
+//        RegisterReqDto registerReqDto = new RegisterReqDto();
+//        registerReqDto.setEntName(reqVo.getFirmName());
+//        registerReqDto.setName(reqVo.getContacts());
+//        registerReqDto.setPhone(reqVo.getPhone());
+//        registerReqDto.setIsMain(Global.YES);
+//        registerReqDto.setSystemType(SystemTypeEnum.COMPANY.getCode());
+//        RegisterResDto register = kwsUserService.register(registerReqDto);
+
+        KwsEnterprise kwsEnterprise = new KwsEnterprise();
+        long entId = new IdWorker(1L).nextId();
+        kwsEnterprise.setId(entId);
+        kwsEnterprise.setCode("");
+        kwsEnterprise.setFirmName(reqVo.getFirmName());
+        kwsEnterprise.setApproval(ApprovalEnum.NO.getCode());
+        kwsEnterprise.setContacts(reqVo.getContacts());
+        kwsEnterprise.setPhone(reqVo.getPhone());
+        kwsEnterprise.setCreateBy(LoginUserHolder.getUserId());
+        kwsEnterprise.setUpdateBy(LoginUserHolder.getUserId());
+        if (kwsEnterpriseDao.insert(kwsEnterprise) <= 0) {
+            throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
+        }
+
 
         /*2、认证*/
         EntRegisterReqVo entRegisterReqVo = new EntRegisterReqVo();
         BeanUtils.copyProperties(reqVo, entRegisterReqVo);
-        entRegisterReqVo.setEntId(register.getEntId());
+        entRegisterReqVo.setEntId(entId);
         register(entRegisterReqVo);
 
 

+ 1 - 1
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsUserService.java

@@ -156,11 +156,11 @@ public class KwsUserService {
             kwsEnterprise.setCreateBy(createBy);
             kwsEnterprise.setUpdateBy(createBy);
 
-            registerResDto.setEntId(entId);
             if (kwsEnterpriseDao.insert(kwsEnterprise) <= 0) {
                 throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
             }
 
+            registerResDto.setEntId(entId);
             /*1、新增管理员机构*/
             KwsDept kwsDept = new KwsDept();
             Integer systemType = SystemTypeEnum.COMPANY.getCode();