张延森 3 years ago
parent
commit
d8521b72de

+ 29
- 0
deploy/stop.sh View File

1
+#!/bin/sh
2
+#
3
+#
4
+
5
+findProcess(){
6
+  PROCESS_NAME="pet-identity"
7
+  echo $(ps -ef |grep $PROCESS_NAME|grep java| awk '{print $2}')
8
+}
9
+
10
+# 查找进程
11
+PID=$(findProcess)
12
+if [ ! $PID ]; then
13
+  echo "Process not found !"
14
+  exit 0
15
+else
16
+  echo "Process ID ${PID}"
17
+fi
18
+
19
+echo "Please wait ..."
20
+kill -9 $PID
21
+
22
+# 重新查询一次
23
+PID=$(findProcess)
24
+if [ ! $PID ]; then
25
+  echo "Process killed success !"
26
+  exit 0
27
+else
28
+  echo "Process killed fail, please retry ."
29
+fi

+ 1
- 1
pom.xml View File

10
 	</parent>
10
 	</parent>
11
 	<groupId>com.njyunzhi</groupId>
11
 	<groupId>com.njyunzhi</groupId>
12
 	<artifactId>pet_identity</artifactId>
12
 	<artifactId>pet_identity</artifactId>
13
-	<version>0.0.4</version>
13
+	<version>0.0.7</version>
14
 	<name>pet_identity</name>
14
 	<name>pet_identity</name>
15
 	<description>Demo project for Spring Boot</description>
15
 	<description>Demo project for Spring Boot</description>
16
 
16
 

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

267
             }
267
             }
268
             taApplication.setOriginApplyId(origin.getApplyId());
268
             taApplication.setOriginApplyId(origin.getApplyId());
269
 
269
 
270
-            if (!taApplication.getOriginCardNo().equals(origin.getOriginCardNo())) {
270
+            if (!taApplication.getOriginCardNo().equals(origin.getCardNo())) {
271
                 return ResponseBean.error("原始证件信息校验异常");
271
                 return ResponseBean.error("原始证件信息校验异常");
272
             }
272
             }
273
 
273
 
539
         TaPetIdentity taPetIdentity = iTaPetIdentityService.getExistBy("card_no", taApplication.getCardNo(), false, true);
539
         TaPetIdentity taPetIdentity = iTaPetIdentityService.getExistBy("card_no", taApplication.getCardNo(), false, true);
540
         if (null != taPetIdentity) {
540
         if (null != taPetIdentity) {
541
             // 新办 续期,都需要重置有效期
541
             // 新办 续期,都需要重置有效期
542
-            iTaPetIdentityService.updateCardDate(taPetIdentity.getCardNo());
542
+            iTaPetIdentityService.extendDate(taPetIdentity);
543
         }
543
         }
544
 
544
 
545
         if (iTaApplicationService.updateById(taApplication)){
545
         if (iTaApplicationService.updateById(taApplication)){

+ 1
- 1
src/main/java/com/njyunzhi/pet_identity/controller/TaPetIdentityController.java View File

93
         queryWrapper.gt("status", Constants.STATUS_DELETE);
93
         queryWrapper.gt("status", Constants.STATUS_DELETE);
94
         queryWrapper.orderByDesc("create_date");
94
         queryWrapper.orderByDesc("create_date");
95
 
95
 
96
-        IPage<TaPetIdentity> result = iTaPetIdentityService.page(pg, queryWrapper);
96
+        IPage<TaPetIdentity> result = iTaPetIdentityService.getMineCards(pg, taPerson.getPersonId());
97
         return ResponseBean.success(result);
97
         return ResponseBean.success(result);
98
     }
98
     }
99
 
99
 

+ 3
- 0
src/main/java/com/njyunzhi/pet_identity/mapper/TaPetIdentityMapper.java View File

1
 package com.njyunzhi.pet_identity.mapper;
1
 package com.njyunzhi.pet_identity.mapper;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.njyunzhi.pet_identity.entity.TaPetIdentity;
4
 import com.njyunzhi.pet_identity.entity.TaPetIdentity;
4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
 import org.apache.ibatis.annotations.Mapper;
6
 import org.apache.ibatis.annotations.Mapper;
23
     int countNotDelete();
24
     int countNotDelete();
24
 
25
 
25
     List<TaPetIdentity> getListByCard(@Param("cardNoList") List<String> cardNoList);
26
     List<TaPetIdentity> getListByCard(@Param("cardNoList") List<String> cardNoList);
27
+
28
+    IPage<TaPetIdentity> getMineCards(IPage<TaPetIdentity> pg, @Param("personId") String personId);
26
 }
29
 }

+ 3
- 2
src/main/java/com/njyunzhi/pet_identity/service/ITaPetIdentityService.java View File

1
 package com.njyunzhi.pet_identity.service;
1
 package com.njyunzhi.pet_identity.service;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.njyunzhi.pet_identity.entity.TaApplication;
4
 import com.njyunzhi.pet_identity.entity.TaApplication;
4
 import com.njyunzhi.pet_identity.entity.TaPetIdentity;
5
 import com.njyunzhi.pet_identity.entity.TaPetIdentity;
5
 import com.njyunzhi.pet_identity.vo.MakeCardParam;
6
 import com.njyunzhi.pet_identity.vo.MakeCardParam;
18
 
19
 
19
     TaPetIdentity createNewCard(TaApplication taApplication, MakeCardParam makeCardParam) throws Exception;
20
     TaPetIdentity createNewCard(TaApplication taApplication, MakeCardParam makeCardParam) throws Exception;
20
 
21
 
21
-    boolean updateCardDate(String cardNo) throws Exception;
22
-
23
     boolean extendDate(TaPetIdentity taPetIdentity) throws Exception;
22
     boolean extendDate(TaPetIdentity taPetIdentity) throws Exception;
24
 
23
 
25
     TaPetIdentity getByPet(String petId, String personId);
24
     TaPetIdentity getByPet(String petId, String personId);
27
     int countNotDelete();
26
     int countNotDelete();
28
 
27
 
29
     List<TaPetIdentity> getListByCard(List<String> cardNoList);
28
     List<TaPetIdentity> getListByCard(List<String> cardNoList);
29
+
30
+    IPage<TaPetIdentity> getMineCards(IPage<TaPetIdentity> pg, String personId);
30
 }
31
 }

+ 6
- 17
src/main/java/com/njyunzhi/pet_identity/service/impl/TaPetIdentityServiceImpl.java View File

2
 
2
 
3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
4
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
5
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.njyunzhi.pet_identity.common.Constants;
6
 import com.njyunzhi.pet_identity.common.Constants;
6
 import com.njyunzhi.pet_identity.common.DateUtils;
7
 import com.njyunzhi.pet_identity.common.DateUtils;
7
 import com.njyunzhi.pet_identity.entity.SysSetting;
8
 import com.njyunzhi.pet_identity.entity.SysSetting;
71
         return taPetIdentity;
72
         return taPetIdentity;
72
     }
73
     }
73
 
74
 
74
-    @Override
75
-    public boolean updateCardDate(String cardNo) throws Exception {
76
-        SysSetting sysSetting = sysSettingMapper.selectById(Constants.SYSSETTING_CARD_EXPIRE);
77
-        // 北京时间
78
-        LocalDateTime now = LocalDateTime.now(ZoneId.of("Asia/Shanghai"));
79
-        LocalDateTime expire = now.plusDays(Long.parseLong(sysSetting.getContent()));
80
-
81
-
82
-        UpdateWrapper<TaPetIdentity> updateWrapper = new UpdateWrapper<>();
83
-        updateWrapper.set("start_date", now);
84
-        updateWrapper.set("expire_date", expire);
85
-        updateWrapper.eq("card_no", cardNo);
86
-
87
-        return update(updateWrapper);
88
-    }
89
-
90
-
91
     @Override
75
     @Override
92
     public boolean extendDate(TaPetIdentity taPetIdentity) throws Exception {
76
     public boolean extendDate(TaPetIdentity taPetIdentity) throws Exception {
93
 
77
 
123
     public List<TaPetIdentity> getListByCard(List<String> cardNoList) {
107
     public List<TaPetIdentity> getListByCard(List<String> cardNoList) {
124
         return baseMapper.getListByCard(cardNoList);
108
         return baseMapper.getListByCard(cardNoList);
125
     }
109
     }
110
+
111
+    @Override
112
+    public IPage<TaPetIdentity> getMineCards(IPage<TaPetIdentity> pg, String personId) {
113
+        return baseMapper.getMineCards(pg, personId);
114
+    }
126
 }
115
 }

+ 20
- 0
src/main/resources/mapper/TaPetIdentityMapper.xml View File

12
             #{item}
12
             #{item}
13
         </foreach>
13
         </foreach>
14
     </select>
14
     </select>
15
+    <select id="getMineCards" resultType="com.njyunzhi.pet_identity.entity.TaPetIdentity">
16
+        SELECT
17
+            s.*
18
+        FROM
19
+            (
20
+                SELECT
21
+                    t.*
22
+                FROM
23
+                    `ta_pet_identity` t
24
+                WHERE
25
+                    t.person_id = #{personId}
26
+                  AND t.`status` &gt; -1
27
+                HAVING
28
+                    1
29
+                ORDER BY
30
+                    t.create_date DESC
31
+            ) s
32
+        GROUP BY
33
+            s.pet_id
34
+    </select>
15
 </mapper>
35
 </mapper>