Просмотр исходного кода

2022-09-9 审批列表查询和统计。

zhuchangxue лет назад: 3
Родитель
Сommit
ff71be0974

+ 0 - 15
zd-modules/zd-bottle-parent/zd-bottle-api/src/main/java/com/zd/bottle/domain/UsegasApply.java

@@ -83,19 +83,4 @@ public class UsegasApply extends BaseBean {
     @ApiModelProperty("原因(实验室负责人)")
     @ApiModelProperty("原因(实验室负责人)")
     private String leadAuditCause;
     private String leadAuditCause;
 
 
-    @ApiModelProperty("审核状态 0 未审核 1.通过 2.驳回")
-    private Short centerAuditStatus;
-
-    @ApiModelProperty("审核人id")
-    private Long centerAuditUserid;
-
-    @ApiModelProperty("审核人(实验中心)")
-    private String centerAuditUsername;
-
-    @ApiModelProperty("审核时间")
-    private Timestamp centerAuditTime;
-
-    @ApiModelProperty("原因(实验中心)")
-    private String centerAuditCause;
-
 }
 }

+ 32 - 0
zd-modules/zd-bottle-parent/zd-bottle-api/src/main/java/com/zd/bottle/vo/UsegasApplyTabVo.java

@@ -0,0 +1,32 @@
+package com.zd.bottle.vo;
+
+import com.zd.bottle.domain.UsegasApply;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+
+/**
+ * Controller
+ *
+ * @author cyl
+ * @date 2022/9/8
+ */
+@Data
+@Accessors(chain = true)
+@ApiModel(value = "UsegasApply对象", description = "用气申请表选项卡统计")
+public class UsegasApplyTabVo {
+
+    @ApiModelProperty(value = "待审核统计")
+    private Long waitApplyCount;
+
+    @ApiModelProperty(value = "已通过统计")
+    private String passApplyCount;
+
+    @ApiModelProperty(value = "未通过统计")
+    private String refuseApplyCount;
+
+}

+ 34 - 2
zd-modules/zd-bottle-parent/zd-bottle/src/main/java/com/zd/bottle/controller/UsegasApplyController.java

@@ -2,12 +2,15 @@ package com.zd.bottle.controller;
 
 
 import com.zd.bottle.domain.UsegasApply;
 import com.zd.bottle.domain.UsegasApply;
 import com.zd.bottle.service.UsegasApplyService;
 import com.zd.bottle.service.UsegasApplyService;
+import com.zd.bottle.vo.UsegasApplyTabVo;
 import com.zd.bottle.vo.UsegasApplyVo;
 import com.zd.bottle.vo.UsegasApplyVo;
 import com.zd.common.core.domain.per.PerFun;
 import com.zd.common.core.domain.per.PerFun;
 import com.zd.common.core.domain.per.PerPrefix;
 import com.zd.common.core.domain.per.PerPrefix;
 import com.zd.common.core.web.domain.BaseBean;
 import com.zd.common.core.web.domain.BaseBean;
 import com.zd.common.core.web.page.TableDataInfo;
 import com.zd.common.core.web.page.TableDataInfo;
+import com.zd.common.response.ResultData;
 import com.zd.common.security.annotation.PreAuthorize;
 import com.zd.common.security.annotation.PreAuthorize;
+import io.swagger.annotations.ApiModelProperty;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -31,12 +34,41 @@ public class UsegasApplyController extends BaseController<UsegasApply> {
     @Autowired
     @Autowired
     private UsegasApplyService usegasApplyService;
     private UsegasApplyService usegasApplyService;
 
 
+    @ApiModelProperty(value = "待审核")
     @PreAuthorize(hasPermi = PerPrefix.QP_USEGASAPPLY + PerFun.LIST)
     @PreAuthorize(hasPermi = PerPrefix.QP_USEGASAPPLY + PerFun.LIST)
-    @GetMapping("/list")
-    public TableDataInfo <UsegasApply> list(UsegasApply usegasApply){
+    @GetMapping("/waitApplyList")
+    public TableDataInfo <UsegasApply> waitApplyList(UsegasApply usegasApply){
         startPage();
         startPage();
+        usegasApply.setLeadAuditStaus((short) 0);
         List <UsegasApplyVo> list = usegasApplyService.selectUseagsApplyList(usegasApply);
         List <UsegasApplyVo> list = usegasApplyService.selectUseagsApplyList(usegasApply);
         return getDataTable(list);
         return getDataTable(list);
     }
     }
 
 
+    @ApiModelProperty(value = "已通过")
+    @PreAuthorize(hasPermi = PerPrefix.QP_USEGASAPPLY + PerFun.LIST)
+    @GetMapping("/passApplyList")
+    public TableDataInfo <UsegasApply> passApplyList(UsegasApply usegasApply){
+        startPage();
+        usegasApply.setLeadAuditStaus((short) 1);
+        List <UsegasApplyVo> list = usegasApplyService.selectUseagsApplyList(usegasApply);
+        return getDataTable(list);
+    }
+
+    @ApiModelProperty(value = "未通过")
+    @PreAuthorize(hasPermi = PerPrefix.QP_USEGASAPPLY + PerFun.LIST)
+    @GetMapping("/refuseApplyList")
+    public TableDataInfo <UsegasApply> refuseApplyList(UsegasApply usegasApply){
+        startPage();
+        usegasApply.setLeadAuditStaus((short) 2);
+        List <UsegasApplyVo> list = usegasApplyService.selectUseagsApplyList(usegasApply);
+        return getDataTable(list);
+    }
+
+
+    @ApiModelProperty(value = "审批选项卡统计")
+    @GetMapping("/applyTabCount")
+    public ResultData<UsegasApplyTabVo> selectApplyTabCount(UsegasApply usegasApply){
+        UsegasApplyTabVo usegasApplyTabVo = usegasApplyService.selectApplyTabCount(usegasApply);
+        return ResultData.success(usegasApplyTabVo);
+    }
 }
 }

+ 9 - 0
zd-modules/zd-bottle-parent/zd-bottle/src/main/java/com/zd/bottle/mapper/UsegasApplyMapper.java

@@ -2,6 +2,10 @@ package com.zd.bottle.mapper;
 
 
 import com.zd.bottle.domain.UsegasApply;
 import com.zd.bottle.domain.UsegasApply;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zd.bottle.vo.UsegasApplyTabVo;
+import com.zd.bottle.vo.UsegasApplyVo;
+
+import java.util.List;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -13,4 +17,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
  */
 public interface UsegasApplyMapper extends BaseMapper<UsegasApply> {
 public interface UsegasApplyMapper extends BaseMapper<UsegasApply> {
 
 
+
+    List <UsegasApplyVo> selectUseagsApplyList(UsegasApply usegasApply);
+
+    UsegasApplyTabVo selectApplyTabCount(UsegasApply usegasApply);
+
 }
 }

+ 3 - 0
zd-modules/zd-bottle-parent/zd-bottle/src/main/java/com/zd/bottle/service/UsegasApplyService.java

@@ -2,6 +2,7 @@ package com.zd.bottle.service;
 
 
 import com.zd.bottle.domain.UsegasApply;
 import com.zd.bottle.domain.UsegasApply;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.zd.bottle.vo.UsegasApplyTabVo;
 import com.zd.bottle.vo.UsegasApplyVo;
 import com.zd.bottle.vo.UsegasApplyVo;
 
 
 import java.util.List;
 import java.util.List;
@@ -18,4 +19,6 @@ public interface UsegasApplyService extends IService<UsegasApply> {
 
 
     List <UsegasApplyVo> selectUseagsApplyList(UsegasApply usegasApply);
     List <UsegasApplyVo> selectUseagsApplyList(UsegasApply usegasApply);
 
 
+    UsegasApplyTabVo selectApplyTabCount(UsegasApply usegasApply);
+
 }
 }

+ 43 - 21
zd-modules/zd-bottle-parent/zd-bottle/src/main/java/com/zd/bottle/service/impl/UsegasApplyServiceImpl.java

@@ -1,12 +1,16 @@
 package com.zd.bottle.service.impl;
 package com.zd.bottle.service.impl;
 
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.BeanUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.zd.bottle.domain.UsegasApply;
 import com.zd.bottle.domain.UsegasApply;
 import com.zd.bottle.mapper.UsegasApplyMapper;
 import com.zd.bottle.mapper.UsegasApplyMapper;
 import com.zd.bottle.service.UsegasApplyService;
 import com.zd.bottle.service.UsegasApplyService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.zd.bottle.vo.UsegasApplyTabVo;
 import com.zd.bottle.vo.UsegasApplyVo;
 import com.zd.bottle.vo.UsegasApplyVo;
+import com.zd.common.core.utils.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import java.util.Collections;
 import java.util.Collections;
@@ -25,29 +29,47 @@ import java.util.stream.Collectors;
 @Service
 @Service
 public class UsegasApplyServiceImpl extends ServiceImpl<UsegasApplyMapper, UsegasApply> implements UsegasApplyService {
 public class UsegasApplyServiceImpl extends ServiceImpl<UsegasApplyMapper, UsegasApply> implements UsegasApplyService {
 
 
+    @Autowired
+    private UsegasApplyMapper usegasApplyMapper;
+
     @Override
     @Override
     public List <UsegasApplyVo> selectUseagsApplyList(UsegasApply usegasApply) {
     public List <UsegasApplyVo> selectUseagsApplyList(UsegasApply usegasApply) {
-        LambdaQueryWrapper <UsegasApply> wrapper = Wrappers.lambdaQuery();
-        wrapper.setEntity(usegasApply);
-        List <UsegasApply> list = list(wrapper);
-        List <UsegasApplyVo> collect = Optional.ofNullable(list).orElseGet(Collections::emptyList)
-                .stream()
-                .map(a -> {
-                    UsegasApplyVo usegasApplyVo = new UsegasApplyVo();
-                    usegasApplyVo.setId(a.getId());
-                    usegasApplyVo.setApplyUserName(a.getApplyUser());
-                    usegasApplyVo.setApplyUserPhone(a.getPhone());
-                    usegasApplyVo.setUseGasName(a.getUseGasName());
-                    usegasApplyVo.setApplyTime(a.getCreateTime());
-                    //todo 这里需要判断第一个审批人是否审批通过,如果第一个通过了,那么需要返回第二个审批人的id
-                    if (a.getLeadAuditStaus() == 0) {
-                        usegasApplyVo.setAuditUserid(a.getLeadAuditUserid());
-                    } else if (a.getCenterAuditStatus() == 0) {
-                        usegasApplyVo.setAuditUserid(a.getCenterAuditUserid());
-                    }
+        List <UsegasApplyVo> applyVos = usegasApplyMapper.selectUseagsApplyList(usegasApply);
+//        LambdaQueryWrapper <UsegasApply> wrapper = Wrappers.lambdaQuery();
+//        wrapper.setEntity(usegasApply);
+//        if(StringUtils.isNotEmpty(usegasApply.getSearchValue())){
+//            wrapper.and(
+//                    wrapper1 -> wrapper1
+//                            .like(StringUtils.isNotEmpty(usegasApply.getSearchValue()),UsegasApply::getApplyUser, "%"+usegasApply.getSearchValue()+"%")
+//                            .or()
+//                            .like(StringUtils.isNotEmpty(usegasApply.getSearchValue()),UsegasApply::getPhone, "%"+usegasApply.getSearchValue()+"%")
+//            );
+//        }
+//        List <UsegasApply> list = list(wrapper);
+//        List <UsegasApplyVo> collect = Optional.ofNullable(list).orElseGet(Collections::emptyList)
+//                .stream()
+//                .map(a -> {
+//
+//                    UsegasApplyVo usegasApplyVo = new UsegasApplyVo();
+//                    usegasApplyVo.setId(a.getId());
+//                    usegasApplyVo.setApplyUserName(a.getApplyUser());
+//                    usegasApplyVo.setApplyUserPhone(a.getPhone());
+//                    usegasApplyVo.setUseGasName(a.getUseGasName());
+//                    usegasApplyVo.setApplyTime(a.getCreateTime());
+//                    //todo 这里需要判断第一个审批人是否审批通过,如果第一个通过了,那么需要返回第二个审批人的id
+//                    if (a.getLeadAuditStaus() == 0) {
+//                        usegasApplyVo.setAuditUserid(a.getLeadAuditUserid());
+//                    } else if (a.getCenterAuditStatus() == 0) {
+//                        usegasApplyVo.setAuditUserid(a.getCenterAuditUserid());
+//                    }
+//
+//                    return usegasApplyVo;
+//                }).collect(Collectors.toList());
+        return applyVos;
+    }
 
 
-                    return usegasApplyVo;
-                }).collect(Collectors.toList());
-        return collect;
+    @Override
+    public UsegasApplyTabVo selectApplyTabCount(UsegasApply usegasApply) {
+        return usegasApplyMapper.selectApplyTabCount(usegasApply);
     }
     }
 }
 }

+ 26 - 6
zd-modules/zd-bottle-parent/zd-bottle/src/main/resources/mapper/UsegasApplyMapper.xml

@@ -25,18 +25,38 @@
         <result column="lead_audit_username" property="leadAuditUsername" />
         <result column="lead_audit_username" property="leadAuditUsername" />
         <result column="lead_audit_time" property="leadAuditTime" />
         <result column="lead_audit_time" property="leadAuditTime" />
         <result column="lead_audit_cause" property="leadAuditCause" />
         <result column="lead_audit_cause" property="leadAuditCause" />
-        <result column="center_audit_status" property="centerAuditStatus" />
-        <result column="center_audit_userid" property="centerAuditUserid" />
-        <result column="center_audit_username" property="centerAuditUsername" />
-        <result column="center_audit_time" property="centerAuditTime" />
-        <result column="center_audit_cause" property="centerAuditCause" />
     </resultMap>
     </resultMap>
 
 
     <!-- 通用查询结果列 -->
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
     <sql id="Base_Column_List">
         id,
         id,
         create_time,
         create_time,
-        location, subject_id, apply_user, user_id, dept_id, dept_name, phone, start_time, end_time, gas_use, apply_certificate, safety_precautions, use_gas_id, use_gas_name, lead_audit_staus, lead_audit_userid, lead_audit_username, lead_audit_time, lead_audit_cause, center_audit_status, center_audit_userid, center_audit_username, center_audit_time, center_audit_cause
+        location, subject_id, apply_user, user_id, dept_id, dept_name, phone, start_time, end_time, gas_use, apply_certificate, safety_precautions, use_gas_id, use_gas_name, lead_audit_staus, lead_audit_userid, lead_audit_username, lead_audit_time, lead_audit_cause
     </sql>
     </sql>
 
 
+
+    <select id="selectUseagsApplyList" parameterType="com.zd.bottle.domain.UsegasApply" resultType="com.zd.bottle.vo.UsegasApplyVo">
+        select ua.id,ua.apply_user applyUserName,ua.phone applyUserPhone,ua.use_gas_name useGasName,ua.create_time applyTime,
+        ua.lead_audit_userid auditUserid
+        from ab_usegas_apply ua
+        <where>
+            <if test="searchValue != null ">
+                and (
+                ua.apply_user like concat('%', #{searchValue}, '%') or
+                ua.phone like concat('%', #{searchValue}, '%')
+                )
+            </if>
+            <if test="leadAuditStaus != null ">
+                and ua.lead_audit_staus = #{leadAuditStaus}
+            </if>
+        </where>
+    </select>
+
+    <select id="selectApplyTabCount" parameterType="com.zd.bottle.domain.UsegasApply" resultType="com.zd.bottle.vo.UsegasApplyTabVo">
+        SELECT
+         (SELECT COUNT(ua.id) FROM ab_usegas_apply ua WHERE ua.lead_audit_staus = 0) waitApplyCount,
+         (SELECT COUNT(ua.id) FROM ab_usegas_apply ua WHERE ua.lead_audit_staus = 1) passApplyCount,
+         (SELECT COUNT(ua.id) FROM ab_usegas_apply ua WHERE ua.lead_audit_staus = 2) refuseApplyCount
+        FROM DUAL
+    </select>
 </mapper>
 </mapper>