张延森 3 vuotta sitten
vanhempi
commit
48d9354448
21 muutettua tiedostoa jossa 384 lisäystä ja 74 poistoa
  1. 14
    0
      pom.xml
  2. 5
    0
      src/main/java/com/njyunzhi/pet_identity/common/Constants.java
  3. 9
    0
      src/main/java/com/njyunzhi/pet_identity/common/DateUtils.java
  4. 1
    1
      src/main/java/com/njyunzhi/pet_identity/config/SaTokenConfigure.java
  5. 86
    25
      src/main/java/com/njyunzhi/pet_identity/controller/TaApplicationController.java
  6. 5
    4
      src/main/java/com/njyunzhi/pet_identity/controller/TaOrderController.java
  7. 18
    18
      src/main/java/com/njyunzhi/pet_identity/controller/TaPersonController.java
  8. 36
    5
      src/main/java/com/njyunzhi/pet_identity/controller/TaPetController.java
  9. 55
    3
      src/main/java/com/njyunzhi/pet_identity/controller/TaPetIdentityController.java
  10. 15
    14
      src/main/java/com/njyunzhi/pet_identity/controller/WxPayController.java
  11. 3
    0
      src/main/java/com/njyunzhi/pet_identity/entity/TaOrder.java
  12. 3
    0
      src/main/java/com/njyunzhi/pet_identity/mapper/TaOrderMapper.java
  13. 4
    0
      src/main/java/com/njyunzhi/pet_identity/mapper/TaSequenceMapper.java
  14. 9
    1
      src/main/java/com/njyunzhi/pet_identity/service/ITaOrderService.java
  15. 2
    0
      src/main/java/com/njyunzhi/pet_identity/service/ITaPetIdentityService.java
  16. 1
    0
      src/main/java/com/njyunzhi/pet_identity/service/ITaSequenceService.java
  17. 90
    0
      src/main/java/com/njyunzhi/pet_identity/service/impl/TaOrderServiceImpl.java
  18. 14
    2
      src/main/java/com/njyunzhi/pet_identity/service/impl/TaPetIdentityServiceImpl.java
  19. 4
    0
      src/main/java/com/njyunzhi/pet_identity/service/impl/TaSequenceServiceImpl.java
  20. 1
    1
      src/main/resources/application.yml
  21. 9
    0
      src/main/resources/mapper/TaOrderMapper.xml

+ 14
- 0
pom.xml Näytä tiedosto

@@ -159,6 +159,11 @@
159 159
 						<artifactId>maven-resources-plugin</artifactId>
160 160
 						<configuration>
161 161
 							<encoding>UTF-8</encoding>
162
+							<nonFilteredFileExtensions>
163
+								<nonFilteredFileExtension>pem</nonFilteredFileExtension>
164
+								<nonFilteredFileExtension>pfx</nonFilteredFileExtension>
165
+								<nonFilteredFileExtension>p12</nonFilteredFileExtension>
166
+							</nonFilteredFileExtensions>
162 167
 						</configuration>
163 168
 					</plugin>
164 169
 				</plugins>
@@ -168,6 +173,8 @@
168 173
 						<filtering>true</filtering>
169 174
 						<includes>
170 175
 							<include>**/*.xml</include>
176
+							<include>**/*.p12</include>
177
+							<include>**/*.pem</include>
171 178
 <!--							<include>*.xlsx</include>-->
172 179
 							<include>application.yml</include>
173 180
 							<include>application-${profileActive}.yml</include>
@@ -210,6 +217,11 @@
210 217
 						<artifactId>maven-resources-plugin</artifactId>
211 218
 						<configuration>
212 219
 							<encoding>UTF-8</encoding>
220
+							<nonFilteredFileExtensions>
221
+								<nonFilteredFileExtension>pem</nonFilteredFileExtension>
222
+								<nonFilteredFileExtension>pfx</nonFilteredFileExtension>
223
+								<nonFilteredFileExtension>p12</nonFilteredFileExtension>
224
+							</nonFilteredFileExtensions>
213 225
 						</configuration>
214 226
 					</plugin>
215 227
 				</plugins>
@@ -218,6 +230,8 @@
218 230
 						<directory>src/main/resources</directory>
219 231
 						<filtering>true</filtering>
220 232
 						<includes>
233
+							<include>**/*.p12</include>
234
+							<include>**/*.pem</include>
221 235
 							<include>**/*.xml</include>
222 236
 <!--							<include>*.xlsx</include>-->
223 237
 							<include>application.yml</include>

+ 5
- 0
src/main/java/com/njyunzhi/pet_identity/common/Constants.java Näytä tiedosto

@@ -28,6 +28,7 @@ public class Constants {
28 28
     public final static int PAY_STATUS_READY = 0;  // 未支付
29 29
     public final static int PAY_STATUS_PAYING = 1;  // 支付中
30 30
     public final static int PAY_STATUS_PAID = 2;  // 已支付
31
+    public final static int PAY_STATUS_REFUND = 3;  // 已退款
31 32
 
32 33
     // 审核状态
33 34
     public final static int AUDIT_STATUS_READY = 0;  // 未审核
@@ -50,6 +51,10 @@ public class Constants {
50 51
     public final static int WORKFLOW_STATUS_AUDIT = 2;  // 已审批
51 52
     public final static int WORKFLOW_STATUS_MADE = 3;  // 已发证
52 53
 
54
+    // 流程进度
55
+    public final static int WORKFLOW_PROCESS_AUDIT = 1;  // 待审批
56
+    public final static int WORKFLOW_PROCESS_MADE = 2;  // 待发证
57
+
53 58
     // 系统参数
54 59
     public final static String SYSSETTING_EXPRESS_FEE = "express_fee";  // 快递费
55 60
     public final static String SYSSETTING_PRODUCTION_COST = "production_cost";  // 工本费

+ 9
- 0
src/main/java/com/njyunzhi/pet_identity/common/DateUtils.java Näytä tiedosto

@@ -48,4 +48,13 @@ public class DateUtils {
48 48
         if (dt == null || dt.equals("")) return null;
49 49
         return from(dt + " 23:59:59", "yyyy-MM-dd HH:mm:ss");
50 50
     }
51
+
52
+    public static String today(String ...formaters) {
53
+        String formater = "yyyy-MM-dd";
54
+        if (formaters.length > 0) {
55
+            formater = formaters[0];
56
+        }
57
+
58
+        return toString(LocalDateTime.now(ZoneId.of("Asia/Shanghai")), formater);
59
+    }
51 60
 }

+ 1
- 1
src/main/java/com/njyunzhi/pet_identity/config/SaTokenConfigure.java Näytä tiedosto

@@ -21,7 +21,7 @@ public class SaTokenConfigure implements WebMvcConfigurer {
21 21
         anonList.add("/swagger-ui/**");
22 22
         anonList.add("/swagger-resources/**");
23 23
         anonList.add("/v2/**");
24
-//        anonList.add("/wxpay/notify/**");
24
+        anonList.add("/wxpay/notify/**");
25 25
         anonList.add("/h5/**");
26 26
         anonList.add("/**/sms-captcha");
27 27
         anonList.add("/**/**/sms-captcha");

+ 86
- 25
src/main/java/com/njyunzhi/pet_identity/controller/TaApplicationController.java Näytä tiedosto

@@ -7,9 +7,8 @@ import com.njyunzhi.pet_identity.common.BaseController;
7 7
 import com.njyunzhi.pet_identity.common.Constants;
8 8
 import com.njyunzhi.pet_identity.common.ResponseBean;
9 9
 import com.njyunzhi.pet_identity.common.StringUtils;
10
-import com.njyunzhi.pet_identity.entity.SysUser;
11
-import com.njyunzhi.pet_identity.entity.TaPerson;
12
-import com.njyunzhi.pet_identity.entity.TaPetIdentity;
10
+import com.njyunzhi.pet_identity.entity.*;
11
+import com.njyunzhi.pet_identity.service.ITaOrderService;
13 12
 import com.njyunzhi.pet_identity.service.ITaPetIdentityService;
14 13
 import com.njyunzhi.pet_identity.vo.AuditParam;
15 14
 import com.njyunzhi.pet_identity.vo.MakeCardParam;
@@ -25,10 +24,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
25 24
 import org.springframework.web.bind.annotation.RequestMethod;
26 25
 import org.springframework.web.bind.annotation.RequestParam;
27 26
 import com.njyunzhi.pet_identity.service.ITaApplicationService;
28
-import com.njyunzhi.pet_identity.entity.TaApplication;
29 27
 import org.springframework.web.bind.annotation.RestController;
30 28
 
31 29
 import java.time.LocalDateTime;
30
+import java.util.ArrayList;
32 31
 
33 32
 /**
34 33
  * <p>
@@ -52,6 +51,9 @@ public class TaApplicationController extends BaseController {
52 51
     @Autowired
53 52
     public ITaPetIdentityService iTaPetIdentityService;
54 53
 
54
+    @Autowired
55
+    public ITaOrderService iTaOrderService;
56
+
55 57
     /**
56 58
      * 分页查询列表
57 59
      * @param pageNum
@@ -61,7 +63,8 @@ public class TaApplicationController extends BaseController {
61 63
     @RequestMapping(value="/admin/application",method= RequestMethod.GET)
62 64
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
63 65
     public ResponseBean taApplicationList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
64
-									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
66
+                                          @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
67
+                                          @ApiParam("表单进度") @RequestParam(value ="process", defaultValue = "0") Integer process) throws Exception{
65 68
 
66 69
         SysUser sysUser = currentUser();
67 70
 
@@ -69,17 +72,30 @@ public class TaApplicationController extends BaseController {
69 72
         QueryWrapper<TaApplication> queryWrapper = new QueryWrapper<>();
70 73
         queryWrapper.gt("status", Constants.STATUS_DELETE);
71 74
 
72
-        // 审核人角色
73
-        if (Constants.USER_AUDITOR.equals(sysUser.getRoleName())) {
74
-            queryWrapper.ge("status", Constants.WORKFLOW_STATUS_PROCESSING);
75
-            queryWrapper.le("status", Constants.WORKFLOW_STATUS_AUDIT);
75
+        if (Constants.WORKFLOW_PROCESS_AUDIT == process) {
76
+            // 过滤待审批列表
77
+            // 必须是已交费的 或者 续期的
78
+            queryWrapper.in("status", new Integer[] { Constants.WORKFLOW_STATUS_PROCESSING, Constants.WORKFLOW_STATUS_AUDIT });
79
+            queryWrapper.nested(q -> q.eq("pay_status", Constants.PAY_STATUS_PAID).or().eq("apply_type", Constants.APPLY_TYPE_RENEWAL));
80
+        } else if (Constants.WORKFLOW_PROCESS_MADE == process) {
81
+            // 过滤待制卡列表
82
+            // 必须是审核通过的, 且是初次提审或者挂失补办的
83
+            queryWrapper.in("status", new Integer[] { Constants.WORKFLOW_STATUS_AUDIT, Constants.WORKFLOW_STATUS_MADE });
84
+            queryWrapper.eq("verify_Status", Constants.AUDIT_STATUS_PASSED);
85
+            queryWrapper.in("apply_type", new String[] { Constants.APPLY_TYPE_FIRST,  Constants.APPLY_TYPE_REISSUE});
76 86
         }
77 87
 
78
-        // 发证(制卡)人角色
79
-        if (Constants.USER_MAKER.equals(sysUser.getRoleName())) {
80
-            queryWrapper.ge("status", Constants.WORKFLOW_STATUS_AUDIT);
81
-            queryWrapper.le("status", Constants.WORKFLOW_STATUS_MADE);
82
-        }
88
+//        // 审核人角色
89
+//        if (Constants.USER_AUDITOR.equals(sysUser.getRoleName())) {
90
+//            queryWrapper.ge("status", Constants.WORKFLOW_STATUS_PROCESSING);
91
+//            queryWrapper.le("status", Constants.WORKFLOW_STATUS_AUDIT);
92
+//        }
93
+//
94
+//        // 发证(制卡)人角色
95
+//        if (Constants.USER_MAKER.equals(sysUser.getRoleName())) {
96
+//            queryWrapper.ge("status", Constants.WORKFLOW_STATUS_AUDIT);
97
+//            queryWrapper.le("status", Constants.WORKFLOW_STATUS_MADE);
98
+//        }
83 99
 
84 100
         queryWrapper.orderByAsc("status");
85 101
         queryWrapper.orderByDesc("create_date");
@@ -136,6 +152,39 @@ public class TaApplicationController extends BaseController {
136 152
         taApplication.setVerifyStatus(Constants.AUDIT_STATUS_READY);
137 153
         taApplication.setMakeStatus(Constants.MAKE_STATUS_READY);
138 154
 
155
+        if (Constants.APPLY_TYPE_RENEWAL.equals(taApplication.getApplyType())) {
156
+            // 如果是续期申请
157
+            if (StringUtils.isEmpty(taApplication.getOriginCardNo())) {
158
+                return ResponseBean.error("未找到原始证件信息");
159
+            }
160
+            TaPetIdentity taPetIdentity = iTaPetIdentityService.getExistBy("card_no", taApplication.getOriginCardNo(), false, true);
161
+            if (null == taPetIdentity) {
162
+                return ResponseBean.error("未找到原始证件信息");
163
+            }
164
+            taApplication.setStatus(Constants.WORKFLOW_STATUS_PROCESSING);
165
+        } else if (Constants.APPLY_TYPE_REISSUE.equals(taApplication.getApplyType())) {
166
+            // 如果是挂失补办
167
+            if (StringUtils.isEmpty(taApplication.getOriginCardNo())) {
168
+                return ResponseBean.error("未找到原始证件信息");
169
+            }
170
+            TaPetIdentity taPetIdentity = iTaPetIdentityService.getExistBy("card_no", taApplication.getOriginCardNo(), false, true);
171
+            if (null == taPetIdentity) {
172
+                return ResponseBean.error("未找到原始证件信息");
173
+            }
174
+
175
+            // 直接将原卡置为挂失
176
+            taPetIdentity.setStatus(Constants.CARD_STATUS_LOSS);
177
+            if (!iTaPetIdentityService.updateById(taPetIdentity)) {
178
+                return ResponseBean.error("挂失证件失败, 请重试");
179
+            }
180
+        } else {
181
+            // 当前狗狗是否存在证件
182
+            TaPetIdentity origin = iTaPetIdentityService.getByPet(taApplication.getPetId(), taApplication.getPersonId());
183
+            if (null != origin) {
184
+                return ResponseBean.error("请先挂失原始证件");
185
+            }
186
+        }
187
+
139 188
         if (iTaApplicationService.save(taApplication)){
140 189
             return ResponseBean.success(taApplication);
141 190
         } else {
@@ -183,6 +232,10 @@ public class TaApplicationController extends BaseController {
183 232
     public ResponseBean audit(@ApiParam("对象ID") @PathVariable Integer id,
184 233
                                         @ApiParam("更新内容") @RequestBody AuditParam auditParam) throws Exception{
185 234
 
235
+        // 目前业务有 3 种, 初次申请, 挂失, 续期
236
+        // 其中 续期 不需要缴费
237
+        // 如果审核驳回,那么已缴费用, 需要原路返回
238
+
186 239
         SysUser sysUser = currentUser();
187 240
         if (!checkRole(sysUser.getRoleName(), Constants.USER_AUDITOR)) {
188 241
             return ResponseBean.error("暂无权限");
@@ -229,14 +282,6 @@ public class TaApplicationController extends BaseController {
229 282
             if (null == taPetIdentity) {
230 283
                 return ResponseBean.error("未找到原始证件信息");
231 284
             }
232
-
233
-            // 审核同意之后, 直接作废原始证件
234
-            if (Constants.AUDIT_STATUS_PASSED == auditParam.getVerifyStatus()) {
235
-                taPetIdentity.setStatus(Constants.CARD_STATUS_LOSS);
236
-                if (!iTaPetIdentityService.updateById(taPetIdentity)) {
237
-                    return ResponseBean.error("续期挂失失败, 请重试");
238
-                }
239
-            }
240 285
         } else {
241 286
             return ResponseBean.error("申办业务类型不支持");
242 287
         }
@@ -245,14 +290,23 @@ public class TaApplicationController extends BaseController {
245 290
             return ResponseBean.error("当前记录已审批");
246 291
         }
247 292
 
248
-        if (auditParam.getVerifyStatus() == Constants.AUDIT_STATUS_REJECT && StringUtils.isEmpty(auditParam.getRejectReason())) {
249
-            return ResponseBean.error("请填写驳回理由");
293
+        if (auditParam.getVerifyStatus() == Constants.AUDIT_STATUS_REJECT) {
294
+            if (StringUtils.isEmpty(auditParam.getRejectReason())) {
295
+                return ResponseBean.error("请填写驳回理由");
296
+            }
297
+
298
+            // 如果已经缴费, 则原路退回费用
299
+            if (Constants.PAY_STATUS_PAID == taApplication.getPayStatus()) {
300
+                iTaOrderService.refundByApplication(taApplication);
301
+            }
250 302
         }
251 303
 
252 304
         taApplication.setVerifyStatus(auditParam.getVerifyStatus());
305
+        taApplication.setRejectReason(auditParam.getRejectReason());
253 306
         taApplication.setVerifyDate(LocalDateTime.now());
254 307
         taApplication.setVerifyUser(sysUser.getUserId());
255 308
         taApplication.setVerifyUserName(sysUser.getUserName());
309
+        taApplication.setStatus(Constants.WORKFLOW_STATUS_AUDIT);
256 310
 
257 311
         if (iTaApplicationService.updateById(taApplication)){
258 312
             return ResponseBean.success(taApplication);
@@ -297,8 +351,11 @@ public class TaApplicationController extends BaseController {
297 351
         }
298 352
 
299 353
         if (taApplication.getApplyMethod() == Constants.APPLY_METHOD_EXPRESS) {
300
-            if (StringUtils.isEmpty(taApplication.getTrackingType()) || StringUtils.isEmpty(taApplication.getTrackingNo())) {
354
+            if (StringUtils.isEmpty(makeCardParam.getTrackingType()) || StringUtils.isEmpty(makeCardParam.getTrackingNo())) {
301 355
                 return ResponseBean.error("请填写快递信息");
356
+            } else {
357
+                taApplication.setTrackingNo(makeCardParam.getTrackingNo());
358
+                taApplication.setTrackingType(makeCardParam.getTrackingType());
302 359
             }
303 360
         }
304 361
 
@@ -311,12 +368,15 @@ public class TaApplicationController extends BaseController {
311 368
             }
312 369
         }
313 370
 
371
+        // 关联证件
372
+        taApplication.setOriginCardNo(makeCardParam.getCardNo());
314 373
         taApplication.setMakeStatus(Constants.MAKE_STATUS_MADE);
315 374
         taApplication.setMakeDate(LocalDateTime.now());
316 375
         taApplication.setMakeUser(sysUser.getUserId());
317 376
         taApplication.setMakeUserName(sysUser.getUserName());
318 377
         taApplication.setTrackingType(makeCardParam.getTrackingType());
319 378
         taApplication.setTrackingNo(makeCardParam.getTrackingNo());
379
+        taApplication.setStatus(Constants.WORKFLOW_STATUS_MADE);
320 380
 
321 381
         if (iTaApplicationService.updateById(taApplication)){
322 382
             TaPetIdentity newCard = iTaPetIdentityService.createNewCard(taApplication, makeCardParam);
@@ -363,4 +423,5 @@ public class TaApplicationController extends BaseController {
363 423
 
364 424
         return ResponseBean.success(taApplication);
365 425
     }
426
+
366 427
 }

+ 5
- 4
src/main/java/com/njyunzhi/pet_identity/controller/TaOrderController.java Näytä tiedosto

@@ -106,18 +106,18 @@ public class TaOrderController extends BaseController {
106 106
 
107 107
         // 快递费
108 108
         SysSetting expressFeeSetting = iSysSettingService.getById(Constants.SYSSETTING_EXPRESS_FEE);
109
-        Integer expressFee = Float.valueOf(expressFeeSetting.getContent()).intValue();
109
+        float expressFee = Float.parseFloat(expressFeeSetting.getContent());
110 110
         // 工本费
111 111
         SysSetting productionCostSetting = iSysSettingService.getById(Constants.SYSSETTING_PRODUCTION_COST);
112
-        Integer productionCost = Float.valueOf(productionCostSetting.getContent()).intValue();
112
+        float productionCost = Float.parseFloat(productionCostSetting.getContent());
113 113
 
114 114
         TaOrder taOrder = new TaOrder();
115 115
         String orderNo = iTaOrderService.createOrderNo();
116 116
         taOrder.setOrderNo(orderNo);
117 117
         taOrder.setApplyId(applyId);
118
-        taOrder.setProductionCost(productionCost);
118
+        taOrder.setProductionCost((int) (productionCost * 100));
119 119
         // 如果没有选择快递提取, 则没有快递费用
120
-        taOrder.setExpressFee(taApplication.getApplyMethod() == 2 ? expressFee : 0);
120
+        taOrder.setExpressFee(taApplication.getApplyMethod() == 2 ? (int) (expressFee * 100) : 0);
121 121
         taOrder.setCharges(taOrder.getExpressFee() + taOrder.getProductionCost());
122 122
         taOrder.setStatus(Constants.PAY_STATUS_READY);
123 123
         taOrder.setCreateDate(LocalDateTime.now());
@@ -153,6 +153,7 @@ public class TaOrderController extends BaseController {
153 153
 
154 154
             return ResponseBean.success(rtn);
155 155
         } catch (Exception e) {
156
+            e.printStackTrace();
156 157
             return ResponseBean.error("生成微信预支付信息失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
157 158
         }
158 159
     }

+ 18
- 18
src/main/java/com/njyunzhi/pet_identity/controller/TaPersonController.java Näytä tiedosto

@@ -39,25 +39,25 @@ public class TaPersonController extends BaseController {
39 39
     @Autowired
40 40
     public ITaPersonService iTaPersonService;
41 41
 
42
+    /**
43
+     * 分页查询列表
44
+     * @param pageNum
45
+     * @param pageSize
46
+     * @return
47
+     */
48
+    @RequestMapping(value="/admin/person",method= RequestMethod.GET)
49
+    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
50
+    public ResponseBean taPersonList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
51
+									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
42 52
 
43
-//    /**
44
-//     * 分页查询列表
45
-//     * @param pageNum
46
-//     * @param pageSize
47
-//     * @return
48
-//     */
49
-//    @RequestMapping(value="/taPerson",method= RequestMethod.GET)
50
-//    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
-//    public ResponseBean taPersonList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
-//									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
53
-//
54
-//        IPage<TaPerson> pg = new Page<>(pageNum, pageSize);
55
-//        QueryWrapper<TaPerson> queryWrapper = new QueryWrapper<>();
56
-//        queryWrapper.orderByDesc("create_date");
57
-//
58
-//        IPage<TaPerson> result = iTaPersonService.page(pg, queryWrapper);
59
-//        return ResponseBean.success(result);
60
-//    }
53
+        IPage<TaPerson> pg = new Page<>(pageNum, pageSize);
54
+        QueryWrapper<TaPerson> queryWrapper = new QueryWrapper<>();
55
+        queryWrapper.isNotNull("phone");
56
+        queryWrapper.orderByDesc("create_date");
57
+
58
+        IPage<TaPerson> result = iTaPersonService.page(pg, queryWrapper);
59
+        return ResponseBean.success(result);
60
+    }
61 61
 
62 62
 //    /**
63 63
 //     * 保存对象

+ 36
- 5
src/main/java/com/njyunzhi/pet_identity/controller/TaPetController.java Näytä tiedosto

@@ -7,6 +7,8 @@ import com.njyunzhi.pet_identity.common.BaseController;
7 7
 import com.njyunzhi.pet_identity.common.Constants;
8 8
 import com.njyunzhi.pet_identity.common.ResponseBean;
9 9
 import com.njyunzhi.pet_identity.entity.TaPerson;
10
+import com.njyunzhi.pet_identity.entity.TaPetIdentity;
11
+import com.njyunzhi.pet_identity.service.ITaPetIdentityService;
10 12
 import io.swagger.annotations.Api;
11 13
 import io.swagger.annotations.ApiOperation;
12 14
 import io.swagger.annotations.ApiParam;
@@ -35,7 +37,7 @@ import java.time.LocalDateTime;
35 37
 
36 38
 @Api(tags = "宠物表")
37 39
 @RestController
38
-@RequestMapping("/wx/{clientId}")
40
+@RequestMapping("/")
39 41
 public class TaPetController extends BaseController {
40 42
 
41 43
     private final Logger logger = LoggerFactory.getLogger(TaPetController.class);
@@ -43,6 +45,9 @@ public class TaPetController extends BaseController {
43 45
     @Autowired
44 46
     public ITaPetService iTaPetService;
45 47
 
48
+    @Autowired
49
+    public ITaPetIdentityService iTaPetIdentityService;
50
+
46 51
 
47 52
     /**
48 53
      * 分页查询列表
@@ -50,7 +55,7 @@ public class TaPetController extends BaseController {
50 55
      * @param pageSize
51 56
      * @return
52 57
      */
53
-    @RequestMapping(value="/pet",method= RequestMethod.GET)
58
+    @RequestMapping(value="/wx/{clientId}/pet",method= RequestMethod.GET)
54 59
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
55 60
     public ResponseBean taPetList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
56 61
 									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception {
@@ -71,7 +76,7 @@ public class TaPetController extends BaseController {
71 76
      * @param taPet 实体对象
72 77
      * @return
73 78
      */
74
-    @RequestMapping(value="/pet",method= RequestMethod.POST)
79
+    @RequestMapping(value="/wx/{clientId}/pet",method= RequestMethod.POST)
75 80
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
76 81
     public ResponseBean taPetAdd(@ApiParam("保存内容") @RequestBody TaPet taPet) throws Exception {
77 82
         TaPerson taPerson = currentPerson();
@@ -106,7 +111,7 @@ public class TaPetController extends BaseController {
106 111
      * @param taPet 实体对象
107 112
      * @return
108 113
      */
109
-    @RequestMapping(value="/pet/{id}",method= RequestMethod.PUT)
114
+    @RequestMapping(value="/wx/{clientId}/pet/{id}",method= RequestMethod.PUT)
110 115
     @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
111 116
     public ResponseBean taPetUpdate(@ApiParam("对象ID") @PathVariable String id,
112 117
                                         @ApiParam("更新内容") @RequestBody TaPet taPet) throws Exception{
@@ -125,9 +130,35 @@ public class TaPetController extends BaseController {
125 130
      * 根据id查询对象
126 131
      * @param id  实体ID
127 132
      */
128
-    @RequestMapping(value="/pet/{id}",method= RequestMethod.GET)
133
+    @RequestMapping(value="/wx/{clientId}/pet/{id}",method= RequestMethod.GET)
129 134
     @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
130 135
     public ResponseBean taPetGet(@ApiParam("对象ID") @PathVariable String id) throws Exception{
131 136
         return ResponseBean.success(iTaPetService.getById(id));
132 137
     }
138
+
139
+    /**
140
+     * 根据id查询对象
141
+     * @param id  实体ID
142
+     */
143
+    @RequestMapping(value="/wx/{clientId}/pet/{id}/card",method= RequestMethod.GET)
144
+    @ApiOperation(value="狗子证件", notes = "狗子证件", httpMethod = "GET", response = ResponseBean.class)
145
+    public ResponseBean getCard(@ApiParam("对象ID") @PathVariable String id) throws Exception{
146
+
147
+        TaPetIdentity taPetIdentity = iTaPetIdentityService.getExistBy("pet_id", id, false, true);
148
+
149
+        return ResponseBean.success(taPetIdentity);
150
+    }
151
+
152
+    /**
153
+     * 根据id查询对象
154
+     * @param id  实体ID
155
+     */
156
+    @RequestMapping(value="/admin/pet/{id}/card",method= RequestMethod.GET)
157
+    @ApiOperation(value="狗子证件", notes = "狗子证件", httpMethod = "GET", response = ResponseBean.class)
158
+    public ResponseBean getPetCard(@ApiParam("对象ID") @PathVariable String id) throws Exception{
159
+
160
+        TaPetIdentity taPetIdentity = iTaPetIdentityService.getExistBy("pet_id", id, false, true);
161
+
162
+        return ResponseBean.success(taPetIdentity);
163
+    }
133 164
 }

+ 55
- 3
src/main/java/com/njyunzhi/pet_identity/controller/TaPetIdentityController.java Näytä tiedosto

@@ -3,10 +3,9 @@ package com.njyunzhi.pet_identity.controller;
3 3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
-import com.njyunzhi.pet_identity.common.BaseController;
7
-import com.njyunzhi.pet_identity.common.Constants;
8
-import com.njyunzhi.pet_identity.common.ResponseBean;
6
+import com.njyunzhi.pet_identity.common.*;
9 7
 import com.njyunzhi.pet_identity.entity.TaPerson;
8
+import com.njyunzhi.pet_identity.service.ITaSequenceService;
10 9
 import io.swagger.annotations.Api;
11 10
 import io.swagger.annotations.ApiOperation;
12 11
 import io.swagger.annotations.ApiParam;
@@ -41,6 +40,28 @@ public class TaPetIdentityController extends BaseController {
41 40
     @Autowired
42 41
     public ITaPetIdentityService iTaPetIdentityService;
43 42
 
43
+    @Autowired
44
+    public ITaSequenceService iTaSequenceService;
45
+
46
+    /**
47
+     * 分页查询列表
48
+     * @param pageNum
49
+     * @param pageSize
50
+     * @return
51
+     */
52
+    @RequestMapping(value="/admin/card",method= RequestMethod.GET)
53
+    @ApiOperation(value="证件列表", notes = "证件列表", httpMethod = "GET", response = ResponseBean.class)
54
+    public ResponseBean getList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
55
+                               @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
56
+
57
+        IPage<TaPetIdentity> pg = new Page<>(pageNum, pageSize);
58
+        QueryWrapper<TaPetIdentity> queryWrapper = new QueryWrapper<>();
59
+        queryWrapper.gt("status", Constants.STATUS_DELETE);
60
+        queryWrapper.orderByDesc("create_date");
61
+
62
+        IPage<TaPetIdentity> result = iTaPetIdentityService.page(pg, queryWrapper);
63
+        return ResponseBean.success(result);
64
+    }
44 65
 
45 66
     /**
46 67
      * 分页查询列表
@@ -112,6 +133,21 @@ public class TaPetIdentityController extends BaseController {
112 133
 //        }
113 134
 //    }
114 135
 
136
+    /**
137
+     * 获取证件号码
138
+     * @param id  实体ID
139
+     */
140
+    @RequestMapping(value="/admin/card/next",method= RequestMethod.GET)
141
+    @ApiOperation(value="获取证件号码", notes = "获取证件号码", httpMethod = "GET", response = ResponseBean.class)
142
+    public ResponseBean getNewNo() throws Exception{
143
+        String seqName = String.format("%s-%s", "card", DateUtils.today("yyyyMMdd"));
144
+        Integer nextVal = iTaSequenceService.getNextVal(seqName);
145
+
146
+        String cardNo = StringUtils.lpad(nextVal.toString(), "0", 3);
147
+
148
+        return ResponseBean.success(DateUtils.today("yyyyMMdd")+cardNo);
149
+    }
150
+
115 151
     /**
116 152
      * 根据id查询对象
117 153
      * @param id  实体ID
@@ -126,4 +162,20 @@ public class TaPetIdentityController extends BaseController {
126 162
 
127 163
         return ResponseBean.success(taPetIdentity);
128 164
     }
165
+
166
+
167
+    /**
168
+     * 根据id查询对象
169
+     * @param id  实体ID
170
+     */
171
+    @RequestMapping(value="/admin/card/{id}",method= RequestMethod.GET)
172
+    @ApiOperation(value="证件详情", notes = "证件详情", httpMethod = "GET", response = ResponseBean.class)
173
+    public ResponseBean getDetail(@ApiParam("对象ID") @PathVariable String id) throws Exception{
174
+        TaPetIdentity taPetIdentity = iTaPetIdentityService.getExistBy("card_id", id, false, true);
175
+        if (null == taPetIdentity) {
176
+            return ResponseBean.error("未找到证件信息");
177
+        }
178
+
179
+        return ResponseBean.success(taPetIdentity);
180
+    }
129 181
 }

+ 15
- 14
src/main/java/com/njyunzhi/pet_identity/controller/WxPayController.java Näytä tiedosto

@@ -2,6 +2,7 @@ package com.njyunzhi.pet_identity.controller;
2 2
 
3 3
 import com.github.binarywang.wxpay.bean.notify.WxPayNotifyResponse;
4 4
 import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyV3Result;
5
+import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyV3Result;
5 6
 import com.github.binarywang.wxpay.service.WxPayService;
6 7
 import com.njyunzhi.pet_identity.common.BaseController;
7 8
 import com.njyunzhi.pet_identity.common.WxUtils;
@@ -41,19 +42,19 @@ public class WxPayController extends BaseController {
41 42
 
42 43
     }
43 44
 
44
-//    @ResponseBody
45
-//    @RequestMapping("/notify/refund")
46
-//    public String refundNotify(@RequestBody String jsonData) {
47
-//        WxPayService payService = wxUtils.getPayService();
48
-//        WxPayRefundNotifyV3Result result = null;
49
-//        try {
50
-//            result = payService.parseRefundNotifyV3Result(jsonData, null);
51
-//            orderPayService.refundNotifyOrder(result.getResult());
52
-//            return WxPayNotifyResponse.success("OK");
53
-//        } catch (Exception e) {
54
-//            e.printStackTrace();
55
-//            return WxPayNotifyResponse.fail(e.getMessage());
56
-//        }
57
-//    }
45
+    @ResponseBody
46
+    @RequestMapping("/notify/refund")
47
+    public String refundNotify(@RequestBody String jsonData) {
48
+        WxPayService payService = wxUtils.getPayService();
49
+        WxPayRefundNotifyV3Result result = null;
50
+        try {
51
+            result = payService.parseRefundNotifyV3Result(jsonData, null);
52
+            iTaOrderService.refundNotifyOrder(result.getResult());
53
+            return WxPayNotifyResponse.success("OK");
54
+        } catch (Exception e) {
55
+            e.printStackTrace();
56
+            return WxPayNotifyResponse.fail(e.getMessage());
57
+        }
58
+    }
58 59
 
59 60
 }

+ 3
- 0
src/main/java/com/njyunzhi/pet_identity/entity/TaOrder.java Näytä tiedosto

@@ -54,4 +54,7 @@ public class TaOrder implements Serializable {
54 54
     @ApiModelProperty(value = "支付日期")
55 55
     private LocalDateTime payDate;
56 56
 
57
+    @ApiModelProperty(value = "退款日期")
58
+    private LocalDateTime refundDate;
59
+
57 60
 }

+ 3
- 0
src/main/java/com/njyunzhi/pet_identity/mapper/TaOrderMapper.java Näytä tiedosto

@@ -3,6 +3,7 @@ package com.njyunzhi.pet_identity.mapper;
3 3
 import com.njyunzhi.pet_identity.entity.TaOrder;
4 4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 5
 import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Param;
6 7
 import org.apache.ibatis.annotations.Select;
7 8
 
8 9
 /**
@@ -18,4 +19,6 @@ public interface TaOrderMapper extends BaseMapper<TaOrder> {
18 19
 
19 20
     @Select("SELECT UUID_SHORT()")
20 21
     String getShortUUID();
22
+
23
+    TaOrder getByApplyId(@Param("applyId") String applyId);
21 24
 }

+ 4
- 0
src/main/java/com/njyunzhi/pet_identity/mapper/TaSequenceMapper.java Näytä tiedosto

@@ -3,6 +3,8 @@ package com.njyunzhi.pet_identity.mapper;
3 3
 import com.njyunzhi.pet_identity.entity.TaSequence;
4 4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 5
 import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Param;
7
+import org.apache.ibatis.annotations.Select;
6 8
 
7 9
 /**
8 10
  * <p>
@@ -15,4 +17,6 @@ import org.apache.ibatis.annotations.Mapper;
15 17
 @Mapper
16 18
 public interface TaSequenceMapper extends BaseMapper<TaSequence> {
17 19
 
20
+    @Select("SELECT fn_nextval(#{seqName})")
21
+    Integer getNextVal(@Param("seqName") String seqName);
18 22
 }

+ 9
- 1
src/main/java/com/njyunzhi/pet_identity/service/ITaOrderService.java Näytä tiedosto

@@ -1,8 +1,10 @@
1 1
 package com.njyunzhi.pet_identity.service;
2 2
 
3 3
 import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyV3Result;
4
+import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyV3Result;
5
+import com.njyunzhi.pet_identity.entity.TaApplication;
4 6
 import com.njyunzhi.pet_identity.entity.TaOrder;
5
-import com.baomidou.mybatisplus.extension.service.IService;
7
+import com.njyunzhi.pet_identity.entity.TaPerson;
6 8
 
7 9
 /**
8 10
  * <p>
@@ -17,4 +19,10 @@ public interface ITaOrderService extends IBaseService<TaOrder> {
17 19
     void notifyOrderPay(WxPayOrderNotifyV3Result.DecryptNotifyResult result) throws Exception;
18 20
 
19 21
     String createOrderNo() throws Exception;
22
+
23
+    boolean refundByApplication(TaApplication taApplication) throws Exception;
24
+
25
+    TaOrder createByApplication(TaPerson taPerson, TaApplication taApplication) throws Exception;
26
+
27
+    void refundNotifyOrder(WxPayRefundNotifyV3Result.DecryptNotifyResult result) throws Exception;
20 28
 }

+ 2
- 0
src/main/java/com/njyunzhi/pet_identity/service/ITaPetIdentityService.java Näytä tiedosto

@@ -17,4 +17,6 @@ public interface ITaPetIdentityService extends IBaseService<TaPetIdentity> {
17 17
     TaPetIdentity createNewCard(TaApplication taApplication, MakeCardParam makeCardParam) throws Exception;
18 18
 
19 19
     boolean extendDate(TaPetIdentity taPetIdentity) throws Exception;
20
+
21
+    TaPetIdentity getByPet(String petId, String personId);
20 22
 }

+ 1
- 0
src/main/java/com/njyunzhi/pet_identity/service/ITaSequenceService.java Näytä tiedosto

@@ -13,4 +13,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
13 13
  */
14 14
 public interface ITaSequenceService extends IService<TaSequence> {
15 15
 
16
+    Integer getNextVal(String seqName);
16 17
 }

+ 90
- 0
src/main/java/com/njyunzhi/pet_identity/service/impl/TaOrderServiceImpl.java Näytä tiedosto

@@ -1,13 +1,20 @@
1 1
 package com.njyunzhi.pet_identity.service.impl;
2 2
 
3 3
 import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyV3Result;
4
+import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyV3Result;
5
+import com.github.binarywang.wxpay.bean.request.WxPayRefundV3Request;
4 6
 import com.github.binarywang.wxpay.constant.WxPayConstants;
5 7
 import com.njyunzhi.pet_identity.common.Constants;
8
+import com.njyunzhi.pet_identity.common.ResponseBean;
6 9
 import com.njyunzhi.pet_identity.common.StringUtils;
10
+import com.njyunzhi.pet_identity.common.WxPayUtils;
11
+import com.njyunzhi.pet_identity.entity.SysSetting;
7 12
 import com.njyunzhi.pet_identity.entity.TaApplication;
8 13
 import com.njyunzhi.pet_identity.entity.TaOrder;
14
+import com.njyunzhi.pet_identity.entity.TaPerson;
9 15
 import com.njyunzhi.pet_identity.mapper.TaApplicationMapper;
10 16
 import com.njyunzhi.pet_identity.mapper.TaOrderMapper;
17
+import com.njyunzhi.pet_identity.service.ISysSettingService;
11 18
 import com.njyunzhi.pet_identity.service.ITaOrderService;
12 19
 import org.springframework.beans.factory.annotation.Autowired;
13 20
 import org.springframework.stereotype.Service;
@@ -28,6 +35,12 @@ public class TaOrderServiceImpl extends BaseServiceImpl<TaOrderMapper, TaOrder>
28 35
     @Autowired
29 36
     TaApplicationMapper applicationMapper;
30 37
 
38
+    @Autowired
39
+    ISysSettingService iSysSettingService;
40
+
41
+    @Autowired
42
+    WxPayUtils wxPayUtils;
43
+
31 44
     @Override
32 45
     public void notifyOrderPay(WxPayOrderNotifyV3Result.DecryptNotifyResult result) throws Exception {
33 46
         TaOrder taOrder = getExistBy("order_no", result.getOutTradeNo(), false, true);
@@ -53,6 +66,7 @@ public class TaOrderServiceImpl extends BaseServiceImpl<TaOrderMapper, TaOrder>
53 66
         if (null == taApplication || Constants.STATUS_DELETE == taApplication.getStatus()) return;
54 67
 
55 68
         taApplication.setPayStatus(Constants.PAY_STATUS_PAID);
69
+        taApplication.setStatus(Constants.WORKFLOW_STATUS_PROCESSING);
56 70
         applicationMapper.updateById(taApplication);
57 71
     }
58 72
 
@@ -60,4 +74,80 @@ public class TaOrderServiceImpl extends BaseServiceImpl<TaOrderMapper, TaOrder>
60 74
     public String createOrderNo() throws Exception {
61 75
         return baseMapper.getShortUUID();
62 76
     }
77
+
78
+    @Override
79
+    public boolean refundByApplication(TaApplication taApplication) throws Exception {
80
+        TaOrder taOrder = baseMapper.getByApplyId(taApplication.getApplyId().toString());
81
+
82
+        WxPayRefundV3Request request = new WxPayRefundV3Request();
83
+        request.setOutTradeNo(taOrder.getOrderNo()); // 原单号
84
+        request.setOutRefundNo("R-" + taOrder.getOrderNo()); // 退款单号
85
+        WxPayRefundV3Request.Amount amount = new  WxPayRefundV3Request.Amount();
86
+        amount.setTotal(taOrder.getCharges());
87
+        amount.setRefund(taOrder.getCharges());
88
+        amount.setCurrency("CNY");
89
+        request.setAmount(amount);
90
+        wxPayUtils.refund(request);
91
+
92
+        return true;
93
+    }
94
+
95
+    @Override
96
+    public TaOrder createByApplication(TaPerson taPerson, TaApplication taApplication) throws Exception {
97
+        if (!taPerson.getPersonId().equals(taApplication.getPersonId())) {
98
+            throw new Exception("非本人订单, 不能支付");
99
+        }
100
+
101
+        if (Constants.PAY_STATUS_PAID == taApplication.getPayStatus()) {
102
+            throw new Exception("当前申请已支付");
103
+        }
104
+
105
+        // 快递费
106
+        SysSetting expressFeeSetting = iSysSettingService.getById(Constants.SYSSETTING_EXPRESS_FEE);
107
+        float expressFee = Float.parseFloat(expressFeeSetting.getContent());
108
+        // 工本费
109
+        SysSetting productionCostSetting = iSysSettingService.getById(Constants.SYSSETTING_PRODUCTION_COST);
110
+        float productionCost = Float.parseFloat(productionCostSetting.getContent());
111
+
112
+        TaOrder taOrder = new TaOrder();
113
+        String orderNo = createOrderNo();
114
+        taOrder.setOrderNo(orderNo);
115
+        taOrder.setApplyId(taApplication.getApplyId().toString());
116
+        taOrder.setProductionCost((int) (productionCost * 100));
117
+        // 如果没有选择快递提取, 则没有快递费用
118
+        taOrder.setExpressFee(taApplication.getApplyMethod() == 2 ? (int) (expressFee * 100) : 0);
119
+        taOrder.setCharges(taOrder.getExpressFee() + taOrder.getProductionCost());
120
+        taOrder.setStatus(Constants.PAY_STATUS_READY);
121
+        taOrder.setCreateDate(LocalDateTime.now());
122
+
123
+        if (save(taOrder)) {
124
+            return taOrder;
125
+        } else {
126
+            throw new Exception("生成订单失败");
127
+        }
128
+    }
129
+
130
+    @Override
131
+    public void refundNotifyOrder(WxPayRefundNotifyV3Result.DecryptNotifyResult result) throws Exception {
132
+        String orderNo = result.getOutTradeNo();
133
+        TaOrder taOrder = getExistBy("order_no", orderNo, false, true);
134
+        if (null == taOrder) {
135
+            log.error("退款通知处理失败: 单号 " + orderNo);
136
+            log.error(result.toString());
137
+            return;
138
+        }
139
+
140
+        boolean isSuccess = WxPayConstants.RefundStatus.SUCCESS.equals(result.getRefundStatus());
141
+        if (isSuccess) {
142
+            // 更新订单
143
+            taOrder.setStatus(Constants.PAY_STATUS_REFUND);
144
+            taOrder.setRefundDate(LocalDateTime.now());
145
+            updateById(taOrder);
146
+            // 更新申请
147
+            TaApplication taApplication = applicationMapper.selectById(taOrder.getApplyId());
148
+            taApplication.setPayStatus(Constants.PAY_STATUS_REFUND);
149
+            applicationMapper.updateById(taApplication);
150
+        }
151
+
152
+    }
63 153
 }

+ 14
- 2
src/main/java/com/njyunzhi/pet_identity/service/impl/TaPetIdentityServiceImpl.java Näytä tiedosto

@@ -1,5 +1,6 @@
1 1
 package com.njyunzhi.pet_identity.service.impl;
2 2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3 4
 import com.njyunzhi.pet_identity.common.Constants;
4 5
 import com.njyunzhi.pet_identity.common.DateUtils;
5 6
 import com.njyunzhi.pet_identity.entity.SysSetting;
@@ -52,7 +53,7 @@ public class TaPetIdentityServiceImpl extends BaseServiceImpl<TaPetIdentityMappe
52 53
         taPetIdentity.setPetImg2(taApplication.getImg2());
53 54
         taPetIdentity.setAddress(taApplication.getAddress());
54 55
         taPetIdentity.setStartDate(DateUtils.toString(now, "yyyy-MM-dd"));
55
-        taPetIdentity.setStartDate(DateUtils.toString(expire, "yyyy-MM-dd"));
56
+        taPetIdentity.setExpireDate(DateUtils.toString(expire, "yyyy-MM-dd"));
56 57
         taPetIdentity.setStatus(Constants.STATUS_NORMAL);
57 58
         taPetIdentity.setCreateDate(now);
58 59
 
@@ -73,8 +74,19 @@ public class TaPetIdentityServiceImpl extends BaseServiceImpl<TaPetIdentityMappe
73 74
         LocalDateTime expire = now.plusDays(Long.parseLong(sysSetting.getContent()));
74 75
 
75 76
         taPetIdentity.setStartDate(DateUtils.toString(now, "yyyy-MM-dd"));
76
-        taPetIdentity.setStartDate(DateUtils.toString(expire, "yyyy-MM-dd"));
77
+        taPetIdentity.setExpireDate(DateUtils.toString(expire, "yyyy-MM-dd"));
77 78
 
78 79
         return updateById(taPetIdentity);
79 80
     }
81
+
82
+    @Override
83
+    public TaPetIdentity getByPet(String petId, String personId) {
84
+        QueryWrapper<TaPetIdentity> queryWrapper = new QueryWrapper<>();
85
+        queryWrapper.eq("pet_id", petId);
86
+        queryWrapper.eq("person_id", personId);
87
+        queryWrapper.in("status", new Integer[] { Constants.CARD_STATUS_NORMAL, Constants.CARD_STATUS_EXPIRE });
88
+        queryWrapper.last("limit 1");
89
+
90
+        return getOne(queryWrapper);
91
+    }
80 92
 }

+ 4
- 0
src/main/java/com/njyunzhi/pet_identity/service/impl/TaSequenceServiceImpl.java Näytä tiedosto

@@ -17,4 +17,8 @@ import org.springframework.stereotype.Service;
17 17
 @Service
18 18
 public class TaSequenceServiceImpl extends ServiceImpl<TaSequenceMapper, TaSequence> implements ITaSequenceService {
19 19
 
20
+    @Override
21
+    public Integer getNextVal(String seqName) {
22
+        return baseMapper.getNextVal(seqName);
23
+    }
20 24
 }

+ 1
- 1
src/main/resources/application.yml Näytä tiedosto

@@ -41,7 +41,7 @@ sms:
41 41
 ###
42 42
 yz:
43 43
   default:
44
-    servBase: https://xxx
44
+    servBase: https://pet-certificate-online.njyunzhi.com/api
45 45
   sms:
46 46
     ## ??????
47 47
     appid: ubpa

+ 9
- 0
src/main/resources/mapper/TaOrderMapper.xml Näytä tiedosto

@@ -2,4 +2,13 @@
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.TaOrderMapper">
4 4
 
5
+    <select id="getByApplyId" resultType="com.njyunzhi.pet_identity.entity.TaOrder">
6
+        SELECT
7
+            *
8
+        FROM
9
+            ta_order t
10
+        WHERE
11
+            t.apply_id = #{applyId}
12
+          AND t.`status` = 2
13
+    </select>
5 14
 </mapper>