张延森 3 年前
父节点
当前提交
6cf834e74d
共有 48 个文件被更改,包括 1635 次插入145 次删除
  1. 8
    0
      pom.xml
  2. 16
    0
      src/main/java/com/njyunzhi/pet_identity/common/Constants.java
  3. 68
    0
      src/main/java/com/njyunzhi/pet_identity/common/WxPayUtils.java
  4. 33
    1
      src/main/java/com/njyunzhi/pet_identity/common/WxUtils.java
  5. 51
    39
      src/main/java/com/njyunzhi/pet_identity/controller/SysSettingController.java
  6. 79
    8
      src/main/java/com/njyunzhi/pet_identity/controller/TaApplicationController.java
  7. 121
    0
      src/main/java/com/njyunzhi/pet_identity/controller/TaLossReportController.java
  8. 144
    62
      src/main/java/com/njyunzhi/pet_identity/controller/TaOrderController.java
  9. 133
    0
      src/main/java/com/njyunzhi/pet_identity/controller/TaPetController.java
  10. 129
    0
      src/main/java/com/njyunzhi/pet_identity/controller/TaPetIdentityController.java
  11. 119
    0
      src/main/java/com/njyunzhi/pet_identity/controller/TaSequenceController.java
  12. 9
    2
      src/main/java/com/njyunzhi/pet_identity/controller/WxMaController.java
  13. 28
    24
      src/main/java/com/njyunzhi/pet_identity/controller/WxPayController.java
  14. 4
    0
      src/main/java/com/njyunzhi/pet_identity/entity/SysSetting.java
  15. 20
    2
      src/main/java/com/njyunzhi/pet_identity/entity/TaApplication.java
  16. 46
    0
      src/main/java/com/njyunzhi/pet_identity/entity/TaLossReport.java
  17. 6
    1
      src/main/java/com/njyunzhi/pet_identity/entity/TaOrder.java
  18. 1
    1
      src/main/java/com/njyunzhi/pet_identity/entity/TaPerson.java
  19. 61
    0
      src/main/java/com/njyunzhi/pet_identity/entity/TaPet.java
  20. 82
    0
      src/main/java/com/njyunzhi/pet_identity/entity/TaPetIdentity.java
  21. 36
    0
      src/main/java/com/njyunzhi/pet_identity/entity/TaSequence.java
  22. 18
    0
      src/main/java/com/njyunzhi/pet_identity/mapper/TaLossReportMapper.java
  23. 3
    0
      src/main/java/com/njyunzhi/pet_identity/mapper/TaOrderMapper.java
  24. 18
    0
      src/main/java/com/njyunzhi/pet_identity/mapper/TaPetIdentityMapper.java
  25. 18
    0
      src/main/java/com/njyunzhi/pet_identity/mapper/TaPetMapper.java
  26. 18
    0
      src/main/java/com/njyunzhi/pet_identity/mapper/TaSequenceMapper.java
  27. 3
    0
      src/main/java/com/njyunzhi/pet_identity/service/IBaseService.java
  28. 16
    0
      src/main/java/com/njyunzhi/pet_identity/service/ITaLossReportService.java
  29. 5
    1
      src/main/java/com/njyunzhi/pet_identity/service/ITaOrderService.java
  30. 20
    0
      src/main/java/com/njyunzhi/pet_identity/service/ITaPetIdentityService.java
  31. 16
    0
      src/main/java/com/njyunzhi/pet_identity/service/ITaPetService.java
  32. 16
    0
      src/main/java/com/njyunzhi/pet_identity/service/ITaSequenceService.java
  33. 11
    0
      src/main/java/com/njyunzhi/pet_identity/service/impl/BaseServiceImpl.java
  34. 20
    0
      src/main/java/com/njyunzhi/pet_identity/service/impl/TaLossReportServiceImpl.java
  35. 45
    2
      src/main/java/com/njyunzhi/pet_identity/service/impl/TaOrderServiceImpl.java
  36. 80
    0
      src/main/java/com/njyunzhi/pet_identity/service/impl/TaPetIdentityServiceImpl.java
  37. 20
    0
      src/main/java/com/njyunzhi/pet_identity/service/impl/TaPetServiceImpl.java
  38. 20
    0
      src/main/java/com/njyunzhi/pet_identity/service/impl/TaSequenceServiceImpl.java
  39. 14
    0
      src/main/java/com/njyunzhi/pet_identity/vo/MaLogin.java
  40. 4
    0
      src/main/java/com/njyunzhi/pet_identity/vo/MakeCardParam.java
  41. 4
    2
      src/main/resources/application.yml
  42. 二进制
      src/main/resources/cert/apiclient_cert.p12
  43. 24
    0
      src/main/resources/cert/apiclient_cert.pem
  44. 28
    0
      src/main/resources/cert/apiclient_key.pem
  45. 5
    0
      src/main/resources/mapper/TaLossReportMapper.xml
  46. 5
    0
      src/main/resources/mapper/TaPetIdentityMapper.xml
  47. 5
    0
      src/main/resources/mapper/TaPetMapper.xml
  48. 5
    0
      src/main/resources/mapper/TaSequenceMapper.xml

+ 8
- 0
pom.xml 查看文件

@@ -92,6 +92,14 @@
92 92
 		</dependency>
93 93
 		<!--weixin-miniapp start-->
94 94
 
95
+		<!--weixin-pay start-->
96
+		<dependency>
97
+			<groupId>com.github.binarywang</groupId>
98
+			<artifactId>weixin-java-pay</artifactId>
99
+			<version>4.2.0</version>
100
+		</dependency>
101
+		<!--weixin-pay start-->
102
+
95 103
 		<!--swagger start-->
96 104
 		<dependency>
97 105
 			<groupId>io.springfox</groupId>

+ 16
- 0
src/main/java/com/njyunzhi/pet_identity/common/Constants.java 查看文件

@@ -15,6 +15,11 @@ public class Constants {
15 15
     public final static String USER_AUDITOR = "auditor";
16 16
     public final static String USER_MAKER = "maker";
17 17
 
18
+    // 用户角色
19
+    public final static String APPLY_TYPE_FIRST = "first";  // 申请
20
+    public final static String APPLY_TYPE_REISSUE = "reissue"; // 补办
21
+    public final static String APPLY_TYPE_RENEWAL = "renewal"; // 续期
22
+
18 23
     // 申领方式
19 24
     public final static int APPLY_METHOD_AUTO = 1;  // 自主领取
20 25
     public final static int APPLY_METHOD_EXPRESS = 2;  // 快递
@@ -33,9 +38,20 @@ public class Constants {
33 38
     public final static int MAKE_STATUS_READY = 0;  // 待发放
34 39
     public final static int MAKE_STATUS_MADE = 1;  // 已发放
35 40
 
41
+    // 证件状态
42
+    public final static int CARD_STATUS_NORMAL = 1;  // 正常
43
+    public final static int CARD_STATUS_LOSS = 2;  // 挂失
44
+    public final static int CARD_STATUS_EXPIRE = 3;  // 过期
45
+    public final static int CARD_STATUS_CANCEL = 4;  // 作废
46
+
36 47
     // 流程状态
37 48
     public final static int WORKFLOW_STATUS_READY = 0;  // 提交申请(未支付)
38 49
     public final static int WORKFLOW_STATUS_PROCESSING = 1;  // 审批中
39 50
     public final static int WORKFLOW_STATUS_AUDIT = 2;  // 已审批
40 51
     public final static int WORKFLOW_STATUS_MADE = 3;  // 已发证
52
+
53
+    // 系统参数
54
+    public final static String SYSSETTING_EXPRESS_FEE = "express_fee";  // 快递费
55
+    public final static String SYSSETTING_PRODUCTION_COST = "production_cost";  // 工本费
56
+    public final static String SYSSETTING_CARD_EXPIRE = "card_expire";  // 证件有效期
41 57
 }

+ 68
- 0
src/main/java/com/njyunzhi/pet_identity/common/WxPayUtils.java 查看文件

@@ -0,0 +1,68 @@
1
+package com.njyunzhi.pet_identity.common;
2
+
3
+import com.github.binarywang.wxpay.bean.request.WxPayRefundV3Request;
4
+import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request;
5
+import com.github.binarywang.wxpay.bean.result.WxPayRefundV3Result;
6
+import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderV3Result;
7
+import com.github.binarywang.wxpay.bean.result.enums.TradeTypeEnum;
8
+import com.github.binarywang.wxpay.exception.WxPayException;
9
+import com.github.binarywang.wxpay.service.WxPayService;
10
+import com.njyunzhi.pet_identity.config.WeixinConfig;
11
+import org.springframework.beans.factory.annotation.Autowired;
12
+import org.springframework.beans.factory.annotation.Value;
13
+import org.springframework.stereotype.Component;
14
+
15
+import java.time.LocalDateTime;
16
+import java.time.ZoneOffset;
17
+
18
+@Component
19
+public class WxPayUtils {
20
+    @Autowired
21
+    WeixinConfig config;
22
+
23
+    @Autowired
24
+    WxUtils wxUtils;
25
+
26
+    @Value("${yz.default.servBase}")
27
+    String servBase;
28
+
29
+    /**
30
+     * 下单
31
+     * @param request
32
+     * @return
33
+     * @throws Exception
34
+     */
35
+    public WxPayUnifiedOrderV3Result.JsapiResult createOrder(WxPayUnifiedOrderV3Request request) throws WxPayException {
36
+        // 北京时间
37
+        LocalDateTime now = LocalDateTime.now(ZoneOffset.ofHours(8));
38
+        WxPayService payService = wxUtils.getPayService();
39
+
40
+        request.setNotifyUrl(servBase + "/wxpay/notify/order");
41
+
42
+        WxPayUnifiedOrderV3Result wxPayUnifiedOrderV3Result = payService.unifiedOrderV3(TradeTypeEnum.JSAPI, request);
43
+        return wxPayUnifiedOrderV3Result.getPayInfo(TradeTypeEnum.JSAPI, request.getAppid(), request.getMchid(), payService.getConfig().getPrivateKey());
44
+    }
45
+
46
+    /**
47
+     * 订单退款
48
+     * @param request
49
+     * @return
50
+     * @throws Exception
51
+     */
52
+    public WxPayRefundV3Result refund(WxPayRefundV3Request request) throws Exception {
53
+        WxPayService payService = wxUtils.getPayService();
54
+
55
+        request.setNotifyUrl(servBase + "/wxpay/notify/refund");
56
+        WxPayRefundV3Result result = payService.refundV3(request);
57
+
58
+        if ("ABNORMAL".equals(result.getStatus())) {
59
+            throw new Exception("退款异常");
60
+        }
61
+        if ("CLOSED".equals(result.getStatus())) {
62
+            throw new Exception("退款关闭");
63
+        }
64
+
65
+        return result;
66
+    }
67
+
68
+}

+ 33
- 1
src/main/java/com/njyunzhi/pet_identity/common/WxUtils.java 查看文件

@@ -3,6 +3,10 @@ package com.njyunzhi.pet_identity.common;
3 3
 import cn.binarywang.wx.miniapp.api.WxMaService;
4 4
 import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
5 5
 import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
6
+import com.github.binarywang.wxpay.config.WxPayConfig;
7
+import com.github.binarywang.wxpay.constant.WxPayConstants;
8
+import com.github.binarywang.wxpay.service.WxPayService;
9
+import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
6 10
 import com.njyunzhi.pet_identity.config.WeixinConfig;
7 11
 import org.springframework.beans.factory.annotation.Autowired;
8 12
 import org.springframework.stereotype.Component;
@@ -13,14 +17,17 @@ public class WxUtils {
13 17
     private final WeixinConfig config;
14 18
     //
15 19
     private static WxMaService maService;
20
+    // 微信支付
21
+    private static WxPayService payService;
16 22
 
17 23
     @Autowired
18 24
     public WxUtils(WeixinConfig config) {
19 25
         this.config = config;
20 26
         this.maService = initMaService(config);
27
+        this.payService = initPayService(config);
21 28
     }
22 29
 
23
-    public WxMaService getMaService() throws Exception {
30
+    public WxMaService getMaService() {
24 31
         return maService;
25 32
     }
26 33
 
@@ -37,4 +44,29 @@ public class WxUtils {
37 44
         service.setWxMaConfig(conf);
38 45
         return service;
39 46
     }
47
+
48
+    public WxPayService getPayService() {
49
+        return payService;
50
+    }
51
+
52
+    private WxPayService initPayService(WeixinConfig config) {
53
+        WxPayConfig payConfig = new WxPayConfig();
54
+        payConfig.setAppId(config.getPay().getAppId());
55
+        payConfig.setMchId(config.getPay().getMchId());
56
+        payConfig.setMchKey(config.getPay().getMchKey());
57
+        payConfig.setSubAppId(config.getPay().getSubAppId());
58
+        payConfig.setSubMchId(config.getPay().getSubMchId());
59
+        payConfig.setKeyPath(config.getPay().getKeyPath());
60
+        payConfig.setApiV3Key(config.getPay().getApiV3Key());
61
+        payConfig.setPrivateKeyPath(config.getPay().getPrivateKeyPath());
62
+        payConfig.setPrivateCertPath(config.getPay().getPrivateCertPath());
63
+        // 固定小程序支付
64
+        payConfig.setTradeType(WxPayConstants.TradeType.JSAPI);
65
+        // 可以指定是否使用沙箱环境
66
+        payConfig.setUseSandboxEnv(false);
67
+
68
+        WxPayService service = new WxPayServiceImpl();
69
+        service.setConfig(payConfig);
70
+        return service;
71
+    }
40 72
 }

+ 51
- 39
src/main/java/com/njyunzhi/pet_identity/controller/SysSettingController.java 查看文件

@@ -4,6 +4,7 @@ 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 6
 import com.njyunzhi.pet_identity.common.BaseController;
7
+import com.njyunzhi.pet_identity.common.Constants;
7 8
 import com.njyunzhi.pet_identity.common.ResponseBean;
8 9
 import io.swagger.annotations.Api;
9 10
 import io.swagger.annotations.ApiOperation;
@@ -46,48 +47,49 @@ public class SysSettingController extends BaseController {
46 47
      * @param pageSize
47 48
      * @return
48 49
      */
49
-    @RequestMapping(value="/sysSetting",method= RequestMethod.GET)
50
+    @RequestMapping(value="/admin/setting",method= RequestMethod.GET)
50 51
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51 52
     public ResponseBean sysSettingList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52 53
 									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
53 54
 
54
-		    IPage<SysSetting> pg = new Page<>(pageNum, pageSize);
55
-            QueryWrapper<SysSetting> queryWrapper = new QueryWrapper<>();
56
-            queryWrapper.orderByDesc("create_date");
55
+        IPage<SysSetting> pg = new Page<>(pageNum, pageSize);
56
+        QueryWrapper<SysSetting> queryWrapper = new QueryWrapper<>();
57
+        queryWrapper.eq("status", Constants.STATUS_NORMAL);
58
+        queryWrapper.orderByDesc("create_date");
57 59
 
58
-            IPage<SysSetting> result = iSysSettingService.page(pg, queryWrapper);
59
-            return ResponseBean.success(result);
60
+        IPage<SysSetting> result = iSysSettingService.page(pg, queryWrapper);
61
+        return ResponseBean.success(result);
60 62
     }
61 63
 
62
-    /**
63
-     * 保存对象
64
-     * @param sysSetting 实体对象
65
-     * @return
66
-     */
67
-    @RequestMapping(value="/sysSetting",method= RequestMethod.POST)
68
-    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69
-    public ResponseBean sysSettingAdd(@ApiParam("保存内容") @RequestBody SysSetting sysSetting) throws Exception{
70
-
71
-        if (iSysSettingService.save(sysSetting)){
72
-            return ResponseBean.success(sysSetting);
73
-        }else {
74
-            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
75
-        }
76
-    }
77
-
78
-    /**
79
-     * 根据id删除对象
80
-     * @param id  实体ID
81
-     */
82
-    @RequestMapping(value="/sysSetting/{id}", method= RequestMethod.DELETE)
83
-    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
-    public ResponseBean sysSettingDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
85
-        if(iSysSettingService.removeById(id)){
86
-            return ResponseBean.success("success");
87
-        }else {
88
-            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
89
-        }
90
-    }
64
+//    /**
65
+//     * 保存对象
66
+//     * @param sysSetting 实体对象
67
+//     * @return
68
+//     */
69
+//    @RequestMapping(value="/sysSetting",method= RequestMethod.POST)
70
+//    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
71
+//    public ResponseBean sysSettingAdd(@ApiParam("保存内容") @RequestBody SysSetting sysSetting) throws Exception{
72
+//
73
+//        if (iSysSettingService.save(sysSetting)){
74
+//            return ResponseBean.success(sysSetting);
75
+//        }else {
76
+//            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
77
+//        }
78
+//    }
79
+//
80
+//    /**
81
+//     * 根据id删除对象
82
+//     * @param id  实体ID
83
+//     */
84
+//    @RequestMapping(value="/sysSetting/{id}", method= RequestMethod.DELETE)
85
+//    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
86
+//    public ResponseBean sysSettingDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
87
+//        if(iSysSettingService.removeById(id)){
88
+//            return ResponseBean.success("success");
89
+//        }else {
90
+//            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
91
+//        }
92
+//    }
91 93
 
92 94
     /**
93 95
      * 修改对象
@@ -95,9 +97,9 @@ public class SysSettingController extends BaseController {
95 97
      * @param sysSetting 实体对象
96 98
      * @return
97 99
      */
98
-    @RequestMapping(value="/sysSetting/{id}",method= RequestMethod.PUT)
100
+    @RequestMapping(value="/admin/setting/{id}",method= RequestMethod.PUT)
99 101
     @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100
-    public ResponseBean sysSettingUpdate(@ApiParam("对象ID") @PathVariable Integer id,
102
+    public ResponseBean sysSettingUpdate(@ApiParam("对象ID") @PathVariable String id,
101 103
                                         @ApiParam("更新内容") @RequestBody SysSetting sysSetting) throws Exception{
102 104
 
103 105
         if (iSysSettingService.updateById(sysSetting)){
@@ -111,9 +113,19 @@ public class SysSettingController extends BaseController {
111 113
      * 根据id查询对象
112 114
      * @param id  实体ID
113 115
      */
114
-    @RequestMapping(value="/sysSetting/{id}",method= RequestMethod.GET)
116
+    @RequestMapping(value="/admin/setting/{id}",method= RequestMethod.GET)
117
+    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
118
+    public ResponseBean sysSettingGet(@ApiParam("对象ID") @PathVariable String id) throws Exception{
119
+        return ResponseBean.success(iSysSettingService.getById(id));
120
+    }
121
+
122
+    /**
123
+     * 根据id查询对象
124
+     * @param id  实体ID
125
+     */
126
+    @RequestMapping(value="/wx/{clientId}/setting/{id}",method= RequestMethod.GET)
115 127
     @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
-    public ResponseBean sysSettingGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
128
+    public ResponseBean wxGet(@ApiParam("对象ID") @PathVariable String id) throws Exception{
117 129
         return ResponseBean.success(iSysSettingService.getById(id));
118 130
     }
119 131
 }

+ 79
- 8
src/main/java/com/njyunzhi/pet_identity/controller/TaApplicationController.java 查看文件

@@ -9,6 +9,8 @@ import com.njyunzhi.pet_identity.common.ResponseBean;
9 9
 import com.njyunzhi.pet_identity.common.StringUtils;
10 10
 import com.njyunzhi.pet_identity.entity.SysUser;
11 11
 import com.njyunzhi.pet_identity.entity.TaPerson;
12
+import com.njyunzhi.pet_identity.entity.TaPetIdentity;
13
+import com.njyunzhi.pet_identity.service.ITaPetIdentityService;
12 14
 import com.njyunzhi.pet_identity.vo.AuditParam;
13 15
 import com.njyunzhi.pet_identity.vo.MakeCardParam;
14 16
 import io.swagger.annotations.Api;
@@ -47,6 +49,8 @@ public class TaApplicationController extends BaseController {
47 49
     @Autowired
48 50
     public ITaApplicationService iTaApplicationService;
49 51
 
52
+    @Autowired
53
+    public ITaPetIdentityService iTaPetIdentityService;
50 54
 
51 55
     /**
52 56
      * 分页查询列表
@@ -171,7 +175,7 @@ public class TaApplicationController extends BaseController {
171 175
     /**
172 176
      * 修改对象
173 177
      * @param id  实体ID
174
-     * @param taApplication 实体对象
178
+     * @param auditParam 实体对象
175 179
      * @return
176 180
      */
177 181
     @RequestMapping(value="/admin/application/{id}/audit",method= RequestMethod.PUT)
@@ -189,9 +193,54 @@ public class TaApplicationController extends BaseController {
189 193
             return ResponseBean.error("未找到数据");
190 194
         }
191 195
 
192
-        if (taApplication.getStatus() < Constants.WORKFLOW_STATUS_PROCESSING) {
193
-            return ResponseBean.error("用户未支付");
196
+        if (Constants.APPLY_TYPE_FIRST.equals(taApplication.getApplyType())) {
197
+            // 办证申请
198
+            if (taApplication.getStatus() < Constants.WORKFLOW_STATUS_PROCESSING) {
199
+                return ResponseBean.error("用户未支付");
200
+            }
201
+        } else if (Constants.APPLY_TYPE_RENEWAL.equals(taApplication.getApplyType())) {
202
+            // 续期 - 续期不需要费用
203
+            if (StringUtils.isEmpty(taApplication.getOriginCardNo())) {
204
+                return ResponseBean.error("未找到原始证件信息");
205
+            }
206
+
207
+            TaPetIdentity taPetIdentity = iTaPetIdentityService.getExistBy("card_no", taApplication.getOriginCardNo(), false, true);
208
+            if (null == taPetIdentity) {
209
+                return ResponseBean.error("未找到原始证件信息");
210
+            }
211
+
212
+            // 审核同意之后, 直接续期原证件
213
+            if (Constants.AUDIT_STATUS_PASSED == auditParam.getVerifyStatus()) {
214
+                if (!iTaPetIdentityService.extendDate(taPetIdentity)) {
215
+                    return ResponseBean.error("续期证件失败, 请重试");
216
+                }
217
+            }
218
+        } else if (Constants.APPLY_TYPE_REISSUE.equals(taApplication.getApplyType())) {
219
+            // 补办
220
+            if (taApplication.getStatus() < Constants.WORKFLOW_STATUS_PROCESSING) {
221
+                return ResponseBean.error("用户未支付");
222
+            }
223
+
224
+            if (StringUtils.isEmpty(taApplication.getOriginCardNo())) {
225
+                return ResponseBean.error("未找到原始证件信息");
226
+            }
227
+
228
+            TaPetIdentity taPetIdentity = iTaPetIdentityService.getExistBy("card_no", taApplication.getOriginCardNo(), false, true);
229
+            if (null == taPetIdentity) {
230
+                return ResponseBean.error("未找到原始证件信息");
231
+            }
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
+        } else {
241
+            return ResponseBean.error("申办业务类型不支持");
194 242
         }
243
+
195 244
         if (taApplication.getStatus() >= Constants.WORKFLOW_STATUS_AUDIT) {
196 245
             return ResponseBean.error("当前记录已审批");
197 246
         }
@@ -206,16 +255,16 @@ public class TaApplicationController extends BaseController {
206 255
         taApplication.setVerifyUserName(sysUser.getUserName());
207 256
 
208 257
         if (iTaApplicationService.updateById(taApplication)){
209
-            return ResponseBean.success(iTaApplicationService.getById(id));
258
+            return ResponseBean.success(taApplication);
210 259
         }else {
211 260
             return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
212 261
         }
213 262
     }
214 263
 
215 264
     /**
216
-     * 修改对象
265
+     * 发证
217 266
      * @param id  实体ID
218
-     * @param taApplication 实体对象
267
+     * @param makeCardParam 实体对象
219 268
      * @return
220 269
      */
221 270
     @RequestMapping(value="/admin/application/{id}/make",method= RequestMethod.PUT)
@@ -232,16 +281,36 @@ public class TaApplicationController extends BaseController {
232 281
             return ResponseBean.error("未找到数据");
233 282
         }
234 283
 
235
-        if (taApplication.getStatus() != Constants.WORKFLOW_STATUS_AUDIT && taApplication.getVerifyStatus() == Constants.AUDIT_STATUS_PASSED) {
284
+        if (!taApplication.getApplyType().equals(Constants.APPLY_TYPE_RENEWAL)
285
+                && taApplication.getPayStatus() != Constants.PAY_STATUS_PAID) {
286
+            return ResponseBean.error("当前申请工本费未支付");
287
+        }
288
+
289
+        if (taApplication.getStatus() != Constants.WORKFLOW_STATUS_AUDIT
290
+                && taApplication.getVerifyStatus() == Constants.AUDIT_STATUS_PASSED) {
236 291
             return ResponseBean.error("申请未通过或状态不对");
237 292
         }
238 293
 
294
+        if (!Constants.APPLY_TYPE_FIRST.equals(taApplication.getApplyType())
295
+                && !Constants.APPLY_TYPE_REISSUE.equals(taApplication.getApplyType())) {
296
+            return ResponseBean.error("非制证申请");
297
+        }
298
+
239 299
         if (taApplication.getApplyMethod() == Constants.APPLY_METHOD_EXPRESS) {
240 300
             if (StringUtils.isEmpty(taApplication.getTrackingType()) || StringUtils.isEmpty(taApplication.getTrackingNo())) {
241 301
                 return ResponseBean.error("请填写快递信息");
242 302
             }
243 303
         }
244 304
 
305
+        if (StringUtils.isEmpty(makeCardParam.getCardNo())) {
306
+            return ResponseBean.error("证件卡号不能为空");
307
+        } else {
308
+            TaPetIdentity taPetIdentity = iTaPetIdentityService.getExistBy("card_no", makeCardParam.getCardNo(), false, true);
309
+            if (taPetIdentity != null) {
310
+                return ResponseBean.error("证件卡号已存在");
311
+            }
312
+        }
313
+
245 314
         taApplication.setMakeStatus(Constants.MAKE_STATUS_MADE);
246 315
         taApplication.setMakeDate(LocalDateTime.now());
247 316
         taApplication.setMakeUser(sysUser.getUserId());
@@ -250,7 +319,9 @@ public class TaApplicationController extends BaseController {
250 319
         taApplication.setTrackingNo(makeCardParam.getTrackingNo());
251 320
 
252 321
         if (iTaApplicationService.updateById(taApplication)){
253
-            return ResponseBean.success(iTaApplicationService.getById(id));
322
+            TaPetIdentity newCard = iTaPetIdentityService.createNewCard(taApplication, makeCardParam);
323
+
324
+            return ResponseBean.success(newCard);
254 325
         } else {
255 326
             return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
256 327
         }

+ 121
- 0
src/main/java/com/njyunzhi/pet_identity/controller/TaLossReportController.java 查看文件

@@ -0,0 +1,121 @@
1
+package com.njyunzhi.pet_identity.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
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;
9
+import io.swagger.annotations.Api;
10
+import io.swagger.annotations.ApiOperation;
11
+import io.swagger.annotations.ApiParam;
12
+import org.slf4j.Logger;
13
+import org.slf4j.LoggerFactory;
14
+import org.springframework.beans.factory.annotation.Autowired;
15
+import org.springframework.web.bind.annotation.PathVariable;
16
+import org.springframework.web.bind.annotation.RequestBody;
17
+import org.springframework.web.bind.annotation.RequestMapping;
18
+import org.springframework.web.bind.annotation.RequestMethod;
19
+import org.springframework.web.bind.annotation.RequestParam;
20
+import com.njyunzhi.pet_identity.service.ITaLossReportService;
21
+import com.njyunzhi.pet_identity.entity.TaLossReport;
22
+import org.springframework.web.bind.annotation.RestController;
23
+
24
+/**
25
+ * <p>
26
+    * 挂失证件 前端控制器
27
+    * </p>
28
+ *
29
+ * @author yansen
30
+ * @since 2022-05-25
31
+ */
32
+
33
+@Api(tags = "挂失证件")
34
+@RestController
35
+@RequestMapping("/")
36
+public class TaLossReportController extends BaseController {
37
+
38
+    private final Logger logger = LoggerFactory.getLogger(TaLossReportController.class);
39
+
40
+    @Autowired
41
+    public ITaLossReportService iTaLossReportService;
42
+
43
+
44
+    /**
45
+     * 分页查询列表
46
+     * @param pageNum
47
+     * @param pageSize
48
+     * @return
49
+     */
50
+    @RequestMapping(value="/admin/loss-report",method= RequestMethod.GET)
51
+    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
52
+    public ResponseBean taLossReportList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
53
+									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
54
+
55
+        IPage<TaLossReport> pg = new Page<>(pageNum, pageSize);
56
+        QueryWrapper<TaLossReport> queryWrapper = new QueryWrapper<>();
57
+        queryWrapper.gt("status", Constants.STATUS_DELETE);
58
+        queryWrapper.orderByDesc("create_date");
59
+
60
+        IPage<TaLossReport> result = iTaLossReportService.page(pg, queryWrapper);
61
+        return ResponseBean.success(result);
62
+    }
63
+
64
+//    /**
65
+//     * 保存对象
66
+//     * @param taLossReport 实体对象
67
+//     * @return
68
+//     */
69
+//    @RequestMapping(value="/taLossReport",method= RequestMethod.POST)
70
+//    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
71
+//    public ResponseBean taLossReportAdd(@ApiParam("保存内容") @RequestBody TaLossReport taLossReport) throws Exception{
72
+//
73
+//        if (iTaLossReportService.save(taLossReport)){
74
+//            return ResponseBean.success(taLossReport);
75
+//        }else {
76
+//            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
77
+//        }
78
+//    }
79
+//
80
+//    /**
81
+//     * 根据id删除对象
82
+//     * @param id  实体ID
83
+//     */
84
+//    @RequestMapping(value="/taLossReport/{id}", method= RequestMethod.DELETE)
85
+//    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
86
+//    public ResponseBean taLossReportDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
87
+//        if(iTaLossReportService.removeById(id)){
88
+//            return ResponseBean.success("success");
89
+//        }else {
90
+//            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
91
+//        }
92
+//    }
93
+//
94
+//    /**
95
+//     * 修改对象
96
+//     * @param id  实体ID
97
+//     * @param taLossReport 实体对象
98
+//     * @return
99
+//     */
100
+//    @RequestMapping(value="/taLossReport/{id}",method= RequestMethod.PUT)
101
+//    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
102
+//    public ResponseBean taLossReportUpdate(@ApiParam("对象ID") @PathVariable Integer id,
103
+//                                        @ApiParam("更新内容") @RequestBody TaLossReport taLossReport) throws Exception{
104
+//
105
+//        if (iTaLossReportService.updateById(taLossReport)){
106
+//            return ResponseBean.success(iTaLossReportService.getById(id));
107
+//        }else {
108
+//            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
109
+//        }
110
+//    }
111
+//
112
+//    /**
113
+//     * 根据id查询对象
114
+//     * @param id  实体ID
115
+//     */
116
+//    @RequestMapping(value="/taLossReport/{id}",method= RequestMethod.GET)
117
+//    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
118
+//    public ResponseBean taLossReportGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
119
+//        return ResponseBean.success(iTaLossReportService.getById(id));
120
+//    }
121
+}

+ 144
- 62
src/main/java/com/njyunzhi/pet_identity/controller/TaOrderController.java 查看文件

@@ -3,8 +3,17 @@ 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.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request;
7
+import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderV3Result;
6 8
 import com.njyunzhi.pet_identity.common.BaseController;
9
+import com.njyunzhi.pet_identity.common.Constants;
7 10
 import com.njyunzhi.pet_identity.common.ResponseBean;
11
+import com.njyunzhi.pet_identity.common.WxPayUtils;
12
+import com.njyunzhi.pet_identity.entity.SysSetting;
13
+import com.njyunzhi.pet_identity.entity.TaApplication;
14
+import com.njyunzhi.pet_identity.entity.TaPerson;
15
+import com.njyunzhi.pet_identity.service.ISysSettingService;
16
+import com.njyunzhi.pet_identity.service.ITaApplicationService;
8 17
 import io.swagger.annotations.Api;
9 18
 import io.swagger.annotations.ApiOperation;
10 19
 import io.swagger.annotations.ApiParam;
@@ -20,6 +29,10 @@ import com.njyunzhi.pet_identity.service.ITaOrderService;
20 29
 import com.njyunzhi.pet_identity.entity.TaOrder;
21 30
 import org.springframework.web.bind.annotation.RestController;
22 31
 
32
+import java.time.LocalDateTime;
33
+import java.util.HashMap;
34
+import java.util.Map;
35
+
23 36
 /**
24 37
  * <p>
25 38
     * 订单表 前端控制器
@@ -39,81 +52,150 @@ public class TaOrderController extends BaseController {
39 52
     @Autowired
40 53
     public ITaOrderService iTaOrderService;
41 54
 
55
+    @Autowired
56
+    public ITaApplicationService iTaApplicationService;
42 57
 
43
-    /**
44
-     * 分页查询列表
45
-     * @param pageNum
46
-     * @param pageSize
47
-     * @return
48
-     */
49
-    @RequestMapping(value="/taOrder",method= RequestMethod.GET)
50
-    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
-    public ResponseBean taOrderList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
-									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
58
+    @Autowired
59
+    public ISysSettingService iSysSettingService;
53 60
 
54
-		    IPage<TaOrder> pg = new Page<>(pageNum, pageSize);
55
-            QueryWrapper<TaOrder> queryWrapper = new QueryWrapper<>();
56
-            queryWrapper.orderByDesc("create_date");
61
+    @Autowired
62
+    WxPayUtils wxPayUtils;
57 63
 
58
-            IPage<TaOrder> result = iTaOrderService.page(pg, queryWrapper);
59
-            return ResponseBean.success(result);
60
-    }
64
+
65
+//    /**
66
+//     * 分页查询列表
67
+//     * @param pageNum
68
+//     * @param pageSize
69
+//     * @return
70
+//     */
71
+//    @RequestMapping(value="/taOrder",method= RequestMethod.GET)
72
+//    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
73
+//    public ResponseBean taOrderList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
74
+//									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
75
+//
76
+//        IPage<TaOrder> pg = new Page<>(pageNum, pageSize);
77
+//        QueryWrapper<TaOrder> queryWrapper = new QueryWrapper<>();
78
+//        queryWrapper.orderByDesc("create_date");
79
+//
80
+//        IPage<TaOrder> result = iTaOrderService.page(pg, queryWrapper);
81
+//        return ResponseBean.success(result);
82
+//    }
61 83
 
62 84
     /**
63 85
      * 保存对象
64
-     * @param taOrder 实体对象
86
+     * @param applyId 实体对象
65 87
      * @return
66 88
      */
67
-    @RequestMapping(value="/taOrder",method= RequestMethod.POST)
68
-    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69
-    public ResponseBean taOrderAdd(@ApiParam("保存内容") @RequestBody TaOrder taOrder) throws Exception{
70
-
71
-        if (iTaOrderService.save(taOrder)){
72
-            return ResponseBean.success(taOrder);
73
-        }else {
74
-            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
89
+    @RequestMapping(value="/wx/{clientId}/order",method= RequestMethod.POST)
90
+    @ApiOperation(value="生成订单", notes = "生成订单", httpMethod = "POST", response = ResponseBean.class)
91
+    public ResponseBean taOrderAdd(@ApiParam("申请单ID") @RequestParam String applyId) throws Exception {
92
+        TaPerson taPerson = currentPerson();
93
+
94
+        TaApplication taApplication = iTaApplicationService.getExistBy("apply_id", applyId, false, true);
95
+        if (null == taApplication) {
96
+            return ResponseBean.error("未找到申请单");
75 97
         }
76
-    }
77 98
 
78
-    /**
79
-     * 根据id删除对象
80
-     * @param id  实体ID
81
-     */
82
-    @RequestMapping(value="/taOrder/{id}", method= RequestMethod.DELETE)
83
-    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
-    public ResponseBean taOrderDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
85
-        if(iTaOrderService.removeById(id)){
86
-            return ResponseBean.success("success");
87
-        }else {
88
-            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
99
+        if (!taPerson.getPersonId().equals(taApplication.getPersonId())) {
100
+            return ResponseBean.error("非本人订单, 不能支付");
89 101
         }
90
-    }
91 102
 
92
-    /**
93
-     * 修改对象
94
-     * @param id  实体ID
95
-     * @param taOrder 实体对象
96
-     * @return
97
-     */
98
-    @RequestMapping(value="/taOrder/{id}",method= RequestMethod.PUT)
99
-    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100
-    public ResponseBean taOrderUpdate(@ApiParam("对象ID") @PathVariable Integer id,
101
-                                        @ApiParam("更新内容") @RequestBody TaOrder taOrder) throws Exception{
102
-
103
-        if (iTaOrderService.updateById(taOrder)){
104
-            return ResponseBean.success(iTaOrderService.getById(id));
105
-        }else {
106
-            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
103
+        if (Constants.PAY_STATUS_PAID == taApplication.getPayStatus()) {
104
+            return ResponseBean.error("当前申请已支付");
107 105
         }
108
-    }
109 106
 
110
-    /**
111
-     * 根据id查询对象
112
-     * @param id  实体ID
113
-     */
114
-    @RequestMapping(value="/taOrder/{id}",method= RequestMethod.GET)
115
-    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
-    public ResponseBean taOrderGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
117
-        return ResponseBean.success(iTaOrderService.getById(id));
107
+        // 快递费
108
+        SysSetting expressFeeSetting = iSysSettingService.getById(Constants.SYSSETTING_EXPRESS_FEE);
109
+        Integer expressFee = Float.valueOf(expressFeeSetting.getContent()).intValue();
110
+        // 工本费
111
+        SysSetting productionCostSetting = iSysSettingService.getById(Constants.SYSSETTING_PRODUCTION_COST);
112
+        Integer productionCost = Float.valueOf(productionCostSetting.getContent()).intValue();
113
+
114
+        TaOrder taOrder = new TaOrder();
115
+        String orderNo = iTaOrderService.createOrderNo();
116
+        taOrder.setOrderNo(orderNo);
117
+        taOrder.setApplyId(applyId);
118
+        taOrder.setProductionCost(productionCost);
119
+        // 如果没有选择快递提取, 则没有快递费用
120
+        taOrder.setExpressFee(taApplication.getApplyMethod() == 2 ? expressFee : 0);
121
+        taOrder.setCharges(taOrder.getExpressFee() + taOrder.getProductionCost());
122
+        taOrder.setStatus(Constants.PAY_STATUS_READY);
123
+        taOrder.setCreateDate(LocalDateTime.now());
124
+
125
+        boolean isSuccess = iTaOrderService.save(taOrder);
126
+        if (!isSuccess) {
127
+            return ResponseBean.error("生成订单失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
128
+        }
129
+
130
+        // 生成微信预支付信息
131
+        WxPayUnifiedOrderV3Request.Amount amount = new  WxPayUnifiedOrderV3Request.Amount();
132
+        amount.setTotal(taOrder.getCharges());
133
+
134
+        WxPayUnifiedOrderV3Request.Payer payer = new WxPayUnifiedOrderV3Request.Payer();
135
+        payer.setOpenid(taPerson.getOpenid());
136
+
137
+        WxPayUnifiedOrderV3Request req = new WxPayUnifiedOrderV3Request();
138
+        req.setDescription(taApplication.getApplyMethod() == 2 ? "工本费+快递费" : "工本费");
139
+        req.setOutTradeNo(orderNo);
140
+        req.setAmount(amount);
141
+        req.setPayer(payer);
142
+
143
+        try {
144
+            WxPayUnifiedOrderV3Result.JsapiResult result = wxPayUtils.createOrder(req);
145
+
146
+            // 订单信息变成支付中
147
+            taOrder.setStatus(Constants.PAY_STATUS_PAYING);
148
+            iTaOrderService.updateById(taOrder);
149
+
150
+            Map<String, Object> rtn = new HashMap<>();
151
+            rtn.put("order", taOrder);
152
+            rtn.put("prepay", result);
153
+
154
+            return ResponseBean.success(rtn);
155
+        } catch (Exception e) {
156
+            return ResponseBean.error("生成微信预支付信息失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
157
+        }
118 158
     }
159
+
160
+//    /**
161
+//     * 根据id删除对象
162
+//     * @param id  实体ID
163
+//     */
164
+//    @RequestMapping(value="/taOrder/{id}", method= RequestMethod.DELETE)
165
+//    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
166
+//    public ResponseBean taOrderDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
167
+//        if(iTaOrderService.removeById(id)){
168
+//            return ResponseBean.success("success");
169
+//        }else {
170
+//            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
171
+//        }
172
+//    }
173
+//
174
+//    /**
175
+//     * 修改对象
176
+//     * @param id  实体ID
177
+//     * @param taOrder 实体对象
178
+//     * @return
179
+//     */
180
+//    @RequestMapping(value="/taOrder/{id}",method= RequestMethod.PUT)
181
+//    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
182
+//    public ResponseBean taOrderUpdate(@ApiParam("对象ID") @PathVariable Integer id,
183
+//                                        @ApiParam("更新内容") @RequestBody TaOrder taOrder) throws Exception{
184
+//
185
+//        if (iTaOrderService.updateById(taOrder)){
186
+//            return ResponseBean.success(iTaOrderService.getById(id));
187
+//        }else {
188
+//            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
189
+//        }
190
+//    }
191
+//
192
+//    /**
193
+//     * 根据id查询对象
194
+//     * @param id  实体ID
195
+//     */
196
+//    @RequestMapping(value="/taOrder/{id}",method= RequestMethod.GET)
197
+//    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
198
+//    public ResponseBean taOrderGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
199
+//        return ResponseBean.success(iTaOrderService.getById(id));
200
+//    }
119 201
 }

+ 133
- 0
src/main/java/com/njyunzhi/pet_identity/controller/TaPetController.java 查看文件

@@ -0,0 +1,133 @@
1
+package com.njyunzhi.pet_identity.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
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;
9
+import com.njyunzhi.pet_identity.entity.TaPerson;
10
+import io.swagger.annotations.Api;
11
+import io.swagger.annotations.ApiOperation;
12
+import io.swagger.annotations.ApiParam;
13
+import org.slf4j.Logger;
14
+import org.slf4j.LoggerFactory;
15
+import org.springframework.beans.factory.annotation.Autowired;
16
+import org.springframework.web.bind.annotation.PathVariable;
17
+import org.springframework.web.bind.annotation.RequestBody;
18
+import org.springframework.web.bind.annotation.RequestMapping;
19
+import org.springframework.web.bind.annotation.RequestMethod;
20
+import org.springframework.web.bind.annotation.RequestParam;
21
+import com.njyunzhi.pet_identity.service.ITaPetService;
22
+import com.njyunzhi.pet_identity.entity.TaPet;
23
+import org.springframework.web.bind.annotation.RestController;
24
+
25
+import java.time.LocalDateTime;
26
+
27
+/**
28
+ * <p>
29
+    * 宠物表 前端控制器
30
+    * </p>
31
+ *
32
+ * @author yansen
33
+ * @since 2022-05-25
34
+ */
35
+
36
+@Api(tags = "宠物表")
37
+@RestController
38
+@RequestMapping("/wx/{clientId}")
39
+public class TaPetController extends BaseController {
40
+
41
+    private final Logger logger = LoggerFactory.getLogger(TaPetController.class);
42
+
43
+    @Autowired
44
+    public ITaPetService iTaPetService;
45
+
46
+
47
+    /**
48
+     * 分页查询列表
49
+     * @param pageNum
50
+     * @param pageSize
51
+     * @return
52
+     */
53
+    @RequestMapping(value="/pet",method= RequestMethod.GET)
54
+    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
55
+    public ResponseBean taPetList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
56
+									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception {
57
+        TaPerson taPerson = currentPerson();
58
+
59
+        IPage<TaPet> pg = new Page<>(pageNum, pageSize);
60
+        QueryWrapper<TaPet> queryWrapper = new QueryWrapper<>();
61
+        queryWrapper.eq("person_id", taPerson.getPersonId());
62
+        queryWrapper.gt("status", Constants.STATUS_DELETE);
63
+        queryWrapper.orderByDesc("create_date");
64
+
65
+        IPage<TaPet> result = iTaPetService.page(pg, queryWrapper);
66
+        return ResponseBean.success(result);
67
+    }
68
+
69
+    /**
70
+     * 保存对象
71
+     * @param taPet 实体对象
72
+     * @return
73
+     */
74
+    @RequestMapping(value="/pet",method= RequestMethod.POST)
75
+    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
76
+    public ResponseBean taPetAdd(@ApiParam("保存内容") @RequestBody TaPet taPet) throws Exception {
77
+        TaPerson taPerson = currentPerson();
78
+        taPet.setPersonId(taPerson.getPersonId());
79
+        taPet.setStatus(Constants.STATUS_NORMAL);
80
+        taPet.setCreateDate(LocalDateTime.now());
81
+
82
+        if (iTaPetService.save(taPet)){
83
+            return ResponseBean.success(taPet);
84
+        }else {
85
+            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
86
+        }
87
+    }
88
+
89
+//    /**
90
+//     * 根据id删除对象
91
+//     * @param id  实体ID
92
+//     */
93
+//    @RequestMapping(value="/pet/{id}", method= RequestMethod.DELETE)
94
+//    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
95
+//    public ResponseBean taPetDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
96
+//        if(iTaPetService.removeById(id)){
97
+//            return ResponseBean.success("success");
98
+//        }else {
99
+//            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
100
+//        }
101
+//    }
102
+
103
+    /**
104
+     * 修改对象
105
+     * @param id  实体ID
106
+     * @param taPet 实体对象
107
+     * @return
108
+     */
109
+    @RequestMapping(value="/pet/{id}",method= RequestMethod.PUT)
110
+    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
111
+    public ResponseBean taPetUpdate(@ApiParam("对象ID") @PathVariable String id,
112
+                                        @ApiParam("更新内容") @RequestBody TaPet taPet) throws Exception{
113
+        TaPerson taPerson = currentPerson();
114
+        taPet.setPetId(id);
115
+        taPet.setPersonId(taPerson.getPersonId());
116
+
117
+        if (iTaPetService.updateById(taPet)){
118
+            return ResponseBean.success(taPet);
119
+        }else {
120
+            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
121
+        }
122
+    }
123
+
124
+    /**
125
+     * 根据id查询对象
126
+     * @param id  实体ID
127
+     */
128
+    @RequestMapping(value="/pet/{id}",method= RequestMethod.GET)
129
+    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
130
+    public ResponseBean taPetGet(@ApiParam("对象ID") @PathVariable String id) throws Exception{
131
+        return ResponseBean.success(iTaPetService.getById(id));
132
+    }
133
+}

+ 129
- 0
src/main/java/com/njyunzhi/pet_identity/controller/TaPetIdentityController.java 查看文件

@@ -0,0 +1,129 @@
1
+package com.njyunzhi.pet_identity.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
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;
9
+import com.njyunzhi.pet_identity.entity.TaPerson;
10
+import io.swagger.annotations.Api;
11
+import io.swagger.annotations.ApiOperation;
12
+import io.swagger.annotations.ApiParam;
13
+import org.slf4j.Logger;
14
+import org.slf4j.LoggerFactory;
15
+import org.springframework.beans.factory.annotation.Autowired;
16
+import org.springframework.web.bind.annotation.PathVariable;
17
+import org.springframework.web.bind.annotation.RequestBody;
18
+import org.springframework.web.bind.annotation.RequestMapping;
19
+import org.springframework.web.bind.annotation.RequestMethod;
20
+import org.springframework.web.bind.annotation.RequestParam;
21
+import com.njyunzhi.pet_identity.service.ITaPetIdentityService;
22
+import com.njyunzhi.pet_identity.entity.TaPetIdentity;
23
+import org.springframework.web.bind.annotation.RestController;
24
+
25
+/**
26
+ * <p>
27
+    * 宠物证件 前端控制器
28
+    * </p>
29
+ *
30
+ * @author yansen
31
+ * @since 2022-05-25
32
+ */
33
+
34
+@Api(tags = "宠物证件")
35
+@RestController
36
+@RequestMapping("/")
37
+public class TaPetIdentityController extends BaseController {
38
+
39
+    private final Logger logger = LoggerFactory.getLogger(TaPetIdentityController.class);
40
+
41
+    @Autowired
42
+    public ITaPetIdentityService iTaPetIdentityService;
43
+
44
+
45
+    /**
46
+     * 分页查询列表
47
+     * @param pageNum
48
+     * @param pageSize
49
+     * @return
50
+     */
51
+    @RequestMapping(value="/wx/{clientId}/card",method= RequestMethod.GET)
52
+    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
53
+    public ResponseBean wxList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
54
+									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
55
+        TaPerson taPerson = currentPerson();
56
+
57
+        IPage<TaPetIdentity> pg = new Page<>(pageNum, pageSize);
58
+        QueryWrapper<TaPetIdentity> queryWrapper = new QueryWrapper<>();
59
+        queryWrapper.eq("person_id", taPerson.getPersonId());
60
+        queryWrapper.gt("status", Constants.STATUS_DELETE);
61
+        queryWrapper.orderByDesc("create_date");
62
+
63
+        IPage<TaPetIdentity> result = iTaPetIdentityService.page(pg, queryWrapper);
64
+        return ResponseBean.success(result);
65
+    }
66
+
67
+//    /**
68
+//     * 保存对象
69
+//     * @param taPetIdentity 实体对象
70
+//     * @return
71
+//     */
72
+//    @RequestMapping(value="/taPetIdentity",method= RequestMethod.POST)
73
+//    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
74
+//    public ResponseBean taPetIdentityAdd(@ApiParam("保存内容") @RequestBody TaPetIdentity taPetIdentity) throws Exception{
75
+//
76
+//        if (iTaPetIdentityService.save(taPetIdentity)){
77
+//            return ResponseBean.success(taPetIdentity);
78
+//        }else {
79
+//            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
80
+//        }
81
+//    }
82
+//
83
+//    /**
84
+//     * 根据id删除对象
85
+//     * @param id  实体ID
86
+//     */
87
+//    @RequestMapping(value="/taPetIdentity/{id}", method= RequestMethod.DELETE)
88
+//    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
89
+//    public ResponseBean taPetIdentityDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
90
+//        if(iTaPetIdentityService.removeById(id)){
91
+//            return ResponseBean.success("success");
92
+//        }else {
93
+//            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
94
+//        }
95
+//    }
96
+//
97
+//    /**
98
+//     * 修改对象
99
+//     * @param id  实体ID
100
+//     * @param taPetIdentity 实体对象
101
+//     * @return
102
+//     */
103
+//    @RequestMapping(value="/taPetIdentity/{id}",method= RequestMethod.PUT)
104
+//    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
105
+//    public ResponseBean taPetIdentityUpdate(@ApiParam("对象ID") @PathVariable Integer id,
106
+//                                        @ApiParam("更新内容") @RequestBody TaPetIdentity taPetIdentity) throws Exception{
107
+//
108
+//        if (iTaPetIdentityService.updateById(taPetIdentity)){
109
+//            return ResponseBean.success(iTaPetIdentityService.getById(id));
110
+//        }else {
111
+//            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
112
+//        }
113
+//    }
114
+
115
+    /**
116
+     * 根据id查询对象
117
+     * @param id  实体ID
118
+     */
119
+    @RequestMapping(value="/wx/{clientId}/card/{id}",method= RequestMethod.GET)
120
+    @ApiOperation(value="证件详情", notes = "证件详情", httpMethod = "GET", response = ResponseBean.class)
121
+    public ResponseBean taPetIdentityGet(@ApiParam("对象ID") @PathVariable String id) throws Exception{
122
+        TaPetIdentity taPetIdentity = iTaPetIdentityService.getExistBy("card_id", id, false, true);
123
+        if (null == taPetIdentity) {
124
+            return ResponseBean.error("未找到证件信息");
125
+        }
126
+
127
+        return ResponseBean.success(taPetIdentity);
128
+    }
129
+}

+ 119
- 0
src/main/java/com/njyunzhi/pet_identity/controller/TaSequenceController.java 查看文件

@@ -0,0 +1,119 @@
1
+package com.njyunzhi.pet_identity.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.njyunzhi.pet_identity.common.BaseController;
7
+import com.njyunzhi.pet_identity.common.ResponseBean;
8
+import io.swagger.annotations.Api;
9
+import io.swagger.annotations.ApiOperation;
10
+import io.swagger.annotations.ApiParam;
11
+import org.slf4j.Logger;
12
+import org.slf4j.LoggerFactory;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.web.bind.annotation.PathVariable;
15
+import org.springframework.web.bind.annotation.RequestBody;
16
+import org.springframework.web.bind.annotation.RequestMapping;
17
+import org.springframework.web.bind.annotation.RequestMethod;
18
+import org.springframework.web.bind.annotation.RequestParam;
19
+import com.njyunzhi.pet_identity.service.ITaSequenceService;
20
+import com.njyunzhi.pet_identity.entity.TaSequence;
21
+import org.springframework.web.bind.annotation.RestController;
22
+
23
+/**
24
+ * <p>
25
+    * 序列表 前端控制器
26
+    * </p>
27
+ *
28
+ * @author yansen
29
+ * @since 2022-05-25
30
+ */
31
+
32
+@Api(tags = "序列表")
33
+@RestController
34
+@RequestMapping("/")
35
+public class TaSequenceController extends BaseController {
36
+
37
+    private final Logger logger = LoggerFactory.getLogger(TaSequenceController.class);
38
+
39
+    @Autowired
40
+    public ITaSequenceService iTaSequenceService;
41
+
42
+//
43
+//    /**
44
+//     * 分页查询列表
45
+//     * @param pageNum
46
+//     * @param pageSize
47
+//     * @return
48
+//     */
49
+//    @RequestMapping(value="/taSequence",method= RequestMethod.GET)
50
+//    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
+//    public ResponseBean taSequenceList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
+//									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
53
+//
54
+//		    IPage<TaSequence> pg = new Page<>(pageNum, pageSize);
55
+//            QueryWrapper<TaSequence> queryWrapper = new QueryWrapper<>();
56
+//            queryWrapper.orderByDesc("create_date");
57
+//
58
+//            IPage<TaSequence> result = iTaSequenceService.page(pg, queryWrapper);
59
+//            return ResponseBean.success(result);
60
+//    }
61
+//
62
+//    /**
63
+//     * 保存对象
64
+//     * @param taSequence 实体对象
65
+//     * @return
66
+//     */
67
+//    @RequestMapping(value="/taSequence",method= RequestMethod.POST)
68
+//    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69
+//    public ResponseBean taSequenceAdd(@ApiParam("保存内容") @RequestBody TaSequence taSequence) throws Exception{
70
+//
71
+//        if (iTaSequenceService.save(taSequence)){
72
+//            return ResponseBean.success(taSequence);
73
+//        }else {
74
+//            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
75
+//        }
76
+//    }
77
+//
78
+//    /**
79
+//     * 根据id删除对象
80
+//     * @param id  实体ID
81
+//     */
82
+//    @RequestMapping(value="/taSequence/{id}", method= RequestMethod.DELETE)
83
+//    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
+//    public ResponseBean taSequenceDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
85
+//        if(iTaSequenceService.removeById(id)){
86
+//            return ResponseBean.success("success");
87
+//        }else {
88
+//            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
89
+//        }
90
+//    }
91
+//
92
+//    /**
93
+//     * 修改对象
94
+//     * @param id  实体ID
95
+//     * @param taSequence 实体对象
96
+//     * @return
97
+//     */
98
+//    @RequestMapping(value="/taSequence/{id}",method= RequestMethod.PUT)
99
+//    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100
+//    public ResponseBean taSequenceUpdate(@ApiParam("对象ID") @PathVariable Integer id,
101
+//                                        @ApiParam("更新内容") @RequestBody TaSequence taSequence) throws Exception{
102
+//
103
+//        if (iTaSequenceService.updateById(taSequence)){
104
+//            return ResponseBean.success(iTaSequenceService.getById(id));
105
+//        }else {
106
+//            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
107
+//        }
108
+//    }
109
+//
110
+//    /**
111
+//     * 根据id查询对象
112
+//     * @param id  实体ID
113
+//     */
114
+//    @RequestMapping(value="/taSequence/{id}",method= RequestMethod.GET)
115
+//    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
+//    public ResponseBean taSequenceGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
117
+//        return ResponseBean.success(iTaSequenceService.getById(id));
118
+//    }
119
+}

+ 9
- 2
src/main/java/com/njyunzhi/pet_identity/controller/WxMaController.java 查看文件

@@ -8,6 +8,8 @@ import cn.dev33.satoken.stp.StpUtil;
8 8
 import com.njyunzhi.pet_identity.common.*;
9 9
 import com.njyunzhi.pet_identity.entity.TaPerson;
10 10
 import com.njyunzhi.pet_identity.service.ITaPersonService;
11
+import com.njyunzhi.pet_identity.service.ITaPetService;
12
+import com.njyunzhi.pet_identity.vo.MaLogin;
11 13
 import com.njyunzhi.pet_identity.vo.WxMaAuthParam;
12 14
 import com.njyunzhi.pet_identity.vo.WxMaPreload;
13 15
 import io.swagger.annotations.Api;
@@ -29,12 +31,15 @@ public class WxMaController extends BaseController {
29 31
     @Autowired
30 32
     ITaPersonService iTaPersonService;
31 33
 
34
+    @Autowired
35
+    ITaPetService iTaPetService;
36
+
32 37
     @Autowired
33 38
     WxUtils wxUtils;
34 39
 
35 40
 
36 41
     @GetMapping("/preload")
37
-    @ApiOperation(value="小程序登录", notes = "小程序登录", httpMethod = "POST", response = ResponseBean.class)
42
+    @ApiOperation(value="小程序预加载", notes = "小程序预加载", httpMethod = "POST", response = ResponseBean.class)
38 43
     public ResponseBean preload(@ApiParam("客户端ID") @PathVariable String clientId,
39 44
                                 @ApiParam("小程序预加载参数") @RequestParam(required = false) WxMaPreload wxMaPreload) throws Exception {
40 45
 
@@ -50,8 +55,9 @@ public class WxMaController extends BaseController {
50 55
     @PostMapping("/login")
51 56
     @ApiOperation(value="小程序登录", notes = "小程序登录", httpMethod = "POST", response = ResponseBean.class)
52 57
     public ResponseBean appLogin(@ApiParam("客户端ID") @PathVariable String clientId,
53
-                                 @ApiParam("登录参数") @RequestParam String code) throws Exception {
58
+                                 @ApiParam("登录参数") @RequestBody MaLogin loginParam) throws Exception {
54 59
 
60
+        String code = loginParam.getCode();
55 61
         WxMaJscode2SessionResult sessionInfo = wxUtils.getMaService().getUserService().getSessionInfo(code);
56 62
         String openid = sessionInfo.getOpenid();
57 63
         String sessionKey = sessionInfo.getSessionKey();
@@ -68,6 +74,7 @@ public class WxMaController extends BaseController {
68 74
         StpUtil.login(taPerson.getPersonId(), clientId);
69 75
         Map<String, Object> res = new HashMap<>();
70 76
         res.put("person", taPerson);
77
+        res.put("pets", iTaPetService.getListBy("person_id", taPerson.getPersonId(), true, true));
71 78
         res.put("token", StpUtil.getTokenValue());
72 79
         res.put("sessionKey", sessionKey);
73 80
 

+ 28
- 24
src/main/java/com/njyunzhi/pet_identity/controller/WxPayController.java 查看文件

@@ -1,6 +1,11 @@
1 1
 package com.njyunzhi.pet_identity.controller;
2 2
 
3
+import com.github.binarywang.wxpay.bean.notify.WxPayNotifyResponse;
4
+import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyV3Result;
5
+import com.github.binarywang.wxpay.service.WxPayService;
3 6
 import com.njyunzhi.pet_identity.common.BaseController;
7
+import com.njyunzhi.pet_identity.common.WxUtils;
8
+import com.njyunzhi.pet_identity.service.ITaOrderService;
4 9
 import io.swagger.annotations.Api;
5 10
 import org.springframework.beans.factory.annotation.Autowired;
6 11
 import org.springframework.web.bind.annotation.RequestBody;
@@ -13,29 +18,29 @@ import org.springframework.web.bind.annotation.RestController;
13 18
 @RequestMapping("/wxpay")
14 19
 public class WxPayController extends BaseController {
15 20
 
16
-//    @Autowired
17
-//    WxUtils wxUtils;
18
-//
19
-//    @Autowired
20
-//    ITaPayService orderPayService;
21
-//
22
-//    @ResponseBody
23
-//    @RequestMapping("/notify/order")
24
-//    public String payNotify(@RequestBody String jsonData) {
25
-//        WxPayService payService = wxUtils.getPayService();
26
-//        WxPayOrderNotifyV3Result result = null;
27
-//        try {
28
-//            result = payService.parseOrderNotifyV3Result(jsonData, null);
29
-//            orderPayService.notifyOrder(result.getResult());
30
-//            return WxPayNotifyResponse.success("OK");
31
-//        } catch (Exception e) {
32
-//            e.printStackTrace();
33
-//            return WxPayNotifyResponse.fail(e.getMessage());
34
-//        }
35
-//
36
-//
37
-//    }
38
-//
21
+    @Autowired
22
+    WxUtils wxUtils;
23
+
24
+    @Autowired
25
+    ITaOrderService iTaOrderService;
26
+
27
+    @ResponseBody
28
+    @RequestMapping("/notify/order")
29
+    public String payNotify(@RequestBody String jsonData) {
30
+        WxPayService payService = wxUtils.getPayService();
31
+        WxPayOrderNotifyV3Result result = null;
32
+        try {
33
+            result = payService.parseOrderNotifyV3Result(jsonData, null);
34
+            iTaOrderService.notifyOrderPay(result.getResult());
35
+            return WxPayNotifyResponse.success("OK");
36
+        } catch (Exception e) {
37
+            e.printStackTrace();
38
+            return WxPayNotifyResponse.fail(e.getMessage());
39
+        }
40
+
41
+
42
+    }
43
+
39 44
 //    @ResponseBody
40 45
 //    @RequestMapping("/notify/refund")
41 46
 //    public String refundNotify(@RequestBody String jsonData) {
@@ -49,7 +54,6 @@ public class WxPayController extends BaseController {
49 54
 //            e.printStackTrace();
50 55
 //            return WxPayNotifyResponse.fail(e.getMessage());
51 56
 //        }
52
-//
53 57
 //    }
54 58
 
55 59
 }

+ 4
- 0
src/main/java/com/njyunzhi/pet_identity/entity/SysSetting.java 查看文件

@@ -2,6 +2,8 @@ package com.njyunzhi.pet_identity.entity;
2 2
 
3 3
 import com.baomidou.mybatisplus.annotation.IdType;
4 4
 import java.time.LocalDateTime;
5
+
6
+import com.baomidou.mybatisplus.annotation.TableField;
5 7
 import com.baomidou.mybatisplus.annotation.TableId;
6 8
 import java.io.Serializable;
7 9
 import io.swagger.annotations.ApiModel;
@@ -33,12 +35,14 @@ public class SysSetting implements Serializable {
33 35
     @ApiModelProperty(value = "配置标题")
34 36
     private String title;
35 37
 
38
+    @TableField("`desc`")
36 39
     @ApiModelProperty(value = "详细说明")
37 40
     private String desc;
38 41
 
39 42
     @ApiModelProperty(value = "配置内容")
40 43
     private String content;
41 44
 
45
+    @TableField("`status`")
42 46
     @ApiModelProperty(value = "状态")
43 47
     private Integer status;
44 48
 

+ 20
- 2
src/main/java/com/njyunzhi/pet_identity/entity/TaApplication.java 查看文件

@@ -30,6 +30,9 @@ public class TaApplication implements Serializable {
30 30
     @ApiModelProperty(value = "申请ID")
31 31
     @TableId(value = "apply_id", type = IdType.AUTO)
32 32
     private Integer applyId ;
33
+    /** 申请类型 */
34
+    @ApiModelProperty(value = "申请类型;first申请,reissue补办,renewal续期",notes = "")
35
+    private String applyType ;
33 36
     /** 申请人 */
34 37
     @ApiModelProperty(value = "申请人",notes = "")
35 38
     private String personId ;
@@ -39,6 +42,15 @@ public class TaApplication implements Serializable {
39 42
     /** 申请人手机;冗余 */
40 43
     @ApiModelProperty(value = "申请人手机",notes = "冗余")
41 44
     private String phone ;
45
+    /** 原始证件 */
46
+    @ApiModelProperty(value = "原始证件",notes = "")
47
+    private String originCardNo ;
48
+    /** 证件有效期 */
49
+    @ApiModelProperty(value = "证件有效期",notes = "")
50
+    private LocalDateTime cardExpireDate ;
51
+    /** 宠物ID */
52
+    @ApiModelProperty(value = "宠物ID",notes = "")
53
+    private String petId ;
42 54
     /** 宠物名称 */
43 55
     @ApiModelProperty(value = "宠物名称",notes = "")
44 56
     private String petName ;
@@ -55,8 +67,14 @@ public class TaApplication implements Serializable {
55 67
     @ApiModelProperty(value = "毛色",notes = "")
56 68
     private String petColor ;
57 69
     /** 免疫证明 */
58
-    @ApiModelProperty(value = "免疫证明",notes = "")
59
-    private String immunization ;
70
+    @ApiModelProperty(value = "免疫证图",notes = "")
71
+    private String immunizationImg ;
72
+    /** 免疫证明 */
73
+    @ApiModelProperty(value = "免疫证号",notes = "")
74
+    private String immunizationCode ;
75
+    /** 免疫证明 */
76
+    @ApiModelProperty(value = "最近免疫日期",notes = "")
77
+    private String immunizationDate ;
60 78
     /** 宠养区域 */
61 79
     @ApiModelProperty(value = "宠养区域",notes = "")
62 80
     private String areaCode ;

+ 46
- 0
src/main/java/com/njyunzhi/pet_identity/entity/TaLossReport.java 查看文件

@@ -0,0 +1,46 @@
1
+package com.njyunzhi.pet_identity.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import java.time.LocalDateTime;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import java.io.Serializable;
7
+import io.swagger.annotations.ApiModel;
8
+import io.swagger.annotations.ApiModelProperty;
9
+import lombok.Data;
10
+import lombok.EqualsAndHashCode;
11
+import lombok.experimental.Accessors;
12
+
13
+/**
14
+ * <p>
15
+ * 挂失证件
16
+ * </p>
17
+ *
18
+ * @author yansen
19
+ * @since 2022-05-25
20
+ */
21
+@Data
22
+@EqualsAndHashCode(callSuper = false)
23
+@Accessors(chain = true)
24
+@ApiModel(value="TaLossReport对象", description="挂失证件")
25
+public class TaLossReport implements Serializable {
26
+
27
+    private static final long serialVersionUID = 1L;
28
+
29
+    @ApiModelProperty(value = "挂失ID")
30
+    @TableId(value = "report_id", type = IdType.INPUT)
31
+    private String reportId;
32
+
33
+    @ApiModelProperty(value = "挂失人")
34
+    private String personId;
35
+
36
+    @ApiModelProperty(value = "挂失证件号")
37
+    private String cardNo;
38
+
39
+    @ApiModelProperty(value = "状态")
40
+    private Integer status;
41
+
42
+    @ApiModelProperty(value = "创建日期")
43
+    private LocalDateTime createDate;
44
+
45
+
46
+}

+ 6
- 1
src/main/java/com/njyunzhi/pet_identity/entity/TaOrder.java 查看文件

@@ -27,9 +27,12 @@ public class TaOrder implements Serializable {
27 27
     private static final long serialVersionUID = 1L;
28 28
 
29 29
     @ApiModelProperty(value = "订单ID")
30
-    @TableId(value = "order_id", type = IdType.INPUT)
30
+    @TableId(value = "order_id", type = IdType.UUID)
31 31
     private String orderId;
32 32
 
33
+    @ApiModelProperty(value = "订单号")
34
+    private String orderNo;
35
+
33 36
     @ApiModelProperty(value = "申请ID")
34 37
     private String applyId;
35 38
 
@@ -48,5 +51,7 @@ public class TaOrder implements Serializable {
48 51
     @ApiModelProperty(value = "创建日期")
49 52
     private LocalDateTime createDate;
50 53
 
54
+    @ApiModelProperty(value = "支付日期")
55
+    private LocalDateTime payDate;
51 56
 
52 57
 }

+ 1
- 1
src/main/java/com/njyunzhi/pet_identity/entity/TaPerson.java 查看文件

@@ -27,7 +27,7 @@ public class TaPerson implements Serializable {
27 27
     private static final long serialVersionUID = 1L;
28 28
 
29 29
     @ApiModelProperty(value = "用户ID")
30
-    @TableId(value = "person_id", type = IdType.INPUT)
30
+    @TableId(value = "person_id", type = IdType.UUID)
31 31
     private String personId;
32 32
 
33 33
     @ApiModelProperty(value = "小程序APPID")

+ 61
- 0
src/main/java/com/njyunzhi/pet_identity/entity/TaPet.java 查看文件

@@ -0,0 +1,61 @@
1
+package com.njyunzhi.pet_identity.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import java.time.LocalDateTime;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import java.io.Serializable;
7
+import io.swagger.annotations.ApiModel;
8
+import io.swagger.annotations.ApiModelProperty;
9
+import lombok.Data;
10
+import lombok.EqualsAndHashCode;
11
+import lombok.experimental.Accessors;
12
+
13
+/**
14
+ * <p>
15
+ * 宠物表
16
+ * </p>
17
+ *
18
+ * @author yansen
19
+ * @since 2022-05-25
20
+ */
21
+@Data
22
+@EqualsAndHashCode(callSuper = false)
23
+@Accessors(chain = true)
24
+@ApiModel(value="TaPet对象", description="宠物表")
25
+public class TaPet implements Serializable {
26
+
27
+    private static final long serialVersionUID = 1L;
28
+
29
+    @ApiModelProperty(value = "宠物ID")
30
+    @TableId(value = "pet_id", type = IdType.UUID)
31
+    private String petId;
32
+
33
+    @ApiModelProperty(value = "名称")
34
+    private String name;
35
+
36
+    @ApiModelProperty(value = "人员ID")
37
+    private String personId;
38
+
39
+    @ApiModelProperty(value = "性别")
40
+    private Integer sex;
41
+
42
+    @ApiModelProperty(value = "生日")
43
+    private String birthday;
44
+
45
+    @ApiModelProperty(value = "毛色")
46
+    private String color;
47
+
48
+    @ApiModelProperty(value = "宠物类别")
49
+    private String petType;
50
+
51
+    @ApiModelProperty(value = "宠物照片")
52
+    private String image;
53
+
54
+    @ApiModelProperty(value = "状态")
55
+    private Integer status;
56
+
57
+    @ApiModelProperty(value = "创建日期")
58
+    private LocalDateTime createDate;
59
+
60
+
61
+}

+ 82
- 0
src/main/java/com/njyunzhi/pet_identity/entity/TaPetIdentity.java 查看文件

@@ -0,0 +1,82 @@
1
+package com.njyunzhi.pet_identity.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import java.time.LocalDateTime;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import java.io.Serializable;
7
+import io.swagger.annotations.ApiModel;
8
+import io.swagger.annotations.ApiModelProperty;
9
+import lombok.Data;
10
+import lombok.EqualsAndHashCode;
11
+import lombok.experimental.Accessors;
12
+
13
+/**
14
+ * <p>
15
+ * 宠物证件
16
+ * </p>
17
+ *
18
+ * @author yansen
19
+ * @since 2022-05-25
20
+ */
21
+@Data
22
+@EqualsAndHashCode(callSuper = false)
23
+@Accessors(chain = true)
24
+@ApiModel(value="TaPetIdentity对象", description="宠物证件")
25
+public class TaPetIdentity implements Serializable {
26
+
27
+    private static final long serialVersionUID = 1L;
28
+
29
+    @ApiModelProperty(value = "证件ID")
30
+    @TableId(value = "card_id", type = IdType.UUID)
31
+    private String cardId;
32
+
33
+    @ApiModelProperty(value = "证件号码")
34
+    private String cardNo;
35
+
36
+    @ApiModelProperty(value = "属主ID")
37
+    private String personId;
38
+
39
+    @ApiModelProperty(value = "属主姓名")
40
+    private String personName;
41
+
42
+    @ApiModelProperty(value = "属主手机")
43
+    private String phone;
44
+
45
+    @ApiModelProperty(value = "宠物ID")
46
+    private String petId;
47
+
48
+    @ApiModelProperty(value = "宠物名称")
49
+    private String petName;
50
+
51
+    @ApiModelProperty(value = "宠物性别")
52
+    private Integer petSex;
53
+
54
+    @ApiModelProperty(value = "毛色")
55
+    private String petColor;
56
+
57
+    @ApiModelProperty(value = "宠物类别")
58
+    private String petType;
59
+
60
+    @ApiModelProperty(value = "宠物照片")
61
+    private String petImg1;
62
+
63
+    @ApiModelProperty(value = "宠物照片")
64
+    private String petImg2;
65
+
66
+    @ApiModelProperty(value = "详细地址")
67
+    private String address;
68
+
69
+    @ApiModelProperty(value = "起始期;格式YYYY-MM-DD")
70
+    private String startDate;
71
+
72
+    @ApiModelProperty(value = "有效期;格式YYYY-MM-DD")
73
+    private String expireDate;
74
+
75
+    @ApiModelProperty(value = "状态;1正常,2挂失,3过期")
76
+    private Integer status;
77
+
78
+    @ApiModelProperty(value = "创建日期")
79
+    private LocalDateTime createDate;
80
+
81
+
82
+}

+ 36
- 0
src/main/java/com/njyunzhi/pet_identity/entity/TaSequence.java 查看文件

@@ -0,0 +1,36 @@
1
+package com.njyunzhi.pet_identity.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import java.io.Serializable;
6
+import io.swagger.annotations.ApiModel;
7
+import io.swagger.annotations.ApiModelProperty;
8
+import lombok.Data;
9
+import lombok.EqualsAndHashCode;
10
+import lombok.experimental.Accessors;
11
+
12
+/**
13
+ * <p>
14
+ * 序列表
15
+ * </p>
16
+ *
17
+ * @author yansen
18
+ * @since 2022-05-25
19
+ */
20
+@Data
21
+@EqualsAndHashCode(callSuper = false)
22
+@Accessors(chain = true)
23
+@ApiModel(value="TaSequence对象", description="序列表")
24
+public class TaSequence implements Serializable {
25
+
26
+    private static final long serialVersionUID = 1L;
27
+
28
+    @ApiModelProperty(value = "名称")
29
+    @TableId(value = "name", type = IdType.INPUT)
30
+    private String name;
31
+
32
+    @ApiModelProperty(value = "值")
33
+    private Integer value;
34
+
35
+
36
+}

+ 18
- 0
src/main/java/com/njyunzhi/pet_identity/mapper/TaLossReportMapper.java 查看文件

@@ -0,0 +1,18 @@
1
+package com.njyunzhi.pet_identity.mapper;
2
+
3
+import com.njyunzhi.pet_identity.entity.TaLossReport;
4
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 挂失证件 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author yansen
13
+ * @since 2022-05-25
14
+ */
15
+@Mapper
16
+public interface TaLossReportMapper extends BaseMapper<TaLossReport> {
17
+
18
+}

+ 3
- 0
src/main/java/com/njyunzhi/pet_identity/mapper/TaOrderMapper.java 查看文件

@@ -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.Select;
6 7
 
7 8
 /**
8 9
  * <p>
@@ -15,4 +16,6 @@ import org.apache.ibatis.annotations.Mapper;
15 16
 @Mapper
16 17
 public interface TaOrderMapper extends BaseMapper<TaOrder> {
17 18
 
19
+    @Select("SELECT UUID_SHORT()")
20
+    String getShortUUID();
18 21
 }

+ 18
- 0
src/main/java/com/njyunzhi/pet_identity/mapper/TaPetIdentityMapper.java 查看文件

@@ -0,0 +1,18 @@
1
+package com.njyunzhi.pet_identity.mapper;
2
+
3
+import com.njyunzhi.pet_identity.entity.TaPetIdentity;
4
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 宠物证件 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author yansen
13
+ * @since 2022-05-25
14
+ */
15
+@Mapper
16
+public interface TaPetIdentityMapper extends BaseMapper<TaPetIdentity> {
17
+
18
+}

+ 18
- 0
src/main/java/com/njyunzhi/pet_identity/mapper/TaPetMapper.java 查看文件

@@ -0,0 +1,18 @@
1
+package com.njyunzhi.pet_identity.mapper;
2
+
3
+import com.njyunzhi.pet_identity.entity.TaPet;
4
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 宠物表 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author yansen
13
+ * @since 2022-05-25
14
+ */
15
+@Mapper
16
+public interface TaPetMapper extends BaseMapper<TaPet> {
17
+
18
+}

+ 18
- 0
src/main/java/com/njyunzhi/pet_identity/mapper/TaSequenceMapper.java 查看文件

@@ -0,0 +1,18 @@
1
+package com.njyunzhi.pet_identity.mapper;
2
+
3
+import com.njyunzhi.pet_identity.entity.TaSequence;
4
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 序列表 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author yansen
13
+ * @since 2022-05-25
14
+ */
15
+@Mapper
16
+public interface TaSequenceMapper extends BaseMapper<TaSequence> {
17
+
18
+}

+ 3
- 0
src/main/java/com/njyunzhi/pet_identity/service/IBaseService.java 查看文件

@@ -3,6 +3,7 @@ package com.njyunzhi.pet_identity.service;
3 3
 import com.baomidou.mybatisplus.extension.service.IService;
4 4
 
5 5
 import java.io.Serializable;
6
+import java.util.List;
6 7
 
7 8
 public interface IBaseService<T> extends IService<T> {
8 9
     /**
@@ -30,4 +31,6 @@ public interface IBaseService<T> extends IService<T> {
30 31
     T getByButNot(String column, Object value, String col, Object val, boolean notDelete);
31 32
 
32 33
     T getExistBy(String column, Object value, boolean normal, boolean notDelete);
34
+
35
+    List<T> getListBy(String column, Object value, boolean normal, boolean notDelete);
33 36
 }

+ 16
- 0
src/main/java/com/njyunzhi/pet_identity/service/ITaLossReportService.java 查看文件

@@ -0,0 +1,16 @@
1
+package com.njyunzhi.pet_identity.service;
2
+
3
+import com.njyunzhi.pet_identity.entity.TaLossReport;
4
+import com.baomidou.mybatisplus.extension.service.IService;
5
+
6
+/**
7
+ * <p>
8
+ * 挂失证件 服务类
9
+ * </p>
10
+ *
11
+ * @author yansen
12
+ * @since 2022-05-25
13
+ */
14
+public interface ITaLossReportService extends IService<TaLossReport> {
15
+
16
+}

+ 5
- 1
src/main/java/com/njyunzhi/pet_identity/service/ITaOrderService.java 查看文件

@@ -1,5 +1,6 @@
1 1
 package com.njyunzhi.pet_identity.service;
2 2
 
3
+import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyV3Result;
3 4
 import com.njyunzhi.pet_identity.entity.TaOrder;
4 5
 import com.baomidou.mybatisplus.extension.service.IService;
5 6
 
@@ -11,6 +12,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
11 12
  * @author yansen
12 13
  * @since 2022-05-24
13 14
  */
14
-public interface ITaOrderService extends IService<TaOrder> {
15
+public interface ITaOrderService extends IBaseService<TaOrder> {
15 16
 
17
+    void notifyOrderPay(WxPayOrderNotifyV3Result.DecryptNotifyResult result) throws Exception;
18
+
19
+    String createOrderNo() throws Exception;
16 20
 }

+ 20
- 0
src/main/java/com/njyunzhi/pet_identity/service/ITaPetIdentityService.java 查看文件

@@ -0,0 +1,20 @@
1
+package com.njyunzhi.pet_identity.service;
2
+
3
+import com.njyunzhi.pet_identity.entity.TaApplication;
4
+import com.njyunzhi.pet_identity.entity.TaPetIdentity;
5
+import com.njyunzhi.pet_identity.vo.MakeCardParam;
6
+
7
+/**
8
+ * <p>
9
+ * 宠物证件 服务类
10
+ * </p>
11
+ *
12
+ * @author yansen
13
+ * @since 2022-05-25
14
+ */
15
+public interface ITaPetIdentityService extends IBaseService<TaPetIdentity> {
16
+
17
+    TaPetIdentity createNewCard(TaApplication taApplication, MakeCardParam makeCardParam) throws Exception;
18
+
19
+    boolean extendDate(TaPetIdentity taPetIdentity) throws Exception;
20
+}

+ 16
- 0
src/main/java/com/njyunzhi/pet_identity/service/ITaPetService.java 查看文件

@@ -0,0 +1,16 @@
1
+package com.njyunzhi.pet_identity.service;
2
+
3
+import com.njyunzhi.pet_identity.entity.TaPet;
4
+import com.baomidou.mybatisplus.extension.service.IService;
5
+
6
+/**
7
+ * <p>
8
+ * 宠物表 服务类
9
+ * </p>
10
+ *
11
+ * @author yansen
12
+ * @since 2022-05-25
13
+ */
14
+public interface ITaPetService extends IBaseService<TaPet> {
15
+
16
+}

+ 16
- 0
src/main/java/com/njyunzhi/pet_identity/service/ITaSequenceService.java 查看文件

@@ -0,0 +1,16 @@
1
+package com.njyunzhi.pet_identity.service;
2
+
3
+import com.njyunzhi.pet_identity.entity.TaSequence;
4
+import com.baomidou.mybatisplus.extension.service.IService;
5
+
6
+/**
7
+ * <p>
8
+ * 序列表 服务类
9
+ * </p>
10
+ *
11
+ * @author yansen
12
+ * @since 2022-05-25
13
+ */
14
+public interface ITaSequenceService extends IService<TaSequence> {
15
+
16
+}

+ 11
- 0
src/main/java/com/njyunzhi/pet_identity/service/impl/BaseServiceImpl.java 查看文件

@@ -10,6 +10,7 @@ import com.njyunzhi.pet_identity.service.IBaseService;
10 10
 
11 11
 import java.io.Serializable;
12 12
 import java.time.LocalDateTime;
13
+import java.util.List;
13 14
 
14 15
 public class BaseServiceImpl<M extends BaseMapper<T>, T> extends ServiceImpl<M, T> implements IBaseService<T> {
15 16
     @Override
@@ -117,4 +118,14 @@ public class BaseServiceImpl<M extends BaseMapper<T>, T> extends ServiceImpl<M,
117 118
         queryWrapper.last("limit 1");
118 119
         return getOne(queryWrapper);
119 120
     }
121
+
122
+    @Override
123
+    public List<T> getListBy(String column, Object value, boolean normal, boolean notDelete) {
124
+        QueryWrapper<T> queryWrapper = new QueryWrapper<>();
125
+        queryWrapper.eq(column, value);
126
+        queryWrapper.eq(normal, "status", 1);
127
+        queryWrapper.gt(notDelete, "status", -1);
128
+        queryWrapper.last("limit 1");
129
+        return list(queryWrapper);
130
+    }
120 131
 }

+ 20
- 0
src/main/java/com/njyunzhi/pet_identity/service/impl/TaLossReportServiceImpl.java 查看文件

@@ -0,0 +1,20 @@
1
+package com.njyunzhi.pet_identity.service.impl;
2
+
3
+import com.njyunzhi.pet_identity.entity.TaLossReport;
4
+import com.njyunzhi.pet_identity.mapper.TaLossReportMapper;
5
+import com.njyunzhi.pet_identity.service.ITaLossReportService;
6
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 挂失证件 服务实现类
12
+ * </p>
13
+ *
14
+ * @author yansen
15
+ * @since 2022-05-25
16
+ */
17
+@Service
18
+public class TaLossReportServiceImpl extends ServiceImpl<TaLossReportMapper, TaLossReport> implements ITaLossReportService {
19
+
20
+}

+ 45
- 2
src/main/java/com/njyunzhi/pet_identity/service/impl/TaOrderServiceImpl.java 查看文件

@@ -1,11 +1,19 @@
1 1
 package com.njyunzhi.pet_identity.service.impl;
2 2
 
3
+import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyV3Result;
4
+import com.github.binarywang.wxpay.constant.WxPayConstants;
5
+import com.njyunzhi.pet_identity.common.Constants;
6
+import com.njyunzhi.pet_identity.common.StringUtils;
7
+import com.njyunzhi.pet_identity.entity.TaApplication;
3 8
 import com.njyunzhi.pet_identity.entity.TaOrder;
9
+import com.njyunzhi.pet_identity.mapper.TaApplicationMapper;
4 10
 import com.njyunzhi.pet_identity.mapper.TaOrderMapper;
5 11
 import com.njyunzhi.pet_identity.service.ITaOrderService;
6
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
12
+import org.springframework.beans.factory.annotation.Autowired;
7 13
 import org.springframework.stereotype.Service;
8 14
 
15
+import java.time.LocalDateTime;
16
+
9 17
 /**
10 18
  * <p>
11 19
  * 订单表 服务实现类
@@ -15,6 +23,41 @@ import org.springframework.stereotype.Service;
15 23
  * @since 2022-05-24
16 24
  */
17 25
 @Service
18
-public class TaOrderServiceImpl extends ServiceImpl<TaOrderMapper, TaOrder> implements ITaOrderService {
26
+public class TaOrderServiceImpl extends BaseServiceImpl<TaOrderMapper, TaOrder> implements ITaOrderService {
27
+
28
+    @Autowired
29
+    TaApplicationMapper applicationMapper;
30
+
31
+    @Override
32
+    public void notifyOrderPay(WxPayOrderNotifyV3Result.DecryptNotifyResult result) throws Exception {
33
+        TaOrder taOrder = getExistBy("order_no", result.getOutTradeNo(), false, true);
34
+        if (null == taOrder) {
35
+            throw new Exception("未找到单号 [" + result.getOutTradeNo() + "] 对应的订单");
36
+        }
37
+
38
+        if (taOrder.getStatus() == Constants.PAY_STATUS_PAID) {
39
+            return;
40
+        }
41
+
42
+        boolean isSuccess = WxPayConstants.ResultCode.SUCCESS.equals(result.getTradeState());
43
+        if (!isSuccess) return;
44
+
45
+        taOrder.setStatus(Constants.PAY_STATUS_PAID);
46
+        taOrder.setPayDate(LocalDateTime.now());
47
+
48
+        baseMapper.updateById(taOrder);
49
+
50
+        // 更新申请单状态
51
+        if (StringUtils.isEmpty(taOrder.getApplyId())) return;
52
+        TaApplication taApplication = applicationMapper.selectById(taOrder.getApplyId());
53
+        if (null == taApplication || Constants.STATUS_DELETE == taApplication.getStatus()) return;
54
+
55
+        taApplication.setPayStatus(Constants.PAY_STATUS_PAID);
56
+        applicationMapper.updateById(taApplication);
57
+    }
19 58
 
59
+    @Override
60
+    public String createOrderNo() throws Exception {
61
+        return baseMapper.getShortUUID();
62
+    }
20 63
 }

+ 80
- 0
src/main/java/com/njyunzhi/pet_identity/service/impl/TaPetIdentityServiceImpl.java 查看文件

@@ -0,0 +1,80 @@
1
+package com.njyunzhi.pet_identity.service.impl;
2
+
3
+import com.njyunzhi.pet_identity.common.Constants;
4
+import com.njyunzhi.pet_identity.common.DateUtils;
5
+import com.njyunzhi.pet_identity.entity.SysSetting;
6
+import com.njyunzhi.pet_identity.entity.TaApplication;
7
+import com.njyunzhi.pet_identity.entity.TaPetIdentity;
8
+import com.njyunzhi.pet_identity.mapper.SysSettingMapper;
9
+import com.njyunzhi.pet_identity.mapper.TaPetIdentityMapper;
10
+import com.njyunzhi.pet_identity.service.ITaPetIdentityService;
11
+import com.njyunzhi.pet_identity.vo.MakeCardParam;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.stereotype.Service;
14
+
15
+import java.time.LocalDateTime;
16
+import java.time.ZoneId;
17
+
18
+/**
19
+ * <p>
20
+ * 宠物证件 服务实现类
21
+ * </p>
22
+ *
23
+ * @author yansen
24
+ * @since 2022-05-25
25
+ */
26
+@Service
27
+public class TaPetIdentityServiceImpl extends BaseServiceImpl<TaPetIdentityMapper, TaPetIdentity> implements ITaPetIdentityService {
28
+
29
+    @Autowired
30
+    SysSettingMapper sysSettingMapper;
31
+
32
+    @Override
33
+    public TaPetIdentity createNewCard(TaApplication taApplication, MakeCardParam makeCardParam) throws Exception {
34
+
35
+        SysSetting sysSetting = sysSettingMapper.selectById(Constants.SYSSETTING_CARD_EXPIRE);
36
+
37
+        // 北京时间
38
+        LocalDateTime now = LocalDateTime.now(ZoneId.of("Asia/Shanghai"));
39
+        LocalDateTime expire = now.plusDays(Long.parseLong(sysSetting.getContent()));
40
+
41
+        TaPetIdentity taPetIdentity = new TaPetIdentity();
42
+        taPetIdentity.setCardNo(makeCardParam.getCardNo());
43
+        taPetIdentity.setPersonId(taApplication.getPersonId());
44
+        taPetIdentity.setPersonName(taApplication.getPersonName());
45
+        taPetIdentity.setPhone(taApplication.getPhone());
46
+        taPetIdentity.setPetId(taApplication.getPetId());
47
+        taPetIdentity.setPetName(taApplication.getPetName());
48
+        taPetIdentity.setPetSex(taApplication.getPetSex());
49
+        taPetIdentity.setPetColor(taApplication.getPetColor());
50
+        taPetIdentity.setPetType(taApplication.getPetType());
51
+        taPetIdentity.setPetImg1(taApplication.getImg1());
52
+        taPetIdentity.setPetImg2(taApplication.getImg2());
53
+        taPetIdentity.setAddress(taApplication.getAddress());
54
+        taPetIdentity.setStartDate(DateUtils.toString(now, "yyyy-MM-dd"));
55
+        taPetIdentity.setStartDate(DateUtils.toString(expire, "yyyy-MM-dd"));
56
+        taPetIdentity.setStatus(Constants.STATUS_NORMAL);
57
+        taPetIdentity.setCreateDate(now);
58
+
59
+        if (!save(taPetIdentity)) {
60
+            throw new Exception("生成证件失败");
61
+        }
62
+
63
+        return taPetIdentity;
64
+    }
65
+
66
+    @Override
67
+    public boolean extendDate(TaPetIdentity taPetIdentity) throws Exception {
68
+
69
+        SysSetting sysSetting = sysSettingMapper.selectById(Constants.SYSSETTING_CARD_EXPIRE);
70
+
71
+        // 北京时间
72
+        LocalDateTime now = LocalDateTime.now(ZoneId.of("Asia/Shanghai"));
73
+        LocalDateTime expire = now.plusDays(Long.parseLong(sysSetting.getContent()));
74
+
75
+        taPetIdentity.setStartDate(DateUtils.toString(now, "yyyy-MM-dd"));
76
+        taPetIdentity.setStartDate(DateUtils.toString(expire, "yyyy-MM-dd"));
77
+
78
+        return updateById(taPetIdentity);
79
+    }
80
+}

+ 20
- 0
src/main/java/com/njyunzhi/pet_identity/service/impl/TaPetServiceImpl.java 查看文件

@@ -0,0 +1,20 @@
1
+package com.njyunzhi.pet_identity.service.impl;
2
+
3
+import com.njyunzhi.pet_identity.entity.TaPet;
4
+import com.njyunzhi.pet_identity.mapper.TaPetMapper;
5
+import com.njyunzhi.pet_identity.service.ITaPetService;
6
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 宠物表 服务实现类
12
+ * </p>
13
+ *
14
+ * @author yansen
15
+ * @since 2022-05-25
16
+ */
17
+@Service
18
+public class TaPetServiceImpl extends BaseServiceImpl<TaPetMapper, TaPet> implements ITaPetService {
19
+
20
+}

+ 20
- 0
src/main/java/com/njyunzhi/pet_identity/service/impl/TaSequenceServiceImpl.java 查看文件

@@ -0,0 +1,20 @@
1
+package com.njyunzhi.pet_identity.service.impl;
2
+
3
+import com.njyunzhi.pet_identity.entity.TaSequence;
4
+import com.njyunzhi.pet_identity.mapper.TaSequenceMapper;
5
+import com.njyunzhi.pet_identity.service.ITaSequenceService;
6
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 序列表 服务实现类
12
+ * </p>
13
+ *
14
+ * @author yansen
15
+ * @since 2022-05-25
16
+ */
17
+@Service
18
+public class TaSequenceServiceImpl extends ServiceImpl<TaSequenceMapper, TaSequence> implements ITaSequenceService {
19
+
20
+}

+ 14
- 0
src/main/java/com/njyunzhi/pet_identity/vo/MaLogin.java 查看文件

@@ -0,0 +1,14 @@
1
+package com.njyunzhi.pet_identity.vo;
2
+
3
+
4
+import io.swagger.annotations.ApiModel;
5
+import io.swagger.annotations.ApiModelProperty;
6
+import lombok.Data;
7
+
8
+@ApiModel(description = "小程序登录")
9
+@Data
10
+public class MaLogin {
11
+
12
+    @ApiModelProperty(value = "code",notes = "")
13
+    String code;
14
+}

+ 4
- 0
src/main/java/com/njyunzhi/pet_identity/vo/MakeCardParam.java 查看文件

@@ -8,6 +8,10 @@ import lombok.Data;
8 8
 @ApiModel(description = "发证参数")
9 9
 @Data
10 10
 public class MakeCardParam {
11
+    /** 证件号 */
12
+    @ApiModelProperty(value = "证件号",notes = "")
13
+    private String cardNo ;
14
+
11 15
     /** 制证状态;0待发放,1已发放 */
12 16
     @ApiModelProperty(value = "制证状态",notes = "0待发放,1已发放")
13 17
     private Integer makeStatus ;

+ 4
- 2
src/main/resources/application.yml 查看文件

@@ -40,6 +40,8 @@ sms:
40 40
 
41 41
 ###
42 42
 yz:
43
+  default:
44
+    servBase: https://xxx
43 45
   sms:
44 46
     ## ??????
45 47
     appid: ubpa
@@ -65,8 +67,8 @@ aliyun:
65 67
 ###
66 68
 weixin:
67 69
   miniapp:
68
-    appid: wxd6f47a9bb3052175
69
-    secret: 28f33b6bbc0f778c11a0bb234a7d6d4e
70
+    appid: wxe44244d1a5ea3364
71
+    secret: b7dbbb7b51d40aa716115e76721ed3ff
70 72
     token:
71 73
     aesKey:
72 74
     msgDataFormat: JSON

二进制
src/main/resources/cert/apiclient_cert.p12 查看文件


+ 24
- 0
src/main/resources/cert/apiclient_cert.pem 查看文件

@@ -0,0 +1,24 @@
1
+-----BEGIN CERTIFICATE-----
2
+MIID8zCCAtugAwIBAgIUPNkVw9BO0upFh2FwwTH0I3ijxyIwDQYJKoZIhvcNAQEL
3
+BQAwXjELMAkGA1UEBhMCQ04xEzARBgNVBAoTClRlbnBheS5jb20xHTAbBgNVBAsT
4
+FFRlbnBheS5jb20gQ0EgQ2VudGVyMRswGQYDVQQDExJUZW5wYXkuY29tIFJvb3Qg
5
+Q0EwHhcNMjIwMzMxMDMzMTE4WhcNMjcwMzMwMDMzMTE4WjCBhDETMBEGA1UEAwwK
6
+MTYyMTAzODQ4MzEbMBkGA1UECgwS5b6u5L+h5ZWG5oi357O757ufMTAwLgYDVQQL
7
+DCfljZfkuqzluILkupHoh7Tnp5HmioDmnI3liqHmnInpmZDlhazlj7gxCzAJBgNV
8
+BAYMAkNOMREwDwYDVQQHDAhTaGVuWmhlbjCCASIwDQYJKoZIhvcNAQEBBQADggEP
9
+ADCCAQoCggEBAM+Fi1z/Gm+JQ2S/4vGyVWSAT3SZ17kUgxb+HAlnY6ei/Z9uu9aA
10
+H4llI8h07iTiJxMNeQ2waezmDF14BrsSb1VeSR9RwxVXYBbzOpK5s9pr6hID/bYM
11
+rHd9ZVgGkj4OUKj0u9FJ1ERCyS7ItjX0zFe5fk6oABsoeoR4exbF2PcqM/srXgOD
12
+8VwmnyCxy1duAQTgSRds7Kk+krbQXpCa1X29Bm30CxmYYEDZZzPsG1WYwfZ1Rhfq
13
+Lsxew/Auj8HBjsaSYslDaqS+afz5nnnwxfLssHUbO6nSCSPbY3j0+N8HsHjAQnod
14
+1AR6z1SNc3kA+RmMIQh2gwMELrzATMJLX6ECAwEAAaOBgTB/MAkGA1UdEwQCMAAw
15
+CwYDVR0PBAQDAgTwMGUGA1UdHwReMFwwWqBYoFaGVGh0dHA6Ly9ldmNhLml0cnVz
16
+LmNvbS5jbi9wdWJsaWMvaXRydXNjcmw/Q0E9MUJENDIyMEU1MERCQzA0QjA2QUQz
17
+OTc1NDk4NDZDMDFDM0U4RUJEMjANBgkqhkiG9w0BAQsFAAOCAQEAjxTe9P3HyXBH
18
+/ihXHRFf4JALuLbqA3hMxClvz/SWyoPw7zT/H1/O3O/8neILrxAkLLCO6fQuhJor
19
+fpCCfAQADn9YVhvqjaKXNV05Uwfvu4s9gl+gzP1mIyMyAtToLXRZOcxN2BT6SVfd
20
+e/YRjPuQ3CkLNjkVOWbWHMPMjZYP6H+EUBBE58R5VtouYp02aIg4ziatRVz/vooC
21
+DBzLPZAyFxhdXFHydpDpOp/tHooJx1+JUj+WlKeegolhyGUV3wpEGp6cVY0kfuaJ
22
+vtnHACYdGOJM2ObcWrZiXgb6aFqpcjRGqgj+HpTPjjsLUNr8X0Coz0TLZps4ig2W
23
+DuVdpx4MmQ==
24
+-----END CERTIFICATE-----

+ 28
- 0
src/main/resources/cert/apiclient_key.pem 查看文件

@@ -0,0 +1,28 @@
1
+-----BEGIN PRIVATE KEY-----
2
+MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDPhYtc/xpviUNk
3
+v+LxslVkgE90mde5FIMW/hwJZ2Onov2fbrvWgB+JZSPIdO4k4icTDXkNsGns5gxd
4
+eAa7Em9VXkkfUcMVV2AW8zqSubPaa+oSA/22DKx3fWVYBpI+DlCo9LvRSdREQsku
5
+yLY19MxXuX5OqAAbKHqEeHsWxdj3KjP7K14Dg/FcJp8gsctXbgEE4EkXbOypPpK2
6
+0F6QmtV9vQZt9AsZmGBA2Wcz7BtVmMH2dUYX6i7MXsPwLo/BwY7GkmLJQ2qkvmn8
7
++Z558MXy7LB1Gzup0gkj22N49PjfB7B4wEJ6HdQEes9UjXN5APkZjCEIdoMDBC68
8
+wEzCS1+hAgMBAAECggEBAIQS7EV9nmeKJrhCX7+PzkUuXGNLXj5Ozbeedl2NzaDt
9
+XRlRMn8r/+ZD1mhH8yDKRjAcDQUnV+ML7qa2MyJwcycT4NnsAYrdlyxEFO04/zxu
10
+HgTlQV3R5xoNVqiVVhHkrnU5fSeQI2ZmUwBRgZYJfNwAFGEfDyI5uvAAdeZieNmk
11
+fdj2KqW9AxJXoSWA2vI6GgNrI+9cNDYNsZN9C+/eB4HChmrVXMNtT1OcPCZJggHr
12
+Dv3S4LCGwDDEiw9CID1Siy4TfYccxyejmNwh2KuruNdn+7L7ihhQIhbAOEMoVXcR
13
+BGo0aVqvFg47zxANW8b1yLjr407sFtsPl0VwPCvw8JkCgYEA/MqPItb2HhCgrVw9
14
+LfCKPwrz1kvyGflN7A9TMtURB4C306SGWeNYmmku7QmcTfB2D1/wnPlN33Cw/MKg
15
+l6f15+SLVYshhxha26fHWHPASipkup1srTAtzWFlsb5RgttWBGLUQXZSfS8uNSTY
16
+qNYKZJRYBEFDLtWEZikHZRQSa4sCgYEA0ifh64hsh6vXuaNZZdyzcOByCA8BRrk1
17
+W5V9WKE4bHaCEsCdwJNeW6sVwH/JSdtwDPDHX5UR7UguZiS4rYHvDPKbdjRcAq0D
18
+CGMZkiIy9cFhwMVPfZK0xyn8tzIC8jsv+at9lCOYwryXCysf/gGoNGnG5fOzsTqu
19
+FWnnUe8T9wMCgYBZWFJMswMbzy6q9w3cfcauz3UtCXyQ94813pi+P5YcO788+0pM
20
+3NCFCqX+O0ZWOaXQe000fdyrG05Cl5tg3olII3uniVwZPl9mgR8wwQB2dhNR7a/q
21
+ajvV+hWSQ7zVbiYxuKhiVqqC+jjvqY015yiXMeMF5fcTx31bCidF71kvTwKBgGui
22
+naVixCNgsiaUMU9okEc5zW2vMbolVdzIXeCtAhcbQ1eTa7icQfG1WHi1ekTnrSYT
23
+lCmyUfIzy//owuWq7OK2x0TtYErGjg0XpJsiBPO1zflLlYD9SLXRHWw+ox+pjNLV
24
+MIZVDQKAUOQZfFM+SgY+Pu67uMcHBO5WxXFDf/g9AoGAMmo+ylShyPDt2K6V41vU
25
+fWnhYgVeQDn131/Xd3iwbfpQRAkeJs+KaOLM0aeK0pYj+9zCgUbXO+l833Em9IH6
26
+rD0Xud7T/NZ1h/a15omYYiaaUt53DjGe3N2Tf22Hbrvx7gvYCaXOsEAmFq3BhFBx
27
+AddQ5GqpvsxHMhG5IkiaMjw=
28
+-----END PRIVATE KEY-----

+ 5
- 0
src/main/resources/mapper/TaLossReportMapper.xml 查看文件

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.njyunzhi.pet_identity.mapper.TaLossReportMapper">
4
+
5
+</mapper>

+ 5
- 0
src/main/resources/mapper/TaPetIdentityMapper.xml 查看文件

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.njyunzhi.pet_identity.mapper.TaPetIdentityMapper">
4
+
5
+</mapper>

+ 5
- 0
src/main/resources/mapper/TaPetMapper.xml 查看文件

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.njyunzhi.pet_identity.mapper.TaPetMapper">
4
+
5
+</mapper>

+ 5
- 0
src/main/resources/mapper/TaSequenceMapper.xml 查看文件

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.njyunzhi.pet_identity.mapper.TaSequenceMapper">
4
+
5
+</mapper>