Răsfoiți Sursa

部分接口

PC 2 ani în urmă
părinte
comite
7284fe2f9e
35 a modificat fișierele cu 1399 adăugiri și 133 ștergeri
  1. 5 0
      sckw-common/sckw-common-core/pom.xml
  2. 2 2
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/aspect/DaoAspect.java
  3. 43 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/handle/CustomDataSource.java
  4. 47 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/handle/CustomMetaHandle.java
  5. 57 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/handle/MyConfig.java
  6. 34 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/ApprovalEnum.java
  7. 36 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/CertificateTypeEnum.java
  8. 33 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/EntTypeEnum.java
  9. 8 3
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/constant/HttpStatus.java
  10. 0 1
      sckw-common/sckw-common-datasource/pom.xml
  11. 3 3
      sckw-common/sckw-common-redis/src/main/java/com/sckw/redis/configure/RedissonConfiguration.java
  12. 3 1
      sckw-modules/sckw-system/src/main/java/com/sckw/system/SystemApplication.java
  13. 22 18
      sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/KwsEnterpriseController.java
  14. 1 1
      sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/KwsUserController.java
  15. 8 1
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsEntCertificateDao.java
  16. 8 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsEntTypeDao.java
  17. 2 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsEnterpriseDao.java
  18. 34 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/SysUserDao.java
  19. 0 13
      sckw-modules/sckw-system/src/main/java/com/sckw/system/handle/CustomMetaHandle.java
  20. 0 34
      sckw-modules/sckw-system/src/main/java/com/sckw/system/handle/MyConfig.java
  21. 5 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/KwsEnterprise.java
  22. 48 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/req/BusinessLicense.java
  23. 46 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/req/EntFindPageReqVo.java
  24. 106 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/req/EntRegisterReqVo.java
  25. 20 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/req/FreezeReqVo.java
  26. 81 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/req/KwsEnterpriseReqVo.java
  27. 35 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/CertificateResVo.java
  28. 0 26
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/KwsEnterpriseResVo.java
  29. 266 18
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java
  30. 17 10
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsUserService.java
  31. 18 0
      sckw-modules/sckw-system/src/main/resources/bootstrap-dev.yml
  32. 91 1
      sckw-modules/sckw-system/src/main/resources/mapper/KwsEntCertificateDao.xml
  33. 72 1
      sckw-modules/sckw-system/src/main/resources/mapper/KwsEntTypeDao.xml
  34. 181 0
      sckw-modules/sckw-system/src/main/resources/mapper/KwsEnterpriseDao.xml
  35. 67 0
      sckw-modules/sckw-system/src/main/resources/mapper/SysUserDao.xml

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

@@ -110,6 +110,11 @@
             <artifactId>sckw-common-redis</artifactId>
             <version>1.0.0</version>
         </dependency>
+        <dependency>
+            <groupId>com.sckw</groupId>
+            <artifactId>sckw-common-datasource</artifactId>
+            <version>1.0.0</version>
+        </dependency>
         <dependency>
             <groupId>jakarta.validation</groupId>
             <artifactId>jakarta.validation-api</artifactId>

+ 2 - 2
sckw-common/sckw-common-core/src/main/java/com/sckw/core/aspect/DaoAspect.java

@@ -42,7 +42,7 @@ public class DaoAspect {
     public void daoCreate() {
     }
 
-    @Around("daoUpdate()")
+//    @Around("daoUpdate()")
     public Object doAroundUpdate(ProceedingJoinPoint point) throws Throwable {
         /*ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
         if (attributes == null) {
@@ -69,7 +69,7 @@ public class DaoAspect {
         return object;
     }
 
-    @Around("daoCreate()")
+//    @Around("daoCreate()")
     public Object doAroundCreate(ProceedingJoinPoint point) throws Throwable {
         /*ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
         if (attributes == null) {

+ 43 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/handle/CustomDataSource.java

@@ -0,0 +1,43 @@
+package com.sckw.core.handle;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.jdbc.DataSourceBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import javax.sql.DataSource;
+
+/**
+ * @author czh
+ * @desc TODO
+ * @date 2023/6/9
+ */
+@Slf4j
+@Configuration
+public class CustomDataSource {
+
+    @Value("${spring.datasource.dynamic.datasource.master.url}")
+    private String url;
+
+    @Value("${spring.datasource.dynamic.datasource.master.username}")
+    private String username;
+
+    @Value("${spring.datasource.dynamic.datasource.master.password}")
+    private String password;
+
+    @Value("${spring.datasource.dynamic.datasource.master.driver-class-name}")
+    private String driver;
+
+    @Bean
+    @ConfigurationProperties(prefix = "spring.datasource.dynamic.datasource.master")
+    public DataSource dataSource() {
+        log.info("url:{}", url);
+        log.info("username:{}", username);
+        log.info("password:{}", password);
+        log.info("driver:{}", driver);
+        return DataSourceBuilder.create().url(url).username(username).password(password).driverClassName(driver).build();
+
+    }
+}

+ 47 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/handle/CustomMetaHandle.java

@@ -0,0 +1,47 @@
+package com.sckw.core.handle;
+
+import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
+import com.sckw.core.model.auth.context.LoginUserHolder;
+import com.sckw.core.model.constant.Global;
+import com.sckw.core.utils.IdWorker;
+import com.sckw.core.utils.StringUtils;
+import org.apache.ibatis.reflection.MetaObject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.Objects;
+
+/**
+ * @author czh
+ * @desc TODO
+ * @date 2023/6/9
+ */
+@Component
+public class CustomMetaHandle implements MetaObjectHandler {
+
+    @Override
+    public void insertFill(MetaObject metaObject) {
+        Long userId = Objects.isNull(LoginUserHolder.getUserId()) ? 1 : LoginUserHolder.getUserId();
+        String userName = StringUtils.isBlank(LoginUserHolder.getUserName()) ? "无" : LoginUserHolder.getUserName();
+        Date date = new Date();
+        metaObject.setValue("createBy", userId);
+        metaObject.setValue("updateBy", userId);
+//        metaObject.setValue("createByName", userName);
+        metaObject.setValue("createTime", date);
+        metaObject.setValue("updateTime", date);
+        metaObject.setValue("status",  Global.NO);
+        metaObject.setValue("delFlag", Global.NO);
+        metaObject.setValue("id", new IdWorker(1).nextId());
+    }
+
+    @Override
+    public void updateFill(MetaObject metaObject) {
+        Long userId = Objects.isNull(LoginUserHolder.getUserId()) ? 1 : LoginUserHolder.getUserId();
+        String userName = StringUtils.isBlank(LoginUserHolder.getUserName()) ? "无" : LoginUserHolder.getUserName();
+        metaObject.setValue("updateBy", userId);
+//        metaObject.setValue("updateByName", userName);
+        metaObject.setValue("updateTime", new Date());
+    }
+}

+ 57 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/handle/MyConfig.java

@@ -0,0 +1,57 @@
+package com.sckw.core.handle;
+
+import com.baomidou.mybatisplus.annotation.DbType;
+import com.baomidou.mybatisplus.core.MybatisConfiguration;
+import com.baomidou.mybatisplus.core.MybatisXMLLanguageDriver;
+import com.baomidou.mybatisplus.core.config.GlobalConfig;
+import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
+import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
+import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
+import jakarta.annotation.Resource;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.apache.ibatis.type.JdbcType;
+import org.mybatis.spring.annotation.MapperScan;
+import org.mybatis.spring.transaction.SpringManagedTransactionFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
+import org.springframework.stereotype.Component;
+import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
+
+import javax.sql.DataSource;
+
+
+/**
+ * @author czh
+ * @desc TODO
+ * @date 2023/6/9
+ */
+@Configuration
+public class MyConfig {
+
+    @Autowired
+    private CustomDataSource customDataSource;
+
+    @Bean
+    public MybatisPlusInterceptor mybatisPlusInterceptor() {
+        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
+        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
+        return interceptor;
+    }
+
+    @Bean
+    public SqlSessionFactory sqlSessionFactory() throws Exception {
+        MybatisSqlSessionFactoryBean factoryBean = new MybatisSqlSessionFactoryBean();
+        factoryBean.setDataSource(customDataSource.dataSource());
+        factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:/mapper/*.xml "));
+        factoryBean.setTypeAliases();
+        MybatisConfiguration configuration = new MybatisConfiguration();
+        configuration.setMapUnderscoreToCamelCase(true);
+        factoryBean.setConfiguration(configuration);
+        factoryBean.setGlobalConfig(new GlobalConfig().setMetaObjectHandler(new CustomMetaHandle()));
+        return factoryBean.getObject();
+    }
+}

+ 34 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/ApprovalEnum.java

@@ -0,0 +1,34 @@
+package com.sckw.core.model.enums;
+
+import lombok.Getter;
+
+/**
+ * 审批状态枚举
+ */
+@Getter
+public enum ApprovalEnum {
+
+    NO(0, "未审批"),
+    OK(1, "通过"),
+    PASS(2, "未通过"),
+    PROCESS(3, "审批中");
+
+    private int code;
+
+    private String name;
+
+    ApprovalEnum(int code, String name){
+        this.code = code;
+        this.name = name;
+    }
+
+    public static ApprovalEnum getName(int code){
+        for (ApprovalEnum aprovalEnum : values()) {
+            if (aprovalEnum.getCode() == code) {
+                return aprovalEnum;
+            }
+        }
+        return null;
+    }
+
+}

+ 36 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/CertificateTypeEnum.java

@@ -0,0 +1,36 @@
+package com.sckw.core.model.enums;
+
+import lombok.Getter;
+
+/**
+ * 证照类型枚举
+ */
+@Getter
+public enum CertificateTypeEnum {
+
+    CONTACTS_IDCARD(1, "联系人身份证"),
+    CORPORATION_IDCARD(2, "法人身份证"),
+    BUSINESSLICENSE(3, "营业执照"),
+    ROADLICENSE(4, "道路运输许可证"),
+    ACCOUNT(5, "开户许可证号"),
+    AUTHORIZE(6, "授权证书"),
+    SIGNATURES(7, "电子签章授权书");
+
+    private int code;
+
+    private String name;
+
+    CertificateTypeEnum(int code, String name){
+        this.code = code;
+        this.name = name;
+    }
+
+    public static CertificateTypeEnum getName(int code){
+        for (CertificateTypeEnum certificateTypeEnum : values()) {
+            if (certificateTypeEnum.getCode() == code) {
+                return certificateTypeEnum;
+            }
+        }
+        return null;
+    }
+}

+ 33 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/EntTypeEnum.java

@@ -0,0 +1,33 @@
+package com.sckw.core.model.enums;
+
+import lombok.Getter;
+
+/**
+ * 企业类型枚举
+ */
+@Getter
+public enum EntTypeEnum {
+
+    SUPPLIER(1, "供应商"),
+    PURCHASER(2, "采购商"),
+    LOGISTICS34(3, "34PL物流"),
+    LOGISTICS43(4, "43PL物流");
+
+    private int code;
+
+    private String name;
+
+    EntTypeEnum(int code, String name){
+        this.code = code;
+        this.name = name;
+    }
+
+    public static EntTypeEnum getName(int code) {
+        for (EntTypeEnum entTypeEnum : values()) {
+            if (entTypeEnum.getCode() == code) {
+                return entTypeEnum;
+            }
+        }
+        return null;
+    }
+}

+ 8 - 3
sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/constant/HttpStatus.java

@@ -103,16 +103,21 @@ public class HttpStatus {
 
 
     /**数据库的操作失败*/
-    public static final int CODE_60601 = 60601;
+    public static final int CRUD_FAIL_CODE = 60601;
     public static final String UPDATE_FAIL = "更新失败";
     public static final String INSERT_FAIL = "新增失败";
     public static final String DELETE_FAIL = "删除失败";
 
     /**未查询到相关信息*/
-    public static final int CODE_60602 = 60602;
-    public static final String ACCOUNT_NOT_EXISTS = "用户信息不存在";
+    public static final int QUERY_FAIL_CODE = 60602;
+    public static final String ACCOUNT_NOT_EXISTS = "用户信息不存在或已失效";
+    public static final String ENT_NOT_EXISTS = "企业信息不存在或已失效";
+    public static final String ENTCERTIFICATES_NOT_EXISTS = "未查询到企业资质信息";
 
     /**自定义提示消息*/
     public static final String MSG_001 = "密码重置成功";
     public static final String MSG_002 = "密码修改成功";
+    public static final String MSG_003 = "新增成功";
+    public static final String MSG_004 = "审批完成";
+    public static final String MSG_005 = "更新成功";
 }

+ 0 - 1
sckw-common/sckw-common-datasource/pom.xml

@@ -39,7 +39,6 @@
             <artifactId>mybatis-plus-boot-starter</artifactId>
             <version>${mybatis-plus.version}</version>
         </dependency>
-
         <!--多数据源-->
         <dependency>
             <groupId>com.baomidou</groupId>

+ 3 - 3
sckw-common/sckw-common-redis/src/main/java/com/sckw/redis/configure/RedissonConfiguration.java

@@ -21,8 +21,8 @@ public class RedissonConfiguration {
     @Value("${spring.data.redis.port}")
     private String port;
 
-    @Value("${spring.data.redis.password}")
-    private String password;
+//    @Value("${spring.data.redis.password}")
+//    private String password;
 
     @Value("${spring.data.redis.database}")
     private String database;
@@ -36,7 +36,7 @@ public class RedissonConfiguration {
         config.setCodec(new JsonJacksonCodec());
         config.useSingleServer()
                 .setAddress(address())
-                .setPassword(password)
+//                .setPassword(password)
                 .setDatabase(Integer.parseInt(database))
                 .setConnectTimeout(Integer.parseInt(timeout));
         return Redisson.create(config);

+ 3 - 1
sckw-modules/sckw-system/src/main/java/com/sckw/system/SystemApplication.java

@@ -1,6 +1,7 @@
 package com.sckw.system;
 
 import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@@ -9,7 +10,8 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
 @EnableDubbo
 @EnableFeignClients({"com.sckw.*.api.feign"})
 @EnableDiscoveryClient
-@SpringBootApplication(scanBasePackages = {"com.sckw.core.exception", "com.sckw.core.aspect","com.sckw.system","com.sckw.redis"})
+@SpringBootApplication(scanBasePackages = {"com.sckw.core.*", "com.sckw.core.aspect","com.sckw.system","com.sckw.redis"})
+@MapperScan(basePackages="com.sckw.system.dao")
 public class SystemApplication {
 
     public static void main(String[] args) {

+ 22 - 18
sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/KwsEnterpriseController.java

@@ -1,9 +1,13 @@
 package com.sckw.system.controller;
 
+import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.system.model.KwsEntCheckTrack;
 import com.sckw.system.model.KwsEnterprise;
-import com.sckw.system.model.vo.res.KwsEnterpriseResVo;
+import com.sckw.system.model.vo.req.EntFindPageReqVo;
+import com.sckw.system.model.vo.req.EntRegisterReqVo;
+import com.sckw.system.model.vo.req.FreezeReqVo;
+import com.sckw.system.model.vo.req.KwsEnterpriseReqVo;
 import com.sckw.system.service.KwsEnterpriseService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -31,20 +35,19 @@ public class KwsEnterpriseController {
      **/
     @GetMapping("/detail")
     public HttpResult selectByKey(Long id) throws Exception {
-        KwsEnterprise kwsEnt = kwsEntService.selectByKey(id);
-        return HttpResult.ok(kwsEnt);
+        return HttpResult.ok(kwsEntService.selectByKey(id));
     }
 
     /**
-     * @param params {pageNum:页数、pageSize:每页条数、。。。}
+     * @param pageReqVo
      * @return
      * @description 分页查询
      * @author zk
      * @date 2023/5/30
      **/
-    @PostMapping("/select")
-    public HttpResult findPage(@RequestBody HashMap params) throws Exception {
-        return null;
+    @PostMapping("/findPage")
+    public HttpResult findPage(@RequestBody EntFindPageReqVo pageReqVo) throws Exception {
+        return HttpResult.ok(kwsEntService.findPage(pageReqVo));
     }
 
     /**
@@ -56,20 +59,19 @@ public class KwsEnterpriseController {
      **/
     @GetMapping("/certificate")
     public HttpResult certificate(@RequestParam Long id) throws Exception {
-        return HttpResult.ok();
+        return HttpResult.ok(kwsEntService.certificate(id));
     }
 
     /**
-     * @param params {username 昵称、account 账号、password 密码、captcha 验证码}
      * @return
      * @description 注册
      * @author zk
      * @date 2023/06/02
      **/
     @PostMapping("/register")
-    public HttpResult register(@RequestBody Map<String, Object> params) {
-
-        return null;
+    public HttpResult register(@RequestBody EntRegisterReqVo reqVo) {
+        kwsEntService.register(reqVo);
+        return HttpResult.ok(HttpStatus.MSG_003);
     }
 
     /**
@@ -85,15 +87,15 @@ public class KwsEnterpriseController {
     }
 
     /**
-     * @param params {id 主键ID、name 机构名称、company 是否公司}
      * @return
      * @description 更新/资质认证
      * @author zk
      * @date 2023/06/02
      **/
     @PostMapping("/update")
-    public HttpResult update(@RequestBody KwsEnterpriseResVo params) throws Exception {
-        return kwsEntService.update(params);
+    public HttpResult update(@RequestBody KwsEnterpriseReqVo reqVo) throws Exception {
+        kwsEntService.update(reqVo);
+        return HttpResult.ok(HttpStatus.MSG_005);
     }
 
     /**
@@ -117,7 +119,8 @@ public class KwsEnterpriseController {
      **/
     @PostMapping(value = "/approval")
     public HttpResult approval(@RequestBody KwsEntCheckTrack params) {
-        return null;
+        kwsEntService.approval(params);
+        return HttpResult.ok(HttpStatus.MSG_004);
     }
 
     /**
@@ -140,8 +143,9 @@ public class KwsEnterpriseController {
      * @date 2023/06/02
      **/
     @PostMapping(value = "/freeze")
-    public HttpResult freeze(@RequestBody Map<String, Object> params) {
-        return null;
+    public HttpResult freeze(@RequestBody FreezeReqVo reqVo) {
+        kwsEntService.freeze(reqVo);
+        return HttpResult.ok();
     }
 
     /**

+ 1 - 1
sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/KwsUserController.java

@@ -96,7 +96,7 @@ public class KwsUserController {
      * @date 2023/06/02
      **/
     @PostMapping("/resetPassword")
-    public HttpResult resetPassword(@RequestParam Long id) throws Exception {
+    public HttpResult resetPassword(@RequestParam Long id) {
         kwsUserService.resetPassword(id);
         return HttpResult.ok(HttpStatus.MSG_001);
     }

+ 8 - 1
sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsEntCertificateDao.java

@@ -1,5 +1,6 @@
 package com.sckw.system.dao;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.sckw.system.model.KwsEntCertificate;
 import org.apache.ibatis.annotations.Mapper;
 import java.util.List;
@@ -10,7 +11,7 @@ import java.util.List;
  * @date 2023-06-02
  */
 @Mapper
-public interface KwsEntCertificateDao {
+public interface KwsEntCertificateDao extends BaseMapper<KwsEntCertificate> {
     /**
      * 新增
      * @param record
@@ -39,4 +40,10 @@ public interface KwsEntCertificateDao {
      * @throws Exception
      */
     List<KwsEntCertificate> findList(Long entId);
+
+    /**
+     * 批量插入
+     */
+    int insertForBatch(List<KwsEntCertificate> list);
+
 }

+ 8 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsEntTypeDao.java

@@ -1,5 +1,6 @@
 package com.sckw.system.dao;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.sckw.system.model.KwsEntType;
 import org.apache.ibatis.annotations.Mapper;
 import java.util.List;
@@ -32,4 +33,11 @@ public interface KwsEntTypeDao {
      * @throws Exception
      */
     List<KwsEntType> findList(Long entId);
+
+    /**
+     * 批量插
+     * @param list
+     * @return
+     */
+    int insertForBatchtest(List<KwsEntType> list);
 }

+ 2 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsEnterpriseDao.java

@@ -20,6 +20,8 @@ public interface KwsEnterpriseDao extends BaseMapper<KwsEnterprise> {
      */
     int insert(KwsEnterprise record);
 
+    int insertPPPPP(KwsEnterprise record);
+
     /**
      * 更新
      * @param record

+ 34 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/SysUserDao.java

@@ -0,0 +1,34 @@
+package com.sckw.system.dao;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.sckw.system.model.KwsEntType;
+import com.sckw.system.model.SysUser;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+import java.util.List;
+import java.util.Map;
+
+@Mapper
+public interface SysUserDao {
+
+    /**
+     * 账号查询用户信息
+     * @param params {account:账号, systemType:系统类别}
+     * @return
+//     */
+    @DS("slave_1")
+    SysUser findByAccount(Map params);
+
+    @DS("master")
+    @Select("SELECT * FROM user limit 1")
+    List<SysUser> findUserByAccount(String account);
+
+    @DS("slave_1")
+    @Select("SELECT * FROM sys_user limit 10")
+    List<Map> findUserByAccount1(String account);
+
+    @DS("slave_1")
+    List<Map<String, Object>> findPage(Map<String, Object> params);
+
+    int cunstomtest(KwsEntType record);
+}

+ 0 - 13
sckw-modules/sckw-system/src/main/java/com/sckw/system/handle/CustomMetaHandle.java

@@ -1,13 +0,0 @@
-package com.sckw.system.handle;
-
-
-import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
-import com.sckw.core.utils.IdWorker;
-import org.apache.ibatis.reflection.MetaObject;
-import org.springframework.context.annotation.Configuration;
-
-//@Configuration
-public class CustomMetaHandle  {
-
-
-}

+ 0 - 34
sckw-modules/sckw-system/src/main/java/com/sckw/system/handle/MyConfig.java

@@ -1,34 +0,0 @@
-package com.sckw.system.handle;
-
-import com.baomidou.mybatisplus.core.MybatisConfiguration;
-import com.baomidou.mybatisplus.core.MybatisXMLLanguageDriver;
-import com.baomidou.mybatisplus.core.config.GlobalConfig;
-import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
-import org.apache.ibatis.session.SqlSessionFactory;
-import org.apache.ibatis.type.JdbcType;
-import org.mybatis.spring.transaction.SpringManagedTransactionFactory;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import javax.sql.DataSource;
-
-
-//@Configuration
-public class MyConfig {
-
-//    @Bean
-    public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception {
-        MybatisSqlSessionFactoryBean mybatisSqlSessionFactoryBean = new MybatisSqlSessionFactoryBean();
-        mybatisSqlSessionFactoryBean.setTypeAliasesPackage("com.sckw.*.model");
-        mybatisSqlSessionFactoryBean.setDataSource(dataSource);
-        MybatisConfiguration configuration = new MybatisConfiguration();
-        configuration.setDefaultScriptingLanguage(MybatisXMLLanguageDriver.class);
-        configuration.setJdbcTypeForNull(JdbcType.NULL);
-        mybatisSqlSessionFactoryBean.setConfiguration(configuration);
-
-        mybatisSqlSessionFactoryBean.setTransactionFactory(new SpringManagedTransactionFactory());
-//        mybatisSqlSessionFactoryBean.setGlobalConfig(new GlobalConfig().setMetaObjectHandler(new CustomMetaHandle()));
-        return mybatisSqlSessionFactoryBean.getObject();
-    }
-
-}

+ 5 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/KwsEnterprise.java

@@ -116,4 +116,9 @@ public class KwsEnterprise extends BaseModel {
      * 审批时间
      */
     private Date approvalTime;
+
+    /**
+     * 专属客户经理(用户ID)
+     */
+    private long manager;
 }

+ 48 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/req/BusinessLicense.java

@@ -0,0 +1,48 @@
+package com.sckw.system.model.vo.req;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 执照
+ */
+@Data
+public class BusinessLicense {
+
+    /**
+     * 执照记录id,新增时为空
+     */
+    private long id;
+
+    /**
+     * 执照编号
+     */
+    private String code;
+
+    /**
+     * 证书类型 (1联系人身份证 2法人身份证 3营业执照 4道路运输许可证 5开户许可证号 6授权证书 6电子签章授权书)
+     */
+    private int type;
+
+    /**
+     * 证书正面
+     */
+    private String certificateMian;
+
+    /**
+     * 证书反面
+     */
+    private String certificateRevolt;
+
+    /**
+     * 有效期
+     */
+    private Date validity;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+}

+ 46 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/req/EntFindPageReqVo.java

@@ -0,0 +1,46 @@
+package com.sckw.system.model.vo.req;
+
+import com.sckw.core.model.page.PageRequest;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author czh
+ * @desc 分页查询入参
+ * @date 2023/6/9
+ */
+@Data
+public class EntFindPageReqVo extends PageRequest implements Serializable {
+
+    /**
+     * 企业名
+     */
+    private String firmName;
+
+    /**
+     * 联系人
+     */
+    private String contacts;
+
+    /**
+     * 联系电话
+     */
+    private String telephone;
+
+    /**
+     * 法人姓名
+     */
+    private String legalName;
+
+    /**
+     * 法人电话
+     */
+    private String legalTelephone;
+
+    /**
+     * 审批状态 0未审批、1通过、2未通过、3审批中
+     */
+    private int approval;
+
+}

+ 106 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/req/EntRegisterReqVo.java

@@ -0,0 +1,106 @@
+package com.sckw.system.model.vo.req;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+@Data
+public class EntRegisterReqVo implements Serializable {
+
+    /**
+     * 企业名称
+     */
+    private String firmName;
+
+    /**
+     * 企业编号
+     */
+    private String code;
+
+    /**
+     * 企业联系人
+     */
+    private String contacts;
+
+    /**
+     * 联系电话
+     */
+    private String telephone;
+
+    /**
+     * 法人姓名
+     */
+    private String legalName;
+
+    /**
+     * 法人电话
+     */
+    private String legalTelephone;
+
+    /**
+     * 企业头像
+     */
+    private String head;
+
+    /**
+     * 企业类型 多个类型用","隔开
+     */
+    private String entTypes;
+
+    /**
+     * 企业级别
+     */
+    private String entLevel;
+
+    /**
+     * 所属一级企业
+     */
+    private String belongFirstEnt;
+
+    /**
+     * 组织机构代码
+     */
+    private String orgCode;
+
+    /**
+     * 企业地址
+     */
+    private String cityCode;
+
+    /**
+     * 详细地址
+     */
+    private String detailAddress;
+
+    /**
+     * 注册来源 (app、pc)
+     */
+    private String regSource;
+
+    /**
+     * 纬度
+     */
+    private String lat;
+
+    /**
+     * 经度
+     */
+    private String lng;
+
+    /**
+     * 专属客户经理(用户ID)
+     */
+    private long manager;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 执照集合
+     */
+    private List<BusinessLicense> businessLicense;
+
+}

+ 20 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/req/FreezeReqVo.java

@@ -0,0 +1,20 @@
+package com.sckw.system.model.vo.req;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class FreezeReqVo implements Serializable {
+
+    /**
+     * 企业id
+     */
+    private long id;
+
+    /**
+     * 状态0正常1锁定
+     */
+    private int status;
+
+}

+ 81 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/req/KwsEnterpriseReqVo.java

@@ -0,0 +1,81 @@
+package com.sckw.system.model.vo.req;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 企业关联信息
+ * @author zk
+ * @date 2023-06-02
+ */
+@Data
+public class KwsEnterpriseReqVo implements Serializable {
+
+    /**
+     * 企业ID
+     */
+    private long id;
+
+    /**
+     * 企业名称
+     */
+    private String firmName;
+
+    /**
+     * 企业类型,多个用","隔开
+     */
+    private String entTypes;
+
+    /**
+     * 联系人
+     */
+    private String contacts;
+
+    /**
+     * 联系电话
+     */
+    private String telephone;
+
+    /**
+     * 法人姓名
+     */
+    private String legalName;
+
+    /**
+     * 法人联系方式
+     */
+    private String legalTelephone;
+
+    /**
+     * 企业头像
+     */
+    private String head;
+
+    /**
+     * 组织机构code
+     */
+    private String orgCode;
+
+    /**
+     * 企业地址code
+     */
+    private String cityCode;
+
+    /**
+     * 企业地址
+     */
+    private String cityName;
+
+    /**
+     * 详细地址
+     */
+    private String detailAddress;
+
+    /**
+     * 企业证件信息
+     */
+    private List<BusinessLicense> certificates;
+
+}

+ 35 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/CertificateResVo.java

@@ -0,0 +1,35 @@
+package com.sckw.system.model.vo.res;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class CertificateResVo implements Serializable {
+
+    /**
+     * 证书类型
+     */
+    private int type;
+
+    /**
+     * 证书类型名
+     */
+    private String typeName;
+
+    /**
+     * 证书编号
+     */
+    private String code;
+
+    /**
+     * 证书正面URL地址
+     */
+    private String certificateMian;
+
+    /**
+     * 证书反面
+     */
+    private String certificateRevolt;
+
+}

+ 0 - 26
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/KwsEnterpriseResVo.java

@@ -1,26 +0,0 @@
-package com.sckw.system.model.vo.res;
-
-import com.sckw.core.model.base.BaseModel;
-import com.sckw.system.model.KwsEntCertificate;
-import com.sckw.system.model.KwsEntType;
-import lombok.Data;
-import java.util.List;
-
-/**
- * 企业关联信息
- * @author zk
- * @date 2023-06-02
- */
-@Data
-public class KwsEnterpriseResVo extends BaseModel {
-
-    /**
-     * 企业证件信息
-     */
-    private List<KwsEntCertificate> certificates;
-
-    /**
-     *企业类型
-     */
-    private List<KwsEntType> entTypes;
-}

+ 266 - 18
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java

@@ -1,25 +1,62 @@
 package com.sckw.system.service;
 
+import java.util.*;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.sckw.core.exception.SystemException;
+import com.sckw.core.model.constant.Global;
+import com.sckw.core.model.enums.ApprovalEnum;
+import com.sckw.core.model.enums.EntTypeEnum;
+import com.sckw.core.model.page.PageHelperUtil;
+import com.sckw.core.model.page.PageResult;
+import com.sckw.core.utils.BeanUtils;
+import com.sckw.core.utils.CollectionUtils;
+import com.sckw.core.utils.IdWorker;
+import com.sckw.core.utils.StringUtils;
+import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.response.HttpResult;
+import com.sckw.system.dao.KwsEntCertificateDao;
+import com.sckw.system.dao.KwsEntCheckTrackDao;
+import com.sckw.system.dao.KwsEntTypeDao;
 import com.sckw.system.dao.KwsEnterpriseDao;
+import com.sckw.system.model.KwsEntCertificate;
+import com.sckw.system.model.KwsEntCheckTrack;
+import com.sckw.system.model.KwsEntType;
 import com.sckw.system.model.KwsEnterprise;
-import com.sckw.system.model.vo.res.KwsEnterpriseResVo;
+import com.sckw.system.model.vo.req.*;
+import com.sckw.system.model.vo.res.CertificateResVo;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-
-import java.util.List;
-import java.util.Map;
+import org.springframework.transaction.annotation.Transactional;
 
 /**
  * 企业service接口
+ *
  * @author zk
  * @date 2023-05-31
  */
 @Service
 public class KwsEnterpriseService extends ServiceImpl<KwsEnterpriseDao, KwsEnterprise> {
 
+    @Autowired
+    private KwsEnterpriseDao kwsEnterpriseDao;
+
+    @Autowired
+    private KwsEntTypeDao kwsEntTypeDao;
+
+    @Autowired
+    private KwsEntCertificateDao kwsEntCertificateDao;
+
+    @Autowired
+    private KwsEntCheckTrackDao kwsEntCheckTrackDao;
+
     /**
      * 添加新纪录
+     *
      * @param params
      * @return
      * @throws Exception
@@ -38,6 +75,7 @@ public class KwsEnterpriseService extends ServiceImpl<KwsEnterpriseDao, KwsEnter
 
     /**
      * 删除记录-根据主键
+     *
      * @param ids
      * @return
      * @throws Exception
@@ -47,47 +85,140 @@ public class KwsEnterpriseService extends ServiceImpl<KwsEnterpriseDao, KwsEnter
     }
 
     /**
-     * 更新记录
-     * @param params
-     * @return
-     * @throws Exception
+     * 更新记录,有的是更新有的是新增,两种情况
      */
-    public HttpResult update(KwsEnterpriseResVo params) throws Exception {
-        return null;
+    @Transactional(rollbackFor = {})
+    public void update(KwsEnterpriseReqVo reqVo) throws Exception {
+        /*1、更新企业信息表*/
+        long entId = reqVo.getId();
+        KwsEnterprise kwsEnterprise = checkKwsEnterpriseById(entId);
+        BeanUtils.copyProperties(reqVo, kwsEnterprise);
+        if (!this.updateById(kwsEnterprise)) {
+            throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
+        }
+
+        /*2、更新企业类型*/
+        LambdaQueryWrapper<KwsEntType> kwsEntTypeLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        kwsEntTypeLambdaQueryWrapper.eq(KwsEntType::getEntId, entId);
+//        List<KwsEntType> kwsEntTypes = kwsEntTypeDao.selectList(kwsEntTypeLambdaQueryWrapper);
+        List<KwsEntType> kwsEntTypes = null;
+        List<String> typeReqList = Arrays.stream(reqVo.getEntTypes().split(",")).toList();
+        //若入参传来的type在表里面本来就有则不管,没有就新增
+        typeReqList.forEach(item -> {
+            if (CollectionUtils.isEmpty(kwsEntTypes) || kwsEntTypes.stream().filter(x -> x.getType() == Integer.parseInt(item)).findAny().isPresent()) {
+                return;
+            }
+
+            KwsEntType kwsEntType = new KwsEntType();
+            kwsEntType.setEntId(entId);
+            kwsEntType.setType(Integer.parseInt(item));
+            if (kwsEntTypeDao.insert(kwsEntType) <= 0) {
+                throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
+            }
+        });
+
+        //若表里的type没有在入参传来的type里则做逻辑删除,有就不管
+        if (CollectionUtils.isNotEmpty(kwsEntTypes)) {
+            kwsEntTypes.forEach(item -> {
+                if (typeReqList.contains(String.valueOf(item.getType()))) {
+                    item.setDelFlag(Global.YES);
+                    if (kwsEntTypeDao.update(item) <= 0) {
+                        throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
+                    }
+                }
+            });
+        }
+
+        /*更新证书信息*/
+        List<BusinessLicense> certificates = reqVo.getCertificates();
+        certificates.forEach(item -> {
+            long id = item.getId();
+            if (Objects.isNull(id)) {
+                KwsEntCertificate kwsEntCertificate = new KwsEntCertificate();
+                kwsEntCertificate.setEntId(entId);
+                BeanUtils.copyProperties(item, kwsEntCertificate);
+                if(kwsEntCertificateDao.insert(kwsEntCertificate) <= 0) {
+                    throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
+                }
+                return;
+            }
+
+            KwsEntCertificate kwsEntCertificate = checkEntCertificate(id);
+            BeanUtils.copyProperties(item, kwsEntCertificate);
+            //不做更新条数校验
+            kwsEntCertificateDao.update(kwsEntCertificate);
+        });
+
+
+    }
+
+    public KwsEntCertificate checkEntCertificate(long id){
+        KwsEntCertificate kwsEntCertificate = kwsEntCertificateDao.selectById(id);
+        if(Objects.isNull(kwsEntCertificate) || kwsEntCertificate.getDelFlag() == Global.NO){
+            throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.ENTCERTIFICATES_NOT_EXISTS);
+        }
+        return kwsEntCertificate;
     }
 
     /**
      * 根据主键查询
+     *
      * @param key
      * @return
      * @throws Exception
      */
     public KwsEnterprise selectByKey(Long key) throws Exception {
-        return null;
+        return checkKwsEnterpriseById(key);
     }
 
     /**
-     * 分页查询
-     * @param params
-     * @return
-     * @throws Exception
+     * @param reqVo
+     * @return HttpResult
+     * @desc: 分页查询
+     * @author: czh
+     * @date: 2023/6/9
      */
-    public List<KwsEnterprise> findPage(Map<String, Object> params) throws Exception{
-        return null;
+    public PageResult findPage(EntFindPageReqVo reqVo) throws Exception {
+        PageHelper.startPage(reqVo.getPageNum(), reqVo.getPageSize());
+        List<KwsEnterprise> list = findList(reqVo);
+        return PageHelperUtil.getPageResult(new PageInfo(list));
+    }
+
+    /**
+     * @param reqVo
+     * @return List<KwsEnterprise>
+     * @desc: 全量查询
+     * @author: czh
+     * @date: 2023/6/9
+     */
+    public List<KwsEnterprise> findList(EntFindPageReqVo reqVo) {
+        LambdaQueryWrapper<KwsEnterprise> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(StringUtils.isNotBlank(reqVo.getFirmName()), KwsEnterprise::getFirmName, reqVo.getFirmName());
+        wrapper.eq(StringUtils.isNotBlank(reqVo.getContacts()), KwsEnterprise::getContacts, reqVo.getContacts());
+        wrapper.eq(StringUtils.isNotBlank(reqVo.getTelephone()), KwsEnterprise::getTelephone, reqVo.getTelephone());
+        wrapper.eq(StringUtils.isNotBlank(reqVo.getLegalName()), KwsEnterprise::getLegalName, reqVo.getLegalName());
+        wrapper.eq(StringUtils.isNotBlank(reqVo.getLegalTelephone()), KwsEnterprise::getLegalTelephone, reqVo.getLegalTelephone());
+        wrapper.eq(!Objects.isNull(reqVo.getApproval()), KwsEnterprise::getApproval, reqVo.getApproval());
+        wrapper.eq(KwsEnterprise::getDelFlag, Global.NO);
+        wrapper.orderByDesc(KwsEnterprise::getCreateTime);
+        return this.list(wrapper);
     }
 
+
     /**
      * 查询
+     *
      * @param params
      * @return
      * @throws Exception
      */
-    public List<Map<String, Object>> findList(Map<String, Object> params) throws Exception{
+    public List<Map<String, Object>> findList(Map<String, Object> params) throws Exception {
         return null;
     }
 
     /**
      * 参数校验
+     *
      * @param params
      * @return
      * @throws Exception
@@ -96,4 +227,121 @@ public class KwsEnterpriseService extends ServiceImpl<KwsEnterpriseDao, KwsEnter
 
         return null;
     }
+
+    /**
+     * 新增企业(注册)
+     */
+    @Transactional(rollbackFor = {})
+    public void register(EntRegisterReqVo reqVo) {
+        /*存企业信息表*/
+        KwsEnterprise kwsEnterprise = new KwsEnterprise();
+        long entId = new IdWorker(1).nextId();
+        kwsEnterprise.setId(entId);
+        BeanUtils.copyProperties(reqVo, kwsEnterprise);
+
+        //一些待确认的字段
+        kwsEnterprise.setIntegral(0);
+        kwsEnterprise.setBalance(0L);
+        kwsEnterprise.setExperience(0);
+        kwsEnterprise.setMemberLevel(0);
+        kwsEnterprise.setRegTime(new Date());
+        kwsEnterprise.setApproval(ApprovalEnum.NO.getCode());
+        kwsEnterpriseDao.insertPPPPP(kwsEnterprise);
+        if (!this.save(kwsEnterprise)) {
+            throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
+        }
+
+        /*存企业类型,一个企业可以有多个类型*/
+        List<KwsEntType> kwsEntTypes = new ArrayList<>();
+        Arrays.stream(reqVo.getEntTypes().split(",")).toList().forEach(item -> {
+            KwsEntType kwsEntType = new KwsEntType();
+            kwsEntType.setEntId(entId);
+            kwsEntType.setType(Integer.parseInt(item));
+            kwsEntTypes.add(kwsEntType);
+        });
+        if (kwsEntTypeDao.insertForBatchtest(kwsEntTypes) != kwsEntTypes.size()) {
+            throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
+        }
+
+        /*存企业证书*/
+        List<KwsEntCertificate> kwsEntCertificates = new ArrayList<>();
+        reqVo.getBusinessLicense().forEach(item -> {
+            KwsEntCertificate kwsEntCertificate = new KwsEntCertificate();
+            //todo 上传证书正反面,将url放到两个入参里
+            kwsEntCertificate.setEntId(entId);
+            BeanUtils.copyProperties(item, kwsEntCertificate);
+            kwsEntCertificates.add(kwsEntCertificate);
+        });
+        if (kwsEntCertificateDao.insertForBatch(kwsEntCertificates) != kwsEntCertificates.size()) {
+            throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
+        }
+    }
+
+    /**
+     * 企业审批
+     */
+    @Transactional(rollbackFor = {})
+    public void approval(KwsEntCheckTrack kwsEntCheckTrack) {
+        /*更新企业信息主表审批状态*/
+        KwsEnterprise kwsEnterprise = checkKwsEnterpriseById(kwsEntCheckTrack.getEntId());
+        LambdaUpdateChainWrapper<KwsEnterprise> wrapper = new LambdaUpdateChainWrapper<>(kwsEnterpriseDao);
+        wrapper.eq(KwsEnterprise::getId, kwsEnterprise.getId());
+        wrapper.eq(KwsEnterprise::getApproval, ApprovalEnum.NO.getCode());
+        wrapper.set(KwsEnterprise::getApproval, kwsEntCheckTrack.getStatus());
+        if (!wrapper.update()) {
+            throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
+        }
+
+        /*新增审批记录*/
+        if (kwsEntCheckTrackDao.insert(kwsEntCheckTrack) <= 0) {
+            throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
+        }
+    }
+
+    private KwsEnterprise checkKwsEnterpriseById(long id) {
+        LambdaQueryWrapper<KwsEnterprise> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(KwsEnterprise::getId, id);
+        wrapper.eq(KwsEnterprise::getDelFlag, Global.NO);
+        KwsEnterprise kwsEnterprise = this.getOne(wrapper);
+        if (Objects.isNull(kwsEnterprise)) {
+            throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.ENT_NOT_EXISTS);
+        }
+        return kwsEnterprise;
+    }
+
+    /**
+     * 企业冻结/解冻
+     */
+    public void freeze(FreezeReqVo reqVo) {
+        KwsEnterprise kwsEnterprise = checkKwsEnterpriseById(reqVo.getId());
+        kwsEnterprise.setStatus(reqVo.getStatus());
+        if (kwsEnterpriseDao.update(kwsEnterprise) <= 0) {
+            throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.UPDATE_FAIL);
+        }
+    }
+
+    /**
+     * 企业证件信息
+     */
+    public List<CertificateResVo> certificate(Long id) {
+        /*查企业资质*/
+        LambdaQueryWrapper<KwsEntCertificate> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(KwsEntCertificate::getEntId, id);
+        wrapper.eq(KwsEntCertificate::getDelFlag, Global.NO);
+        List<KwsEntCertificate> kwsEntCertificates = kwsEntCertificateDao.selectList(wrapper);
+        if (CollectionUtils.isEmpty(kwsEntCertificates)) {
+            throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.ENTCERTIFICATES_NOT_EXISTS);
+        }
+
+        /*拼装返参*/
+        List<CertificateResVo> list = new ArrayList<>();
+        kwsEntCertificates.forEach(item -> {
+            CertificateResVo certificateResVo = new CertificateResVo();
+            certificateResVo.setTypeName(EntTypeEnum.getName(item.getType()).getName());
+            BeanUtils.copyProperties(item, certificateResVo);
+            list.add(certificateResVo);
+        });
+        return list;
+    }
+
 }

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

@@ -1,5 +1,4 @@
 package com.sckw.system.service;
-import java.util.Date;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -69,7 +68,7 @@ public class KwsUserService extends ServiceImpl<KwsUserDao, KwsUser> {
         kwsUser.setUpdateBy(0L);
         int count = kwsUserDao.insert(kwsUser);
         if (count <= 0) {
-           throw new SystemException(HttpStatus.CODE_60601, HttpStatus.INSERT_FAIL);
+           throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
         }
     }
 
@@ -105,7 +104,7 @@ public class KwsUserService extends ServiceImpl<KwsUserDao, KwsUser> {
         }
 
         if (resultCode < idArray.length) {
-            throw new SystemException(HttpStatus.CODE_60601, HttpStatus.DELETE_FAIL);
+            throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.DELETE_FAIL);
         }
     }
 
@@ -138,12 +137,9 @@ public class KwsUserService extends ServiceImpl<KwsUserDao, KwsUser> {
     /**
      * 重置密码
      */
-    public void resetPassword(Long id) throws Exception {
+    public void resetPassword(Long id) {
         //查用户信息
-        KwsUser kwsUser = kwsUserDao.selectByKey(id);
-        if (Objects.isNull(kwsUser)) {
-            throw new SystemException(HttpStatus.CODE_60602, HttpStatus.ACCOUNT_NOT_EXISTS);
-        }
+        KwsUser kwsUser = checkUserBase(id);
 
         //重置密码
         updatePwd(PasswordUtils.md5(kwsUser.getAccount()), kwsUser);
@@ -226,7 +222,7 @@ public class KwsUserService extends ServiceImpl<KwsUserDao, KwsUser> {
     private void updatePwd(String newPassword, KwsUser kwsUser) {
         kwsUser.setPassword(PasswordUtils.entryptPassword(newPassword));
         if(kwsUserDao.update(kwsUser) <= 0) {
-            throw new SystemException(HttpStatus.CODE_60601, HttpStatus.UPDATE_FAIL);
+            throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
         }
     }
 
@@ -254,7 +250,18 @@ public class KwsUserService extends ServiceImpl<KwsUserDao, KwsUser> {
     public KwsUser checkUserBase(String account) {
         KwsUser kwsUser = getUserByAccount(account);
         if (Objects.isNull(kwsUser)) {
-            throw new SystemException(HttpStatus.CODE_60602, HttpStatus.ACCOUNT_NOT_EXISTS);
+            throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.ACCOUNT_NOT_EXISTS);
+        }
+        return kwsUser;
+    }
+
+    /**
+     * 根据id校验
+     */
+    public KwsUser checkUserBase(long id) {
+        KwsUser kwsUser = this.getById(id);
+        if (Objects.isNull(kwsUser) || kwsUser.getDelFlag() != Global.NO) {
+            throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.ACCOUNT_NOT_EXISTS);
         }
         return kwsUser;
     }

+ 18 - 0
sckw-modules/sckw-system/src/main/resources/bootstrap-dev.yml

@@ -69,9 +69,27 @@ dubbo:
     #use-as-config-center: false
     #use-as-metadata-center: false
 
+  datasource:
+    dynamic:
+      primary: master #设置默认的数据源或者数据源组,默认值即为master
+      strict: false #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
+      datasource:
+        master:
+          url: jdbc:mysql://47.108.162.14:3306/sckw_system?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8
+          username: root
+          password: Yy123...
+          driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
+        slave_1:
+          url: jdbc:mysql://47.108.162.14:3306/wph_system?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8
+          username: root
+          password: Yy123...
+          driver-class-name: com.mysql.jdbc.Driver
+
+
 mybatis-plus:
   mapper-locations: classpath*:/mapper/*.xml    #扫描xml文件
   #实体扫描,多个package用逗号或者分号分隔
   typeAliasesPackage: com.sckw.*.model
   configuration:
     log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+

+ 91 - 1
sckw-modules/sckw-system/src/main/resources/mapper/KwsEntCertificateDao.xml

@@ -115,7 +115,97 @@
     </trim>
   </insert>
 
-  <update id="update" parameterType="com.sckw.system.model.KwsEntCertificate">
+    <insert id="insertForBatch">
+      insert into kws_ent_certificate
+      <trim prefix="(" suffix=")" suffixOverrides=",">
+        <if test="id != null">
+          id,
+        </if>
+        <if test="entId != null">
+          ent_id,
+        </if>
+        <if test="type != null">
+          type,
+        </if>
+        <if test="code != null">
+          code,
+        </if>
+        <if test="certificateMian != null">
+          certificate_mian,
+        </if>
+        <if test="certificateRevolt != null">
+          certificate_revolt,
+        </if>
+        <if test="remark != null">
+          remark,
+        </if>
+        <if test="status != null">
+          status,
+        </if>
+        <if test="createBy != null">
+          create_by,
+        </if>
+        <if test="createTime != null">
+          create_time,
+        </if>
+        <if test="updateBy != null">
+          update_by,
+        </if>
+        <if test="updateTime != null">
+          update_time,
+        </if>
+        <if test="delFlag != null">
+          del_flag,
+        </if>
+      </trim>
+      values
+        <foreach collection="list" item="item" separator=",">
+          <trim prefix="(" suffix=")" suffixOverrides=",">
+          <if test="id != null">
+            #{id,jdbcType=BIGINT},
+          </if>
+          <if test="entId != null">
+            #{entId,jdbcType=BIGINT},
+          </if>
+          <if test="type != null">
+            #{type,jdbcType=INTEGER},
+          </if>
+          <if test="code != null">
+            #{code,jdbcType=VARCHAR},
+          </if>
+          <if test="certificateMian != null">
+            #{certificateMian,jdbcType=VARCHAR},
+          </if>
+          <if test="certificateRevolt != null">
+            #{certificateRevolt,jdbcType=VARCHAR},
+          </if>
+          <if test="remark != null">
+            #{remark,jdbcType=VARCHAR},
+          </if>
+          <if test="status != null">
+            #{status,jdbcType=INTEGER},
+          </if>
+          <if test="createBy != null">
+            #{createBy,jdbcType=BIGINT},
+          </if>
+          <if test="createTime != null">
+            #{createTime,jdbcType=TIMESTAMP},
+          </if>
+          <if test="updateBy != null">
+            #{updateBy,jdbcType=BIGINT},
+          </if>
+          <if test="updateTime != null">
+            #{updateTime,jdbcType=TIMESTAMP},
+          </if>
+          <if test="delFlag != null">
+            #{delFlag,jdbcType=INTEGER},
+          </if>
+          </trim>
+        </foreach>
+
+    </insert>
+
+    <update id="update" parameterType="com.sckw.system.model.KwsEntCertificate">
     update kws_ent_certificate
     <set>
       <if test="entId != null">

+ 72 - 1
sckw-modules/sckw-system/src/main/resources/mapper/KwsEntTypeDao.xml

@@ -19,7 +19,7 @@
     del_flag
   </sql>
 
-  <insert id="insertSelective" parameterType="com.sckw.system.model.KwsEntType">
+  <insert id="insert" parameterType="com.sckw.system.model.KwsEntType">
     insert into kws_ent_type
     <trim prefix="(" suffix=")" suffixOverrides=",">
       <if test="id != null">
@@ -87,6 +87,77 @@
     </trim>
   </insert>
 
+    <insert id="insertForBatchtest" parameterType="com.sckw.system.model.KwsEntType">
+      insert into kws_ent_type
+      <trim prefix="(" suffix=")" suffixOverrides=",">
+        <if test="id != null">
+          id,
+        </if>
+        <if test="entId != null">
+          ent_id,
+        </if>
+        <if test="type != null">
+          type,
+        </if>
+        <if test="remark != null">
+          remark,
+        </if>
+        <if test="status != null">
+          status,
+        </if>
+        <if test="createBy != null">
+          create_by,
+        </if>
+        <if test="createTime != null">
+          create_time,
+        </if>
+        <if test="updateBy != null">
+          update_by,
+        </if>
+        <if test="updateTime != null">
+          update_time,
+        </if>
+        <if test="delFlag != null">
+          del_flag,
+        </if>
+      </trim>
+      values
+      <foreach collection="list" item="item" separator=",">
+      <trim prefix="values (" suffix=")" suffixOverrides=",">
+        <if test="id != null">
+          #{id,jdbcType=BIGINT},
+        </if>
+        <if test="entId != null">
+          #{entId,jdbcType=BIGINT},
+        </if>
+        <if test="type != null">
+          #{type,jdbcType=INTEGER},
+        </if>
+        <if test="remark != null">
+          #{remark,jdbcType=VARCHAR},
+        </if>
+        <if test="status != null">
+          #{status,jdbcType=INTEGER},
+        </if>
+        <if test="createBy != null">
+          #{createBy,jdbcType=BIGINT},
+        </if>
+        <if test="createTime != null">
+          #{createTime,jdbcType=TIMESTAMP},
+        </if>
+        <if test="updateBy != null">
+          #{updateBy,jdbcType=BIGINT},
+        </if>
+        <if test="updateTime != null">
+          #{updateTime,jdbcType=TIMESTAMP},
+        </if>
+        <if test="delFlag != null">
+          #{delFlag,jdbcType=INTEGER},
+        </if>
+      </trim>
+      </foreach>
+    </insert>
+
   <update id="updateByPrimaryKeySelective" parameterType="com.sckw.system.model.KwsEntType">
     update kws_ent_type
     <set>

+ 181 - 0
sckw-modules/sckw-system/src/main/resources/mapper/KwsEnterpriseDao.xml

@@ -228,6 +228,187 @@
       </if>
     </trim>
   </insert>
+  <insert id="insertPPPPP" parameterType="com.sckw.system.model.KwsEnterprise">
+    insert into kws_enterprise
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="firmName != null">
+        firm_name,
+      </if>
+      <if test="code != null">
+        code,
+      </if>
+      <if test="contacts != null">
+        contacts,
+      </if>
+      <if test="telephone != null">
+        telephone,
+      </if>
+      <if test="legalName != null">
+        legal_name,
+      </if>
+      <if test="legalTelephone != null">
+        legal_telephone,
+      </if>
+      <if test="head != null">
+        head,
+      </if>
+      <if test="integral != null">
+        integral,
+      </if>
+      <if test="balance != null">
+        balance,
+      </if>
+      <if test="experience != null">
+        experience,
+      </if>
+      <if test="memberLevel != null">
+        member_level,
+      </if>
+      <if test="regTime != null">
+        reg_time,
+      </if>
+      <if test="regSource != null">
+        reg_source,
+      </if>
+      <if test="orgCode != null">
+        org_code,
+      </if>
+      <if test="cityCode != null">
+        city_code,
+      </if>
+      <if test="detailAddress != null">
+        detail_address,
+      </if>
+      <if test="lat != null">
+        lat,
+      </if>
+      <if test="lng != null">
+        lng,
+      </if>
+      <if test="approval != null">
+        approval,
+      </if>
+      <if test="approvalTime != null">
+        approval_time,
+      </if>
+      <if test="manager != null">
+        manager,
+      </if>
+      <if test="remark != null">
+        remark,
+      </if>
+      <if test="status != null">
+        status,
+      </if>
+      <if test="createBy != null">
+        create_by,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="updateBy != null">
+        update_by,
+      </if>
+      <if test="updateTime != null">
+        update_time,
+      </if>
+      <if test="delFlag != null">
+        del_flag,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=BIGINT},
+      </if>
+      <if test="firmName != null">
+        #{firmName,jdbcType=VARCHAR},
+      </if>
+      <if test="code != null">
+        #{code,jdbcType=VARCHAR},
+      </if>
+      <if test="contacts != null">
+        #{contacts,jdbcType=VARCHAR},
+      </if>
+      <if test="telephone != null">
+        #{telephone,jdbcType=VARCHAR},
+      </if>
+      <if test="legalName != null">
+        #{legalName,jdbcType=VARCHAR},
+      </if>
+      <if test="legalTelephone != null">
+        #{legalTelephone,jdbcType=VARCHAR},
+      </if>
+      <if test="head != null">
+        #{head,jdbcType=VARCHAR},
+      </if>
+      <if test="integral != null">
+        #{integral,jdbcType=INTEGER},
+      </if>
+      <if test="balance != null">
+        #{balance,jdbcType=DECIMAL},
+      </if>
+      <if test="experience != null">
+        #{experience,jdbcType=INTEGER},
+      </if>
+      <if test="memberLevel != null">
+        #{memberLevel,jdbcType=INTEGER},
+      </if>
+      <if test="regTime != null">
+        #{regTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="regSource != null">
+        #{regSource,jdbcType=VARCHAR},
+      </if>
+      <if test="orgCode != null">
+        #{orgCode,jdbcType=VARCHAR},
+      </if>
+      <if test="cityCode != null">
+        #{cityCode,jdbcType=INTEGER},
+      </if>
+      <if test="detailAddress != null">
+        #{detailAddress,jdbcType=VARCHAR},
+      </if>
+      <if test="lat != null">
+        #{lat,jdbcType=VARCHAR},
+      </if>
+      <if test="lng != null">
+        #{lng,jdbcType=VARCHAR},
+      </if>
+      <if test="approval != null">
+        #{approval,jdbcType=INTEGER},
+      </if>
+      <if test="approvalTime != null">
+        #{approvalTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="manager != null">
+        #{manager,jdbcType=BIGINT},
+      </if>
+      <if test="remark != null">
+        #{remark,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        #{status,jdbcType=INTEGER},
+      </if>
+      <if test="createBy != null">
+        #{createBy,jdbcType=BIGINT},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateBy != null">
+        #{updateBy,jdbcType=BIGINT},
+      </if>
+      <if test="updateTime != null">
+        #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="delFlag != null">
+        #{delFlag,jdbcType=INTEGER},
+      </if>
+    </trim>
+  </insert>
 
   <update id="update" parameterType="com.sckw.system.model.KwsEnterprise">
     update kws_enterprise

+ 67 - 0
sckw-modules/sckw-system/src/main/resources/mapper/SysUserDao.xml

@@ -19,6 +19,73 @@
     <result column="update_time" property="updateTime" />
     <result column="del_flag" property="delFlag" />
   </resultMap>
+  <insert id="cunstomtest" parameterType="com.sckw.system.model.KwsEntType">
+    insert into kws_ent_type
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="entId != null">
+        ent_id,
+      </if>
+      <if test="type != null">
+        type,
+      </if>
+      <if test="remark != null">
+        remark,
+      </if>
+      <if test="status != null">
+        status,
+      </if>
+      <if test="createBy != null">
+        create_by,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="updateBy != null">
+        update_by,
+      </if>
+      <if test="updateTime != null">
+        update_time,
+      </if>
+      <if test="delFlag != null">
+        del_flag,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=BIGINT},
+      </if>
+      <if test="entId != null">
+        #{entId,jdbcType=BIGINT},
+      </if>
+      <if test="type != null">
+        #{type,jdbcType=INTEGER},
+      </if>
+      <if test="remark != null">
+        #{remark,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        #{status,jdbcType=INTEGER},
+      </if>
+      <if test="createBy != null">
+        #{createBy,jdbcType=BIGINT},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateBy != null">
+        #{updateBy,jdbcType=BIGINT},
+      </if>
+      <if test="updateTime != null">
+        #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="delFlag != null">
+        #{delFlag,jdbcType=INTEGER},
+      </if>
+    </trim>
+  </insert>
 
   <select id="findByAccount" parameterType="java.util.Map" resultType="com.sckw.system.model.SysUser">
     SELECT