张延森 před 3 roky
rodič
revize
4a9cadc7d7
57 změnil soubory, kde provedl 1506 přidání a 167 odebrání
  1. 1
    0
      src/main/java/com/yunzhi/shigongli/common/Constants.java
  2. 1
    1
      src/main/java/com/yunzhi/shigongli/common/JWTUtils.java
  3. 53
    0
      src/main/java/com/yunzhi/shigongli/controller/StatisticsController.java
  4. 27
    8
      src/main/java/com/yunzhi/shigongli/controller/TaFeedbackController.java
  5. 22
    2
      src/main/java/com/yunzhi/shigongli/controller/TaOrderController.java
  6. 44
    28
      src/main/java/com/yunzhi/shigongli/controller/TaOrderSubController.java
  7. 29
    10
      src/main/java/com/yunzhi/shigongli/controller/TaRoomOrderController.java
  8. 1
    20
      src/main/java/com/yunzhi/shigongli/controller/TaRoomOrderPersonController.java
  9. 55
    3
      src/main/java/com/yunzhi/shigongli/controller/TaShopAccountController.java
  10. 29
    77
      src/main/java/com/yunzhi/shigongli/controller/TaShopAccountLogController.java
  11. 94
    1
      src/main/java/com/yunzhi/shigongli/controller/TaShopController.java
  12. 166
    0
      src/main/java/com/yunzhi/shigongli/controller/TaVerifyTargetController.java
  13. 90
    0
      src/main/java/com/yunzhi/shigongli/controller/TrPersonPageController.java
  14. 5
    0
      src/main/java/com/yunzhi/shigongli/entity/TaFeedback.java
  15. 5
    0
      src/main/java/com/yunzhi/shigongli/entity/TaOrder.java
  16. 6
    0
      src/main/java/com/yunzhi/shigongli/entity/TaRoomOrder.java
  17. 90
    0
      src/main/java/com/yunzhi/shigongli/entity/TaVerifyTarget.java
  18. 57
    0
      src/main/java/com/yunzhi/shigongli/entity/TrPersonPage.java
  19. 44
    0
      src/main/java/com/yunzhi/shigongli/entity/TsStatisDaily.java
  20. 10
    0
      src/main/java/com/yunzhi/shigongli/mapper/TaOrderSubMapper.java
  21. 2
    0
      src/main/java/com/yunzhi/shigongli/mapper/TaRoomOrderPersonMapper.java
  22. 7
    0
      src/main/java/com/yunzhi/shigongli/mapper/TaShopAccountLogMapper.java
  23. 4
    0
      src/main/java/com/yunzhi/shigongli/mapper/TaShopMapper.java
  24. 30
    0
      src/main/java/com/yunzhi/shigongli/mapper/TaVerifyTargetMapper.java
  25. 18
    0
      src/main/java/com/yunzhi/shigongli/mapper/TrPersonPageMapper.java
  26. 39
    0
      src/main/java/com/yunzhi/shigongli/mapper/TsStatisDailyMapper.java
  27. 1
    3
      src/main/java/com/yunzhi/shigongli/service/ITaOrderService.java
  28. 5
    0
      src/main/java/com/yunzhi/shigongli/service/ITaOrderSubService.java
  29. 4
    1
      src/main/java/com/yunzhi/shigongli/service/ITaRoomOrderPersonService.java
  30. 3
    0
      src/main/java/com/yunzhi/shigongli/service/ITaShopAccountLogService.java
  31. 2
    0
      src/main/java/com/yunzhi/shigongli/service/ITaShopAccountService.java
  32. 5
    0
      src/main/java/com/yunzhi/shigongli/service/ITaShopService.java
  33. 2
    0
      src/main/java/com/yunzhi/shigongli/service/ITaShopWorkerService.java
  34. 25
    0
      src/main/java/com/yunzhi/shigongli/service/ITaVerifyTargetService.java
  35. 16
    0
      src/main/java/com/yunzhi/shigongli/service/ITrPersonPageService.java
  36. 23
    0
      src/main/java/com/yunzhi/shigongli/service/ITsStatisDailyService.java
  37. 85
    2
      src/main/java/com/yunzhi/shigongli/service/impl/TaOrderPayServiceImpl.java
  38. 31
    9
      src/main/java/com/yunzhi/shigongli/service/impl/TaOrderServiceImpl.java
  39. 10
    0
      src/main/java/com/yunzhi/shigongli/service/impl/TaOrderSubServiceImpl.java
  40. 12
    0
      src/main/java/com/yunzhi/shigongli/service/impl/TaRoomOrderPersonServiceImpl.java
  41. 6
    0
      src/main/java/com/yunzhi/shigongli/service/impl/TaShopAccountLogServiceImpl.java
  42. 5
    0
      src/main/java/com/yunzhi/shigongli/service/impl/TaShopAccountServiceImpl.java
  43. 5
    0
      src/main/java/com/yunzhi/shigongli/service/impl/TaShopServiceImpl.java
  44. 9
    0
      src/main/java/com/yunzhi/shigongli/service/impl/TaShopWorkerServiceImpl.java
  45. 56
    0
      src/main/java/com/yunzhi/shigongli/service/impl/TaVerifyTargetServiceImpl.java
  46. 19
    0
      src/main/java/com/yunzhi/shigongli/service/impl/TrPersonPageServiceImpl.java
  47. 59
    0
      src/main/java/com/yunzhi/shigongli/service/impl/TsStatisDailyServiceImpl.java
  48. 17
    0
      src/main/java/com/yunzhi/shigongli/vo/RefundParamsVO.java
  49. 19
    0
      src/main/java/com/yunzhi/shigongli/vo/StatisDailyVO.java
  50. 15
    0
      src/main/java/com/yunzhi/shigongli/vo/VerifyTargetVO.java
  51. 7
    2
      src/main/resources/application.yml
  52. 39
    0
      src/main/resources/mapper/TaOrderSubMapper.xml
  53. 10
    0
      src/main/resources/mapper/TaShopAccountLogMapper.xml
  54. 11
    0
      src/main/resources/mapper/TaShopMapper.xml
  55. 53
    0
      src/main/resources/mapper/TaVerifyTargetMapper.xml
  56. 5
    0
      src/main/resources/mapper/TrPersonPageMapper.xml
  57. 18
    0
      src/main/resources/mapper/TsStatisDailyMapper.xml

+ 1
- 0
src/main/java/com/yunzhi/shigongli/common/Constants.java Zobrazit soubor

@@ -30,6 +30,7 @@ public class Constants {
30 30
 
31 31
     // 账户金额类型
32 32
     public final static String ACCOUNT_CASHBACK = "cashback";       // 返现
33
+    public final static String ACCOUNT_ORDER = "order";             // 订单
33 34
     public final static String ACCOUNT_COMMISSION = "commission";   // 抽成
34 35
     public final static String ACCOUNT_SETTLEMENT = "settlement";   // 佣金结算
35 36
 

+ 1
- 1
src/main/java/com/yunzhi/shigongli/common/JWTUtils.java Zobrazit soubor

@@ -25,7 +25,7 @@ public class JWTUtils {
25 25
     private static final Logger log = LoggerFactory.getLogger(JWTUtils.class);
26 26
 
27 27
     // 过期时间 30 分钟
28
-    public static final long EXPIRE_TIME = 30 * 60;
28
+    public static final long EXPIRE_TIME = 30 * 60 * 24;
29 29
 
30 30
     // 私钥
31 31
     static final SecretKey SECRET_KEY = Keys.hmacShaKeyFor(Base64.getEncoder().encode("Yansen is so handsome. He is a good man. Everyone like him !!!".getBytes()));

+ 53
- 0
src/main/java/com/yunzhi/shigongli/controller/StatisticsController.java Zobrazit soubor

@@ -0,0 +1,53 @@
1
+package com.yunzhi.shigongli.controller;
2
+
3
+import com.yunzhi.shigongli.common.BaseController;
4
+import com.yunzhi.shigongli.common.DateUtils;
5
+import com.yunzhi.shigongli.common.ResponseBean;
6
+import com.yunzhi.shigongli.service.ITaOrderSubService;
7
+import com.yunzhi.shigongli.service.ITsStatisDailyService;
8
+import com.yunzhi.shigongli.vo.StatisDailyVO;
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.*;
16
+
17
+import java.time.LocalDateTime;
18
+import java.util.HashMap;
19
+import java.util.List;
20
+import java.util.Map;
21
+
22
+@Api(tags = "查询统计")
23
+@RestController
24
+@RequestMapping("/")
25
+public class StatisticsController  extends BaseController {
26
+
27
+    private final Logger logger = LoggerFactory.getLogger(SysUserController.class);
28
+
29
+    @Autowired
30
+    ITsStatisDailyService iTsStatisDailyService;
31
+
32
+    @RequestMapping(value="/admin/statis/summary",method= RequestMethod.GET)
33
+    @ApiOperation(value="当前用户", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
34
+    public ResponseBean statisSummary() {
35
+        Map<String, Integer> result = iTsStatisDailyService.statisSummary();
36
+
37
+        return ResponseBean.success(result);
38
+    }
39
+
40
+    @RequestMapping(value="/admin/statis/{type}/daliy",method= RequestMethod.GET)
41
+    @ApiOperation(value="首页日活统计", notes = "首页日活统计", httpMethod = "GET", response = ResponseBean.class)
42
+    public ResponseBean statisIndexDaliy(@ApiParam("统计类型") @PathVariable String type,
43
+                                    @ApiParam(value = "开始时间", example = "2021-09-01") @RequestParam(value ="start") String start,
44
+                                    @ApiParam(value = "结束时间", example = "2021-09-01") @RequestParam(value ="end") String end) {
45
+        LocalDateTime startDate = DateUtils.from(start + " 00:00:00", "yyyy-MM-dd HH:mm:ss");
46
+        LocalDateTime endDate = DateUtils.from(end + " 00:00:00", "yyyy-MM-dd HH:mm:ss");
47
+        long days = DateUtils.daysBetween(startDate, endDate);
48
+
49
+        List<StatisDailyVO> result = iTsStatisDailyService.getListBy(start, type, days);
50
+
51
+        return ResponseBean.success(result);
52
+    }
53
+}

+ 27
- 8
src/main/java/com/yunzhi/shigongli/controller/TaFeedbackController.java Zobrazit soubor

@@ -20,6 +20,8 @@ import com.yunzhi.shigongli.service.ITaFeedbackService;
20 20
 import com.yunzhi.shigongli.entity.TaFeedback;
21 21
 import org.springframework.web.bind.annotation.RestController;
22 22
 
23
+import java.time.LocalDateTime;
24
+
23 25
 /**
24 26
  * <p>
25 27
     * 意见反馈 前端控制器
@@ -49,14 +51,22 @@ public class TaFeedbackController extends BaseController {
49 51
     @RequestMapping(value="/admin/taFeedback",method= RequestMethod.GET)
50 52
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51 53
     public ResponseBean taFeedbackList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
-									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
54
+                                       @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
55
+                                       @ApiParam("是否管理首页") @RequestParam(value = "isIndex", required = false) Boolean isIndex ) throws Exception{
56
+
57
+        IPage<TaFeedback> pg = new Page<>(pageNum, pageSize);
58
+        QueryWrapper<TaFeedback> queryWrapper = new QueryWrapper<>();
59
+        queryWrapper.orderByDesc("create_date");
53 60
 
54
-		    IPage<TaFeedback> pg = new Page<>(pageNum, pageSize);
55
-            QueryWrapper<TaFeedback> queryWrapper = new QueryWrapper<>();
56
-            queryWrapper.orderByDesc("create_date");
61
+        if (null != isIndex && isIndex) {
62
+            // 只查询近3天的, 且未读的数据
63
+            LocalDateTime dt = LocalDateTime.now().minusDays(3);
64
+            queryWrapper.ge("create_date", dt);
65
+            queryWrapper.eq("is_readed", 0);
66
+        }
57 67
 
58
-            IPage<TaFeedback> result = iTaFeedbackService.page(pg, queryWrapper);
59
-            return ResponseBean.success(result);
68
+        IPage<TaFeedback> result = iTaFeedbackService.page(pg, queryWrapper);
69
+        return ResponseBean.success(result);
60 70
     }
61 71
 
62 72
     /**
@@ -67,7 +77,7 @@ public class TaFeedbackController extends BaseController {
67 77
     @RequestMapping(value="/wx/taFeedback",method= RequestMethod.POST)
68 78
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69 79
     public ResponseBean taFeedbackAdd(@ApiParam("保存内容") @RequestBody TaFeedback taFeedback) throws Exception{
70
-
80
+        taFeedback.setIsReaded(false);
71 81
         if (iTaFeedbackService.save(taFeedback)){
72 82
             return ResponseBean.success(taFeedback);
73 83
         }else {
@@ -114,6 +124,15 @@ public class TaFeedbackController extends BaseController {
114 124
     @RequestMapping(value="/admin/taFeedback/{id}",method= RequestMethod.GET)
115 125
     @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116 126
     public ResponseBean taFeedbackGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
117
-        return ResponseBean.success(iTaFeedbackService.getById(id));
127
+        TaFeedback feedback = iTaFeedbackService.getById(id);
128
+
129
+        // 更新为已读
130
+        if (null == feedback.getIsReaded() || !feedback.getIsReaded()) {
131
+            feedback.setIsReaded(true);
132
+            feedback.setReadDate(LocalDateTime.now());
133
+            iTaFeedbackService.updateById(feedback);
134
+        }
135
+
136
+        return ResponseBean.success(feedback);
118 137
     }
119 138
 }

+ 22
- 2
src/main/java/com/yunzhi/shigongli/controller/TaOrderController.java Zobrazit soubor

@@ -7,11 +7,14 @@ import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
7 7
 import com.yunzhi.shigongli.common.BaseController;
8 8
 import com.yunzhi.shigongli.common.Constants;
9 9
 import com.yunzhi.shigongli.common.ResponseBean;
10
+import com.yunzhi.shigongli.common.StringUtils;
10 11
 import com.yunzhi.shigongli.entity.TaOrderSub;
11 12
 import com.yunzhi.shigongli.entity.TaPerson;
12 13
 import com.yunzhi.shigongli.service.ITaOrderPayService;
13 14
 import com.yunzhi.shigongli.service.ITaOrderSubService;
15
+import com.yunzhi.shigongli.service.ITaVerifyTargetService;
14 16
 import com.yunzhi.shigongli.vo.OrderItem;
17
+import com.yunzhi.shigongli.vo.RefundParamsVO;
15 18
 import io.swagger.annotations.Api;
16 19
 import io.swagger.annotations.ApiOperation;
17 20
 import io.swagger.annotations.ApiParam;
@@ -55,6 +58,8 @@ public class TaOrderController extends BaseController {
55 58
     @Autowired
56 59
     public ITaOrderPayService iTaOrderPayService;
57 60
 
61
+    @Autowired
62
+    public ITaVerifyTargetService iTaVerifyTargetService;
58 63
 
59 64
 //    /**
60 65
 //     * 分页查询列表
@@ -156,12 +161,22 @@ public class TaOrderController extends BaseController {
156 161
     @RequestMapping(value="/wx/order/{id}/refund",method= RequestMethod.DELETE)
157 162
     @ApiOperation(value="订单退款", notes = "订单退款", httpMethod = "DELETE", response = ResponseBean.class)
158 163
     public ResponseBean taOrderPayCancel(@ApiParam("订单号") @PathVariable String id,
164
+                                   @ApiParam("退款说明") @RequestBody RefundParamsVO refundParamsVO,
159 165
                                    HttpServletRequest request) throws Exception{
160 166
         TaOrder taOrder = iTaOrderService.getById(id);
161 167
         if (null == taOrder || Constants.STATUS_DELETED.equals(taOrder.getStatus())) {
162 168
             return ResponseBean.error("未找到订单信息", ResponseBean.ERROR_ILLEGAL_PARAMS);
163 169
         }
164 170
 
171
+        if (null == refundParamsVO
172
+                || (StringUtils.isEmpty(refundParamsVO.getRefundReason())
173
+                && StringUtils.isEmpty(refundParamsVO.getRefundDecription()))) {
174
+            return ResponseBean.error("请设置退款原因", ResponseBean.ERROR_ILLEGAL_PARAMS);
175
+        }
176
+
177
+        taOrder.setRefundReason(refundParamsVO.getRefundReason());
178
+        taOrder.setRefundDecription(refundParamsVO.getRefundDecription());
179
+
165 180
         if (!Constants.ORDER_PAYED.equals(taOrder.getStatus())) {
166 181
             return ResponseBean.error("订单非未支付状态, 不能完成操作", ResponseBean.ERROR_ILLEGAL_PARAMS);
167 182
         }
@@ -182,12 +197,17 @@ public class TaOrderController extends BaseController {
182 197
             throw new Exception("订单存在非支付状态项目, 不能退款");
183 198
         }
184 199
 
200
+        // 如果存在已核销的, 则不能退款
201
+        int cnt = iTaVerifyTargetService.getCountBy(taOrder.getOrderId(), null, 1);
202
+        if (cnt > 0) {
203
+            return ResponseBean.error("当前存在已核销内容, 不能退款", ResponseBean.ERROR_ILLEGAL_PARAMS);
204
+        }
205
+
185 206
         // 计算返现总额
186 207
         Integer totalCashback = orderSubList.stream().mapToInt(TaOrderSub::getCashback).reduce(Integer::sum).getAsInt();
187 208
 
188 209
         TaPerson person = getCurrentPerson();
189
-        iTaOrderService.refundOrder(taOrder, taPerson);
190
-        iTaOrderPayService.refundOrder(person, taOrder, totalCashback);
210
+        iTaOrderService.refundOrder(taOrder, taPerson, totalCashback);
191 211
 
192 212
         return ResponseBean.success("success");
193 213
     }

+ 44
- 28
src/main/java/com/yunzhi/shigongli/controller/TaOrderSubController.java Zobrazit soubor

@@ -11,6 +11,7 @@ import com.yunzhi.shigongli.entity.TaOrder;
11 11
 import com.yunzhi.shigongli.entity.TaPerson;
12 12
 import com.yunzhi.shigongli.service.ITaOrderPayService;
13 13
 import com.yunzhi.shigongli.service.ITaOrderService;
14
+import com.yunzhi.shigongli.service.ITaVerifyTargetService;
14 15
 import com.yunzhi.shigongli.vo.MineOrder;
15 16
 import com.yunzhi.shigongli.vo.MineOrderSummary;
16 17
 import io.swagger.annotations.Api;
@@ -50,6 +51,9 @@ public class TaOrderSubController extends BaseController {
50 51
     @Autowired
51 52
     public ITaOrderPayService iTaOrderPayService;
52 53
 
54
+    @Autowired
55
+    public ITaVerifyTargetService iTaVerifyTargetService;
56
+
53 57
     /**
54 58
      * 分页查询列表
55 59
      * @param pageNum
@@ -128,31 +132,39 @@ public class TaOrderSubController extends BaseController {
128 132
             return ResponseBean.error("您无权操作当前订单项目", ResponseBean.ERROR_ILLEGAL_PARAMS);
129 133
         }
130 134
 
135
+        // 如果存在已核销的, 则不能退款
136
+        int cnt = iTaVerifyTargetService.getCountBy(taOrderSub.getOrderId(), taOrderSub.getSubOrderId(), 1);
137
+        if (cnt > 0) {
138
+            return ResponseBean.error("当前存在已核销内容, 不能退款", ResponseBean.ERROR_ILLEGAL_PARAMS);
139
+        }
140
+
131 141
         iTaOrderPayService.refundOrderSub(taPerson, taOrder, taOrderSub);
132 142
         iTaOrderSubService.refund(taPerson, taOrder, taOrderSub);
143
+        // 删除所有待核销内容
144
+        iTaVerifyTargetService.removeBy(taOrderSub.getOrderId(), taOrderSub.getSubOrderId());
133 145
 
134 146
         return ResponseBean.success("操作完成");
135 147
     }
136 148
 
137
-    @PutMapping("/wx/orderSub/{id}/valid")
138
-    @ApiOperation(value="订单项目核销", notes = "订单项目核销", httpMethod = "PUT", response = ResponseBean.class)
139
-    public ResponseBean valdiation(@ApiParam(value = "订单项目ID") @PathVariable String id) throws Exception {
140
-        TaPerson taPerson = getCurrentPerson();
141
-        TaOrderSub taOrderSub = iTaOrderSubService.getById(id);
142
-        TaOrder taOrder = iTaOrderService.getById(taOrderSub.getOrderId());
143
-
144
-        if (!taPerson.getPersonId().equals(taOrder.getPersonId())) {
145
-            return ResponseBean.error("您不能核销当前套餐", ResponseBean.ERROR_ILLEGAL_PARAMS);
146
-        }
147
-
148
-        if (!Constants.ORDER_PAYED.equals(taOrderSub.getStatus())) {
149
-            return ResponseBean.error("套餐未支付或者状态异常", ResponseBean.ERROR_ILLEGAL_PARAMS);
150
-        }
151
-
152
-        iTaOrderSubService.validation(taPerson, taOrder, taOrderSub);
153
-
154
-        return ResponseBean.success("核销成功");
155
-    }
149
+//    @PutMapping("/wx/orderSub/{id}/valid")
150
+//    @ApiOperation(value="订单项目核销", notes = "订单项目核销", httpMethod = "PUT", response = ResponseBean.class)
151
+//    public ResponseBean valdiation(@ApiParam(value = "订单项目ID") @PathVariable String id) throws Exception {
152
+//        TaPerson taPerson = getCurrentPerson();
153
+//        TaOrderSub taOrderSub = iTaOrderSubService.getById(id);
154
+//        TaOrder taOrder = iTaOrderService.getById(taOrderSub.getOrderId());
155
+//
156
+//        if (!taPerson.getPersonId().equals(taOrder.getPersonId())) {
157
+//            return ResponseBean.error("您不能核销当前套餐", ResponseBean.ERROR_ILLEGAL_PARAMS);
158
+//        }
159
+//
160
+//        if (!Constants.ORDER_PAYED.equals(taOrderSub.getStatus())) {
161
+//            return ResponseBean.error("套餐未支付或者状态异常", ResponseBean.ERROR_ILLEGAL_PARAMS);
162
+//        }
163
+//
164
+//        iTaOrderSubService.validation(taPerson, taOrder, taOrderSub);
165
+//
166
+//        return ResponseBean.success("核销成功");
167
+//    }
156 168
 
157 169
 //    /**
158 170
 //     * 保存对象
@@ -202,15 +214,19 @@ public class TaOrderSubController extends BaseController {
202 214
 //        }
203 215
 //    }
204 216
 
205
-//    /**
206
-//     * 根据id查询对象
207
-//     * @param id  实体ID
208
-//     */
209
-//    @RequestMapping(value="/taOrderSub/{id}",method= RequestMethod.GET)
210
-//    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
211
-//    public ResponseBean taOrderSubGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
212
-//        return ResponseBean.success(iTaOrderSubService.getById(id));
213
-//    }
217
+    /**
218
+     * 根据id查询对象
219
+     * @param id  实体ID
220
+     */
221
+    @RequestMapping(value="/wx/orderSub/{id}",method= RequestMethod.GET)
222
+    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
223
+    public ResponseBean taOrderSubGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
224
+
225
+        TaPerson taPerson = getCurrentPerson();
226
+        MineOrder result =  iTaOrderSubService.getSingleOrderSubOf(taPerson, id);
227
+
228
+        return ResponseBean.success(result);
229
+    }
214 230
 
215 231
     @GetMapping("/wx/orderSub")
216 232
     @ApiOperation(value="订单列表", notes = "订单列表", httpMethod = "GET", response = MineOrder.class)

+ 29
- 10
src/main/java/com/yunzhi/shigongli/controller/TaRoomOrderController.java Zobrazit soubor

@@ -6,7 +6,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.yunzhi.shigongli.common.*;
7 7
 import com.yunzhi.shigongli.entity.TaHotel;
8 8
 import com.yunzhi.shigongli.entity.TaRoom;
9
+import com.yunzhi.shigongli.entity.TaRoomOrderPerson;
9 10
 import com.yunzhi.shigongli.service.ITaHotelService;
11
+import com.yunzhi.shigongli.service.ITaRoomOrderPersonService;
10 12
 import com.yunzhi.shigongli.service.ITaRoomService;
11 13
 import com.yunzhi.shigongli.vo.AMapWeather;
12 14
 import io.swagger.annotations.Api;
@@ -21,6 +23,7 @@ import com.yunzhi.shigongli.service.ITaRoomOrderService;
21 23
 import com.yunzhi.shigongli.entity.TaRoomOrder;
22 24
 
23 25
 import java.time.LocalDateTime;
26
+import java.util.List;
24 27
 
25 28
 /**
26 29
  * <p>
@@ -41,6 +44,9 @@ public class TaRoomOrderController extends BaseController {
41 44
     @Autowired
42 45
     public ITaRoomOrderService iTaRoomOrderService;
43 46
 
47
+    @Autowired
48
+    public ITaRoomOrderPersonService roomOrderPersonService;
49
+
44 50
     @Autowired
45 51
     public ITaRoomService iTaRoomService;
46 52
 
@@ -62,17 +68,30 @@ public class TaRoomOrderController extends BaseController {
62 68
      * @param pageSize
63 69
      * @return
64 70
      */
65
-    @RequestMapping(value="/admin/taRoomOrder",method= RequestMethod.GET)
66
-    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
71
+    @RequestMapping(value="/wx/roomOrder",method= RequestMethod.GET)
72
+    @ApiOperation(value="房源订单列表", notes = "房源订单列表", httpMethod = "GET", response = ResponseBean.class)
67 73
     public ResponseBean taRoomOrderList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
68
-									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
69
-
70
-		    IPage<TaRoomOrder> pg = new Page<>(pageNum, pageSize);
71
-            QueryWrapper<TaRoomOrder> queryWrapper = new QueryWrapper<>();
72
-            queryWrapper.orderByDesc("create_date");
74
+                                        @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
75
+                                        @ApiParam("房源ID") @RequestParam("roomId") String roomId ) throws Exception{
76
+
77
+        IPage<TaRoomOrder> pg = new Page<>(pageNum, pageSize);
78
+        QueryWrapper<TaRoomOrder> queryWrapper = new QueryWrapper<>();
79
+        queryWrapper.eq("room_id", roomId);
80
+        queryWrapper.eq("status", Constants.STATUS_NORMAL);
81
+        queryWrapper.orderByDesc("create_date");
82
+
83
+        IPage<TaRoomOrder> result = iTaRoomOrderService.page(pg, queryWrapper);
84
+
85
+        // 遍历房源入住人
86
+        List<TaRoomOrder> list = result.getRecords();
87
+        if (null != list) {
88
+            for (TaRoomOrder roomOrder : list) {
89
+                List<TaRoomOrderPerson> personList = roomOrderPersonService.getListByRoomOrder(roomOrder.getRoomOrderId());
90
+                roomOrder.setPersonList(personList);
91
+            }
92
+        }
73 93
 
74
-            IPage<TaRoomOrder> result = iTaRoomOrderService.page(pg, queryWrapper);
75
-            return ResponseBean.success(result);
94
+        return ResponseBean.success(result);
76 95
     }
77 96
 
78 97
     /**
@@ -153,7 +172,7 @@ public class TaRoomOrderController extends BaseController {
153 172
      */
154 173
     @RequestMapping(value="/wx/roomOrder/{id}",method= RequestMethod.GET)
155 174
     @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
156
-    public ResponseBean taRoomOrderGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
175
+    public ResponseBean taRoomOrderGet(@ApiParam("对象ID") @PathVariable String id) throws Exception{
157 176
         return ResponseBean.success(iTaRoomOrderService.getById(id));
158 177
     }
159 178
 

+ 1
- 20
src/main/java/com/yunzhi/shigongli/controller/TaRoomOrderPersonController.java Zobrazit soubor

@@ -56,25 +56,6 @@ public class TaRoomOrderPersonController extends BaseController {
56 56
     public ITaRoomService iTaRoomService;
57 57
 
58 58
 
59
-//    /**
60
-//     * 分页查询列表
61
-//     * @param pageNum
62
-//     * @param pageSize
63
-//     * @return
64
-//     */
65
-//    @RequestMapping(value="/wx/taRoomOrderPerson",method= RequestMethod.GET)
66
-//    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
67
-//    public ResponseBean taRoomOrderPersonList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
68
-//									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
69
-//
70
-//		    IPage<TaRoomOrderPerson> pg = new Page<>(pageNum, pageSize);
71
-//            QueryWrapper<TaRoomOrderPerson> queryWrapper = new QueryWrapper<>();
72
-//            queryWrapper.orderByDesc("create_date");
73
-//
74
-//            IPage<TaRoomOrderPerson> result = iTaRoomOrderPersonService.page(pg, queryWrapper);
75
-//            return ResponseBean.success(result);
76
-//    }
77
-
78 59
     /**
79 60
      * 保存对象
80 61
      * @param roomOrderPersonList 实体对象
@@ -94,7 +75,7 @@ public class TaRoomOrderPersonController extends BaseController {
94 75
             return ResponseBean.error("未找到有效的房源信息", ResponseBean.ERROR_ILLEGAL_PARAMS);
95 76
         }
96 77
 
97
-        TaRoom taRoom = iTaRoomService.getById(id);
78
+        TaRoom taRoom = iTaRoomService.getById(taRoomOrder.getRoomId());
98 79
         if (taRoom == null || !Constants.STATUS_NORMAL.equals(taRoom.getStatus())) {
99 80
             return ResponseBean.error("未找到有效的房源信息", ResponseBean.ERROR_ILLEGAL_PARAMS);
100 81
         }

+ 55
- 3
src/main/java/com/yunzhi/shigongli/controller/TaShopAccountController.java Zobrazit soubor

@@ -3,10 +3,10 @@ package com.yunzhi.shigongli.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.yunzhi.shigongli.common.BaseController;
7
-import com.yunzhi.shigongli.common.ResponseBean;
8
-import com.yunzhi.shigongli.common.StringUtils;
6
+import com.yunzhi.shigongli.common.*;
9 7
 import com.yunzhi.shigongli.entity.TaHotelAccount;
8
+import com.yunzhi.shigongli.service.ITaOrderSubService;
9
+import com.yunzhi.shigongli.service.ITaShopAccountLogService;
10 10
 import com.yunzhi.shigongli.vo.CommissionSettlementVO;
11 11
 import io.swagger.annotations.Api;
12 12
 import io.swagger.annotations.ApiOperation;
@@ -18,6 +18,10 @@ import org.springframework.web.bind.annotation.*;
18 18
 import com.yunzhi.shigongli.service.ITaShopAccountService;
19 19
 import com.yunzhi.shigongli.entity.TaShopAccount;
20 20
 
21
+import java.time.LocalDateTime;
22
+import java.util.HashMap;
23
+import java.util.Map;
24
+
21 25
 /**
22 26
  * <p>
23 27
     * 民宿账户 前端控制器
@@ -37,6 +41,12 @@ public class TaShopAccountController extends BaseController {
37 41
     @Autowired
38 42
     public ITaShopAccountService iTaShopAccountService;
39 43
 
44
+    @Autowired
45
+    public ITaOrderSubService iTaOrderSubService;
46
+
47
+    @Autowired
48
+    public ITaShopAccountLogService iTaShopAccountLogService;
49
+
40 50
     /**
41 51
      * 佣金结算
42 52
      * @param commissionSettlementVO
@@ -72,6 +82,48 @@ public class TaShopAccountController extends BaseController {
72 82
         }
73 83
     }
74 84
 
85
+    @GetMapping("/wx/shop/{id}/account")
86
+    @ApiOperation(value="商铺账户", notes = "商铺账户", httpMethod = "GET", response = ResponseBean.class)
87
+    public ResponseBean getAccountInfo(@ApiParam("对象ID") @PathVariable String id,
88
+                                       @ApiParam("收入类型") @RequestParam("amountType") String amountType) throws Exception {
89
+
90
+        Map<String, Object> result = new HashMap<>();
91
+        TaShopAccount taShopAccount = iTaShopAccountService.getByShop(id);
92
+        if (null == taShopAccount) {
93
+            return ResponseBean.error("未找到有效的结算民宿对象", ResponseBean.ERROR_MISSING_PARAMS);
94
+        }
95
+        result.put("acc", taShopAccount);
96
+
97
+        LocalDateTime now = LocalDateTime.now();
98
+        if (Constants.ACCOUNT_ORDER.equals(amountType)) {
99
+            // 获取全部订单金额
100
+            LocalDateTime start = DateUtils.from("2000-01-01 00:00:00", "yyyy-MM-dd HH:mm:ss");
101
+            LocalDateTime end = now;
102
+            Integer totalCharges = iTaOrderSubService.getTotalCharges(Constants.TARGET_SHOP, id, start, end);
103
+            result.put("totalCharges", totalCharges);
104
+            // 本月订单金额
105
+            String month = DateUtils.toString(end, "yyyy-MM");
106
+            start = DateUtils.from(month + "-01 00:00:00", "yyyy-MM-dd HH:mm:ss");
107
+            Integer currentCharges = iTaOrderSubService.getTotalCharges(Constants.TARGET_SHOP, id, start, end);
108
+            result.put("currentCharges", currentCharges);
109
+        }
110
+
111
+        if (Constants.ACCOUNT_COMMISSION.equals(amountType)) {
112
+            // 获取全部佣金金额
113
+            LocalDateTime start = DateUtils.from("2000-01-01 00:00:00", "yyyy-MM-dd HH:mm:ss");
114
+            LocalDateTime end = now;
115
+            Integer totalCharges = iTaShopAccountLogService.getTotalCharges(taShopAccount.getAccountId(), Constants.ACCOUNT_COMMISSION, start, end);
116
+            result.put("totalCharges", totalCharges);
117
+            // 本月订单金额
118
+            String month = DateUtils.toString(end, "yyyy-MM");
119
+            start = DateUtils.from(month + "-01 00:00:00", "yyyy-MM-dd HH:mm:ss");
120
+            Integer currentCharges = iTaShopAccountLogService.getTotalCharges(taShopAccount.getAccountId(), Constants.ACCOUNT_COMMISSION, start, end);
121
+            result.put("currentCharges", currentCharges);
122
+        }
123
+
124
+        return ResponseBean.success(result);
125
+    }
126
+
75 127
 //
76 128
 //
77 129
 //    /**

+ 29
- 77
src/main/java/com/yunzhi/shigongli/controller/TaShopAccountLogController.java Zobrazit soubor

@@ -4,7 +4,10 @@ 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.yunzhi.shigongli.common.BaseController;
7
+import com.yunzhi.shigongli.common.Constants;
7 8
 import com.yunzhi.shigongli.common.ResponseBean;
9
+import com.yunzhi.shigongli.common.StringUtils;
10
+import com.yunzhi.shigongli.entity.TaHotelAccountLog;
8 11
 import io.swagger.annotations.Api;
9 12
 import io.swagger.annotations.ApiOperation;
10 13
 import io.swagger.annotations.ApiParam;
@@ -39,81 +42,30 @@ public class TaShopAccountLogController extends BaseController {
39 42
     @Autowired
40 43
     public ITaShopAccountLogService iTaShopAccountLogService;
41 44
 
42
-//
43
-//    /**
44
-//     * 分页查询列表
45
-//     * @param pageNum
46
-//     * @param pageSize
47
-//     * @return
48
-//     */
49
-//    @RequestMapping(value="/taShopAccountLog",method= RequestMethod.GET)
50
-//    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
-//    public ResponseBean taShopAccountLogList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
-//									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
53
-//
54
-//		    IPage<TaShopAccountLog> pg = new Page<>(pageNum, pageSize);
55
-//            QueryWrapper<TaShopAccountLog> queryWrapper = new QueryWrapper<>();
56
-//            queryWrapper.orderByDesc("create_date");
57
-//
58
-//            IPage<TaShopAccountLog> result = iTaShopAccountLogService.page(pg, queryWrapper);
59
-//            return ResponseBean.success(result);
60
-//    }
61
-//
62
-//    /**
63
-//     * 保存对象
64
-//     * @param taShopAccountLog 实体对象
65
-//     * @return
66
-//     */
67
-//    @RequestMapping(value="/taShopAccountLog",method= RequestMethod.POST)
68
-//    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69
-//    public ResponseBean taShopAccountLogAdd(@ApiParam("保存内容") @RequestBody TaShopAccountLog taShopAccountLog) throws Exception{
70
-//
71
-//        if (iTaShopAccountLogService.save(taShopAccountLog)){
72
-//            return ResponseBean.success(taShopAccountLog);
73
-//        }else {
74
-//            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
75
-//        }
76
-//    }
77
-//
78
-//    /**
79
-//     * 根据id删除对象
80
-//     * @param id  实体ID
81
-//     */
82
-//    @RequestMapping(value="/taShopAccountLog/{id}", method= RequestMethod.DELETE)
83
-//    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
-//    public ResponseBean taShopAccountLogDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
85
-//        if(iTaShopAccountLogService.removeLogicById(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 taShopAccountLog 实体对象
96
-//     * @return
97
-//     */
98
-//    @RequestMapping(value="/taShopAccountLog/{id}",method= RequestMethod.PUT)
99
-//    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100
-//    public ResponseBean taShopAccountLogUpdate(@ApiParam("对象ID") @PathVariable Integer id,
101
-//                                        @ApiParam("更新内容") @RequestBody TaShopAccountLog taShopAccountLog) throws Exception{
102
-//
103
-//        if (iTaShopAccountLogService.updateById(taShopAccountLog)){
104
-//            return ResponseBean.success(iTaShopAccountLogService.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="/taShopAccountLog/{id}",method= RequestMethod.GET)
115
-//    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
-//    public ResponseBean taShopAccountLogGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
117
-//        return ResponseBean.success(iTaShopAccountLogService.getById(id));
118
-//    }
45
+    /**
46
+     * 获取账户流水
47
+     * @param pageNum
48
+     * @param pageSize
49
+     * @return
50
+     */
51
+    @RequestMapping(value="/wx/shop/account/{id}/log",method= RequestMethod.GET)
52
+    @ApiOperation(value="获取账户流水", notes = "获取账户流水", httpMethod = "GET", response = ResponseBean.class)
53
+    public ResponseBean taHotelAccountLogList(@ApiParam("账户ID") @PathVariable String id,
54
+                                              @ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
55
+                                              @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
56
+                                              @ApiParam("账户流水类型") @RequestParam(value ="amountType", required = false) String amountType) throws Exception{
57
+
58
+        if (StringUtils.isEmpty(amountType)) {
59
+            amountType = Constants.ACCOUNT_COMMISSION;
60
+        }
61
+
62
+        IPage<TaShopAccountLog> pg = new Page<>(pageNum, pageSize);
63
+        QueryWrapper<TaShopAccountLog> queryWrapper = new QueryWrapper<>();
64
+        queryWrapper.eq("account_id", id);
65
+        queryWrapper.eq("amount_type", amountType);
66
+        queryWrapper.orderByDesc("create_date");
67
+
68
+        IPage<TaShopAccountLog> result = iTaShopAccountLogService.page(pg, queryWrapper);
69
+        return ResponseBean.success(result);
70
+    }
119 71
 }

+ 94
- 1
src/main/java/com/yunzhi/shigongli/controller/TaShopController.java Zobrazit soubor

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 5
 import com.yunzhi.shigongli.common.*;
6 6
 import com.yunzhi.shigongli.entity.*;
7 7
 import com.yunzhi.shigongli.service.*;
8
+import com.yunzhi.shigongli.vo.QrCodeParamsVO;
8 9
 import com.yunzhi.shigongli.vo.ResourceFieldVO;
9 10
 import com.yunzhi.shigongli.vo.ShopListVO;
10 11
 import io.swagger.annotations.Api;
@@ -14,9 +15,14 @@ import org.slf4j.Logger;
14 15
 import org.slf4j.LoggerFactory;
15 16
 import org.springframework.beans.BeanUtils;
16 17
 import org.springframework.beans.factory.annotation.Autowired;
18
+import org.springframework.beans.factory.annotation.Value;
17 19
 import org.springframework.web.bind.annotation.*;
18 20
 
19 21
 import java.time.LocalDateTime;
22
+import java.util.HashMap;
23
+import java.util.List;
24
+import java.util.Map;
25
+import java.util.Optional;
20 26
 
21 27
 /**
22 28
  * <p>
@@ -57,6 +63,15 @@ public class TaShopController extends BaseController {
57 63
     @Autowired
58 64
     public ITaLikeService iTaLikeService;
59 65
 
66
+    @Autowired
67
+    public ITaShopAccountService iTaShopAccountService;
68
+
69
+    @Autowired
70
+    public ITaMiniappQrcodeService iTaMiniappQrcodeService;
71
+
72
+    @Value("${sysBiz.miniapp.shopPage}")
73
+    public String shopPage;
74
+
60 75
     /**
61 76
      * 分页查询列表
62 77
      * @param pageNum
@@ -193,7 +208,7 @@ public class TaShopController extends BaseController {
193 208
     @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
194 209
     public ResponseBean taShopGet(@ApiParam("对象ID") @PathVariable String id) throws Exception {
195 210
         TaShop taShop = iTaShopService.getById(id);
196
-        if (Constants.STATUS_DELETED.equals(taShop.getStatus())) {
211
+        if (null == taShop || Constants.STATUS_DELETED.equals(taShop.getStatus())) {
197 212
             return ResponseBean.error("当前商铺信息不存在", ResponseBean.ERROR_ILLEGAL_PARAMS);
198 213
         }
199 214
 
@@ -207,6 +222,27 @@ public class TaShopController extends BaseController {
207 222
         return ResponseBean.success(taShop);
208 223
     }
209 224
 
225
+    @PostMapping("/admin/taShop/{id}/qrcode")
226
+    @ApiOperation(value="店铺二维码", notes = "店铺二维码", httpMethod = "POST", response = ResponseBean.class)
227
+    public ResponseBean generateQrCode(@ApiParam("对象ID") @PathVariable String id) throws Exception {
228
+        TaShop taShop = iTaShopService.getById(id);
229
+        if (null == taShop || Constants.STATUS_DELETED.equals(taShop.getStatus())) {
230
+            return ResponseBean.error("当前商铺信息不存在", ResponseBean.ERROR_ILLEGAL_PARAMS);
231
+        }
232
+
233
+        QrCodeParamsVO qrCodeParamsVO = new QrCodeParamsVO();
234
+        qrCodeParamsVO.setPage(shopPage);
235
+        qrCodeParamsVO.setType(Constants.TARGET_SHOP);
236
+        qrCodeParamsVO.setScene(new HashMap<String, Object>(){{
237
+            put("id", id);
238
+        }});
239
+        String qrCode = iTaMiniappQrcodeService.createQrCode(qrCodeParamsVO);
240
+
241
+        return ResponseBean.success(new HashMap<String, Object>(){{
242
+            put("qrCode", qrCode);
243
+        }});
244
+    }
245
+
210 246
     /**
211 247
      * 微信端详情
212 248
      * @param id
@@ -245,4 +281,61 @@ public class TaShopController extends BaseController {
245 281
         return ResponseBean.success(taShop);
246 282
     }
247 283
 
284
+    /**
285
+     * 商铺小程序首页
286
+     */
287
+    @RequestMapping(value="/wx/shop/manage/index",method= RequestMethod.GET)
288
+    @ApiOperation(value="商铺小程序首页", notes = "商铺小程序首页", httpMethod = "GET", response = ResponseBean.class)
289
+    public ResponseBean getWxManageIndex() throws Exception{
290
+        TaPerson taPerson = getCurrentPerson();
291
+        if (!Constants.TARGET_SHOP.equals(taPerson.getPersonRole())) {
292
+            return ResponseBean.error("请先进行人员身份绑定", ResponseBean.ERROR_ILLEGAL_PARAMS);
293
+        }
294
+
295
+        // 获取所有的民宿信息
296
+        List<TaShop> shopList = iTaShopService.getListByPerson(taPerson);
297
+        if (null == shopList || shopList.size() < 1) {
298
+            return ResponseBean.error("数据异常, 未找到关联民宿", ResponseBean.ERROR_UNAVAILABLE);
299
+        }
300
+
301
+        Map<String, Object> result = new HashMap<>();
302
+        result.put("shopList", shopList);
303
+        result.put("shop", shopList.get(0));
304
+
305
+        return ResponseBean.success(result);
306
+    }
307
+
308
+//    /**
309
+//     * 民宿小程序首页
310
+//     */
311
+//    @RequestMapping(value="/wx/hotel/manage/{id}",method= RequestMethod.GET)
312
+//    @ApiOperation(value="民宿小程序首页", notes = "民宿小程序首页", httpMethod = "GET", response = ResponseBean.class)
313
+//    public ResponseBean getWxManageHotel(@ApiParam("民宿ID") @PathVariable String id) throws Exception{
314
+//        TaPerson taPerson = getCurrentPerson();
315
+//        if (!Constants.TARGET_HOTEL.equals(taPerson.getPersonRole())) {
316
+//            return ResponseBean.error("请先进行人员身份绑定", ResponseBean.ERROR_ILLEGAL_PARAMS);
317
+//        }
318
+//
319
+//        // 获取所有的民宿信息
320
+//        List<TaHotel> hotelList = iTaHotelService.getListByPerson(taPerson);
321
+//        if (null == hotelList || hotelList.size() < 1) {
322
+//            return ResponseBean.error("数据异常, 未找到关联民宿", ResponseBean.ERROR_UNAVAILABLE);
323
+//        }
324
+//
325
+//        Optional<TaHotel> first = hotelList.stream().filter(x -> x.getHotelId().equals(id)).findFirst();
326
+//        if (!first.isPresent()) {
327
+//            return ResponseBean.error("数据异常, 未找到关联民宿", ResponseBean.ERROR_UNAVAILABLE);
328
+//        }
329
+//
330
+//        // 默认获取第一个店铺信息
331
+//        TaHotel taHotel = first.get();
332
+//        TaHotelAccount taHotelAccount = iTaHotelAccountService.getAccountInfoBy(taHotel.getHotelId());
333
+//
334
+//        Map<String, Object> result = new HashMap<>();
335
+//        result.put("hotel", taHotel);
336
+//        result.put("account", taHotelAccount);
337
+//
338
+//        return ResponseBean.success(result);
339
+//    }
340
+
248 341
 }

+ 166
- 0
src/main/java/com/yunzhi/shigongli/controller/TaVerifyTargetController.java Zobrazit soubor

@@ -0,0 +1,166 @@
1
+package com.yunzhi.shigongli.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.yunzhi.shigongli.common.BaseController;
7
+import com.yunzhi.shigongli.common.Constants;
8
+import com.yunzhi.shigongli.common.ResponseBean;
9
+import com.yunzhi.shigongli.common.StringUtils;
10
+import com.yunzhi.shigongli.entity.*;
11
+import com.yunzhi.shigongli.service.*;
12
+import com.yunzhi.shigongli.vo.VerifyTargetVO;
13
+import io.swagger.annotations.Api;
14
+import io.swagger.annotations.ApiOperation;
15
+import io.swagger.annotations.ApiParam;
16
+import org.slf4j.Logger;
17
+import org.slf4j.LoggerFactory;
18
+import org.springframework.beans.factory.annotation.Autowired;
19
+import org.springframework.web.bind.annotation.*;
20
+
21
+import java.time.LocalDateTime;
22
+import java.util.List;
23
+
24
+/**
25
+ * <p>
26
+    * 核销内容表 前端控制器
27
+    * </p>
28
+ *
29
+ * @author yansen
30
+ * @since 2021-08-17
31
+ */
32
+
33
+@Api(tags = "核销内容表")
34
+@RestController
35
+@RequestMapping("/")
36
+public class TaVerifyTargetController extends BaseController {
37
+
38
+    private final Logger logger = LoggerFactory.getLogger(TaVerifyTargetController.class);
39
+
40
+    @Autowired
41
+    public ITaVerifyTargetService iTaVerifyTargetService;
42
+
43
+    @Autowired
44
+    public ITaOrderSubService iTaOrderSubService;
45
+
46
+    @Autowired
47
+    public ITaOrderService iTaOrderService;
48
+
49
+    @Autowired
50
+    public ITaShopWorkerService shopWorkerService;
51
+
52
+    /**
53
+     * 分页查询列表
54
+     * @param pageNum
55
+     * @param pageSize
56
+     * @return
57
+     */
58
+    @RequestMapping(value="/wx/verifyTarget",method= RequestMethod.GET)
59
+    @ApiOperation(value="核销内容表", notes = "核销内容表", httpMethod = "GET", response = ResponseBean.class)
60
+    public ResponseBean tdTypeList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
61
+                                   @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
62
+                                   @ApiParam("商铺ID") @RequestParam(value ="shopId", required = false) String shopId,
63
+                                   @ApiParam("客户手机") @RequestParam(value ="phone", required = false) String phone,
64
+                                   @ApiParam("是否本人") @RequestParam(value ="isMine", required = false) Boolean isMine,
65
+                                   @ApiParam("是否核销") @RequestParam(value ="isVerified", required = false) Integer isVerified) throws Exception{
66
+
67
+        String personId = getCurrentPerson().getPersonId();
68
+        if (!StringUtils.isEmpty(shopId)) {
69
+            // 如果商铺不为空, 那么检索商铺的核销订单
70
+            personId = null;
71
+        }
72
+
73
+        if (null != isMine && isMine) {
74
+            personId = getCurrentPerson().getPersonId();
75
+        }
76
+
77
+        IPage<VerifyTargetVO> pg = new Page<>(pageNum, pageSize);
78
+        IPage<VerifyTargetVO> result = iTaVerifyTargetService.getWxPagedBy(pg, personId, shopId, phone, isVerified);
79
+        return ResponseBean.success(result);
80
+    }
81
+
82
+    /**
83
+     * 核销
84
+     * @param id
85
+     * @return
86
+     * @throws Exception
87
+     */
88
+    @PutMapping("/wx/verifyTarget/{id}")
89
+    @ApiOperation(value="订单项目核销", notes = "订单项目核销", httpMethod = "PUT", response = ResponseBean.class)
90
+    public ResponseBean valdiation(@ApiParam(value = "核销码") @PathVariable String id) throws Exception {
91
+        TaVerifyTarget taVerifyTarget = iTaVerifyTargetService.getById(id);
92
+        if (null == taVerifyTarget || Constants.STATUS_DELETED.equals(taVerifyTarget.getStatus())) {
93
+            return ResponseBean.error("未找到待核销内容", ResponseBean.ERROR_ILLEGAL_PARAMS);
94
+        }
95
+
96
+        TaPerson taPerson = getCurrentPerson();
97
+        TaOrder taOrder = iTaOrderService.getById(taVerifyTarget.getOrderId());
98
+        TaOrderSub taOrderSub = iTaOrderSubService.getById(taVerifyTarget.getSubOrderId());
99
+
100
+        // 是否属于当前用户
101
+        String personId = getCurrentPerson().getPersonId();
102
+        if (!personId.equals(taVerifyTarget.getPersonId())) {
103
+            return ResponseBean.error("您无权核销当前内容", ResponseBean.ERROR_ILLEGAL_PARAMS);
104
+        }
105
+
106
+        LocalDateTime expireDate = taVerifyTarget.getExpireDate();
107
+        if (null != expireDate && expireDate.isBefore(LocalDateTime.now())) {
108
+            return ResponseBean.error("当前项目已过期", ResponseBean.ERROR_ILLEGAL_PARAMS);
109
+        }
110
+
111
+        // 核销
112
+        iTaVerifyTargetService.verify(taVerifyTarget);
113
+
114
+        // 是否当前子订单下所有都已经核销完成
115
+        int cnt = iTaVerifyTargetService.getCountBy(taVerifyTarget.getOrderId(), taVerifyTarget.getSubOrderId(), 0);
116
+        if (cnt == 0) {
117
+            iTaOrderSubService.validation(taPerson, taOrder, taOrderSub);
118
+        }
119
+
120
+        return ResponseBean.success("核销成功");
121
+    }
122
+
123
+    /**
124
+     * 核销确认
125
+     * @param id
126
+     * @return
127
+     * @throws Exception
128
+     */
129
+    @PutMapping("/wx/verifyTarget/{id}/confirm")
130
+    @ApiOperation(value="核销确认", notes = "核销确认", httpMethod = "PUT", response = ResponseBean.class)
131
+    public ResponseBean valdiateConfirm(@ApiParam(value = "核销码") @PathVariable String id) throws Exception {
132
+        TaVerifyTarget taVerifyTarget = iTaVerifyTargetService.getById(id);
133
+        if (null == taVerifyTarget || Constants.STATUS_DELETED.equals(taVerifyTarget.getStatus())) {
134
+            return ResponseBean.error("未找到待核销内容", ResponseBean.ERROR_ILLEGAL_PARAMS);
135
+        }
136
+
137
+        if (null != taVerifyTarget.getIsConfirmVerified() && taVerifyTarget.getIsConfirmVerified()) {
138
+            return ResponseBean.error("请勿重复确认核销", ResponseBean.ERROR_ILLEGAL_PARAMS);
139
+        }
140
+
141
+        TaPerson taPerson = getCurrentPerson();
142
+        TaOrder taOrder = iTaOrderService.getById(taVerifyTarget.getOrderId());
143
+        TaOrderSub taOrderSub = iTaOrderSubService.getById(taVerifyTarget.getSubOrderId());
144
+
145
+        // 是否属于当前用户
146
+        List<TaShopWorker> workerList = shopWorkerService.getByPerson(taPerson.getPersonId());
147
+        if (null == workerList || workerList.size() < 1) {
148
+            return ResponseBean.error("您无权操作", ResponseBean.ERROR_ILLEGAL_PARAMS);
149
+        }
150
+        boolean isOwner = false;
151
+        for (TaShopWorker worker : workerList) {
152
+            isOwner = isOwner || worker.getShopId().equals(taOrderSub.getShopId());
153
+        }
154
+        if (!isOwner) {
155
+            return ResponseBean.error("您无权操作", ResponseBean.ERROR_ILLEGAL_PARAMS);
156
+        }
157
+
158
+        // 确认核销
159
+        taVerifyTarget.setIsConfirmVerified(true);
160
+        taVerifyTarget.setConfirmPerson(taPerson.getPersonId());
161
+        taVerifyTarget.setConfirmDate(LocalDateTime.now());
162
+        iTaVerifyTargetService.updateById(taVerifyTarget);
163
+
164
+        return ResponseBean.success("ok");
165
+    }
166
+}

+ 90
- 0
src/main/java/com/yunzhi/shigongli/controller/TrPersonPageController.java Zobrazit soubor

@@ -0,0 +1,90 @@
1
+package com.yunzhi.shigongli.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.yunzhi.shigongli.common.BaseController;
7
+import com.yunzhi.shigongli.common.Constants;
8
+import com.yunzhi.shigongli.common.ResponseBean;
9
+import com.yunzhi.shigongli.common.StringUtils;
10
+import com.yunzhi.shigongli.entity.TdType;
11
+import com.yunzhi.shigongli.entity.TrPersonPage;
12
+import com.yunzhi.shigongli.service.ITdTypeService;
13
+import com.yunzhi.shigongli.service.ITrPersonPageService;
14
+import io.swagger.annotations.Api;
15
+import io.swagger.annotations.ApiOperation;
16
+import io.swagger.annotations.ApiParam;
17
+import org.slf4j.Logger;
18
+import org.slf4j.LoggerFactory;
19
+import org.springframework.beans.factory.annotation.Autowired;
20
+import org.springframework.web.bind.annotation.*;
21
+
22
+import java.time.Duration;
23
+import java.time.LocalDateTime;
24
+
25
+/**
26
+ * <p>
27
+    * 用户访问埋点 前端控制器
28
+    * </p>
29
+ *
30
+ * @author yansen
31
+ * @since 2021-08-17
32
+ */
33
+
34
+@Api(tags = "用户访问埋点")
35
+@RestController
36
+@RequestMapping("/")
37
+public class TrPersonPageController extends BaseController {
38
+
39
+    private final Logger logger = LoggerFactory.getLogger(TrPersonPageController.class);
40
+
41
+    @Autowired
42
+    public ITrPersonPageService iTrPersonPageService;
43
+
44
+
45
+    /**
46
+     * 保存对象
47
+     * @param trPersonPage 实体对象
48
+     * @return
49
+     */
50
+    @RequestMapping(value="/wx/track/page",method= RequestMethod.POST)
51
+    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
52
+    public ResponseBean tdTypeAdd(@ApiParam("保存内容") @RequestBody TrPersonPage trPersonPage) throws Exception{
53
+
54
+        LocalDateTime now = LocalDateTime.now();
55
+        trPersonPage.setPersonId(getCurrentPerson().getPersonId());
56
+        trPersonPage.setInDate(now);
57
+        trPersonPage.setOutDate(now);
58
+        trPersonPage.setDwellTime(0l);
59
+        trPersonPage.setCreateDate(now);
60
+
61
+        if (iTrPersonPageService.save(trPersonPage)){
62
+            return ResponseBean.success(trPersonPage);
63
+        }else {
64
+            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
65
+        }
66
+    }
67
+
68
+    /**
69
+     * 修改对象
70
+     * @param id  实体ID
71
+     * @return
72
+     */
73
+    @RequestMapping(value="/wx/track/page/{id}",method= RequestMethod.PUT)
74
+    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
75
+    public ResponseBean tdTypeUpdate(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
76
+        TrPersonPage trPersonPage = iTrPersonPageService.getById(id);
77
+
78
+        LocalDateTime now = LocalDateTime.now();
79
+        Duration duration = Duration.between(trPersonPage.getInDate(), now);
80
+        trPersonPage.setOutDate(LocalDateTime.now());
81
+        trPersonPage.setDwellTime(duration.toMillis() / 1000);
82
+
83
+        if (iTrPersonPageService.updateById(trPersonPage)){
84
+            return ResponseBean.success(trPersonPage);
85
+        }else {
86
+            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
87
+        }
88
+    }
89
+
90
+}

+ 5
- 0
src/main/java/com/yunzhi/shigongli/entity/TaFeedback.java Zobrazit soubor

@@ -39,5 +39,10 @@ public class TaFeedback implements Serializable {
39 39
     @ApiModelProperty(value = "时间")
40 40
     private LocalDateTime createDate;
41 41
 
42
+    @ApiModelProperty(value = "是否已读")
43
+    private Boolean isReaded;
44
+
45
+    @ApiModelProperty(value = "读取时间")
46
+    private LocalDateTime readDate;
42 47
 
43 48
 }

+ 5
- 0
src/main/java/com/yunzhi/shigongli/entity/TaOrder.java Zobrazit soubor

@@ -52,4 +52,9 @@ public class TaOrder implements Serializable {
52 52
     @ApiModelProperty(value = "创建时间")
53 53
     private LocalDateTime createDate;
54 54
 
55
+    @ApiModelProperty(value = "退款原因")
56
+    private String refundReason;
57
+
58
+    @ApiModelProperty(value = "退款说明")
59
+    private String refundDecription;
55 60
 }

+ 6
- 0
src/main/java/com/yunzhi/shigongli/entity/TaRoomOrder.java Zobrazit soubor

@@ -6,6 +6,8 @@ import java.time.LocalDateTime;
6 6
 import com.baomidou.mybatisplus.annotation.TableField;
7 7
 import com.baomidou.mybatisplus.annotation.TableId;
8 8
 import java.io.Serializable;
9
+import java.util.List;
10
+
9 11
 import io.swagger.annotations.ApiModel;
10 12
 import io.swagger.annotations.ApiModelProperty;
11 13
 import lombok.Data;
@@ -59,4 +61,8 @@ public class TaRoomOrder implements Serializable {
59 61
     @ApiModelProperty(value = "分享图")
60 62
     @TableField(exist = false)
61 63
     private String shareImage;
64
+
65
+    @ApiModelProperty(value = "房源入住人")
66
+    @TableField(exist = false)
67
+    private List<TaRoomOrderPerson> personList;
62 68
 }

+ 90
- 0
src/main/java/com/yunzhi/shigongli/entity/TaVerifyTarget.java Zobrazit soubor

@@ -0,0 +1,90 @@
1
+package com.yunzhi.shigongli.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import io.swagger.annotations.ApiModel;
6
+import io.swagger.annotations.ApiModelProperty;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+import lombok.experimental.Accessors;
10
+
11
+import java.io.Serializable;
12
+import java.time.LocalDateTime;
13
+
14
+/**
15
+ * <p>
16
+ * 核销内容表
17
+ * </p>
18
+ *
19
+ * @author yansen
20
+ * @since 2021-08-17
21
+ */
22
+@Data
23
+@EqualsAndHashCode(callSuper = false)
24
+@Accessors(chain = true)
25
+@ApiModel(value="TaVerifyTarget对象", description="核销内容表")
26
+public class TaVerifyTarget implements Serializable {
27
+
28
+    private static final long serialVersionUID = 1L;
29
+
30
+    @ApiModelProperty(value = "产品核销码")
31
+    @TableId(value = "verify_no", type = IdType.INPUT)
32
+    private String verifyNo;
33
+
34
+    @ApiModelProperty(value = "产品类型")
35
+    private String targetType;
36
+
37
+    @ApiModelProperty(value = "产品ID")
38
+    private String targetId;
39
+
40
+    @ApiModelProperty(value = "产品描述")
41
+    private String description;
42
+
43
+    @ApiModelProperty(value = "主图")
44
+    private String poster;
45
+
46
+    @ApiModelProperty(value = "价格/单位分")
47
+    private Integer actualPrice;
48
+
49
+    @ApiModelProperty(value = "原始价格/单位分")
50
+    private Integer standPrice;
51
+
52
+    @ApiModelProperty(value = "返现金额/单位分")
53
+    private Integer cashback;
54
+
55
+    @ApiModelProperty(value = "发放时间")
56
+    private LocalDateTime createDate;
57
+
58
+    @ApiModelProperty(value = "过期时间")
59
+    private LocalDateTime expireDate;
60
+
61
+    @ApiModelProperty(value = "下单时间")
62
+    private LocalDateTime orderDate;
63
+
64
+    @ApiModelProperty(value = "下单ID")
65
+    private String orderId;
66
+
67
+    @ApiModelProperty(value = "子单号")
68
+    private String subOrderId;
69
+
70
+    @ApiModelProperty(value = "所属客户")
71
+    private String personId;
72
+
73
+    @ApiModelProperty(value = "是否核销")
74
+    private Boolean isVerified;
75
+
76
+    @ApiModelProperty(value = "核销时间")
77
+    private LocalDateTime verifiedDate;
78
+
79
+    @ApiModelProperty(value = "是否确认核销")
80
+    private Boolean isConfirmVerified;
81
+
82
+    @ApiModelProperty(value = "确认核销人")
83
+    private String confirmPerson;
84
+
85
+    @ApiModelProperty(value = "确认核销时间")
86
+    private LocalDateTime confirmDate;
87
+
88
+    @ApiModelProperty(value = "状态")
89
+    private Integer status;
90
+}

+ 57
- 0
src/main/java/com/yunzhi/shigongli/entity/TrPersonPage.java Zobrazit soubor

@@ -0,0 +1,57 @@
1
+package com.yunzhi.shigongli.entity;
2
+
3
+
4
+import com.baomidou.mybatisplus.annotation.IdType;
5
+import com.baomidou.mybatisplus.annotation.TableId;
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
+import java.time.LocalDateTime;
13
+
14
+/**
15
+ * <p>
16
+ * 用户访问埋点
17
+ * </p>
18
+ *
19
+ * @author yansen
20
+ * @since 2021-08-17
21
+ */
22
+@Data
23
+@EqualsAndHashCode(callSuper = false)
24
+@Accessors(chain = true)
25
+@ApiModel(value="TrPersonPage对象", description="用户访问埋点")
26
+public class TrPersonPage {
27
+
28
+    private static final long serialVersionUID = 1L;
29
+
30
+    @ApiModelProperty(value = "序号")
31
+    @TableId(value = "track_id", type = IdType.AUTO)
32
+    private String trackId;
33
+
34
+    @ApiModelProperty(value = "人员ID")
35
+    private String personId;
36
+
37
+    @ApiModelProperty(value = "地址位置")
38
+    private String location;
39
+
40
+    @ApiModelProperty(value = "页面地址")
41
+    private String page;
42
+
43
+    @ApiModelProperty(value = "页面参数")
44
+    private String params;
45
+
46
+    @ApiModelProperty(value = "创建时间")
47
+    private LocalDateTime createDate;
48
+
49
+    @ApiModelProperty(value = "进入时间")
50
+    private LocalDateTime inDate;
51
+
52
+    @ApiModelProperty(value = "离开时间")
53
+    private LocalDateTime outDate;
54
+
55
+    @ApiModelProperty(value = "驻留时间;单位秒")
56
+    private Long dwellTime;
57
+}

+ 44
- 0
src/main/java/com/yunzhi/shigongli/entity/TsStatisDaily.java Zobrazit soubor

@@ -0,0 +1,44 @@
1
+package com.yunzhi.shigongli.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import io.swagger.annotations.ApiModel;
6
+import io.swagger.annotations.ApiModelProperty;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+import lombok.experimental.Accessors;
10
+
11
+import java.io.Serializable;
12
+import java.time.LocalDateTime;
13
+
14
+/**
15
+ * <p>
16
+ * 日统计
17
+ * </p>
18
+ *
19
+ * @author yansen
20
+ * @since 2021-08-17
21
+ */
22
+@Data
23
+@EqualsAndHashCode(callSuper = false)
24
+@Accessors(chain = true)
25
+@ApiModel(value="TsStatisDaily对象", description="日统计")
26
+public class TsStatisDaily implements Serializable {
27
+
28
+    private static final long serialVersionUID = 1L;
29
+
30
+    @ApiModelProperty(value = "序号")
31
+    @TableId(value = "statis_no", type = IdType.AUTO)
32
+    private String statisNo;
33
+
34
+    @ApiModelProperty(value = "日期;yyyy-MM-dd格式")
35
+    private String statisDate;
36
+
37
+    @ApiModelProperty(value = "统计内容")
38
+    private String statisType;
39
+
40
+    @ApiModelProperty(value = "数目")
41
+    private Integer num;
42
+
43
+
44
+}

+ 10
- 0
src/main/java/com/yunzhi/shigongli/mapper/TaOrderSubMapper.java Zobrazit soubor

@@ -6,7 +6,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6 6
 import com.yunzhi.shigongli.vo.MineOrder;
7 7
 import org.apache.ibatis.annotations.Mapper;
8 8
 import org.apache.ibatis.annotations.Param;
9
+import org.apache.ibatis.annotations.Select;
9 10
 
11
+import java.time.LocalDateTime;
10 12
 import java.util.List;
11 13
 
12 14
 /**
@@ -36,4 +38,12 @@ public interface TaOrderSubMapper extends BaseMapper<TaOrderSub> {
36 38
                                        @Param("isVerified") Integer isVerified);
37 39
 
38 40
     int getOrderNum(@Param("personId") String personId, @Param("status") Integer status);
41
+
42
+    Integer getTotalCharges(@Param("targetType") String targetType,
43
+                            @Param("targetId") String targetId,
44
+                            @Param("start") LocalDateTime start,
45
+                            @Param("end") LocalDateTime end);
46
+
47
+
48
+    MineOrder getSingleOrderSubOf(@Param("personId") String personId, @Param("targetType") String targetType, @Param("subOrderId") Integer subOrderId);
39 49
 }

+ 2
- 0
src/main/java/com/yunzhi/shigongli/mapper/TaRoomOrderPersonMapper.java Zobrazit soubor

@@ -1,8 +1,10 @@
1 1
 package com.yunzhi.shigongli.mapper;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.yunzhi.shigongli.entity.TaRoomOrderPerson;
4 5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 6
 import org.apache.ibatis.annotations.Mapper;
7
+import org.apache.ibatis.annotations.Param;
6 8
 
7 9
 /**
8 10
  * <p>

+ 7
- 0
src/main/java/com/yunzhi/shigongli/mapper/TaShopAccountLogMapper.java Zobrazit soubor

@@ -3,6 +3,9 @@ package com.yunzhi.shigongli.mapper;
3 3
 import com.yunzhi.shigongli.entity.TaShopAccountLog;
4 4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 5
 import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.time.LocalDateTime;
6 9
 
7 10
 /**
8 11
  * <p>
@@ -15,4 +18,8 @@ import org.apache.ibatis.annotations.Mapper;
15 18
 @Mapper
16 19
 public interface TaShopAccountLogMapper extends BaseMapper<TaShopAccountLog> {
17 20
 
21
+    Integer getTotalCharges(@Param("accountId") String accountId,
22
+                            @Param("amountType") String amountType,
23
+                            @Param("start") LocalDateTime start,
24
+                            @Param("end") LocalDateTime end);
18 25
 }

+ 4
- 0
src/main/java/com/yunzhi/shigongli/mapper/TaShopMapper.java Zobrazit soubor

@@ -7,6 +7,8 @@ import com.yunzhi.shigongli.vo.ShopListVO;
7 7
 import org.apache.ibatis.annotations.Mapper;
8 8
 import org.apache.ibatis.annotations.Param;
9 9
 
10
+import java.util.List;
11
+
10 12
 /**
11 13
  * <p>
12 14
  * 商铺 Mapper 接口
@@ -26,4 +28,6 @@ public interface TaShopMapper extends BaseMapper<TaShop> {
26 28
                     @Param("evaluateType") String evaluateType,
27 29
                     @Param("targetType") String targetType,
28 30
                     @Param("targetId") String targetId);
31
+
32
+    List<TaShop> getListByPerson(@Param("personId") String personId);
29 33
 }

+ 30
- 0
src/main/java/com/yunzhi/shigongli/mapper/TaVerifyTargetMapper.java Zobrazit soubor

@@ -0,0 +1,30 @@
1
+package com.yunzhi.shigongli.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.yunzhi.shigongli.entity.TaVerifyTarget;
6
+import com.yunzhi.shigongli.vo.VerifyTargetVO;
7
+import org.apache.ibatis.annotations.Mapper;
8
+import org.apache.ibatis.annotations.Param;
9
+
10
+/**
11
+ * <p>
12
+ * 核销内容表 Mapper 接口
13
+ * </p>
14
+ *
15
+ * @author yansen
16
+ * @since 2021-08-17
17
+ */
18
+@Mapper
19
+public interface TaVerifyTargetMapper extends BaseMapper<TaVerifyTarget> {
20
+
21
+    IPage<VerifyTargetVO> getWxPagedBy(IPage<VerifyTargetVO> pg,
22
+                                       @Param("personId") String personId,
23
+                                       @Param("shopId") String shopId,
24
+                                       @Param("phone") String phone,
25
+                                       @Param("isVerified") Integer isVerified);
26
+
27
+    int existsNo(@Param("verifyNo") String verifyNo);
28
+
29
+    int getCountBy(@Param("orderId") String orderId, @Param("subOrderId") String subOrderId, @Param("isVerified") Integer isVerified);
30
+}

+ 18
- 0
src/main/java/com/yunzhi/shigongli/mapper/TrPersonPageMapper.java Zobrazit soubor

@@ -0,0 +1,18 @@
1
+package com.yunzhi.shigongli.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.yunzhi.shigongli.entity.TrPersonPage;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 用户访问埋点 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author yansen
13
+ * @since 2021-08-17
14
+ */
15
+@Mapper
16
+public interface TrPersonPageMapper extends BaseMapper<TrPersonPage> {
17
+
18
+}

+ 39
- 0
src/main/java/com/yunzhi/shigongli/mapper/TsStatisDailyMapper.java Zobrazit soubor

@@ -0,0 +1,39 @@
1
+package com.yunzhi.shigongli.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.yunzhi.shigongli.entity.TsStatisDaily;
5
+import com.yunzhi.shigongli.vo.StatisDailyVO;
6
+import org.apache.ibatis.annotations.Mapper;
7
+import org.apache.ibatis.annotations.Param;
8
+import org.apache.ibatis.annotations.Select;
9
+
10
+import java.util.List;
11
+
12
+/**
13
+ * <p>
14
+ * 日统计 Mapper 接口
15
+ * </p>
16
+ *
17
+ * @author yansen
18
+ * @since 2021-08-17
19
+ */
20
+@Mapper
21
+public interface TsStatisDailyMapper extends BaseMapper<TsStatisDaily> {
22
+
23
+    List<StatisDailyVO> getListBy(@Param("startDate") String startDate, @Param("statisType") String statisType, @Param("days") long days);
24
+
25
+    @Select("SELECT sum( t.charges ) FROM ta_order_sub t  WHERE t.`status` = 1")
26
+    Integer statisOrderTotal();
27
+
28
+    @Select("SELECT count( 1 ) FROM ta_hotel t WHERE t.`status` > -1")
29
+    Integer countHotelTotal();
30
+
31
+    @Select("SELECT count( 1 ) FROM ta_room t WHERE t.`status` > -1")
32
+    Integer countRoomTotal();
33
+
34
+    @Select("SELECT count( 1 ) FROM ta_shop t WHERE t.`status` > -1")
35
+    Integer countShopTotal();
36
+
37
+    @Select("SELECT count( 1 ) FROM ta_person t WHERE t.`status` > -1")
38
+    Integer countPersonTotal();
39
+}

+ 1
- 3
src/main/java/com/yunzhi/shigongli/service/ITaOrderService.java Zobrazit soubor

@@ -1,7 +1,5 @@
1 1
 package com.yunzhi.shigongli.service;
2 2
 
3
-import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
4
-import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
5 3
 import com.yunzhi.shigongli.entity.TaOrder;
6 4
 
7 5
 import com.yunzhi.shigongli.entity.TaPerson;
@@ -21,5 +19,5 @@ public interface ITaOrderService extends IBaseService<TaOrder> {
21 19
 
22 20
     void cancelOrder(TaOrder taOrder, TaPerson taPerson) throws Exception;
23 21
 
24
-    void refundOrder(TaOrder taOrder, TaPerson taPerson) throws Exception;
22
+    void refundOrder(TaOrder taOrder, TaPerson taPerson, Integer totalCashback) throws Exception;
25 23
 }

+ 5
- 0
src/main/java/com/yunzhi/shigongli/service/ITaOrderSubService.java Zobrazit soubor

@@ -8,6 +8,7 @@ import com.yunzhi.shigongli.entity.TaPerson;
8 8
 import com.yunzhi.shigongli.vo.MineOrder;
9 9
 import com.yunzhi.shigongli.vo.MineOrderSummary;
10 10
 
11
+import java.time.LocalDateTime;
11 12
 import java.util.List;
12 13
 
13 14
 /**
@@ -29,4 +30,8 @@ public interface ITaOrderSubService extends IBaseService<TaOrderSub> {
29 30
     MineOrderSummary getOrderSummary(TaPerson taPerson);
30 31
 
31 32
     List<TaOrderSub> getListByOrder(TaOrder taOrder);
33
+
34
+    Integer getTotalCharges(String targetType, String targetId, LocalDateTime start, LocalDateTime end);
35
+
36
+    MineOrder getSingleOrderSubOf(TaPerson taPerson, Integer subOrderId);
32 37
 }

+ 4
- 1
src/main/java/com/yunzhi/shigongli/service/ITaRoomOrderPersonService.java Zobrazit soubor

@@ -1,7 +1,10 @@
1 1
 package com.yunzhi.shigongli.service;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.yunzhi.shigongli.entity.TaRoomOrderPerson;
4 5
 
6
+import java.util.List;
7
+
5 8
 
6 9
 /**
7 10
  * <p>
@@ -12,5 +15,5 @@ import com.yunzhi.shigongli.entity.TaRoomOrderPerson;
12 15
  * @since 2021-08-17
13 16
  */
14 17
 public interface ITaRoomOrderPersonService extends IBaseService<TaRoomOrderPerson> {
15
-
18
+    List<TaRoomOrderPerson> getListByRoomOrder(String roomOrderId);
16 19
 }

+ 3
- 0
src/main/java/com/yunzhi/shigongli/service/ITaShopAccountLogService.java Zobrazit soubor

@@ -2,6 +2,8 @@ package com.yunzhi.shigongli.service;
2 2
 
3 3
 import com.yunzhi.shigongli.entity.TaShopAccountLog;
4 4
 
5
+import java.time.LocalDateTime;
6
+
5 7
 
6 8
 /**
7 9
  * <p>
@@ -13,4 +15,5 @@ import com.yunzhi.shigongli.entity.TaShopAccountLog;
13 15
  */
14 16
 public interface ITaShopAccountLogService extends IBaseService<TaShopAccountLog> {
15 17
 
18
+    Integer getTotalCharges(String accountId, String amountType, LocalDateTime start, LocalDateTime end);
16 19
 }

+ 2
- 0
src/main/java/com/yunzhi/shigongli/service/ITaShopAccountService.java Zobrazit soubor

@@ -16,4 +16,6 @@ public interface ITaShopAccountService extends IBaseService<TaShopAccount> {
16 16
     TaShopAccount getByShop(String shopId);
17 17
 
18 18
     boolean commissionSettlement(TaShopAccount taShopAccount, Integer charges) throws Exception;
19
+
20
+    TaShopAccount getAccountInfoBy(String shopId);
19 21
 }

+ 5
- 0
src/main/java/com/yunzhi/shigongli/service/ITaShopService.java Zobrazit soubor

@@ -1,10 +1,13 @@
1 1
 package com.yunzhi.shigongli.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.yunzhi.shigongli.entity.TaPerson;
4 5
 import com.yunzhi.shigongli.entity.TaShop;
5 6
 import com.yunzhi.shigongli.vo.ResourceFieldVO;
6 7
 import com.yunzhi.shigongli.vo.ShopListVO;
7 8
 
9
+import java.util.List;
10
+
8 11
 
9 12
 /**
10 13
  * <p>
@@ -23,4 +26,6 @@ public interface ITaShopService extends IBaseService<TaShop> {
23 26
     boolean updatePVNum(String id);
24 27
 
25 28
     ResourceFieldVO copyProperties(TaShop taShop);
29
+
30
+    List<TaShop> getListByPerson(TaPerson taPerson);
26 31
 }

+ 2
- 0
src/main/java/com/yunzhi/shigongli/service/ITaShopWorkerService.java Zobrazit soubor

@@ -23,4 +23,6 @@ public interface ITaShopWorkerService extends IBaseService<TaShopWorker> {
23 23
     List<TaShopWorker> getByPhone(String phone);
24 24
 
25 25
     void updateByPerson(TaPerson taPerson) throws Exception;
26
+
27
+    List<TaShopWorker> getByPerson(String personId);
26 28
 }

+ 25
- 0
src/main/java/com/yunzhi/shigongli/service/ITaVerifyTargetService.java Zobrazit soubor

@@ -0,0 +1,25 @@
1
+package com.yunzhi.shigongli.service;
2
+
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.yunzhi.shigongli.entity.TaVerifyTarget;
5
+import com.yunzhi.shigongli.vo.VerifyTargetVO;
6
+
7
+
8
+/**
9
+ * <p>
10
+ * 核销内容表 服务类
11
+ * </p>
12
+ *
13
+ * @author yansen
14
+ * @since 2021-08-17
15
+ */
16
+public interface ITaVerifyTargetService extends IBaseService<TaVerifyTarget> {
17
+
18
+    IPage<VerifyTargetVO> getWxPagedBy(IPage<VerifyTargetVO> pg, String personId, String shopId, String phone, Integer isVerified);
19
+
20
+    int getCountBy(String orderId, String subOrderId, Integer isVerified);
21
+
22
+    boolean removeBy(String orderId, String subOrderId);
23
+
24
+    void verify(TaVerifyTarget taVerifyTarget) throws Exception;
25
+}

+ 16
- 0
src/main/java/com/yunzhi/shigongli/service/ITrPersonPageService.java Zobrazit soubor

@@ -0,0 +1,16 @@
1
+package com.yunzhi.shigongli.service;
2
+
3
+
4
+import com.yunzhi.shigongli.entity.TrPersonPage;
5
+
6
+/**
7
+ * <p>
8
+ * 用户访问埋点 服务类
9
+ * </p>
10
+ *
11
+ * @author yansen
12
+ * @since 2021-08-17
13
+ */
14
+public interface ITrPersonPageService extends IBaseService<TrPersonPage> {
15
+
16
+}

+ 23
- 0
src/main/java/com/yunzhi/shigongli/service/ITsStatisDailyService.java Zobrazit soubor

@@ -0,0 +1,23 @@
1
+package com.yunzhi.shigongli.service;
2
+
3
+import com.yunzhi.shigongli.entity.TsStatisDaily;
4
+import com.yunzhi.shigongli.vo.StatisDailyVO;
5
+
6
+import java.util.List;
7
+import java.util.Map;
8
+
9
+
10
+/**
11
+ * <p>
12
+ * 日统计 服务类
13
+ * </p>
14
+ *
15
+ * @author yansen
16
+ * @since 2021-08-17
17
+ */
18
+public interface ITsStatisDailyService extends IBaseService<TsStatisDaily> {
19
+
20
+    List<StatisDailyVO> getListBy(String startDate, String statisType, long days);
21
+
22
+    Map<String, Integer> statisSummary();
23
+}

+ 85
- 2
src/main/java/com/yunzhi/shigongli/service/impl/TaOrderPayServiceImpl.java Zobrazit soubor

@@ -17,8 +17,13 @@ import com.yunzhi.shigongli.service.ITaOrderPayService;
17 17
 import org.springframework.beans.factory.annotation.Autowired;
18 18
 import org.springframework.context.ApplicationEventPublisher;
19 19
 import org.springframework.stereotype.Service;
20
+import org.springframework.transaction.annotation.Propagation;
20 21
 import org.springframework.transaction.annotation.Transactional;
21 22
 
23
+import java.time.LocalDateTime;
24
+import java.util.ArrayList;
25
+import java.util.List;
26
+
22 27
 /**
23 28
  * <p>
24 29
  * 订单支付 服务实现类
@@ -51,6 +56,12 @@ public class TaOrderPayServiceImpl extends BaseServiceImpl<TaOrderPayMapper, TaO
51 56
     @Autowired
52 57
     TaShopPackageMapper shopPackageMapper;
53 58
 
59
+    @Autowired
60
+    TaPersonMapper taPersonMapper;
61
+
62
+    @Autowired
63
+    TaVerifyTargetMapper taVerifyTargetMapper;
64
+
54 65
     /**
55 66
      * 支付回调
56 67
      * @param notifyResult
@@ -62,6 +73,10 @@ public class TaOrderPayServiceImpl extends BaseServiceImpl<TaOrderPayMapper, TaO
62 73
         String orderId = orderPay.getOrderId();
63 74
         String orderSubId = orderPay.getSubOrderId();
64 75
 
76
+        TaOrder taOrder = taOrderMapper.selectById(orderId);
77
+        TaOrderSub taOrderSub = taOrderSubMapper.selectById(orderSubId);
78
+        TaPerson taPerson = taPersonMapper.selectById(orderPay.getPersonId());
79
+
65 80
         boolean isSuccess = WxPayConstants.ResultCode.SUCCESS.equals(notifyResult.getResultCode());
66 81
 
67 82
         orderPay.setPayDate(DateUtils.from(notifyResult.getTimeEnd(), "yyyyMMddHHmmss"));
@@ -70,8 +85,8 @@ public class TaOrderPayServiceImpl extends BaseServiceImpl<TaOrderPayMapper, TaO
70 85
 
71 86
         orderPayMapper.updateById(orderPay);
72 87
 
73
-        // 更新订单为已支付
74 88
         if (isSuccess) {
89
+            // 更新订单为已支付
75 90
             if (!StringUtils.isEmpty(orderSubId)) {
76 91
                 taOrderSubMapper.updateStatus(orderSubId, Constants.ORDER_PAYED);
77 92
             } else {
@@ -79,11 +94,79 @@ public class TaOrderPayServiceImpl extends BaseServiceImpl<TaOrderPayMapper, TaO
79 94
                 taOrderSubMapper.updateStatusByOrder(orderId, Constants.ORDER_PAYED);
80 95
             }
81 96
 
97
+            // 发送核销码
98
+            generateVerfiedRecords(taOrder, taOrderSub, taPerson);
99
+
82 100
             PaySuccessEvent evt = new PaySuccessEvent(this, orderPay);
83 101
             eventPublisher.publishEvent(evt);
84 102
         }
85 103
     }
86 104
 
105
+    /**
106
+     * 发放核销码
107
+     * @param taOrder
108
+     * @param taOrderSub
109
+     * @param taPerson
110
+     * @throws Exception
111
+     */
112
+    private void generateVerfiedRecords(TaOrder taOrder, TaOrderSub taOrderSub, TaPerson taPerson) throws Exception {
113
+        List<TaOrderSub> orderSubList = new ArrayList<>();
114
+        if (null != taOrder) {
115
+            orderSubList = taOrderSubMapper.getListByOrder(taOrder.getOrderId());
116
+        } else {
117
+            orderSubList.add(taOrderSub);
118
+        }
119
+
120
+        LocalDateTime now = LocalDateTime.now();
121
+
122
+        // 循环发放
123
+        for (TaOrderSub item : orderSubList) {
124
+            if (null == item) continue;
125
+
126
+            // 已经处理过的, 则不发放
127
+            int cnt = taVerifyTargetMapper.getCountBy(item.getOrderId(), item.getSubOrderId(), null);
128
+            if (cnt > 0) {
129
+                continue;
130
+            }
131
+
132
+            // 对应的套餐
133
+            TaShopPackage shopPackage = shopPackageMapper.selectById(item.getPackageId());
134
+            // 如果数量为2, 则生成2个
135
+            for (int i = 0; i < item.getAmount(); i += 1) {
136
+                TaVerifyTarget taVerifyTarget = new TaVerifyTarget();
137
+                taVerifyTarget.setVerifyNo(getVerifyNo());
138
+                taVerifyTarget.setTargetType(Constants.TARGET_SHOP_PACKAGE);
139
+                taVerifyTarget.setTargetId(item.getPackageId());
140
+                taVerifyTarget.setDescription(shopPackage.getDescription());
141
+                taVerifyTarget.setPoster(shopPackage.getPoster());
142
+                taVerifyTarget.setActualPrice(shopPackage.getActualPrice());
143
+                taVerifyTarget.setStandPrice(shopPackage.getStandardPrice());
144
+                taVerifyTarget.setCashback(shopPackage.getCashback());
145
+                taVerifyTarget.setCreateDate(now);
146
+                taVerifyTarget.setExpireDate(shopPackage.getEndTime());
147
+                taVerifyTarget.setOrderDate(item.getCreateDate());
148
+                taVerifyTarget.setOrderId(item.getOrderId());
149
+                taVerifyTarget.setSubOrderId(item.getSubOrderId());
150
+                taVerifyTarget.setPersonId(taPerson.getPersonId());
151
+                taVerifyTarget.setIsVerified(false);
152
+                taVerifyTarget.setIsConfirmVerified(false);
153
+                taVerifyTarget.setStatus(Constants.STATUS_NORMAL);
154
+
155
+                taVerifyTargetMapper.insert(taVerifyTarget);
156
+            }
157
+        }
158
+    }
159
+
160
+    private String getVerifyNo() {
161
+        while (true) {
162
+            String verifyNo = StringUtils.random(10);
163
+            int i = taVerifyTargetMapper.existsNo(verifyNo);
164
+            if (i <1 ) {
165
+                return verifyNo;
166
+            }
167
+        }
168
+    }
169
+
87 170
     @Override
88 171
     public void refundNotifyOrder(WxPayRefundNotifyResult result) throws Exception {
89 172
         WxPayRefundNotifyResult.ReqInfo reqInfo = result.getReqInfo();
@@ -164,7 +247,7 @@ public class TaOrderPayServiceImpl extends BaseServiceImpl<TaOrderPayMapper, TaO
164 247
         // 找到主订单对应的那个支付记录
165 248
         TaOrderPay originOrderPay = orderPayMapper.getLastRowByOrder(taOrder.getOrderId());
166 249
         if (null != originOrderPay) {
167
-            if (Constants.PAY_SUCCESS.equals(originOrderPay.getStatus())) {
250
+            if (!Constants.PAY_SUCCESS.equals(originOrderPay.getStatus())) {
168 251
                 throw new Exception("未找到当前订单有效的支付记录");
169 252
             }
170 253
         } else {

+ 31
- 9
src/main/java/com/yunzhi/shigongli/service/impl/TaOrderServiceImpl.java Zobrazit soubor

@@ -1,15 +1,13 @@
1 1
 package com.yunzhi.shigongli.service.impl;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4
-import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
5
-import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
6
-import com.github.binarywang.wxpay.bean.result.WxPayRefundResult;
7
-import com.github.binarywang.wxpay.constant.WxPayConstants;
8 4
 import com.yunzhi.shigongli.common.*;
9 5
 import com.yunzhi.shigongli.entity.*;
10 6
 import com.yunzhi.shigongli.mapper.*;
7
+import com.yunzhi.shigongli.service.ITaOrderPayService;
11 8
 import com.yunzhi.shigongli.service.ITaOrderService;
12 9
 
10
+import com.yunzhi.shigongli.service.ITaVerifyTargetService;
13 11
 import com.yunzhi.shigongli.vo.OrderItem;
14 12
 import lombok.extern.slf4j.Slf4j;
15 13
 import org.springframework.beans.factory.annotation.Autowired;
@@ -49,6 +47,15 @@ public class TaOrderServiceImpl extends BaseServiceImpl<TaOrderMapper, TaOrder>
49 47
     @Autowired
50 48
     TaOrderPayMapper orderPayMapper;
51 49
 
50
+    @Autowired
51
+    TaPersonRecommenderMapper personRecommenderMapper;
52
+
53
+    @Autowired
54
+    public ITaOrderPayService iTaOrderPayService;
55
+
56
+    @Autowired
57
+    public ITaVerifyTargetService iTaVerifyTargetService;
58
+
52 59
     /**
53 60
      * 下单支付
54 61
      * @param person
@@ -121,11 +128,18 @@ public class TaOrderServiceImpl extends BaseServiceImpl<TaOrderMapper, TaOrder>
121 128
 
122 129
     @Transactional(rollbackFor = Exception.class)
123 130
     @Override
124
-    public void refundOrder(TaOrder taOrder, TaPerson taPerson) throws Exception {
131
+    public void refundOrder(TaOrder taOrder, TaPerson taPerson, Integer totalCashback) throws Exception {
132
+
133
+        taOrder.setStatus(Constants.ORDER_REFUND);
134
+        taOrderMapper.updateById(taOrder);
125 135
 
126 136
         // 只需要更新状态即可
127
-        taOrderMapper.updateStatus(taOrder.getOrderId(), Constants.ORDER_REFUND);
137
+//        taOrderMapper.updateStatus(taOrder.getOrderId(), Constants.ORDER_REFUND);
128 138
         taOrderSubMapper.updateStatusByOrder(taOrder.getOrderId(), Constants.ORDER_REFUND);
139
+
140
+        iTaOrderPayService.refundOrder(taPerson, taOrder, totalCashback);
141
+        // 删除所有待核销内容
142
+        iTaVerifyTargetService.removeBy(taOrder.getOrderId(), null);
129 143
     }
130 144
 
131 145
     /**
@@ -201,6 +215,9 @@ public class TaOrderServiceImpl extends BaseServiceImpl<TaOrderMapper, TaOrder>
201 215
             boolean isRecommend = Constants.RECOMMEND_SHOP.equals(taPerson.getFromType())
202 216
                     && shopPackage.getShopId().equals(taPerson.getRecommender());
203 217
 
218
+            // 当前人员是否有有效的推荐人
219
+            boolean hasRecommend = checkPersonRecommender(taPerson);
220
+
204 221
             orderSub.setShopId(shopPackage.getShopId());
205 222
             orderSub.setPackageId(packageId);
206 223
             String desc = StringUtils.ifNull(shopPackage.getDescription(), "套餐项目");
@@ -231,11 +248,11 @@ public class TaOrderServiceImpl extends BaseServiceImpl<TaOrderMapper, TaOrder>
231 248
                 Integer charges = orderSub.getCharges() - orderSub.getCashback();
232 249
 
233 250
                 // 引流分成
234
-                Integer trafficRate = packageSetting.getTrafficRate();
235
-                Integer trafficCommission = charges * (trafficRate / 1000);
251
+                Integer trafficRate = hasRecommend ? packageSetting.getTrafficRate() : 0;
252
+                Integer trafficCommission = (int) (charges * (trafficRate.floatValue() / 1000));
236 253
                 // 平台分成
237 254
                 Integer platformRate = packageSetting.getPlatformRate();
238
-                Integer platformCommission = charges * (platformRate / 1000);
255
+                Integer platformCommission = (int) (charges * (platformRate.floatValue() / 1000));
239 256
                 // 总提成
240 257
                 Integer commissionCharge = trafficCommission + platformCommission;
241 258
                 if (commissionCharge < 0 || commissionCharge >= charges) {
@@ -262,6 +279,11 @@ public class TaOrderServiceImpl extends BaseServiceImpl<TaOrderMapper, TaOrder>
262 279
         return totalCharge;
263 280
     }
264 281
 
282
+    private boolean checkPersonRecommender(TaPerson taPerson) {
283
+        TaPersonRecommender acitveRecommender = personRecommenderMapper.getAcitveRecommender(taPerson.getPersonId());
284
+        return null != acitveRecommender;
285
+    }
286
+
265 287
     /**
266 288
      * 获取人员最近的一笔订单
267 289
      * @param personId

+ 10
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TaOrderSubServiceImpl.java Zobrazit soubor

@@ -135,6 +135,16 @@ public class TaOrderSubServiceImpl extends BaseServiceImpl<TaOrderSubMapper, TaO
135 135
         return taOrderSubMapper.getListByOrder(taOrder.getOrderId());
136 136
     }
137 137
 
138
+    @Override
139
+    public Integer getTotalCharges(String targetType, String targetId, LocalDateTime start, LocalDateTime end) {
140
+        return taOrderSubMapper.getTotalCharges(targetType, targetId, start, end);
141
+    }
142
+
143
+    @Override
144
+    public MineOrder getSingleOrderSubOf(TaPerson taPerson, Integer subOrderId) {
145
+        return baseMapper.getSingleOrderSubOf(taPerson.getPersonId(), Constants.TARGET_SHOP, subOrderId);
146
+    }
147
+
138 148
     /**
139 149
      * 商铺抽成入账户
140 150
      * @param shopId

+ 12
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TaRoomOrderPersonServiceImpl.java Zobrazit soubor

@@ -1,11 +1,15 @@
1 1
 package com.yunzhi.shigongli.service.impl;
2 2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 5
 import com.yunzhi.shigongli.entity.TaRoomOrderPerson;
4 6
 import com.yunzhi.shigongli.mapper.TaRoomOrderPersonMapper;
5 7
 import com.yunzhi.shigongli.service.ITaRoomOrderPersonService;
6 8
 
7 9
 import org.springframework.stereotype.Service;
8 10
 
11
+import java.util.List;
12
+
9 13
 /**
10 14
  * <p>
11 15
  * 房源订单打开人 服务实现类
@@ -17,4 +21,12 @@ import org.springframework.stereotype.Service;
17 21
 @Service
18 22
 public class TaRoomOrderPersonServiceImpl extends BaseServiceImpl<TaRoomOrderPersonMapper, TaRoomOrderPerson> implements ITaRoomOrderPersonService {
19 23
 
24
+    @Override
25
+    public List<TaRoomOrderPerson> getListByRoomOrder(String roomOrderId) {
26
+        LambdaQueryWrapper<TaRoomOrderPerson> queryWrapper = new LambdaQueryWrapper<>();
27
+        queryWrapper.eq(TaRoomOrderPerson::getRoomOrderId, roomOrderId);
28
+        queryWrapper.orderByAsc(TaRoomOrderPerson::getCreateDate);
29
+
30
+        return list(queryWrapper);
31
+    }
20 32
 }

+ 6
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TaShopAccountLogServiceImpl.java Zobrazit soubor

@@ -6,6 +6,8 @@ import com.yunzhi.shigongli.service.ITaShopAccountLogService;
6 6
 
7 7
 import org.springframework.stereotype.Service;
8 8
 
9
+import java.time.LocalDateTime;
10
+
9 11
 /**
10 12
  * <p>
11 13
  * 商户账户流水 服务实现类
@@ -17,4 +19,8 @@ import org.springframework.stereotype.Service;
17 19
 @Service
18 20
 public class TaShopAccountLogServiceImpl extends BaseServiceImpl<TaShopAccountLogMapper, TaShopAccountLog> implements ITaShopAccountLogService {
19 21
 
22
+    @Override
23
+    public Integer getTotalCharges(String accountId, String amountType, LocalDateTime start, LocalDateTime end) {
24
+        return baseMapper.getTotalCharges(accountId, amountType, start, end);
25
+    }
20 26
 }

+ 5
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TaShopAccountServiceImpl.java Zobrazit soubor

@@ -59,4 +59,9 @@ public class TaShopAccountServiceImpl extends BaseServiceImpl<TaShopAccountMappe
59 59
 
60 60
         return true;
61 61
     }
62
+
63
+    @Override
64
+    public TaShopAccount getAccountInfoBy(String shopId) {
65
+        return null;
66
+    }
62 67
 }

+ 5
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TaShopServiceImpl.java Zobrazit soubor

@@ -110,4 +110,9 @@ public class TaShopServiceImpl extends BaseServiceImpl<TaShopMapper, TaShop> imp
110 110
         }
111 111
         return  resourceVO;
112 112
     }
113
+
114
+    @Override
115
+    public List<TaShop> getListByPerson(TaPerson taPerson) {
116
+        return taShopMapper.getListByPerson(taPerson.getPersonId());
117
+    }
113 118
 }

+ 9
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TaShopWorkerServiceImpl.java Zobrazit soubor

@@ -46,4 +46,13 @@ public class TaShopWorkerServiceImpl extends BaseServiceImpl<TaShopWorkerMapper,
46 46
     public void updateByPerson(TaPerson taPerson) throws Exception {
47 47
         shopWorkerMapper.updateByPerson(taPerson);
48 48
     }
49
+
50
+    @Override
51
+    public List<TaShopWorker> getByPerson(String personId) {
52
+        LambdaQueryWrapper<TaShopWorker> queryWrapper = new LambdaQueryWrapper<>();
53
+        queryWrapper.eq(TaShopWorker::getPersonId, personId);
54
+        queryWrapper.gt(TaShopWorker::getStatus, Constants.STATUS_DELETED);
55
+
56
+        return list(queryWrapper);
57
+    }
49 58
 }

+ 56
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TaVerifyTargetServiceImpl.java Zobrazit soubor

@@ -0,0 +1,56 @@
1
+package com.yunzhi.shigongli.service.impl;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.yunzhi.shigongli.common.Constants;
6
+import com.yunzhi.shigongli.common.StringUtils;
7
+import com.yunzhi.shigongli.entity.TaVerifyTarget;
8
+import com.yunzhi.shigongli.mapper.TaVerifyTargetMapper;
9
+import com.yunzhi.shigongli.service.ITaVerifyTargetService;
10
+import com.yunzhi.shigongli.vo.VerifyTargetVO;
11
+import org.springframework.jdbc.object.UpdatableSqlQuery;
12
+import org.springframework.stereotype.Service;
13
+
14
+import java.time.LocalDateTime;
15
+
16
+/**
17
+ * <p>
18
+ * 核销内容表 服务实现类
19
+ * </p>
20
+ *
21
+ * @author yansen
22
+ * @since 2021-08-17
23
+ */
24
+@Service
25
+public class TaVerifyTargetServiceImpl extends BaseServiceImpl<TaVerifyTargetMapper, TaVerifyTarget> implements ITaVerifyTargetService {
26
+
27
+    @Override
28
+    public IPage<VerifyTargetVO> getWxPagedBy(IPage<VerifyTargetVO> pg, String personId, String shopId, String phone, Integer isVerified) {
29
+        return baseMapper.getWxPagedBy(pg, personId, shopId, phone, isVerified);
30
+    }
31
+
32
+    @Override
33
+    public int getCountBy(String orderId, String subOrderId, Integer isVerified) {
34
+        return baseMapper.getCountBy(orderId, subOrderId, isVerified);
35
+    }
36
+
37
+    @Override
38
+    public boolean removeBy(String orderId, String subOrderId) {
39
+        UpdateWrapper<TaVerifyTarget> updateWrapper = new UpdateWrapper<>();
40
+        updateWrapper.set("status", Constants.STATUS_DELETED);
41
+        updateWrapper.eq("order_id", orderId);
42
+        updateWrapper.eq(!StringUtils.isEmpty(subOrderId), "sub_order_id", subOrderId);
43
+
44
+        return update(updateWrapper);
45
+    }
46
+
47
+    @Override
48
+    public void verify(TaVerifyTarget taVerifyTarget) throws Exception {
49
+        taVerifyTarget.setIsVerified(true);
50
+        taVerifyTarget.setVerifiedDate(LocalDateTime.now());
51
+
52
+        if (!updateById(taVerifyTarget)) {
53
+            throw new Exception("核销失败, 请重试");
54
+        }
55
+    }
56
+}

+ 19
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TrPersonPageServiceImpl.java Zobrazit soubor

@@ -0,0 +1,19 @@
1
+package com.yunzhi.shigongli.service.impl;
2
+
3
+import com.yunzhi.shigongli.entity.TrPersonPage;
4
+import com.yunzhi.shigongli.mapper.TrPersonPageMapper;
5
+import com.yunzhi.shigongli.service.ITrPersonPageService;
6
+import org.springframework.stereotype.Service;
7
+
8
+/**
9
+ * <p>
10
+ * 用户访问埋点 服务实现类
11
+ * </p>
12
+ *
13
+ * @author yansen
14
+ * @since 2021-08-17
15
+ */
16
+@Service
17
+public class TrPersonPageServiceImpl extends BaseServiceImpl<TrPersonPageMapper, TrPersonPage> implements ITrPersonPageService {
18
+
19
+}

+ 59
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TsStatisDailyServiceImpl.java Zobrazit soubor

@@ -0,0 +1,59 @@
1
+package com.yunzhi.shigongli.service.impl;
2
+
3
+import com.yunzhi.shigongli.entity.TaOrderSub;
4
+import com.yunzhi.shigongli.entity.TsStatisDaily;
5
+import com.yunzhi.shigongli.mapper.TaOrderSubMapper;
6
+import com.yunzhi.shigongli.mapper.TsStatisDailyMapper;
7
+import com.yunzhi.shigongli.service.ITsStatisDailyService;
8
+import com.yunzhi.shigongli.vo.StatisDailyVO;
9
+import org.springframework.beans.factory.annotation.Autowired;
10
+import org.springframework.stereotype.Service;
11
+
12
+import java.time.LocalDateTime;
13
+import java.util.HashMap;
14
+import java.util.List;
15
+import java.util.Map;
16
+
17
+/**
18
+ * <p>
19
+ * 分类标签 服务实现类
20
+ * </p>
21
+ *
22
+ * @author yansen
23
+ * @since 2021-08-17
24
+ */
25
+@Service
26
+public class TsStatisDailyServiceImpl extends BaseServiceImpl<TsStatisDailyMapper, TsStatisDaily> implements ITsStatisDailyService {
27
+
28
+    @Autowired
29
+    TaOrderSubMapper orderSubMapper;
30
+
31
+    @Override
32
+    public List<StatisDailyVO> getListBy(String startDate, String statisType, long days) {
33
+
34
+        return baseMapper.getListBy(startDate, statisType, days);
35
+    }
36
+
37
+    @Override
38
+    public Map<String, Integer> statisSummary() {
39
+        // 总营业额
40
+        Integer totalCharge = baseMapper.statisOrderTotal();
41
+        // 民宿数量
42
+        Integer hotelNum = baseMapper.countHotelTotal();
43
+        // 房源数量
44
+        Integer roomNum = baseMapper.countRoomTotal();
45
+        // 商户数量
46
+        Integer shopNum = baseMapper.countShopTotal();
47
+        // 客户数量
48
+        Integer personNum = baseMapper.countPersonTotal();
49
+
50
+        Map<String, Integer> result = new HashMap<>();
51
+        result.put("totalCharge", totalCharge);
52
+        result.put("hotelNum", hotelNum);
53
+        result.put("roomNum", roomNum);
54
+        result.put("shopNum", shopNum);
55
+        result.put("personNum", personNum);
56
+
57
+        return result;
58
+    }
59
+}

+ 17
- 0
src/main/java/com/yunzhi/shigongli/vo/RefundParamsVO.java Zobrazit soubor

@@ -0,0 +1,17 @@
1
+package com.yunzhi.shigongli.vo;
2
+
3
+import io.swagger.annotations.ApiModel;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+
7
+@ApiModel(value="ResourceFieldVO", description="退款申请参数")
8
+@Data
9
+public class RefundParamsVO {
10
+
11
+    @ApiModelProperty(value = "退款原因")
12
+    private String refundReason;
13
+
14
+    @ApiModelProperty(value = "退款说明")
15
+    private String refundDecription;
16
+
17
+}

+ 19
- 0
src/main/java/com/yunzhi/shigongli/vo/StatisDailyVO.java Zobrazit soubor

@@ -0,0 +1,19 @@
1
+package com.yunzhi.shigongli.vo;
2
+
3
+
4
+import io.swagger.annotations.ApiModel;
5
+import io.swagger.annotations.ApiModelProperty;
6
+import lombok.Data;
7
+import lombok.experimental.Accessors;
8
+
9
+@ApiModel(description = "日活统计")
10
+@Data
11
+@Accessors(chain = true)
12
+public class StatisDailyVO {
13
+
14
+    @ApiModelProperty("日期")
15
+    private String date;
16
+
17
+    @ApiModelProperty("统计数")
18
+    private Integer num;
19
+}

+ 15
- 0
src/main/java/com/yunzhi/shigongli/vo/VerifyTargetVO.java Zobrazit soubor

@@ -0,0 +1,15 @@
1
+package com.yunzhi.shigongli.vo;
2
+
3
+import com.yunzhi.shigongli.entity.TaVerifyTarget;
4
+import io.swagger.annotations.ApiModel;
5
+import io.swagger.annotations.ApiModelProperty;
6
+import lombok.Data;
7
+
8
+
9
+@ApiModel(description = "核销订单")
10
+@Data
11
+public class VerifyTargetVO extends TaVerifyTarget {
12
+
13
+    @ApiModelProperty("客户手机")
14
+    String phone;
15
+}

+ 7
- 2
src/main/resources/application.yml Zobrazit soubor

@@ -60,8 +60,8 @@ weixin:
60 60
     subAppId:
61 61
     subMchId:
62 62
     keyPath: /yunpan/shigongli/cert/apiclient_cert.p12
63
-    notifyUrl: https://sgl.njyunzhi.com/api/wxpay/notify/order
64
-    refundNotifyUrl: https://sgl.njyunzhi.com/api/wxpay/notify/refund
63
+    notifyUrl: https://sgl-v2.njyunzhi.com/api/wxpay/notify/order
64
+    refundNotifyUrl: https://sgl-v2.njyunzhi.com/api/wxpay/notify/refund
65 65
 
66 66
 ## 高德地图
67 67
 amap:
@@ -69,6 +69,11 @@ amap:
69 69
     api: https://restapi.amap.com/v3/weather/weatherInfo?key=3be0a9567a794d2690d378476f057a6f&city=%s&extensions=base&output=JSON
70 70
     backImage: https://yz-shigongli.oss-cn-shanghai.aliyuncs.com/images/weather/background_%s.png
71 71
 
72
+sysBiz:
73
+  miniapp:
74
+      shopPage: pages/index/index
75
+#    shopPage: pages/details/foodDetails/foodDetails
76
+
72 77
 ###
73 78
 spring:
74 79
   application:

+ 39
- 0
src/main/resources/mapper/TaOrderSubMapper.xml Zobrazit soubor

@@ -83,4 +83,43 @@
83 83
           AND t.`status` = #{status}
84 84
           AND s.`status` &gt; -1
85 85
     </select>
86
+    <select id="getTotalCharges" resultType="java.lang.Integer">
87
+        SELECT
88
+            sum( t.charges ) - sum( t.cashback )
89
+        FROM
90
+            ta_order_sub t
91
+        WHERE
92
+            t.shop_id = #{targetId}
93
+          AND t.create_date BETWEEN #{start} AND #{end}
94
+          AND t.`status` = 1
95
+    </select>
96
+    <select id="getSingleOrderSubOf" resultType="com.yunzhi.shigongli.vo.MineOrder">
97
+        SELECT
98
+            t.*,
99
+            ( m.sweet_score + m.environment_score + m.service_score ) / 3 AS score,
100
+            n.standard_price,
101
+            n.description AS package_description,
102
+            n.poster,
103
+            n.start_time,
104
+            n.end_time,
105
+            (
106
+                SELECT
107
+                    count( 1 )
108
+                FROM
109
+                    ta_evaluation a
110
+                WHERE
111
+                    a.target_type = #{targetType}
112
+                    AND a.target_id = t.shop_id
113
+                    AND a.person_id = s.person_id
114
+            ) AS is_evaluated
115
+        FROM
116
+            ta_order_sub t
117
+            INNER JOIN ta_order s ON s.order_id = t.order_id
118
+            INNER JOIN ta_shop m ON m.shop_id = t.shop_id
119
+            INNER JOIN ta_shop_package n ON n.package_id = t.package_id
120
+        WHERE
121
+            t.sub_order_id = #{subOrderId}
122
+            AND s.person_id = #{personId}
123
+            AND s.`status` &gt; - 1
124
+    </select>
86 125
 </mapper>

+ 10
- 0
src/main/resources/mapper/TaShopAccountLogMapper.xml Zobrazit soubor

@@ -2,4 +2,14 @@
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.shigongli.mapper.TaShopAccountLogMapper">
4 4
 
5
+    <select id="getTotalCharges" resultType="java.lang.Integer">
6
+        SELECT
7
+            sum( t.amount )
8
+        FROM
9
+            ta_shop_account_log t
10
+        WHERE
11
+            t.account_id = #{accountId}
12
+          AND t.amount_type = #{amountType}
13
+          AND t.create_date BETWEEN #{start} AND #{end}
14
+    </select>
5 15
 </mapper>

+ 11
- 0
src/main/resources/mapper/TaShopMapper.xml Zobrazit soubor

@@ -59,4 +59,15 @@
59 59
             t.weight DESC,
60 60
             t.create_date DESC
61 61
     </select>
62
+    <select id="getListByPerson" resultType="com.yunzhi.shigongli.entity.TaShop">
63
+        SELECT
64
+            t.*
65
+        FROM
66
+            ta_shop t
67
+        WHERE
68
+            EXISTS ( SELECT * FROM ta_shop_worker s WHERE s.shop_id = t.shop_id AND s.person_id = #{personId} AND s.`status` = 1 )
69
+          AND t.`status` = 1
70
+        ORDER BY
71
+            t.create_date DESC
72
+    </select>
62 73
 </mapper>

+ 53
- 0
src/main/resources/mapper/TaVerifyTargetMapper.xml Zobrazit soubor

@@ -0,0 +1,53 @@
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.yunzhi.shigongli.mapper.TaVerifyTargetMapper">
4
+
5
+    <select id="getWxPagedBy" resultType="com.yunzhi.shigongli.vo.VerifyTargetVO">
6
+        SELECT
7
+            t.*,
8
+            s.phone
9
+        FROM
10
+            ta_verify_target t
11
+                INNER JOIN ta_person s ON s.person_id = t.person_id
12
+                INNER JOIN ta_order_sub m ON m.package_id = t.target_id
13
+        WHERE
14
+            t.`status` &gt; - 1
15
+          <if test="personId != null and personId != ''">
16
+              AND s.person_id = #{personId}
17
+          </if>
18
+          <if test="shopId != null and shopId != ''">
19
+              AND m.shop_id = #{shopId}
20
+          </if>
21
+          <if test="phone != null and phone != ''">
22
+            AND s.phone = #{phone}
23
+          </if>
24
+          <if test="isVerified != null">
25
+            AND t.is_verified = #{isVerified}
26
+          </if>
27
+        ORDER BY
28
+            t.create_date DESC
29
+    </select>
30
+    <select id="existsNo" resultType="java.lang.Integer">
31
+        SELECT
32
+            COUNT( 1 )
33
+        FROM
34
+            ta_verify_target t
35
+        WHERE
36
+            t.verify_no = #{verifyNo}
37
+    </select>
38
+    <select id="getCountBy" resultType="java.lang.Integer">
39
+        SELECT
40
+            COUNT( 1 )
41
+        FROM
42
+            ta_verify_target t
43
+        WHERE
44
+            t.order_id = #{orderId}
45
+        <if test="subOrderId != null and subOrderId != ''">
46
+            AND t.sub_order_id = #{subOrderId}
47
+        </if>
48
+        <if test="isVerified != null">
49
+            AND t.is_verified = #{isVerified}
50
+        </if>
51
+            AND t.`status` &gt; - 1
52
+    </select>
53
+</mapper>

+ 5
- 0
src/main/resources/mapper/TrPersonPageMapper.xml Zobrazit soubor

@@ -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.yunzhi.shigongli.mapper.TdTypeMapper">
4
+
5
+</mapper>

+ 18
- 0
src/main/resources/mapper/TsStatisDailyMapper.xml Zobrazit soubor

@@ -0,0 +1,18 @@
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.yunzhi.shigongli.mapper.TsStatisDailyMapper">
4
+
5
+    <select id="getListBy" resultType="com.yunzhi.shigongli.vo.StatisDailyVO">
6
+        SELECT
7
+            fn_format_date_with_interval ( #{startDate}, t.rownum ) AS date,
8
+            IFNULL( s.num, 0 ) AS num
9
+        FROM
10
+            sequence t
11
+            LEFT JOIN ts_statis_daily s ON s.statis_date = fn_format_date_with_interval ( #{startDate}, t.rownum )
12
+            AND s.statis_type = #{statisType}
13
+        WHERE
14
+            t.rownum &lt; #{days}
15
+        ORDER BY
16
+            t.rownum ASC
17
+    </select>
18
+</mapper>