张延森 3 gadus atpakaļ
vecāks
revīzija
b4bbb3df4e
33 mainītis faili ar 663 papildinājumiem un 246 dzēšanām
  1. 2
    1
      src/main/java/com/yunzhi/shigongli/controller/TaExtendContentController.java
  2. 11
    72
      src/main/java/com/yunzhi/shigongli/controller/TaOrderSubController.java
  3. 14
    8
      src/main/java/com/yunzhi/shigongli/controller/TaPersonController.java
  4. 11
    61
      src/main/java/com/yunzhi/shigongli/controller/TaResourceController.java
  5. 2
    7
      src/main/java/com/yunzhi/shigongli/controller/TaShopAccountLogController.java
  6. 70
    35
      src/main/java/com/yunzhi/shigongli/controller/TaShopController.java
  7. 97
    0
      src/main/java/com/yunzhi/shigongli/controller/TrPersonClickController.java
  8. 49
    0
      src/main/java/com/yunzhi/shigongli/entity/TrPersonClick.java
  9. 9
    1
      src/main/java/com/yunzhi/shigongli/mapper/TaOrderSubMapper.java
  10. 2
    0
      src/main/java/com/yunzhi/shigongli/mapper/TaResourceMapper.java
  11. 10
    0
      src/main/java/com/yunzhi/shigongli/mapper/TaShopAccountLogMapper.java
  12. 18
    0
      src/main/java/com/yunzhi/shigongli/mapper/TrPersonClickMapper.java
  13. 1
    1
      src/main/java/com/yunzhi/shigongli/service/ITaOrderSubService.java
  14. 2
    0
      src/main/java/com/yunzhi/shigongli/service/ITaResourceService.java
  15. 7
    0
      src/main/java/com/yunzhi/shigongli/service/ITaShopService.java
  16. 16
    0
      src/main/java/com/yunzhi/shigongli/service/ITrPersonClickService.java
  17. 62
    11
      src/main/java/com/yunzhi/shigongli/service/impl/TaOrderPayServiceImpl.java
  18. 2
    2
      src/main/java/com/yunzhi/shigongli/service/impl/TaOrderSubServiceImpl.java
  19. 26
    29
      src/main/java/com/yunzhi/shigongli/service/impl/TaPersonAccountServiceImpl.java
  20. 4
    9
      src/main/java/com/yunzhi/shigongli/service/impl/TaPersonRecommenderServiceImpl.java
  21. 11
    0
      src/main/java/com/yunzhi/shigongli/service/impl/TaPersonServiceImpl.java
  22. 5
    0
      src/main/java/com/yunzhi/shigongli/service/impl/TaResourceServiceImpl.java
  23. 19
    0
      src/main/java/com/yunzhi/shigongli/service/impl/TaShopServiceImpl.java
  24. 19
    0
      src/main/java/com/yunzhi/shigongli/service/impl/TrPersonClickServiceImpl.java
  25. 48
    0
      src/main/java/com/yunzhi/shigongli/vo/ShopCommissionVO.java
  26. 44
    0
      src/main/java/com/yunzhi/shigongli/vo/ShopOrderVO.java
  27. 4
    5
      src/main/resources/application.yml
  28. 40
    2
      src/main/resources/mapper/TaOrderSubMapper.xml
  29. 0
    2
      src/main/resources/mapper/TaPersonRecommenderMapper.xml
  30. 37
    0
      src/main/resources/mapper/TaShopAccountLogMapper.xml
  31. 4
    0
      src/main/resources/mapper/TaShopPackageMapper.xml
  32. 12
    0
      src/main/resources/mapper/TaTargetQuotaMapper.xml
  33. 5
    0
      src/main/resources/mapper/TrPersonClickMapper.xml

+ 2
- 1
src/main/java/com/yunzhi/shigongli/controller/TaExtendContentController.java Parādīt failu

@@ -63,7 +63,8 @@ public class TaExtendContentController extends BaseController {
63 63
         QueryWrapper<TaExtendContent> queryWrapper = new QueryWrapper<>();
64 64
         queryWrapper.eq("target_type", targetType);
65 65
         queryWrapper.eq("target_id", targetId);
66
-        queryWrapper.orderByAsc("sort");
66
+//        queryWrapper.orderByAsc("sort");
67
+        queryWrapper.orderByAsc("create_date");
67 68
 
68 69
         IPage<TaExtendContent> result = iTaExtendContentService.page(pg, queryWrapper);
69 70
         return ResponseBean.success(result);

+ 11
- 72
src/main/java/com/yunzhi/shigongli/controller/TaOrderSubController.java Parādīt failu

@@ -66,16 +66,22 @@ public class TaOrderSubController extends BaseController {
66 66
                                        @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
67 67
                                        @ApiParam("商家名称") @RequestParam(value = "shopName", required = false) String shopName,
68 68
                                        @ApiParam("标题") @RequestParam(value = "description", required = false) String description,
69
-                                       @ApiParam(value = "下单时间", example = "2021-09-01") @RequestParam(value = "createDate", required = false) String createDate) throws Exception{
69
+                                       @ApiParam(value = "开始时间", example = "2021-09-01") @RequestParam(value = "start", required = false) String start,
70
+                                       @ApiParam(value = "结束时间", example = "2021-09-30") @RequestParam(value = "end", required = false) String end) throws Exception{
70 71
 
71 72
         IPage<OrderSubListVO> pg = new Page<>(pageNum, pageSize);
72 73
 
73
-        LocalDateTime date = null;
74
-        if (!StringUtils.isEmpty(createDate)) {
75
-            date = DateUtils.from(createDate + " 00:00:00", "yyyy-MM-dd HH:mm:ss");
74
+        LocalDateTime startDate = null;
75
+        LocalDateTime endDate = null;
76
+        if (!StringUtils.isEmpty(start)) {
77
+            startDate = DateUtils.from(start + " 00:00:00", "yyyy-MM-dd HH:mm:ss");
76 78
         }
79
+        if (!StringUtils.isEmpty(end)) {
80
+            endDate = DateUtils.from(end + " 23:59:59", "yyyy-MM-dd HH:mm:ss");
81
+        }
82
+
77 83
 
78
-        IPage<OrderSubListVO> result = iTaOrderSubService.getAdminPagedBy(pg, shopName, description, date);
84
+        IPage<OrderSubListVO> result = iTaOrderSubService.getAdminPagedBy(pg, shopName, description, startDate, endDate);
79 85
         return ResponseBean.success(result);
80 86
     }
81 87
 
@@ -152,73 +158,6 @@ public class TaOrderSubController extends BaseController {
152 158
         return ResponseBean.success("操作完成");
153 159
     }
154 160
 
155
-//    @PutMapping("/wx/orderSub/{id}/valid")
156
-//    @ApiOperation(value="订单项目核销", notes = "订单项目核销", httpMethod = "PUT", response = ResponseBean.class)
157
-//    public ResponseBean valdiation(@ApiParam(value = "订单项目ID") @PathVariable String id) throws Exception {
158
-//        TaPerson taPerson = getCurrentPerson();
159
-//        TaOrderSub taOrderSub = iTaOrderSubService.getById(id);
160
-//        TaOrder taOrder = iTaOrderService.getById(taOrderSub.getOrderId());
161
-//
162
-//        if (!taPerson.getPersonId().equals(taOrder.getPersonId())) {
163
-//            return ResponseBean.error("您不能核销当前套餐", ResponseBean.ERROR_ILLEGAL_PARAMS);
164
-//        }
165
-//
166
-//        if (!Constants.ORDER_PAYED.equals(taOrderSub.getStatus())) {
167
-//            return ResponseBean.error("套餐未支付或者状态异常", ResponseBean.ERROR_ILLEGAL_PARAMS);
168
-//        }
169
-//
170
-//        iTaOrderSubService.validation(taPerson, taOrder, taOrderSub);
171
-//
172
-//        return ResponseBean.success("核销成功");
173
-//    }
174
-
175
-//    /**
176
-//     * 保存对象
177
-//     * @param taOrderSub 实体对象
178
-//     * @return
179
-//     */
180
-//    @RequestMapping(value="/wx/taOrderSub",method= RequestMethod.POST)
181
-//    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
182
-//    public ResponseBean taOrderSubAdd(@ApiParam("保存内容") @RequestBody TaOrderSub taOrderSub) throws Exception{
183
-//
184
-//        if (iTaOrderSubService.save(taOrderSub)){
185
-//            return ResponseBean.success(taOrderSub);
186
-//        }else {
187
-//            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
188
-//        }
189
-//    }
190
-//
191
-//    /**
192
-//     * 根据id删除对象
193
-//     * @param id  实体ID
194
-//     */
195
-//    @RequestMapping(value="/wx/taOrderSub/{id}", method= RequestMethod.DELETE)
196
-//    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
197
-//    public ResponseBean taOrderSubDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
198
-//        if(iTaOrderSubService.removeLogicById(id)){
199
-//            return ResponseBean.success("success");
200
-//        }else {
201
-//            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
202
-//        }
203
-//    }
204
-
205
-//    /**
206
-//     * 修改对象
207
-//     * @param id  实体ID
208
-//     * @param taOrderSub 实体对象
209
-//     * @return
210
-//     */
211
-//    @RequestMapping(value="/taOrderSub/{id}",method= RequestMethod.PUT)
212
-//    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
213
-//    public ResponseBean taOrderSubUpdate(@ApiParam("对象ID") @PathVariable Integer id,
214
-//                                        @ApiParam("更新内容") @RequestBody TaOrderSub taOrderSub) throws Exception{
215
-//
216
-//        if (iTaOrderSubService.updateById(taOrderSub)){
217
-//            return ResponseBean.success(iTaOrderSubService.getById(id));
218
-//        }else {
219
-//            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
220
-//        }
221
-//    }
222 161
 
223 162
     /**
224 163
      * 根据id查询对象

+ 14
- 8
src/main/java/com/yunzhi/shigongli/controller/TaPersonController.java Parādīt failu

@@ -66,14 +66,20 @@ public class TaPersonController extends BaseController {
66 66
     @RequestMapping(value="/admin/taPerson",method= RequestMethod.GET)
67 67
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
68 68
     public ResponseBean taPersonList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
69
-									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
70
-
71
-		    IPage<TaPerson> pg = new Page<>(pageNum, pageSize);
72
-            QueryWrapper<TaPerson> queryWrapper = new QueryWrapper<>();
73
-            queryWrapper.orderByDesc("create_date");
74
-
75
-            IPage<TaPerson> result = iTaPersonService.page(pg, queryWrapper);
76
-            return ResponseBean.success(result);
69
+									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
70
+                                     @ApiParam("昵称") @RequestParam(value ="nickName", required = false) String nickName,
71
+                                     @ApiParam("手机号") @RequestParam(value ="phone", required = false) String phone,
72
+                                     @ApiParam("用户类型") @RequestParam(value ="personRole", required = false) String personRole) throws Exception{
73
+
74
+        IPage<TaPerson> pg = new Page<>(pageNum, pageSize);
75
+        QueryWrapper<TaPerson> queryWrapper = new QueryWrapper<>();
76
+        queryWrapper.like(!StringUtils.isEmpty(nickName), "nick_name", "%"+nickName+"%");
77
+        queryWrapper.like(!StringUtils.isEmpty(phone), "phone", "%"+phone+"%");
78
+        queryWrapper.eq(!StringUtils.isEmpty(personRole), "person_role", personRole);
79
+        queryWrapper.orderByDesc("create_date");
80
+
81
+        IPage<TaPerson> result = iTaPersonService.page(pg, queryWrapper);
82
+        return ResponseBean.success(result);
77 83
     }
78 84
 
79 85
 

+ 11
- 61
src/main/java/com/yunzhi/shigongli/controller/TaResourceController.java Parādīt failu

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 5
 import com.yunzhi.shigongli.common.BaseController;
6 6
 import com.yunzhi.shigongli.common.ResponseBean;
7 7
 import com.yunzhi.shigongli.common.StringUtils;
8
+import com.yunzhi.shigongli.entity.TaResource;
8 9
 import com.yunzhi.shigongli.service.ITaResourceService;
9 10
 import com.yunzhi.shigongli.vo.ResourceListVO;
10 11
 import io.swagger.annotations.Api;
@@ -13,10 +14,7 @@ import io.swagger.annotations.ApiParam;
13 14
 import org.slf4j.Logger;
14 15
 import org.slf4j.LoggerFactory;
15 16
 import org.springframework.beans.factory.annotation.Autowired;
16
-import org.springframework.web.bind.annotation.RequestMapping;
17
-import org.springframework.web.bind.annotation.RequestMethod;
18
-import org.springframework.web.bind.annotation.RequestParam;
19
-import org.springframework.web.bind.annotation.RestController;
17
+import org.springframework.web.bind.annotation.*;
20 18
 
21 19
 /**
22 20
  * <p>
@@ -66,62 +64,14 @@ public class TaResourceController extends BaseController {
66 64
         return ResponseBean.success(result);
67 65
     }
68 66
 
67
+    @RequestMapping(value="/wx/resource/{targetType}/{targetId}",method= RequestMethod.GET)
68
+    @ApiOperation(value="获取资源详情", notes = "获取资源详情", httpMethod = "GET", response = ResponseBean.class)
69
+    public ResponseBean getList(@ApiParam("资源类型") @PathVariable String targetType,
70
+                                @ApiParam("资源对象ID") @PathVariable String targetId,
71
+                                @ApiParam("定位") @RequestParam(value ="location", required = false) String location) throws Exception{
69 72
 
70
-//    /**
71
-//     * 保存对象
72
-//     * @param taPv 实体对象
73
-//     * @return
74
-//     */
75
-//    @RequestMapping(value="/taPv",method= RequestMethod.POST)
76
-//    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
77
-//    public ResponseBean taPvAdd(@ApiParam("保存内容") @RequestBody TaPv taPv) throws Exception{
78
-//
79
-//        if (iTaPvService.save(taPv)){
80
-//            return ResponseBean.success(taPv);
81
-//        }else {
82
-//            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
83
-//        }
84
-//    }
85
-//
86
-//    /**
87
-//     * 根据id删除对象
88
-//     * @param id  实体ID
89
-//     */
90
-//    @RequestMapping(value="/taPv/{id}", method= RequestMethod.DELETE)
91
-//    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
92
-//    public ResponseBean taPvDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
93
-//        if(iTaPvService.removeLogicById(id)){
94
-//            return ResponseBean.success("success");
95
-//        }else {
96
-//            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
97
-//        }
98
-//    }
99
-//
100
-//    /**
101
-//     * 修改对象
102
-//     * @param id  实体ID
103
-//     * @param taPv 实体对象
104
-//     * @return
105
-//     */
106
-//    @RequestMapping(value="/taPv/{id}",method= RequestMethod.PUT)
107
-//    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
108
-//    public ResponseBean taPvUpdate(@ApiParam("对象ID") @PathVariable Integer id,
109
-//                                        @ApiParam("更新内容") @RequestBody TaPv taPv) throws Exception{
110
-//
111
-//        if (iTaPvService.updateById(taPv)){
112
-//            return ResponseBean.success(iTaPvService.getById(id));
113
-//        }else {
114
-//            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
115
-//        }
116
-//    }
117
-//
118
-//    /**
119
-//     * 根据id查询对象
120
-//     * @param id  实体ID
121
-//     */
122
-//    @RequestMapping(value="/taPv/{id}",method= RequestMethod.GET)
123
-//    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
124
-//    public ResponseBean taPvGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
125
-//        return ResponseBean.success(iTaPvService.getById(id));
126
-//    }
73
+        ResourceListVO resourceListVO = iTaResourceService.getDetailByTarget(targetType, targetId, location);
74
+
75
+        return ResponseBean.success(resourceListVO);
76
+    }
127 77
 }

+ 2
- 7
src/main/java/com/yunzhi/shigongli/controller/TaShopAccountLogController.java Parādīt failu

@@ -14,14 +14,9 @@ import io.swagger.annotations.ApiParam;
14 14
 import org.slf4j.Logger;
15 15
 import org.slf4j.LoggerFactory;
16 16
 import org.springframework.beans.factory.annotation.Autowired;
17
-import org.springframework.web.bind.annotation.PathVariable;
18
-import org.springframework.web.bind.annotation.RequestBody;
19
-import org.springframework.web.bind.annotation.RequestMapping;
20
-import org.springframework.web.bind.annotation.RequestMethod;
21
-import org.springframework.web.bind.annotation.RequestParam;
17
+import org.springframework.web.bind.annotation.*;
22 18
 import com.yunzhi.shigongli.service.ITaShopAccountLogService;
23 19
 import com.yunzhi.shigongli.entity.TaShopAccountLog;
24
-import org.springframework.web.bind.annotation.RestController;
25 20
 
26 21
 /**
27 22
  * <p>
@@ -50,7 +45,7 @@ public class TaShopAccountLogController extends BaseController {
50 45
      */
51 46
     @RequestMapping(value="/wx/shop/account/{id}/log",method= RequestMethod.GET)
52 47
     @ApiOperation(value="获取账户流水", notes = "获取账户流水", httpMethod = "GET", response = ResponseBean.class)
53
-    public ResponseBean taHotelAccountLogList(@ApiParam("账户ID") @PathVariable String id,
48
+    public ResponseBean taShopAccountLogList(@ApiParam("账户ID") @PathVariable String id,
54 49
                                               @ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
55 50
                                               @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
56 51
                                               @ApiParam("账户流水类型") @RequestParam(value ="amountType", required = false) String amountType) throws Exception{

+ 70
- 35
src/main/java/com/yunzhi/shigongli/controller/TaShopController.java Parādīt failu

@@ -5,9 +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;
9
-import com.yunzhi.shigongli.vo.ResourceFieldVO;
10
-import com.yunzhi.shigongli.vo.ShopListVO;
8
+import com.yunzhi.shigongli.vo.*;
11 9
 import io.swagger.annotations.Api;
12 10
 import io.swagger.annotations.ApiOperation;
13 11
 import io.swagger.annotations.ApiParam;
@@ -305,37 +303,74 @@ public class TaShopController extends BaseController {
305 303
         return ResponseBean.success(result);
306 304
     }
307 305
 
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 306
 
307
+    /**
308
+     * 商铺订单列表
309
+     * @param pageNum
310
+     * @param pageSize
311
+     * @param shopName
312
+     * @param description
313
+     * @param start
314
+     * @param end
315
+     * @return
316
+     * @throws Exception
317
+     */
318
+    @RequestMapping(value="/admin/taShop/orderSub",method= RequestMethod.GET)
319
+    @ApiOperation(value="商铺订单列表", notes = "商铺订单列表", httpMethod = "GET", response = ResponseBean.class)
320
+    public ResponseBean getShopOrderList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
321
+                                         @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
322
+                                         @ApiParam("店铺名称") @RequestParam(value = "shopName", required = false) String shopName,
323
+                                         @ApiParam("套餐名称") @RequestParam(value = "description", required = false) String description,
324
+                                         @ApiParam(value = "开始时间", example = "2021-09-01") @RequestParam(value = "start", required = false) String start,
325
+                                         @ApiParam(value = "结束时间", example = "2021-09-30") @RequestParam(value = "end", required = false) String end) throws Exception {
326
+        IPage<ShopOrderVO> pg = new Page<>(pageNum, pageSize);
327
+
328
+        LocalDateTime startDate = null;
329
+        LocalDateTime endDate = null;
330
+        if (!StringUtils.isEmpty(start)) {
331
+            startDate = DateUtils.from(start + " 00:00:00", "yyyy-MM-dd HH:mm:ss");
332
+        }
333
+        if (!StringUtils.isEmpty(end)) {
334
+            endDate = DateUtils.from(end + " 23:59:59", "yyyy-MM-dd HH:mm:ss");
335
+        }
336
+
337
+        IPage<ShopOrderVO> result = iTaShopService.getShopOrderList(pg, shopName, description, startDate, endDate);
338
+
339
+        return ResponseBean.success(result);
340
+    }
341
+
342
+    /**
343
+     * 商铺推广列表
344
+     * @param pageNum
345
+     * @param pageSize
346
+     * @param shopName
347
+     * @param description
348
+     * @param start
349
+     * @param end
350
+     * @return
351
+     * @throws Exception
352
+     */
353
+    @RequestMapping(value="/admin/taShop/commission",method= RequestMethod.GET)
354
+    @ApiOperation(value="商铺推广列表", notes = "商铺推广列表", httpMethod = "GET", response = ResponseBean.class)
355
+    public ResponseBean getShopCommissionList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
356
+                                         @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
357
+                                         @ApiParam("店铺名称") @RequestParam(value = "shopName", required = false) String shopName,
358
+                                         @ApiParam("套餐名称") @RequestParam(value = "description", required = false) String description,
359
+                                         @ApiParam(value = "开始时间", example = "2021-09-01") @RequestParam(value = "start", required = false) String start,
360
+                                         @ApiParam(value = "结束时间", example = "2021-09-30") @RequestParam(value = "end", required = false) String end) throws Exception {
361
+        IPage<ShopCommissionVO> pg = new Page<>(pageNum, pageSize);
362
+
363
+        LocalDateTime startDate = null;
364
+        LocalDateTime endDate = null;
365
+        if (!StringUtils.isEmpty(start)) {
366
+            startDate = DateUtils.from(start + " 00:00:00", "yyyy-MM-dd HH:mm:ss");
367
+        }
368
+        if (!StringUtils.isEmpty(end)) {
369
+            endDate = DateUtils.from(end + " 23:59:59", "yyyy-MM-dd HH:mm:ss");
370
+        }
371
+
372
+        IPage<ShopCommissionVO> result = iTaShopService.getCommissionList(pg, shopName, description, startDate, endDate);
373
+
374
+        return ResponseBean.success(result);
375
+    }
341 376
 }

+ 97
- 0
src/main/java/com/yunzhi/shigongli/controller/TrPersonClickController.java Parādīt failu

@@ -0,0 +1,97 @@
1
+package com.yunzhi.shigongli.controller;
2
+
3
+import com.yunzhi.shigongli.common.BaseController;
4
+import com.yunzhi.shigongli.common.ResponseBean;
5
+import com.yunzhi.shigongli.entity.TrPersonClick;
6
+import com.yunzhi.shigongli.service.ITrPersonClickService;
7
+import io.swagger.annotations.Api;
8
+import io.swagger.annotations.ApiOperation;
9
+import io.swagger.annotations.ApiParam;
10
+import org.slf4j.Logger;
11
+import org.slf4j.LoggerFactory;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.web.bind.annotation.*;
14
+
15
+import java.time.LocalDateTime;
16
+
17
+/**
18
+ * <p>
19
+    * 用户点击事件埋点 前端控制器
20
+    * </p>
21
+ *
22
+ * @author yansen
23
+ * @since 2021-08-17
24
+ */
25
+
26
+@Api(tags = "用户点击事件埋点")
27
+@RestController
28
+@RequestMapping("/")
29
+public class TrPersonClickController extends BaseController {
30
+
31
+    private final Logger logger = LoggerFactory.getLogger(TrPersonClickController.class);
32
+
33
+    @Autowired
34
+    public ITrPersonClickService iTrPersonClickService;
35
+
36
+
37
+    /**
38
+     * 保存对象
39
+     * @param trPersonClick 实体对象
40
+     * @return
41
+     */
42
+    @RequestMapping(value="/wx/track/click",method= RequestMethod.POST)
43
+    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
44
+    public ResponseBean tdDietMarkAdd(@ApiParam("保存内容") @RequestBody TrPersonClick trPersonClick) throws Exception{
45
+
46
+        trPersonClick.setPersonId(getCurrentPerson().getPersonId());
47
+        trPersonClick.setCreateDate(LocalDateTime.now());
48
+
49
+        if (iTrPersonClickService.save(trPersonClick)){
50
+            return ResponseBean.success(trPersonClick);
51
+        } else {
52
+            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
53
+        }
54
+    }
55
+
56
+//    /**
57
+//     * 根据id删除对象
58
+//     * @param id  实体ID
59
+//     */
60
+//    @RequestMapping(value="/admin/tdDietMark/{id}", method= RequestMethod.DELETE)
61
+//    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
62
+//    public ResponseBean tdDietMarkDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
63
+//        if(iTdDietMarkService.removeLogicById(id)){
64
+//            return ResponseBean.success("success");
65
+//        }else {
66
+//            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
67
+//        }
68
+//    }
69
+//
70
+//    /**
71
+//     * 修改对象
72
+//     * @param id  实体ID
73
+//     * @param tdDietMark 实体对象
74
+//     * @return
75
+//     */
76
+//    @RequestMapping(value="/admin/tdDietMark/{id}",method= RequestMethod.PUT)
77
+//    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
78
+//    public ResponseBean tdDietMarkUpdate(@ApiParam("对象ID") @PathVariable Integer id,
79
+//                                        @ApiParam("更新内容") @RequestBody TdDietMark tdDietMark) throws Exception{
80
+//
81
+//        if (iTdDietMarkService.updateById(tdDietMark)){
82
+//            return ResponseBean.success(iTdDietMarkService.getById(id));
83
+//        }else {
84
+//            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
85
+//        }
86
+//    }
87
+//
88
+//    /**
89
+//     * 根据id查询对象
90
+//     * @param id  实体ID
91
+//     */
92
+//    @RequestMapping(value="/tdDietMark/{id}",method= RequestMethod.GET)
93
+//    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
94
+//    public ResponseBean tdDietMarkGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
95
+//        return ResponseBean.success(iTdDietMarkService.getById(id));
96
+//    }
97
+}

+ 49
- 0
src/main/java/com/yunzhi/shigongli/entity/TrPersonClick.java Parādīt failu

@@ -0,0 +1,49 @@
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="TrPersonClick对象", description="用户点击事件埋点")
26
+public class TrPersonClick implements Serializable {
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 = "父ID")
38
+    private String page;
39
+
40
+    @ApiModelProperty(value = "内容类型")
41
+    private String eventType;
42
+
43
+    @ApiModelProperty(value = "内容对象")
44
+    private Integer eventParams;
45
+
46
+    @ApiModelProperty(value = "创建日期")
47
+    private LocalDateTime createDate;
48
+
49
+}

+ 9
- 1
src/main/java/com/yunzhi/shigongli/mapper/TaOrderSubMapper.java Parādīt failu

@@ -5,6 +5,7 @@ import com.yunzhi.shigongli.entity.TaOrderSub;
5 5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6 6
 import com.yunzhi.shigongli.vo.MineOrder;
7 7
 import com.yunzhi.shigongli.vo.OrderSubListVO;
8
+import com.yunzhi.shigongli.vo.ShopOrderVO;
8 9
 import org.apache.ibatis.annotations.Mapper;
9 10
 import org.apache.ibatis.annotations.Param;
10 11
 import org.apache.ibatis.annotations.Select;
@@ -51,5 +52,12 @@ public interface TaOrderSubMapper extends BaseMapper<TaOrderSub> {
51 52
     IPage<OrderSubListVO> getAdminPagedBy(IPage<OrderSubListVO> pg,
52 53
                                           @Param("shopName") String shopName,
53 54
                                           @Param("description") String description,
54
-                                          @Param("createDate") LocalDateTime createDate);
55
+                                          @Param("startDate") LocalDateTime startDate,
56
+                                          @Param("endDate") LocalDateTime endDate);
57
+
58
+    IPage<ShopOrderVO> getShopOrderList(IPage<ShopOrderVO> pg,
59
+                                        @Param("shopName") String shopName,
60
+                                        @Param("description") String description,
61
+                                        @Param("startDate") LocalDateTime startDate,
62
+                                        @Param("endDate") LocalDateTime endDate);
55 63
 }

+ 2
- 0
src/main/java/com/yunzhi/shigongli/mapper/TaResourceMapper.java Parādīt failu

@@ -32,4 +32,6 @@ public interface TaResourceMapper extends BaseMapper<TaResource> {
32 32
                                         @Param("location") String location,
33 33
                                         @Param("word")  String word,
34 34
                                         @Param("targetType") String targetType);
35
+
36
+    ResourceListVO getDetailByTarget(@Param("targetType") String targetType, @Param("targetId")  String targetId, @Param("location") String location);
35 37
 }

+ 10
- 0
src/main/java/com/yunzhi/shigongli/mapper/TaShopAccountLogMapper.java Parādīt failu

@@ -1,7 +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.TaShopAccountLog;
4 5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6
+import com.yunzhi.shigongli.vo.ShopCommissionVO;
7
+import com.yunzhi.shigongli.vo.ShopOrderVO;
5 8
 import org.apache.ibatis.annotations.Mapper;
6 9
 import org.apache.ibatis.annotations.Param;
7 10
 
@@ -22,4 +25,11 @@ public interface TaShopAccountLogMapper extends BaseMapper<TaShopAccountLog> {
22 25
                             @Param("amountType") String amountType,
23 26
                             @Param("start") LocalDateTime start,
24 27
                             @Param("end") LocalDateTime end);
28
+
29
+    IPage<ShopCommissionVO> getShopAccountList(IPage<ShopCommissionVO> pg,
30
+                                          @Param("amountType") String amountType,
31
+                                          @Param("shopName") String shopName,
32
+                                          @Param("description") String description,
33
+                                          @Param("startDate") LocalDateTime startDate,
34
+                                          @Param("endDate") LocalDateTime endDate);
25 35
 }

+ 18
- 0
src/main/java/com/yunzhi/shigongli/mapper/TrPersonClickMapper.java Parādīt failu

@@ -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.TrPersonClick;
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 TrPersonClickMapper extends BaseMapper<TrPersonClick> {
17
+
18
+}

+ 1
- 1
src/main/java/com/yunzhi/shigongli/service/ITaOrderSubService.java Parādīt failu

@@ -36,5 +36,5 @@ public interface ITaOrderSubService extends IBaseService<TaOrderSub> {
36 36
 
37 37
     MineOrder getSingleOrderSubOf(TaPerson taPerson, Integer subOrderId);
38 38
 
39
-    IPage<OrderSubListVO> getAdminPagedBy(IPage<OrderSubListVO> pg, String shopName, String description, LocalDateTime createDate);
39
+    IPage<OrderSubListVO> getAdminPagedBy(IPage<OrderSubListVO> pg, String shopName, String description, LocalDateTime startDate, LocalDateTime endDate);
40 40
 }

+ 2
- 0
src/main/java/com/yunzhi/shigongli/service/ITaResourceService.java Parādīt failu

@@ -31,4 +31,6 @@ public interface ITaResourceService extends IBaseService<TaResource> {
31 31
     void updateLike(TaLike taLike, int num);
32 32
 
33 33
     IPage<ResourceListVO> searchList(IPage<ResourceListVO> pg, TaPerson currentPerson, String location, String q, String targetType);
34
+
35
+    ResourceListVO getDetailByTarget(String targetType, String targetId, String location);
34 36
 }

+ 7
- 0
src/main/java/com/yunzhi/shigongli/service/ITaShopService.java Parādīt failu

@@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.yunzhi.shigongli.entity.TaPerson;
5 5
 import com.yunzhi.shigongli.entity.TaShop;
6 6
 import com.yunzhi.shigongli.vo.ResourceFieldVO;
7
+import com.yunzhi.shigongli.vo.ShopCommissionVO;
7 8
 import com.yunzhi.shigongli.vo.ShopListVO;
9
+import com.yunzhi.shigongli.vo.ShopOrderVO;
8 10
 
11
+import java.time.LocalDateTime;
9 12
 import java.util.List;
10 13
 
11 14
 
@@ -28,4 +31,8 @@ public interface ITaShopService extends IBaseService<TaShop> {
28 31
     ResourceFieldVO copyProperties(TaShop taShop);
29 32
 
30 33
     List<TaShop> getListByPerson(TaPerson taPerson);
34
+
35
+    IPage<ShopOrderVO> getShopOrderList(IPage<ShopOrderVO> pg, String shopName, String description, LocalDateTime startDate, LocalDateTime endDate);
36
+
37
+    IPage<ShopCommissionVO> getCommissionList(IPage<ShopCommissionVO> pg, String shopName, String description, LocalDateTime startDate, LocalDateTime endDate);
31 38
 }

+ 16
- 0
src/main/java/com/yunzhi/shigongli/service/ITrPersonClickService.java Parādīt failu

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

+ 62
- 11
src/main/java/com/yunzhi/shigongli/service/impl/TaOrderPayServiceImpl.java Parādīt failu

@@ -62,6 +62,12 @@ public class TaOrderPayServiceImpl extends BaseServiceImpl<TaOrderPayMapper, TaO
62 62
     @Autowired
63 63
     TaVerifyTargetMapper taVerifyTargetMapper;
64 64
 
65
+    @Autowired
66
+    TaPersonAccountMapper personAccountMapper;
67
+
68
+    @Autowired
69
+    TaPersonAccountLogMapper accountLogMapper;
70
+
65 71
     /**
66 72
      * 支付回调
67 73
      * @param notifyResult
@@ -94,29 +100,46 @@ public class TaOrderPayServiceImpl extends BaseServiceImpl<TaOrderPayMapper, TaO
94 100
                 taOrderSubMapper.updateStatusByOrder(orderId, Constants.ORDER_PAYED);
95 101
             }
96 102
 
103
+
104
+            List<TaOrderSub> orderSubList = new ArrayList<>();
105
+            if (null != taOrder) {
106
+                orderSubList = taOrderSubMapper.getListByOrder(taOrder.getOrderId());
107
+            } else {
108
+                orderSubList.add(taOrderSub);
109
+            }
110
+
97 111
             // 发送核销码
98
-            generateVerfiedRecords(taOrder, taOrderSub, taPerson);
112
+            generateVerfiedRecords(taPerson, orderSubList);
113
+
114
+            // 返现
115
+            processCallback(orderPay, taPerson, orderSubList, taOrder, taOrderSub);
99 116
 
100 117
             PaySuccessEvent evt = new PaySuccessEvent(this, orderPay);
101 118
             eventPublisher.publishEvent(evt);
102 119
         }
103 120
     }
104 121
 
122
+    private void processCallback(TaOrderPay originPay, TaPerson taPerson, List<TaOrderSub> orderSubList, TaOrder taOrder, TaOrderSub taOrderSub) throws Exception {
123
+        if (null == orderSubList || orderSubList.size() < 1) {
124
+            throw new Exception("未找到有效的订单项目记录");
125
+        }
126
+
127
+        Integer cashback = orderSubList.stream().mapToInt(TaOrderSub::getCashback).reduce(Integer::sum).getAsInt();
128
+
129
+        TaOrderPay orderPay = null != taOrder ? createByOrder(taOrder) : createByOrderSub(taOrderSub, taPerson);
130
+        orderPay.setDescription("返现");
131
+        orderPay.setCharges(cashback);
132
+
133
+        wxPayUtils.refund(originPay, orderPay);
134
+    }
135
+
105 136
     /**
106 137
      * 发放核销码
107
-     * @param taOrder
108
-     * @param taOrderSub
109 138
      * @param taPerson
139
+     * @param orderSubList
110 140
      * @throws Exception
111 141
      */
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
-
142
+    private void generateVerfiedRecords(TaPerson taPerson, List<TaOrderSub> orderSubList) throws Exception {
120 143
         LocalDateTime now = LocalDateTime.now();
121 144
 
122 145
         // 循环发放
@@ -184,6 +207,12 @@ public class TaOrderPayServiceImpl extends BaseServiceImpl<TaOrderPayMapper, TaO
184 207
         boolean isSuccess = WxPayConstants.RefundStatus.SUCCESS.equals(reqInfo.getRefundStatus());
185 208
 
186 209
         TaOrderPay orderPay = getById(reqInfo.getOutTradeNo());
210
+        if ("返现".equals(orderPay.getDescription())) {
211
+            cashback(orderPay);
212
+            return;
213
+        }
214
+
215
+
187 216
         orderPay.setPayDate(DateUtils.from(reqInfo.getSuccessTime(), "yyyyMMddHHmmss"));
188 217
         orderPay.setStatus(isSuccess ? Constants.PAY_SUCCESS : Constants.PAY_FAIL);
189 218
         orderPay.setMessage(isSuccess ? null : reqInfo.getRefundStatus());
@@ -205,6 +234,28 @@ public class TaOrderPayServiceImpl extends BaseServiceImpl<TaOrderPayMapper, TaO
205 234
         }
206 235
     }
207 236
 
237
+    private void cashback(TaOrderPay taOrderPay) throws Exception {
238
+        String orderId = taOrderPay.getOrderId();
239
+        String orderSubId = taOrderPay.getSubOrderId();
240
+        TaOrder taOrder = taOrderMapper.selectById(orderId);
241
+        Integer cashback = taOrderPay.getCharges();
242
+        boolean isOrderSub = !StringUtils.isEmpty(orderSubId);
243
+
244
+        TaPersonAccount personAccount = personAccountMapper.getByPerson(taOrder.getPersonId());
245
+        personAccountMapper.updateCashBack(personAccount.getAccountId(), cashback);
246
+
247
+        TaPersonAccountLog accountLog = new TaPersonAccountLog();
248
+        accountLog.setAccountId(personAccount.getAccountId());
249
+        accountLog.setPersonId(taOrder.getPersonId());
250
+        accountLog.setAmountType(Constants.ACCOUNT_CASHBACK);
251
+        accountLog.setAmount(cashback);
252
+        accountLog.setSignType(Constants.ACCOUNT_INCOME);
253
+        accountLog.setTargetType(isOrderSub ? Constants.TARGET_ORDER_SUB : Constants.TARGET_ORDER);
254
+        accountLog.setTargetId(isOrderSub ? orderSubId : orderId);
255
+        accountLog.setOrderId(orderId);
256
+        accountLogMapper.insert(accountLog);
257
+    }
258
+
208 259
     @Override
209 260
     public WxPayMpOrderResult prePay(TaPerson person, TaOrder taOrder) throws Exception {
210 261
         TaOrderPay orderPay = createByOrder(taOrder);

+ 2
- 2
src/main/java/com/yunzhi/shigongli/service/impl/TaOrderSubServiceImpl.java Parādīt failu

@@ -141,8 +141,8 @@ public class TaOrderSubServiceImpl extends BaseServiceImpl<TaOrderSubMapper, TaO
141 141
     }
142 142
 
143 143
     @Override
144
-    public IPage<OrderSubListVO> getAdminPagedBy(IPage<OrderSubListVO> pg, String shopName, String description, LocalDateTime createDate) {
145
-        return baseMapper.getAdminPagedBy(pg, shopName, description, createDate);
144
+    public IPage<OrderSubListVO> getAdminPagedBy(IPage<OrderSubListVO> pg, String shopName, String description, LocalDateTime startDate, LocalDateTime endDate) {
145
+        return baseMapper.getAdminPagedBy(pg, shopName, description, startDate, endDate);
146 146
     }
147 147
 
148 148
     /**

+ 26
- 29
src/main/java/com/yunzhi/shigongli/service/impl/TaPersonAccountServiceImpl.java Parādīt failu

@@ -38,9 +38,6 @@ public class TaPersonAccountServiceImpl extends BaseServiceImpl<TaPersonAccountM
38 38
     @Autowired
39 39
     TaPersonAccountMapper personAccountMapper;
40 40
 
41
-    @Autowired
42
-    TaPersonAccountMapper accountMapper;
43
-
44 41
     @Autowired
45 42
     TaPersonAccountLogMapper accountLogMapper;
46 43
 
@@ -48,32 +45,32 @@ public class TaPersonAccountServiceImpl extends BaseServiceImpl<TaPersonAccountM
48 45
     @Transactional(rollbackFor = Exception.class)
49 46
     @Override
50 47
     public void cashback(TaOrderPay taOrderPay) throws Exception {
51
-        String orderId = taOrderPay.getOrderId();
52
-        String orderSubId = taOrderPay.getSubOrderId();
53
-        TaOrder taOrder = taOrderMapper.selectById(orderId);
54
-        Integer cashback = 0;
55
-        boolean isOrderSub = !StringUtils.isEmpty(orderSubId);
56
-        if (isOrderSub) {
57
-            TaOrderSub taOrderSub = orderSubMapper.selectById(orderSubId);
58
-            cashback = taOrderSub.getCashback();
59
-        } else {
60
-            List<TaOrderSub> orderSubList = orderSubMapper.getListByOrder(taOrder.getOrderId());
61
-            cashback = orderSubList.stream().mapToInt(TaOrderSub::getCashback).reduce(Integer::sum).getAsInt();
62
-        }
63
-
64
-        TaPersonAccount personAccount = personAccountMapper.getByPerson(taOrder.getPersonId());
65
-        accountMapper.updateCashBack(personAccount.getAccountId(), cashback);
66
-
67
-        TaPersonAccountLog accountLog = new TaPersonAccountLog();
68
-        accountLog.setAccountId(personAccount.getAccountId());
69
-        accountLog.setPersonId(taOrder.getPersonId());
70
-        accountLog.setAmountType(Constants.ACCOUNT_CASHBACK);
71
-        accountLog.setAmount(cashback);
72
-        accountLog.setSignType(Constants.ACCOUNT_INCOME);
73
-        accountLog.setTargetType(isOrderSub ? Constants.TARGET_ORDER_SUB : Constants.TARGET_ORDER);
74
-        accountLog.setTargetId(isOrderSub ? orderSubId : orderId);
75
-        accountLog.setOrderId(orderId);
76
-        accountLogMapper.insert(accountLog);
48
+//        String orderId = taOrderPay.getOrderId();
49
+//        String orderSubId = taOrderPay.getSubOrderId();
50
+//        TaOrder taOrder = taOrderMapper.selectById(orderId);
51
+//        Integer cashback = 0;
52
+//        boolean isOrderSub = !StringUtils.isEmpty(orderSubId);
53
+//        if (isOrderSub) {
54
+//            TaOrderSub taOrderSub = orderSubMapper.selectById(orderSubId);
55
+//            cashback = taOrderSub.getCashback();
56
+//        } else {
57
+//            List<TaOrderSub> orderSubList = orderSubMapper.getListByOrder(taOrder.getOrderId());
58
+//            cashback = orderSubList.stream().mapToInt(TaOrderSub::getCashback).reduce(Integer::sum).getAsInt();
59
+//        }
60
+//
61
+//        TaPersonAccount personAccount = personAccountMapper.getByPerson(taOrder.getPersonId());
62
+//        personAccountMapper.updateCashBack(personAccount.getAccountId(), cashback);
63
+//
64
+//        TaPersonAccountLog accountLog = new TaPersonAccountLog();
65
+//        accountLog.setAccountId(personAccount.getAccountId());
66
+//        accountLog.setPersonId(taOrder.getPersonId());
67
+//        accountLog.setAmountType(Constants.ACCOUNT_CASHBACK);
68
+//        accountLog.setAmount(cashback);
69
+//        accountLog.setSignType(Constants.ACCOUNT_INCOME);
70
+//        accountLog.setTargetType(isOrderSub ? Constants.TARGET_ORDER_SUB : Constants.TARGET_ORDER);
71
+//        accountLog.setTargetId(isOrderSub ? orderSubId : orderId);
72
+//        accountLog.setOrderId(orderId);
73
+//        accountLogMapper.insert(accountLog);
77 74
     }
78 75
 
79 76
 }

+ 4
- 9
src/main/java/com/yunzhi/shigongli/service/impl/TaPersonRecommenderServiceImpl.java Parādīt failu

@@ -34,7 +34,7 @@ public class TaPersonRecommenderServiceImpl extends BaseServiceImpl<TaPersonReco
34 34
     @Async
35 35
     @Override
36 36
     public void addNewRecommender(String personId, String fromType, String recommender) throws Exception {
37
-        if (isExists(personId, fromType, recommender)) {
37
+        if (isExists(personId)) {
38 38
             throw new Exception("当前客户还有未到期的推荐人");
39 39
         }
40 40
 
@@ -43,7 +43,7 @@ public class TaPersonRecommenderServiceImpl extends BaseServiceImpl<TaPersonReco
43 43
         if (Constants.RECOMMEND_SHOP.equals(fromType)) {
44 44
             configCode = Constants.CONF_SHOP_RECOMMEND_VALID_DAYS;
45 45
         }
46
-        if (Constants.RECOMMEND_SHOP.equals(fromType)) {
46
+        if (Constants.RECOMMEND_HOTEL.equals(fromType)) {
47 47
             configCode = Constants.CONF_HOTEL_RECOMMEND_VALID_DAYS;
48 48
         }
49 49
 
@@ -68,15 +68,10 @@ public class TaPersonRecommenderServiceImpl extends BaseServiceImpl<TaPersonReco
68 68
         save(personRecommender);
69 69
     }
70 70
 
71
-    private boolean isExists(String personId, String fromType, String recommender) {
72
-        LocalDateTime now = LocalDateTime.now();
71
+    private boolean isExists(String personId) {
73 72
         LambdaQueryWrapper<TaPersonRecommender> queryWrapper = new LambdaQueryWrapper<>();
74 73
         queryWrapper.eq(TaPersonRecommender::getPersonId, personId)
75
-                .eq(TaPersonRecommender::getFromType, fromType)
76
-                .eq(TaPersonRecommender::getRecommender, recommender)
77
-                .eq(TaPersonRecommender::getStatus, Constants.STATUS_NORMAL)
78
-                .gt(TaPersonRecommender::getCreateDate, LocalDateTime.now())
79
-                .lt(TaPersonRecommender::getExpireDate, now);
74
+                .eq(TaPersonRecommender::getStatus, Constants.STATUS_NORMAL);
80 75
 
81 76
         return count(queryWrapper) > 0;
82 77
     }

+ 11
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TaPersonServiceImpl.java Parādīt failu

@@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 4
 import com.yunzhi.shigongli.common.Constants;
5 5
 import com.yunzhi.shigongli.common.StringUtils;
6 6
 import com.yunzhi.shigongli.entity.TaPerson;
7
+import com.yunzhi.shigongli.entity.TaPersonAccount;
8
+import com.yunzhi.shigongli.mapper.TaPersonAccountMapper;
7 9
 import com.yunzhi.shigongli.mapper.TaPersonMapper;
8 10
 import com.yunzhi.shigongli.service.ITaPersonService;
9 11
 
12
+import org.springframework.beans.factory.annotation.Autowired;
10 13
 import org.springframework.stereotype.Service;
11 14
 
12 15
 /**
@@ -20,6 +23,9 @@ import org.springframework.stereotype.Service;
20 23
 @Service
21 24
 public class TaPersonServiceImpl extends BaseServiceImpl<TaPersonMapper, TaPerson> implements ITaPersonService {
22 25
 
26
+    @Autowired
27
+    TaPersonAccountMapper personAccountMapper;
28
+
23 29
     @Override
24 30
     public TaPerson getByOpenid(String openid) {
25 31
         if (StringUtils.isEmpty(openid)) {
@@ -41,6 +47,11 @@ public class TaPersonServiceImpl extends BaseServiceImpl<TaPersonMapper, TaPerso
41 47
             taPerson = new TaPerson();
42 48
             taPerson.setOpenid(openid);
43 49
             save(taPerson);
50
+
51
+            TaPersonAccount taPersonAccount = new TaPersonAccount();
52
+            taPersonAccount.setPersonId(taPerson.getPersonId());
53
+            personAccountMapper.insert(taPersonAccount);
54
+
44 55
             // 插入过程会有默认字段写入
45 56
             taPerson = getById(taPerson.getPersonId());
46 57
         }

+ 5
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TaResourceServiceImpl.java Parādīt failu

@@ -137,6 +137,11 @@ public class TaResourceServiceImpl extends BaseServiceImpl<TaResourceMapper, TaR
137 137
         return baseMapper.getSearchList(pg, personId, location, word, targetType);
138 138
     }
139 139
 
140
+    @Override
141
+    public ResourceListVO getDetailByTarget(String targetType, String targetId, String location) {
142
+        return baseMapper.getDetailByTarget(targetType, targetId, location);
143
+    }
144
+
140 145
     private TaSearch createSearchLog(String word, String personId) {
141 146
         TaSearch taSearch = new TaSearch();
142 147
         taSearch.setPersonId(personId);

+ 19
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TaShopServiceImpl.java Parādīt failu

@@ -9,7 +9,9 @@ import com.yunzhi.shigongli.mapper.*;
9 9
 import com.yunzhi.shigongli.service.ITaShopService;
10 10
 
11 11
 import com.yunzhi.shigongli.vo.ResourceFieldVO;
12
+import com.yunzhi.shigongli.vo.ShopCommissionVO;
12 13
 import com.yunzhi.shigongli.vo.ShopListVO;
14
+import com.yunzhi.shigongli.vo.ShopOrderVO;
13 15
 import org.apache.poi.ss.formula.functions.T;
14 16
 import org.springframework.beans.BeanUtils;
15 17
 import org.springframework.beans.factory.annotation.Autowired;
@@ -17,6 +19,7 @@ import org.springframework.scheduling.annotation.Async;
17 19
 import org.springframework.stereotype.Service;
18 20
 import org.springframework.transaction.annotation.Transactional;
19 21
 
22
+import java.time.LocalDateTime;
20 23
 import java.util.List;
21 24
 
22 25
 /**
@@ -45,6 +48,12 @@ public class TaShopServiceImpl extends BaseServiceImpl<TaShopMapper, TaShop> imp
45 48
     @Autowired
46 49
     TaResourceMapper taTargetQuotaMapper;
47 50
 
51
+    @Autowired
52
+    TaOrderSubMapper taOrderSubMapper;
53
+
54
+    @Autowired
55
+    TaShopAccountLogMapper shopAccountLogMapper;
56
+
48 57
     @Override
49 58
     public IPage<ShopListVO> getPageListBy(IPage<ShopListVO> pg, String shopName, String phone) {
50 59
         return taShopMapper.getPageListBy(pg, shopName, phone);
@@ -115,4 +124,14 @@ public class TaShopServiceImpl extends BaseServiceImpl<TaShopMapper, TaShop> imp
115 124
     public List<TaShop> getListByPerson(TaPerson taPerson) {
116 125
         return taShopMapper.getListByPerson(taPerson.getPersonId());
117 126
     }
127
+
128
+    @Override
129
+    public IPage<ShopOrderVO> getShopOrderList(IPage<ShopOrderVO> pg, String shopName, String description, LocalDateTime startDate, LocalDateTime endDate) {
130
+        return taOrderSubMapper.getShopOrderList(pg, shopName, description, startDate, endDate);
131
+    }
132
+
133
+    @Override
134
+    public IPage<ShopCommissionVO> getCommissionList(IPage<ShopCommissionVO> pg, String shopName, String description, LocalDateTime startDate, LocalDateTime endDate) {
135
+        return shopAccountLogMapper.getShopAccountList(pg, Constants.ACCOUNT_COMMISSION, shopName, description, startDate, endDate);
136
+    }
118 137
 }

+ 19
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TrPersonClickServiceImpl.java Parādīt failu

@@ -0,0 +1,19 @@
1
+package com.yunzhi.shigongli.service.impl;
2
+
3
+import com.yunzhi.shigongli.entity.TrPersonClick;
4
+import com.yunzhi.shigongli.mapper.TrPersonClickMapper;
5
+import com.yunzhi.shigongli.service.ITrPersonClickService;
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 TrPersonClickServiceImpl extends BaseServiceImpl<TrPersonClickMapper, TrPersonClick> implements ITrPersonClickService {
18
+
19
+}

+ 48
- 0
src/main/java/com/yunzhi/shigongli/vo/ShopCommissionVO.java Parādīt failu

@@ -0,0 +1,48 @@
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
+
8
+@ApiModel(description = "商铺推广列表")
9
+@Data
10
+public class ShopCommissionVO {
11
+
12
+    @ApiModelProperty(value = "日志ID")
13
+    private Integer logId;
14
+
15
+    @ApiModelProperty(value = "店铺ID")
16
+    private String shopId;
17
+
18
+    @ApiModelProperty(value = "店铺名称")
19
+    private String shopName;
20
+
21
+    @ApiModelProperty(value = "订单ID")
22
+    private String orderId;
23
+
24
+    @ApiModelProperty(value = "子订单ID")
25
+    private String subOrderId;
26
+
27
+    @ApiModelProperty(value = "套餐ID")
28
+    private String packageId;
29
+
30
+    @ApiModelProperty(value = "套餐名称")
31
+    private String description;
32
+
33
+    @ApiModelProperty(value = "人员ID")
34
+    private String personId;
35
+
36
+    @ApiModelProperty(value = "人员昵称")
37
+    private String nickName;
38
+
39
+    @ApiModelProperty(value = "人员手机号")
40
+    private String phone;
41
+
42
+    @ApiModelProperty(value = "订单金额")
43
+    private Integer charges;
44
+
45
+    @ApiModelProperty(value = "推广收入")
46
+    private Integer commissionCharge;
47
+
48
+}

+ 44
- 0
src/main/java/com/yunzhi/shigongli/vo/ShopOrderVO.java Parādīt failu

@@ -0,0 +1,44 @@
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
+
8
+@ApiModel(description = "商铺订单列表")
9
+@Data
10
+public class ShopOrderVO {
11
+
12
+    @ApiModelProperty(value = "店铺ID")
13
+    private String shopId;
14
+
15
+    @ApiModelProperty(value = "店铺名称")
16
+    private String shopName;
17
+
18
+    @ApiModelProperty(value = "套餐ID")
19
+    private String packageId;
20
+
21
+    @ApiModelProperty(value = "套餐名称")
22
+    private String description;
23
+
24
+    @ApiModelProperty(value = "下单金额")
25
+    private Integer charges;
26
+
27
+    @ApiModelProperty(value = "下单数量")
28
+    private Integer amount;
29
+
30
+    @ApiModelProperty(value = "返现金额")
31
+    private Integer cashback;
32
+
33
+    @ApiModelProperty(value = "已核销金额")
34
+    private Integer verfiedCharge;
35
+
36
+    @ApiModelProperty(value = "待核销金额")
37
+    private Integer unVerfiedCharge;
38
+
39
+    @ApiModelProperty(value = "被提点金额")
40
+    private Integer commissionCharge;
41
+
42
+    @ApiModelProperty(value = "退款金额")
43
+    private Integer refundCharge;
44
+}

+ 4
- 5
src/main/resources/application.yml Parādīt failu

@@ -48,13 +48,13 @@ aliyun:
48 48
 ###
49 49
 weixin:
50 50
   miniapp:
51
-    appid: wx06a7372d48d56843
52
-    secret: ead0c7b1dd40ce828b1fd9bf18183584
51
+    appid: wx835627a9b9b3932a
52
+    secret: 51cc2b26c1628ae098f05a3ba8e6f6f4
53 53
     token:
54 54
     aesKey:
55 55
     msgDataFormat: JSON
56 56
   pay:
57
-    appId: wx06a7372d48d56843
57
+    appId: wx835627a9b9b3932a
58 58
     mchId: 1612121997
59 59
     mchKey: fUbYPldU5bUCYRl97vMv69JQujsJ8dj5
60 60
     subAppId:
@@ -71,8 +71,7 @@ amap:
71 71
 
72 72
 sysBiz:
73 73
   miniapp:
74
-      shopPage: pages/index/index
75
-#    shopPage: pages/details/foodDetails/foodDetails
74
+    shopPage: pages/details/foodDetails/foodDetails
76 75
 
77 76
 ###
78 77
 spring:

+ 40
- 2
src/main/resources/mapper/TaOrderSubMapper.xml Parādīt failu

@@ -141,10 +141,48 @@
141 141
           <if test="description != null and description != ''">
142 142
               AND t.description LIKE CONCAT( '%', #{description}, '%' )
143 143
           </if>
144
-          <if test="createDate != null">
145
-              AND t.create_date &gt;= #{createDate}
144
+          <if test="startDate != null">
145
+              AND t.create_date &gt;= #{startDate}
146
+          </if>
147
+          <if test="endDate != null">
148
+            AND t.create_date &lt;= #{endDate}
146 149
           </if>
147 150
         ORDER BY
148 151
             t.create_date DESC
149 152
     </select>
153
+    <select id="getShopOrderList" resultType="com.yunzhi.shigongli.vo.ShopOrderVO">
154
+        SELECT
155
+            t.shop_id,
156
+            t.package_id,
157
+            s.shop_name,
158
+            t.description,
159
+            sum( t.charges ) AS charges,
160
+            sum( t.amount ) AS amount,
161
+            sum( t.cashback ) AS cashback,
162
+            sum( IF ( t.is_verified = 1, t.charges, 0 ) ) AS verfied_charge,
163
+            sum( t.commission_charge ) AS commission_charge,
164
+            sum( IF ( t.`status` = 2, t.charges, 0 ) ) AS refund_charge
165
+        FROM
166
+            ta_order_sub t
167
+            INNER JOIN ta_shop s ON s.shop_id = t.shop_id
168
+        WHERE
169
+            t.`status` > - 1
170
+          <if test="shopName != null and shopName != ''">
171
+              AND s.shop_name LIKE CONCAT( '%', #{shopName}, '%' )
172
+          </if>
173
+          <if test="description != null and description != ''">
174
+              AND t.description LIKE CONCAT( '%', #{description}, '%' )
175
+          </if>
176
+          <if test="startDate != null">
177
+              AND t.create_date &gt;= #{startDate}
178
+          </if>
179
+          <if test="endDate != null">
180
+              AND t.create_date &lt;= #{endDate}
181
+          </if>
182
+        GROUP BY
183
+            t.shop_id,
184
+            t.package_id
185
+        ORDER BY
186
+            sum( t.charges ) DESC
187
+    </select>
150 188
 </mapper>

+ 0
- 2
src/main/resources/mapper/TaPersonRecommenderMapper.xml Parādīt failu

@@ -9,8 +9,6 @@
9 9
             ta_person_recommender t
10 10
         WHERE
11 11
             t.person_id = #{personId}
12
-          AND t.create_date &lt; now( )
13
-          AND t.expire_date &gt; now( )
14 12
           AND t.`status` = 1
15 13
     </select>
16 14
 </mapper>

+ 37
- 0
src/main/resources/mapper/TaShopAccountLogMapper.xml Parādīt failu

@@ -12,4 +12,41 @@
12 12
           AND t.amount_type = #{amountType}
13 13
           AND t.create_date BETWEEN #{start} AND #{end}
14 14
     </select>
15
+    <select id="getShopAccountList" resultType="com.yunzhi.shigongli.vo.ShopCommissionVO">
16
+        SELECT
17
+            t.log_id,
18
+            t.shop_id,
19
+            m.shop_name,
20
+            s.order_id,
21
+            s.sub_order_id,
22
+            s.package_id,
23
+            n.description,
24
+            p.person_id,
25
+            p.nick_name,
26
+            p.phone,
27
+            s.charges,
28
+            t.amount as commission_charge
29
+        FROM
30
+            ta_shop_account_log t
31
+            INNER JOIN ta_order_sub s ON s.sub_order_id = t.sub_order_id
32
+            INNER JOIN ta_shop m ON m.shop_id = t.shop_id
33
+            INNER JOIN ta_order n ON n.order_id = t.order_id
34
+            INNER JOIN ta_person p ON p.person_id = n.person_id
35
+        WHERE
36
+            t.amount_type = #{amountType}
37
+          <if test="shopName != null and shopName != ''">
38
+              AND m.shop_name LIKE CONCAT( '%', #{shopName}, '%' )
39
+          </if>
40
+          <if test="description != null and description != ''">
41
+              AND s.description LIKE CONCAT( '%', #{description}, '%' )
42
+          </if>
43
+          <if test="startDate != null">
44
+              AND t.create_date &gt;= #{startDate}
45
+          </if>
46
+          <if test="endDate != null">
47
+              AND t.create_date &lt;= #{endDate}
48
+          </if>
49
+        ORDER BY
50
+            t.create_date DESC
51
+    </select>
15 52
 </mapper>

+ 4
- 0
src/main/resources/mapper/TaShopPackageMapper.xml Parādīt failu

@@ -45,12 +45,16 @@
45 45
             (
46 46
                 SELECT
47 47
                     t.*,
48
+                    c.area_name,
49
+                    d.area_name as area_p_name,
48 50
                     fn_distance ( #{location}, s.locaton ) AS distance,
49 51
                     ( s.sweet_score + s.environment_score + s.service_score ) / 3 AS score,
50 52
                     IF ( m.save_id IS NULL, 0, 1 ) AS is_saved
51 53
                 FROM
52 54
                     ta_shop_package t
53 55
                         INNER JOIN ta_shop s ON s.shop_id = t.shop_id
56
+                        LEFT JOIN td_city c on c.area_id = s.city_id
57
+                        LEFT JOIN td_city d on d.area_id = c.area_p_id
54 58
                         LEFT JOIN ta_save m ON m.target_type = #{targetType}
55 59
                         AND m.target_id = t.package_id
56 60
                         AND m.person_id = #{personId}

+ 12
- 0
src/main/resources/mapper/TaTargetQuotaMapper.xml Parādīt failu

@@ -77,4 +77,16 @@
77 77
             IFNULL( w.weight, 0 ) DESC,
78 78
             w.distance DESC
79 79
     </select>
80
+    <select id="getDetailByTarget" resultType="com.yunzhi.shigongli.vo.ResourceListVO">
81
+        SELECT
82
+            t.*,
83
+            fn_distance ( #{location}, CONCAT( t.lng, ',', t.lat ) ) AS distance,
84
+            0 AS is_saved
85
+        FROM
86
+            ta_resource t
87
+        WHERE
88
+            t.target_type = #{targetType}
89
+            AND t.target_id = #{targetId}
90
+            AND t.`status` &gt; -1
91
+    </select>
80 92
 </mapper>

+ 5
- 0
src/main/resources/mapper/TrPersonClickMapper.xml Parādīt failu

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