张延森 3 years ago
parent
commit
a790bb67e5

+ 22
- 46
src/main/java/com/njyunzhi/pet_identity/controller/TaApplicationController.java View File

@@ -8,6 +8,7 @@ import com.njyunzhi.pet_identity.entity.*;
8 8
 import com.njyunzhi.pet_identity.service.ITaCardNoService;
9 9
 import com.njyunzhi.pet_identity.service.ITaOrderService;
10 10
 import com.njyunzhi.pet_identity.service.ITaPetIdentityService;
11
+import com.njyunzhi.pet_identity.vo.ApplicationParams;
11 12
 import com.njyunzhi.pet_identity.vo.AuditParam;
12 13
 import com.njyunzhi.pet_identity.vo.MakeCardParam;
13 14
 import io.swagger.annotations.Api;
@@ -95,53 +96,28 @@ public class TaApplicationController extends BaseController {
95 96
         SysUser sysUser = currentUser();
96 97
 
97 98
         IPage<TaApplication> pg = new Page<>(pageNum, pageSize);
98
-        QueryWrapper<TaApplication> queryWrapper = new QueryWrapper<>();
99
-        queryWrapper.gt("status", Constants.STATUS_DELETE);
100
-        queryWrapper.eq(!StringUtils.isEmpty(applyType), "apply_type", applyType);
101
-        queryWrapper.eq(null != applyMethod, "apply_method", applyMethod);
102
-        queryWrapper.eq(null != status, "status", status);
103
-        queryWrapper.eq(null != payStatus, "pay_status", payStatus);
104
-        queryWrapper.eq(null != verifyStatus, "verify_status", verifyStatus);
105
-        queryWrapper.eq(null != isOrg, "is_org", isOrg);
106
-        queryWrapper.like(!StringUtils.isEmpty(orgName), "org_name", "%" + orgName + "%");
107
-        queryWrapper.like(!StringUtils.isEmpty(personName), "person_name", "%" + personName + "%");
108
-        queryWrapper.like(!StringUtils.isEmpty(phone), "phone", "%" + phone + "%");
109
-        queryWrapper.like(!StringUtils.isEmpty(petName), "pet_name", "%" + petName + "%");
110
-        queryWrapper.like(!StringUtils.isEmpty(originCardNo), "origin_card_no", "%" + originCardNo + "%");
111
-        queryWrapper.ge(!StringUtils.isEmpty(applyStart), "create_date", applyStart);
112
-        queryWrapper.le(!StringUtils.isEmpty(applyEnd), "create_date", applyEnd);
113
-        queryWrapper.ge(!StringUtils.isEmpty(auditStart), "verify_date", auditStart);
114
-        queryWrapper.le(!StringUtils.isEmpty(auditEnd), "verify_date", auditEnd);
115
-        queryWrapper.ge(!StringUtils.isEmpty(makeStart), "make_date", makeStart);
116
-        queryWrapper.le(!StringUtils.isEmpty(makeEnd), "make_date", makeEnd);
117
-
118
-        if (Constants.WORKFLOW_PROCESS_AUDIT == process) {
119
-            // 过滤待审批列表
120
-            queryWrapper.in("status", new Integer[] { Constants.WORKFLOW_STATUS_PROCESSING, Constants.WORKFLOW_STATUS_AUDIT });
121
-        } else if (Constants.WORKFLOW_PROCESS_MADE == process) {
122
-            // 过滤待制卡列表
123
-            // 必须是审核通过的, 且是初次提审或者挂失补办的
124
-            queryWrapper.in("status", new Integer[] { Constants.WORKFLOW_STATUS_AUDIT, Constants.WORKFLOW_STATUS_MADE });
125
-            queryWrapper.eq("verify_Status", Constants.AUDIT_STATUS_PASSED);
126
-            queryWrapper.in("apply_type", new String[] { Constants.APPLY_TYPE_FIRST,  Constants.APPLY_TYPE_REISSUE});
127
-        }
128 99
 
129
-//        // 审核人角色
130
-//        if (Constants.USER_AUDITOR.equals(sysUser.getRoleName())) {
131
-//            queryWrapper.ge("status", Constants.WORKFLOW_STATUS_PROCESSING);
132
-//            queryWrapper.le("status", Constants.WORKFLOW_STATUS_AUDIT);
133
-//        }
134
-//
135
-//        // 发证(制卡)人角色
136
-//        if (Constants.USER_MAKER.equals(sysUser.getRoleName())) {
137
-//            queryWrapper.ge("status", Constants.WORKFLOW_STATUS_AUDIT);
138
-//            queryWrapper.le("status", Constants.WORKFLOW_STATUS_MADE);
139
-//        }
140
-
141
-        queryWrapper.orderByAsc("status");
142
-        queryWrapper.orderByDesc("create_date");
143
-
144
-        IPage<TaApplication> result = iTaApplicationService.page(pg, queryWrapper);
100
+        ApplicationParams params = new ApplicationParams();
101
+        params.setProcess(process);
102
+        params.setApplyStart(applyStart);
103
+        params.setApplyEnd(applyEnd);
104
+        params.setAuditStart(auditStart);
105
+        params.setAuditEnd(auditEnd);
106
+        params.setMakeStart(makeStart);
107
+        params.setMakeEnd(makeEnd);
108
+        params.setApplyType(applyType);
109
+        params.setApplyMethod(applyMethod);
110
+        params.setPayStatus(payStatus);
111
+        params.setVerifyStatus(verifyStatus);
112
+        params.setPersonName(personName);
113
+        params.setPhone(phone);
114
+        params.setPetName(petName);
115
+        params.setOriginCardNo(originCardNo);
116
+        params.setIsOrg(isOrg);
117
+        params.setOrgName(orgName);
118
+        params.setStatus(status);
119
+
120
+        IPage<TaApplication> result = iTaApplicationService.getPageBy(pg, params);
145 121
         return ResponseBean.success(result);
146 122
     }
147 123
 

+ 4
- 0
src/main/java/com/njyunzhi/pet_identity/mapper/TaApplicationMapper.java View File

@@ -1,8 +1,11 @@
1 1
 package com.njyunzhi.pet_identity.mapper;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.njyunzhi.pet_identity.entity.TaApplication;
4 5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6
+import com.njyunzhi.pet_identity.vo.ApplicationParams;
5 7
 import org.apache.ibatis.annotations.Mapper;
8
+import org.apache.ibatis.annotations.Param;
6 9
 
7 10
 /**
8 11
  * <p>
@@ -15,4 +18,5 @@ import org.apache.ibatis.annotations.Mapper;
15 18
 @Mapper
16 19
 public interface TaApplicationMapper extends BaseMapper<TaApplication> {
17 20
 
21
+    IPage<TaApplication> getPageBy(IPage<TaApplication> pg, @Param("params") ApplicationParams params);
18 22
 }

+ 4
- 0
src/main/java/com/njyunzhi/pet_identity/service/ITaApplicationService.java View File

@@ -1,7 +1,9 @@
1 1
 package com.njyunzhi.pet_identity.service;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.njyunzhi.pet_identity.entity.TaApplication;
4 5
 import com.baomidou.mybatisplus.extension.service.IService;
6
+import com.njyunzhi.pet_identity.vo.ApplicationParams;
5 7
 
6 8
 import java.time.LocalDateTime;
7 9
 
@@ -18,4 +20,6 @@ public interface ITaApplicationService extends IBaseService<TaApplication> {
18 20
     int countBetween(LocalDateTime dayStart, LocalDateTime dayEnd);
19 21
 
20 22
     Integer getTotalCharge(TaApplication taApplication);
23
+
24
+    IPage<TaApplication> getPageBy(IPage<TaApplication> pg, ApplicationParams params);
21 25
 }

+ 7
- 0
src/main/java/com/njyunzhi/pet_identity/service/impl/TaApplicationServiceImpl.java View File

@@ -1,6 +1,7 @@
1 1
 package com.njyunzhi.pet_identity.service.impl;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
4 5
 import com.njyunzhi.pet_identity.common.Constants;
5 6
 import com.njyunzhi.pet_identity.entity.SysSetting;
6 7
 import com.njyunzhi.pet_identity.entity.TaApplication;
@@ -8,6 +9,7 @@ import com.njyunzhi.pet_identity.mapper.SysSettingMapper;
8 9
 import com.njyunzhi.pet_identity.mapper.TaApplicationMapper;
9 10
 import com.njyunzhi.pet_identity.service.ITaApplicationService;
10 11
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
12
+import com.njyunzhi.pet_identity.vo.ApplicationParams;
11 13
 import org.springframework.beans.factory.annotation.Autowired;
12 14
 import org.springframework.stereotype.Service;
13 15
 
@@ -55,4 +57,9 @@ public class TaApplicationServiceImpl extends BaseServiceImpl<TaApplicationMappe
55 57
 
56 58
         return fee1 + fee2;
57 59
     }
60
+
61
+    @Override
62
+    public IPage<TaApplication> getPageBy(IPage<TaApplication> pg, ApplicationParams params) {
63
+        return baseMapper.getPageBy(pg, params);
64
+    }
58 65
 }

+ 64
- 0
src/main/java/com/njyunzhi/pet_identity/vo/ApplicationParams.java View File

@@ -0,0 +1,64 @@
1
+package com.njyunzhi.pet_identity.vo;
2
+
3
+import io.swagger.annotations.ApiModel;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+
7
+@Data
8
+@ApiModel("办证申请查询条件")
9
+public class ApplicationParams {
10
+
11
+    @ApiModelProperty("表单进度")
12
+    Integer process;
13
+
14
+    @ApiModelProperty("申请开始时间")
15
+    String applyStart;
16
+
17
+    @ApiModelProperty("申请结束时间")
18
+    String applyEnd;
19
+
20
+    @ApiModelProperty("审核开始时间")
21
+    String auditStart;
22
+
23
+    @ApiModelProperty("审核结束时间")
24
+    String auditEnd;
25
+
26
+    @ApiModelProperty("发证开始时间")
27
+    String makeStart;
28
+
29
+    @ApiModelProperty("发证结束时间")
30
+    String makeEnd;
31
+
32
+    @ApiModelProperty("申请类型")
33
+    String applyType;
34
+
35
+    @ApiModelProperty("申领方式")
36
+    Integer applyMethod;
37
+
38
+    @ApiModelProperty("付款状态")
39
+    Integer payStatus;
40
+
41
+    @ApiModelProperty("审核状态")
42
+    Integer verifyStatus;
43
+
44
+    @ApiModelProperty("犬主")
45
+    String personName;
46
+
47
+    @ApiModelProperty("手机号")
48
+    String phone;
49
+
50
+    @ApiModelProperty("犬名")
51
+    String petName;
52
+
53
+    @ApiModelProperty("卡号")
54
+    String originCardNo;
55
+
56
+    @ApiModelProperty("是否企业")
57
+    Boolean isOrg;
58
+
59
+    @ApiModelProperty("企业名称")
60
+    String orgName;
61
+
62
+    @ApiModelProperty("状态")
63
+    Integer status;
64
+}

+ 76
- 0
src/main/resources/mapper/TaApplicationMapper.xml View File

@@ -2,4 +2,80 @@
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.njyunzhi.pet_identity.mapper.TaApplicationMapper">
4 4
 
5
+    <select id="getPageBy" resultType="com.njyunzhi.pet_identity.entity.TaApplication">
6
+        SELECT
7
+            t.*
8
+        FROM
9
+            ta_application t
10
+        WHERE
11
+            t.`status` &gt; - 1
12
+          <if test="null != params.applyType and '' != params.applyType">
13
+              AND t.apply_type = #{params.applyType}
14
+          </if>
15
+        <if test="null != params.applyMethod and '' != params.applyMethod">
16
+            AND t.apply_method = #{params.applyMethod}
17
+        </if>
18
+        <if test="null != params.status">
19
+            AND t.`status` = #{params.status}
20
+        </if>
21
+        <if test="null != params.payStatus">
22
+            AND t.pay_status = #{params.payStatus}
23
+        </if>
24
+        <if test="null != params.verifyStatus">
25
+            AND t.verify_status = #{params.verifyStatus}
26
+        </if>
27
+        <if test="null != params.isOrg and params.isOrg">
28
+            AND t.is_org = 1
29
+        </if>
30
+        <if test="null != params.orgName and '' != params.orgName">
31
+            AND t.org_name LIKE CONCAT( '%', #{params.orgName}, '%' )
32
+        </if>
33
+        <if test="null != params.personName and '' != params.personName">
34
+            AND t.person_name LIKE CONCAT( '%', #{params.personName}, '%' )
35
+        </if>
36
+        <if test="null != params.phone and '' != params.phone">
37
+            AND t.phone LIKE CONCAT( '%', #{params.phone}, '%' )
38
+        </if>
39
+        <if test="null != params.petName and '' != params.petName">
40
+            AND t.pet_name LIKE CONCAT( '%', #{params.petName}, '%' )
41
+        </if>
42
+        <if test="null != params.originCardNo and '' != params.originCardNo">
43
+            AND t.origin_card_no LIKE CONCAT( '%', #{params.originCardNo}, '%' )
44
+        </if>
45
+        <if test="null != params.applyStart and '' != params.applyStart">
46
+            AND t.create_date &gt;= #{params.applyStart}
47
+        </if>
48
+        <if test="null != params.applyEnd and '' != params.applyEnd">
49
+            AND t.create_date &lt;= #{params.applyEnd}
50
+        </if>
51
+        <if test="null != params.auditStart and '' != params.auditStart">
52
+            AND t.verify_date &gt;= #{params.auditStart}
53
+        </if>
54
+        <if test="null != params.auditEnd and '' != params.auditEnd">
55
+            AND t.verify_date &lt;= #{params.auditEnd}
56
+        </if>
57
+        <if test="null != params.makeStart and '' != params.makeStart">
58
+            AND t.make_date &gt;= #{params.makeStart}
59
+        </if>
60
+        <if test="null != params.makeEnd and '' != params.makeEnd">
61
+            AND t.make_date &lt;= #{params.makeEnd}
62
+        </if>
63
+        <if test="null != params.process and 1 == params.process">
64
+            AND t.`status` IN ( 1, 2 )
65
+            AND NOT EXISTS (
66
+                SELECT * FROM ta_pet_identity a WHERE t.origin_card_no = a.card_no AND a.`status` != 1
67
+            )
68
+        </if>
69
+        <if test="null != params.process and 2 == params.process">
70
+            AND t.`status` IN ( 2, 3 )
71
+            AND t.verify_status = 1
72
+            AND t.apply_type IN ( 'first', 'reissue' )
73
+            AND NOT EXISTS (
74
+                SELECT * FROM ta_pet_identity a WHERE t.origin_card_no = a.card_no AND a.`status` != 1
75
+            )
76
+        </if>
77
+        ORDER BY
78
+            t.`status` ASC,
79
+            t.create_date DESC
80
+    </select>
5 81
 </mapper>