Browse Source

查企业分组

czh 2 years ago
parent
commit
12ad4548ee

+ 16 - 1
sckw-auth/pom.xml

@@ -49,5 +49,20 @@
         </dependency>
 
     </dependencies>
-
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>3.1.0</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
 </project>

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

@@ -15,7 +15,7 @@ public enum ApprovalEnum {
     //通过
     OK(1, "已认证"),
     //未通过
-    PASS(2, "驳回"),
+    PASS(2, "驳回"),
     //审批中
     PROCESS(3, "待审批"),
     //更新中,待审批

+ 12 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/KwsEnterpriseController.java

@@ -47,6 +47,18 @@ public class KwsEnterpriseController {
         return HttpResult.ok(kwsEntService.findPage(pageReqVo));
     }
 
+    /**
+     * @param pageReqVo
+     * @return HttpResult
+     * @description 分页查询
+     * @author zk
+     * @date 2023/5/30
+     **/
+    @PostMapping("/findListGroup")
+    public HttpResult findListGroup(@RequestBody EntFindPageReqVo pageReqVo) throws SystemException {
+        return HttpResult.ok(kwsEntService.findListGroup(pageReqVo));
+    }
+
     /**
      * @param id 主键ID
      * @return HttpResult

+ 1 - 1
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/pojo/FindPojoParam.java

@@ -42,6 +42,6 @@ public class FindPojoParam extends PageRequest {
     /**
      * 审批状态 0未审批、1通过、2未通过、3审批中
      */
-    private int approval;
+    private Integer approval;
 
 }

+ 1 - 2
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/req/EntFindPageReqVo.java

@@ -5,7 +5,6 @@ import lombok.Data;
 
 import java.io.Serializable;
 import java.util.Date;
-import java.util.List;
 
 /**
  * @author czh
@@ -43,7 +42,7 @@ public class EntFindPageReqVo extends PageRequest implements Serializable {
     /**
      * 审批状态 0未审批、1通过、2未通过、3审批中
      */
-    private int approval;
+    private Integer approval;
 
     /**
      * 企业名/联系人/联系电话

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

@@ -75,4 +75,9 @@ public class EntFindPageResVo implements Serializable {
      */
     private Integer entryType;
 
+    /**
+     * 入驻类型中文
+     */
+    private String entryTypeStr;
+
 }

+ 34 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/FindListGroupResVo.java

@@ -0,0 +1,34 @@
+package com.sckw.system.model.vo.res;
+
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * @author czh
+ * @desc 查询返参
+ * @date 2023/7/13
+ */
+@Data
+public class FindListGroupResVo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 5753140164229285313L;
+
+    /**
+     * 审核状态
+     */
+    private Integer approval;
+
+    /**
+     * 审核状态名
+     */
+    private String approvalName;
+
+    /**
+     * 数量
+     */
+    private Integer count;
+
+}

+ 38 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java

@@ -30,6 +30,7 @@ import com.sckw.system.model.pojo.FindPojoParam;
 import com.sckw.system.model.vo.req.*;
 import com.sckw.system.model.vo.res.CertificateResVo;
 import com.sckw.system.model.vo.res.EntFindPageResVo;
+import com.sckw.system.model.vo.res.FindListGroupResVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -251,6 +252,7 @@ public class KwsEnterpriseService {
             entFindPageResVo.setApprovalTime(item.getApprovalTime());
             entFindPageResVo.setEntTypes(item.getType());
             entFindPageResVo.setEntryType(item.getSystemType().intValue() == SystemTypeEnum.MANAGE.getCode() ? EntryTypeEnum.PLATFORM.getCode() : EntryTypeEnum.SELF.getCode());
+            entFindPageResVo.setEntryTypeStr(EntryTypeEnum.getName(entFindPageResVo.getEntryType()).getName());
             result.add(entFindPageResVo);
         }
         return PageHelperUtil.getPageResult(new PageInfo<>(result));
@@ -583,4 +585,40 @@ public class KwsEnterpriseService {
     public List<KwsEnterprise> queryEntByName(String entName) {
         return kwsEnterpriseDao.queryEntByName(entName);
     }
+
+
+    /**
+     * @param reqVo 查询入参
+     * @return FindListGroupResVo
+     * @desc: 查分组
+     * @author: czh
+     * @date: 2023/7/13
+     */
+    public List<FindListGroupResVo> findListGroup(EntFindPageReqVo reqVo) {
+        List<FindEntListPojo> list = findPojo(reqVo);
+        Map<Integer, List<FindEntListPojo>> collect = list.stream().collect(Collectors.groupingBy(FindEntListPojo::getApproval));
+
+        List<FindListGroupResVo> result = new ArrayList<>();
+        FindListGroupResVo findListGroupResVo = new FindListGroupResVo();
+        findListGroupResVo.setCount(list.size());
+        result.add(findListGroupResVo);
+        result.add(getGroup(ApprovalEnum.NO.getCode(), collect));
+
+        FindListGroupResVo process = getGroup(ApprovalEnum.PROCESS.getCode(), collect);
+        FindListGroupResVo refresh = getGroup(ApprovalEnum.REFRESH.getCode(), collect);
+        process.setCount(process.getCount() + refresh.getCount());
+        result.add(process);
+        result.add(getGroup(ApprovalEnum.OK.getCode(), collect));
+        result.add(getGroup(ApprovalEnum.PASS.getCode(), collect));
+        return result;
+    }
+
+    private static FindListGroupResVo getGroup(Integer code, Map<Integer, List<FindEntListPojo>> collect) {
+        FindListGroupResVo findListGroupResVo = new FindListGroupResVo();
+        findListGroupResVo.setApproval(code);
+        List<FindEntListPojo> findEntListPojos = collect.get(code);
+        findListGroupResVo.setCount(CollectionUtils.isEmpty(findEntListPojos) ? Global.NO : findEntListPojos.size());
+        findListGroupResVo.setApprovalName(ApprovalEnum.getName(code).getName());
+        return findListGroupResVo;
+    }
 }

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

@@ -107,6 +107,7 @@
     <if test="dto.endTime != null">
       and a.update_time &lt;= #{dto.endTime}
     </if>
+    group by a.id
     ) tab
      where tab.id is not null
     order by tab.create_time desc