张延森 3 years ago
parent
commit
d8521b72de

+ 29
- 0
deploy/stop.sh View File

@@ -0,0 +1,29 @@
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,7 +10,7 @@
10 10
 	</parent>
11 11
 	<groupId>com.njyunzhi</groupId>
12 12
 	<artifactId>pet_identity</artifactId>
13
-	<version>0.0.4</version>
13
+	<version>0.0.7</version>
14 14
 	<name>pet_identity</name>
15 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,7 +267,7 @@ public class TaApplicationController extends BaseController {
267 267
             }
268 268
             taApplication.setOriginApplyId(origin.getApplyId());
269 269
 
270
-            if (!taApplication.getOriginCardNo().equals(origin.getOriginCardNo())) {
270
+            if (!taApplication.getOriginCardNo().equals(origin.getCardNo())) {
271 271
                 return ResponseBean.error("原始证件信息校验异常");
272 272
             }
273 273
 
@@ -539,7 +539,7 @@ public class TaApplicationController extends BaseController {
539 539
         TaPetIdentity taPetIdentity = iTaPetIdentityService.getExistBy("card_no", taApplication.getCardNo(), false, true);
540 540
         if (null != taPetIdentity) {
541 541
             // 新办 续期,都需要重置有效期
542
-            iTaPetIdentityService.updateCardDate(taPetIdentity.getCardNo());
542
+            iTaPetIdentityService.extendDate(taPetIdentity);
543 543
         }
544 544
 
545 545
         if (iTaApplicationService.updateById(taApplication)){

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

@@ -93,7 +93,7 @@ public class TaPetIdentityController extends BaseController {
93 93
         queryWrapper.gt("status", Constants.STATUS_DELETE);
94 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 97
         return ResponseBean.success(result);
98 98
     }
99 99
 

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

@@ -1,5 +1,6 @@
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.TaPetIdentity;
4 5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 6
 import org.apache.ibatis.annotations.Mapper;
@@ -23,4 +24,6 @@ public interface TaPetIdentityMapper extends BaseMapper<TaPetIdentity> {
23 24
     int countNotDelete();
24 25
 
25 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,5 +1,6 @@
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.njyunzhi.pet_identity.entity.TaPetIdentity;
5 6
 import com.njyunzhi.pet_identity.vo.MakeCardParam;
@@ -18,8 +19,6 @@ public interface ITaPetIdentityService extends IBaseService<TaPetIdentity> {
18 19
 
19 20
     TaPetIdentity createNewCard(TaApplication taApplication, MakeCardParam makeCardParam) throws Exception;
20 21
 
21
-    boolean updateCardDate(String cardNo) throws Exception;
22
-
23 22
     boolean extendDate(TaPetIdentity taPetIdentity) throws Exception;
24 23
 
25 24
     TaPetIdentity getByPet(String petId, String personId);
@@ -27,4 +26,6 @@ public interface ITaPetIdentityService extends IBaseService<TaPetIdentity> {
27 26
     int countNotDelete();
28 27
 
29 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,6 +2,7 @@ package com.njyunzhi.pet_identity.service.impl;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 4
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
5
+import com.baomidou.mybatisplus.core.metadata.IPage;
5 6
 import com.njyunzhi.pet_identity.common.Constants;
6 7
 import com.njyunzhi.pet_identity.common.DateUtils;
7 8
 import com.njyunzhi.pet_identity.entity.SysSetting;
@@ -71,23 +72,6 @@ public class TaPetIdentityServiceImpl extends BaseServiceImpl<TaPetIdentityMappe
71 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 75
     @Override
92 76
     public boolean extendDate(TaPetIdentity taPetIdentity) throws Exception {
93 77
 
@@ -123,4 +107,9 @@ public class TaPetIdentityServiceImpl extends BaseServiceImpl<TaPetIdentityMappe
123 107
     public List<TaPetIdentity> getListByCard(List<String> cardNoList) {
124 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,4 +12,24 @@
12 12
             #{item}
13 13
         </foreach>
14 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 35
 </mapper>