czh hace 2 años
padre
commit
be5bc7ec82

+ 2 - 0
sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/context/Enums.java

@@ -4,6 +4,7 @@ import com.sckw.core.common.enums.NumberConstant;
 import com.sckw.core.exception.SourceInitializeException;
 import com.sckw.core.model.enums.LogisticsOrderEnum;
 import com.sckw.excel.translate.Sources;
+import jakarta.annotation.PostConstruct;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.Ordered;
 import org.springframework.data.redis.core.RedisTemplate;
@@ -27,6 +28,7 @@ public class Enums implements Source, Ordered {
     @Autowired
     private RedisTemplate<String, Object> redisTemplate;
 
+
     public Enums() {
         initial();
     }

+ 5 - 0
sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/enums/Source.java

@@ -11,6 +11,8 @@ package com.sckw.excel.translate.enums;
  * @copyright
  */
 public enum Source {
+
+    TEST("com.sckw.excel.translate.context.Enums"),
     /**
      * 字典
      */
@@ -45,6 +47,9 @@ public enum Source {
         if (clazzName.equals(ENUMS.getClazz())) {
             return ENUMS;
         }
+        if (clazzName.equals(TEST.getClazz())) {
+            return TEST;
+        }
         return null;
     }
 }

+ 2 - 1
sckw-common/sckw-common-excel/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

@@ -1 +1,2 @@
-com.sckw.excel.translate.SourceUtil
+com.sckw.excel.translate.SourceUtil
+com.sckw.excel.translate.context.Enums

+ 4 - 3
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/controller/KwmCooperateManageController.java

@@ -8,6 +8,7 @@ import com.sckw.manage.service.KwmCooperateManageService;
 import jakarta.servlet.http.HttpServletResponse;
 import jakarta.validation.Valid;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -134,7 +135,7 @@ public class KwmCooperateManageController {
      * @date: 2023/7/22
      */
     @PostMapping("findEntCooperate")
-    public HttpResult findEntCooperate(@RequestBody FindEntCooperateReqVo reqVo) {
+    public HttpResult findEntCooperate(@Valid @RequestBody FindEntCooperateReqVo reqVo) {
         return HttpResult.ok(kwmCooperateManageService.findEntCooperate(reqVo));
     }
 
@@ -147,7 +148,7 @@ public class KwmCooperateManageController {
      * @date: 2023/8/1
      */
     @PostMapping("findCooperateByEnt")
-    public HttpResult findCooperateByEnt(@RequestBody FindCooperateByEntReqVo reqVo) {
+    public HttpResult findCooperateByEnt(@Valid @RequestBody FindCooperateByEntReqVo reqVo) {
         return HttpResult.ok(kwmCooperateManageService.findCooperateByEnt(reqVo));
     }
 
@@ -159,7 +160,7 @@ public class KwmCooperateManageController {
      * @date: 2023/7/22
      */
     @PostMapping("findTargetEntCooperateInOur")
-    public HttpResult findTargetEntCooperateInOur(@RequestBody FindCooperateByEntReqVo reqVo) {
+    public HttpResult findTargetEntCooperateInOur(@Valid @RequestBody FindCooperateByEntReqVo reqVo) {
         return HttpResult.ok(kwmCooperateManageService.findTargetEntCooperateInOur(reqVo));
     }
 

+ 5 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/EntDetailResVo.java

@@ -32,6 +32,11 @@ public class EntDetailResVo implements Serializable {
      */
     private String contacts;
 
+    /**
+     * 企业联系人
+     */
+    private Long contactsId;
+
     /**
      * 联系电话
      */

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

@@ -1,4 +1,5 @@
 package com.sckw.system.service;
+
 import java.util.Date;
 
 import cn.hutool.core.date.DateUtil;
@@ -333,19 +334,19 @@ public class KwsEnterpriseService {
         }
         Arrays.stream(reqVo.getEntTypes().split(",")).toList().forEach(item -> {
             //if (!finalTypeList.contains(Integer.parseInt(item))) {
-                KwsEntType kwsEntType = new KwsEntType();
-                kwsEntType.setEntId(entId);
-                kwsEntType.setType(Integer.parseInt(item));
-                kwsEntType.setId(new IdWorker(1).nextId());
-                kwsEntType.setStatus(Global.NO);
-                kwsEntType.setCreateBy(userId);
-                kwsEntType.setCreateTime(date);
-                kwsEntType.setUpdateBy(userId);
-                kwsEntType.setUpdateTime(date);
-                kwsEntType.setDelFlag(Global.NO);
-                if (kwsEntTypeDao.insert(kwsEntType) <= 0) {
-                    throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
-                }
+            KwsEntType kwsEntType = new KwsEntType();
+            kwsEntType.setEntId(entId);
+            kwsEntType.setType(Integer.parseInt(item));
+            kwsEntType.setId(new IdWorker(1).nextId());
+            kwsEntType.setStatus(Global.NO);
+            kwsEntType.setCreateBy(userId);
+            kwsEntType.setCreateTime(date);
+            kwsEntType.setUpdateBy(userId);
+            kwsEntType.setUpdateTime(date);
+            kwsEntType.setDelFlag(Global.NO);
+            if (kwsEntTypeDao.insert(kwsEntType) <= 0) {
+                throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
+            }
             //}
         });
 
@@ -383,9 +384,9 @@ public class KwsEnterpriseService {
         map.put("entName", kwsEnterprise.getFirmName());
         map.put("createByName", kwsEnterprise.getContacts());
         commonService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(userId).setEntId(entId)),
-                                        MessageEnum.ENT_CERTIFICATE,
-                                        map,
-                                        entCertificateUrl);
+                MessageEnum.ENT_CERTIFICATE,
+                map,
+                entCertificateUrl);
     }
 
     /**
@@ -412,7 +413,7 @@ public class KwsEnterpriseService {
         for (KwsEntCertificate kwsEntCertificate : kwsEntCertificateList) {
             //先把旧的作废
             List<KwsEntCertificate> previous = kwsEntCertificateDao.findByEntType(kwsEntCertificate.getEntId(), kwsEntCertificate.getType());
-            previous = previous.stream().filter(item -> item.getId().compareTo(kwsEntCertificate.getId()) != 0).toList();
+            previous = previous.stream().filter(item -> !item.getId().equals(kwsEntCertificate.getId())).toList();
             if (!CollectionUtils.isEmpty(previous)) {
                 for (KwsEntCertificate kwsEntCertificate1 : previous) {
                     kwsEntCertificate1.setDelFlag(Global.YES);
@@ -533,6 +534,10 @@ public class KwsEnterpriseService {
             throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.ENTCERTIFICATES_NOT_EXISTS);
         }
 
+        kwsEntCertificates = kwsEntCertificates.stream().filter(item -> item.getStatus().equals(Global.NO)).toList();
+        if (CollectionUtils.isEmpty(kwsEntCertificates)) {
+            throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.ENTCERTIFICATES_NOT_EXISTS);
+        }
         /*拼装返参*/
         List<CertificateResVo> list = new ArrayList<>();
         kwsEntCertificates.forEach(item -> {
@@ -778,6 +783,10 @@ public class KwsEnterpriseService {
         }
         EntDetailResVo entDetailResVo = new EntDetailResVo();
         BeanUtils.copyProperties(kwsEnterprise, entDetailResVo);
+        FindManagePojo manageInfoByEntId = kwsEnterpriseDao.findManageInfoByEntId(kwsEnterprise.getId());
+        if (Objects.nonNull(manageInfoByEntId)) {
+            entDetailResVo.setContactsId(manageInfoByEntId.getUserId());
+        }
         List<KwsEntType> listByEntIds = kwsEntTypeDao.findListByEntIds(Collections.singletonList(kwsEnterprise.getId()));
         if (CollectionUtils.isNotEmpty(listByEntIds)) {
             entDetailResVo.setEntTypes(String.join(Global.COMMA, listByEntIds.stream().map(KwsEntType::getType).map(String::valueOf).distinct().toList()));
@@ -786,8 +795,8 @@ public class KwsEnterpriseService {
     }
 
     /**
-     * @desc 企业联系人信息
      * @param id 企业信息
+     * @desc 企业联系人信息
      * @author zk
      * @date 2023/9/1
      **/