张延森 2 лет назад
Родитель
Сommit
982159bc4b

+ 1
- 0
src/main/java/com/yunzhi/nanyang/common/Constants.java Просмотреть файл

@@ -40,6 +40,7 @@ public class Constants {
40 40
     public final static int PAY_PAID = 1;  // 已支付
41 41
     public final static int PAY_FAIL = 2;  // 支付失败
42 42
     public final static int PAY_REFUNDING = 3;  // 退款申请中
43
+    public final static int PAY_PROCESSING = 4;  // 支付中
43 44
     public final static int PAY_REFUND = -1;  // 已退款
44 45
 
45 46
     // 是否调度

+ 0
- 5
src/main/java/com/yunzhi/nanyang/controller/PayNotifyController.java Просмотреть файл

@@ -84,11 +84,6 @@ public class PayNotifyController extends BaseController {
84 84
                             HttpServletRequest request) {
85 85
         Map<String, String> params = getRequestParams(request);
86 86
 
87
-        // 支付等待中
88
-        if ("WAIT_BUYER_PAY".equals(params.get("trade_status"))) {
89
-            return "success";
90
-        }
91
-
92 87
         //切记alipaypublickey是支付宝的公钥,请去open.alipay.com对应应用下查看。
93 88
         //boolean AlipaySignature.rsaCheckV1(Map<String, String> params, String publicKey, String charset, String sign_type)
94 89
         try {

+ 3
- 3
src/main/java/com/yunzhi/nanyang/controller/TaEvaluationController.java Просмотреть файл

@@ -96,9 +96,9 @@ public class TaEvaluationController extends BaseController {
96 96
             return ResponseBean.error("非法操作");
97 97
         }
98 98
 
99
-        if (Constants.PAY_PAID != taOrder.getPayStatus() || Constants.WORK_DONE != taOrder.getWorkStatus()) {
100
-            return ResponseBean.error("订单未支付或者未完成");
101
-        }
99
+//        if (Constants.PAY_PAID != taOrder.getPayStatus() || Constants.WORK_DONE != taOrder.getWorkStatus()) {
100
+//            return ResponseBean.error("订单未支付或者未完成");
101
+//        }
102 102
 
103 103
         taEvaluation.setPersonId(personId);
104 104
 

+ 15
- 14
src/main/java/com/yunzhi/nanyang/controller/TaPayController.java Просмотреть файл

@@ -86,19 +86,20 @@ public class TaPayController extends BaseController {
86 86
     public ResponseBean refund(@ApiParam("客户端") @PathVariable String client,
87 87
                                @ApiParam("客户端ID") @PathVariable String clientId,
88 88
                                @ApiParam("订单ID") @PathVariable String id) throws Exception{
89
-        TaOrder taOrder = iTaOrderService.getExistBy("order_id", id, false, true);
90
-        if (null == taOrder) {
91
-            return ResponseBean.error("未找到订单信息");
92
-        }
93
-
94
-        if (taOrder.getPayStatus() != Constants.PAY_PAID) {
95
-            return ResponseBean.error("订单未支付");
96
-        }
97
-        if (taOrder.getWorkStatus() != Constants.WORK_READY) {
98
-            return ResponseBean.error("订单已作业, 不能退款");
99
-        }
100
-
101
-        iTaPayService.refund(client, clientId, taOrder);
102
-        return ResponseBean.success("success");
89
+        return ResponseBean.error("暂不支持退款操作");
90
+//        TaOrder taOrder = iTaOrderService.getExistBy("order_id", id, false, true);
91
+//        if (null == taOrder) {
92
+//            return ResponseBean.error("未找到订单信息");
93
+//        }
94
+//
95
+//        if (taOrder.getPayStatus() != Constants.PAY_PAID) {
96
+//            return ResponseBean.error("订单未支付");
97
+//        }
98
+//        if (taOrder.getWorkStatus() != Constants.WORK_READY) {
99
+//            return ResponseBean.error("订单已作业, 不能退款");
100
+//        }
101
+//
102
+//        iTaPayService.refund(client, clientId, taOrder);
103
+//        return ResponseBean.success("success");
103 104
     }
104 105
 }

+ 21
- 24
src/main/java/com/yunzhi/nanyang/controller/TaPersonController.java Просмотреть файл

@@ -14,13 +14,9 @@ import io.swagger.annotations.ApiParam;
14 14
 import org.slf4j.Logger;
15 15
 import org.slf4j.LoggerFactory;
16 16
 import org.springframework.beans.factory.annotation.Autowired;
17
-import org.springframework.web.bind.annotation.PathVariable;
18
-import org.springframework.web.bind.annotation.RequestBody;
19
-import org.springframework.web.bind.annotation.RequestMapping;
20
-import org.springframework.web.bind.annotation.RequestMethod;
17
+import org.springframework.web.bind.annotation.*;
21 18
 import com.yunzhi.nanyang.service.ITaPersonService;
22 19
 import com.yunzhi.nanyang.entity.TaPerson;
23
-import org.springframework.web.bind.annotation.RestController;
24 20
 
25 21
 import java.util.HashMap;
26 22
 import java.util.Map;
@@ -51,25 +47,26 @@ public class TaPersonController extends BaseController {
51 47
     public SMSCaptcha smsCaptcha;
52 48
 
53 49
 
54
-//    /**
55
-//     * 分页查询列表
56
-//     * @param pageNum
57
-//     * @param pageSize
58
-//     * @return
59
-//     */
60
-//    @RequestMapping(value="/taPerson",method= RequestMethod.GET)
61
-//    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
62
-//    public ResponseBean taPersonList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
63
-//									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
64
-//
65
-//		    IPage<TaPerson> pg = new Page<>(pageNum, pageSize);
66
-//            QueryWrapper<TaPerson> queryWrapper = new QueryWrapper<>();
67
-//            queryWrapper.orderByDesc("create_date");
68
-//
69
-//            IPage<TaPerson> result = iTaPersonService.page(pg, queryWrapper);
70
-//            return ResponseBean.success(result);
71
-//    }
72
-//
50
+    /**
51
+     * 分页查询列表
52
+     * @param pageNum
53
+     * @param pageSize
54
+     * @return
55
+     */
56
+    @RequestMapping(value="/admin/person",method= RequestMethod.GET)
57
+    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
58
+    public ResponseBean taPersonList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
59
+									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
60
+                                     @ApiParam("身份") @RequestParam(value ="identity", required = false) String identity,
61
+                                     @ApiParam("昵称") @RequestParam(value ="nickName", required = false) String nickName,
62
+                                     @ApiParam("手机号") @RequestParam(value ="phone", required = false) String phone) throws Exception{
63
+
64
+        IPage<TaPerson> pg = new Page<>(pageNum, pageSize);
65
+
66
+        IPage<TaPerson> result = iTaPersonService.getPageBy(pg, identity, nickName, phone);
67
+        return ResponseBean.success(result);
68
+    }
69
+
73 70
 //    /**
74 71
 //     * 保存对象
75 72
 //     * @param taPerson 实体对象

+ 17
- 4
src/main/java/com/yunzhi/nanyang/controller/TaWorkJobController.java Просмотреть файл

@@ -139,9 +139,9 @@ public class TaWorkJobController extends BaseController {
139 139
             return ResponseBean.error("校验订单失败");
140 140
         }
141 141
 
142
-        if (Constants.PAY_PAID != taOrder.getPayStatus()) {
143
-            return ResponseBean.error("订单未支付或者已退款");
144
-        }
142
+//        if (Constants.PAY_PAID != taOrder.getPayStatus()) {
143
+//            return ResponseBean.error("订单未支付或者已退款");
144
+//        }
145 145
 
146 146
 //        int status = mode ? Constants.WORK_DOING : Constants.WORK_PAUSE;
147 147
         int status = Constants.WORK_DOING;
@@ -191,9 +191,22 @@ public class TaWorkJobController extends BaseController {
191 191
         origin.setArea(taWorkJob.getArea());
192 192
         origin.setEndDate(LocalDateTime.now());
193 193
 
194
-        iTaOrderService.updateStatus(taWorkJob.getOrderId(), "work_status", Constants.WORK_DONE);
194
+//        iTaOrderService.updateStatus(taWorkJob.getOrderId(), "work_status", Constants.WORK_DONE);
195 195
         iTaMachineryService.updateStatus(taWorkJob.getMachineryId(), "job_status", Constants.WORK_DONE);
196 196
 
197
+        // 更新订单
198
+        TaOrder taOrder = iTaOrderService.getExistBy("order_id", origin.getOrderId(), false, true);
199
+        if (null == taOrder) {
200
+            return ResponseBean.error("校验订单失败");
201
+        }
202
+
203
+        int area = StringUtils.isEmpty(taWorkJob.getArea()) ? 0 : Integer.valueOf(taWorkJob.getArea());
204
+        int charges = taOrder.getPrice() * area;
205
+        taOrder.setAmount(area);
206
+        taOrder.setCharges(charges);
207
+        taOrder.setWorkStatus(Constants.WORK_DONE);
208
+        iTaOrderService.updateById(taOrder);
209
+
197 210
         if (iTaWorkJobService.updateById(origin)){
198 211
             return ResponseBean.success(origin);
199 212
         }else {

+ 4
- 0
src/main/java/com/yunzhi/nanyang/entity/SysUser.java Просмотреть файл

@@ -68,4 +68,8 @@ public class SysUser implements Serializable {
68 68
     @TableField(exist = false)
69 69
     @ApiModelProperty("登录账号")
70 70
     private String loginName;
71
+
72
+    @TableField(exist = false)
73
+    @ApiModelProperty("移动端昵称")
74
+    private String nickName;
71 75
 }

+ 3
- 0
src/main/java/com/yunzhi/nanyang/mapper/TaPersonMapper.java Просмотреть файл

@@ -1,5 +1,6 @@
1 1
 package com.yunzhi.nanyang.mapper;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.yunzhi.nanyang.entity.TaPerson;
4 5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 6
 import com.yunzhi.nanyang.vo.ChartParam;
@@ -29,4 +30,6 @@ public interface TaPersonMapper extends BaseMapper<TaPerson> {
29 30
 
30 31
     @Select("SELECT * FROM ta_person t WHERE t.phone = #{phone} AND t.identity = #{clientId} AND t.`status` > -1")
31 32
     TaPerson getByPhone(@Param("clientId") String clientId,@Param("phone")  String phone);
33
+
34
+    IPage<TaPerson> getPageBy(IPage<TaPerson> pg, @Param("identity") String identity, @Param("nickName") String nickName, @Param("phone") String phone);
32 35
 }

+ 3
- 0
src/main/java/com/yunzhi/nanyang/service/ITaPersonService.java Просмотреть файл

@@ -1,5 +1,6 @@
1 1
 package com.yunzhi.nanyang.service;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.yunzhi.nanyang.entity.TaPerson;
4 5
 import com.baomidou.mybatisplus.extension.service.IService;
5 6
 import com.yunzhi.nanyang.vo.ChartParam;
@@ -21,4 +22,6 @@ public interface ITaPersonService extends IBaseService<TaPerson> {
21 22
     ChartParam statisTotal();
22 23
 
23 24
     TaPerson getByPhone(String clientId, String phone);
25
+
26
+    IPage<TaPerson> getPageBy(IPage<TaPerson> pg, String identity, String nickName, String phone);
24 27
 }

+ 12
- 3
src/main/java/com/yunzhi/nanyang/service/impl/TaPayServiceImpl.java Просмотреть файл

@@ -122,9 +122,10 @@ public class TaPayServiceImpl extends BaseServiceImpl<TaPayMapper, TaPay> implem
122 122
     public void notifyOrder(WxPayOrderNotifyV3Result.DecryptNotifyResult result) throws Exception {
123 123
         String orderNo = result.getOutTradeNo();
124 124
         boolean isSuccess = WxPayConstants.ResultCode.SUCCESS.equals(result.getTradeState());
125
+        boolean isPaying = WxPayConstants.WxpayTradeStatus.USER_PAYING.equals(result.getTradeState());
125 126
         LocalDateTime payTime = DateUtils.from(result.getSuccessTime(), DateTimeFormatter.ISO_DATE_TIME);
126 127
         String message = result.getTradeStateDesc();
127
-        notifyOrder(orderNo, isSuccess, payTime, message);
128
+        notifyOrder(orderNo, isSuccess, payTime, message, isPaying);
128 129
     }
129 130
 
130 131
     @Override
@@ -132,17 +133,25 @@ public class TaPayServiceImpl extends BaseServiceImpl<TaPayMapper, TaPay> implem
132 133
         String orderNo = params.get("out_trade_no");
133 134
         LocalDateTime payTime = DateUtils.from(params.get("gmt_payment"), "yyyy-MM- dd HH:mm:ss");
134 135
         boolean isSuccess = "TRADE_SUCCESS".equals(params.get("trade_status"));
136
+        boolean isPaying = "WAIT_BUYER_PAY".equals(params.get("trade_status"));
135 137
         String message = params.get("trade_status");
136
-        notifyOrder(orderNo, isSuccess, payTime, message);
138
+        notifyOrder(orderNo, isSuccess, payTime, message, isPaying);
137 139
     }
138 140
 
139
-    private void notifyOrder(String orderNo, boolean isSuccess, LocalDateTime payTime, String message) throws Exception {
141
+    private void notifyOrder(String orderNo, boolean isSuccess, LocalDateTime payTime, String message, boolean isPaying) throws Exception {
140 142
         TaPay orderPay = getByOrderNo(orderNo);
141 143
         if (orderPay.getStatus() != Constants.PAY_READY) {
142 144
             return;
143 145
         }
144 146
         TaOrder taOrder = taOrderMapper.selectById(orderPay.getOrderId());
145 147
 
148
+        // 如果是支付中
149
+        if (isPaying) {
150
+            taOrder.setPayStatus(Constants.PAY_PROCESSING);
151
+            taOrderMapper.updateById(taOrder);
152
+            return;
153
+        }
154
+
146 155
         updateOrderPay(orderPay, taOrder, payTime, isSuccess, message);
147 156
     }
148 157
 

+ 6
- 0
src/main/java/com/yunzhi/nanyang/service/impl/TaPersonServiceImpl.java Просмотреть файл

@@ -1,5 +1,6 @@
1 1
 package com.yunzhi.nanyang.service.impl;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.yunzhi.nanyang.common.StringUtils;
4 5
 import com.yunzhi.nanyang.entity.SysUser;
5 6
 import com.yunzhi.nanyang.entity.TaPerson;
@@ -61,4 +62,9 @@ public class TaPersonServiceImpl extends BaseServiceImpl<TaPersonMapper, TaPerso
61 62
     public TaPerson getByPhone(String clientId, String phone) {
62 63
         return baseMapper.getByPhone(clientId, phone);
63 64
     }
65
+
66
+    @Override
67
+    public IPage<TaPerson> getPageBy(IPage<TaPerson> pg, String identity, String nickName, String phone) {
68
+        return baseMapper.getPageBy(pg, identity, nickName, phone);
69
+    }
64 70
 }

+ 3
- 2
src/main/resources/mapper/SysUserMapper.xml Просмотреть файл

@@ -14,10 +14,11 @@
14 14
           AND s.`status` = 1
15 15
     </select>
16 16
     <select id="getPageBy" resultType="com.yunzhi.nanyang.entity.SysUser">
17
-        SELECT
18
-            *
17
+        SELECT DISTINCT
18
+            t.*, s.nick_name
19 19
         FROM
20 20
             sys_user t
21
+            LEFT JOIN ta_person s ON s.user_id = t.user_id AND s.identity = 'worker'
21 22
         WHERE
22 23
             t.status &gt; -1
23 24
           AND t.user_id != #{adminId}

+ 1
- 2
src/main/resources/mapper/TaDispatchMapper.xml Просмотреть файл

@@ -28,8 +28,7 @@
28 28
             INNER JOIN ta_person m ON t.person_id = m.person_id
29 29
             INNER JOIN ta_org n ON t.org_id = n.org_id
30 30
         WHERE
31
-            t.pay_status = 1
32
-            AND t.work_status &lt; 3
31
+            t.work_status &lt; 3
33 32
           <if test="orgId != null and orgId != ''">
34 33
             AND t.org_id = #{orgId}
35 34
           </if>

+ 1
- 1
src/main/resources/mapper/TaOrderMapper.xml Просмотреть файл

@@ -32,7 +32,7 @@
32 32
             t.`status` &gt; 0
33 33
         <if test="isWarn">
34 34
             AND TO_DAYS(t.appointment_date) = TO_DAYS(now())
35
-            AND t.pay_status = 1
35
+--             AND t.pay_status = 1
36 36
             AND t.dispatch_status = 1
37 37
             AND t.work_status = 0
38 38
         </if>

+ 19
- 0
src/main/resources/mapper/TaPersonMapper.xml Просмотреть файл

@@ -2,4 +2,23 @@
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.yunzhi.nanyang.mapper.TaPersonMapper">
4 4
 
5
+    <select id="getPageBy" resultType="com.yunzhi.nanyang.entity.TaPerson">
6
+        SELECT
7
+            *
8
+        FROM
9
+            ta_person t
10
+        WHERE
11
+            t.`status` &gt; -1
12
+          <if test="identity != null and identity != ''">
13
+            AND t.identity = #{identity}
14
+          </if>
15
+        <if test="nickName != null and nickName != ''">
16
+          AND t.nick_name LIKE CONCAT( '%', #{nickName}, '%' )
17
+        </if>
18
+        <if test="phone != null and phone != ''">
19
+          AND t.phone LIKE CONCAT( '%', #{phone}, '%' )
20
+        </if>
21
+        ORDER BY
22
+            t.create_date DESC
23
+    </select>
5 24
 </mapper>