张延森 3 years ago
parent
commit
09f51ea68d
39 changed files with 352 additions and 66 deletions
  1. 1
    1
      pom.xml
  2. 2
    0
      src/main/java/com/yunzhi/shigongli/common/Constants.java
  3. 36
    0
      src/main/java/com/yunzhi/shigongli/common/WxUtils.java
  4. 1
    1
      src/main/java/com/yunzhi/shigongli/controller/TaOrderController.java
  5. 3
    0
      src/main/java/com/yunzhi/shigongli/controller/TaRoomController.java
  6. 3
    2
      src/main/java/com/yunzhi/shigongli/controller/TaShopController.java
  7. 1
    0
      src/main/java/com/yunzhi/shigongli/controller/TaTouristController.java
  8. 8
    0
      src/main/java/com/yunzhi/shigongli/controller/TaVerifyTargetController.java
  9. 2
    0
      src/main/java/com/yunzhi/shigongli/controller/TdCityController.java
  10. 3
    0
      src/main/java/com/yunzhi/shigongli/entity/TaResource.java
  11. 6
    0
      src/main/java/com/yunzhi/shigongli/entity/TaRoom.java
  12. 3
    0
      src/main/java/com/yunzhi/shigongli/entity/TaShop.java
  13. 5
    2
      src/main/java/com/yunzhi/shigongli/entity/TaShopPackage.java
  14. 3
    0
      src/main/java/com/yunzhi/shigongli/entity/TaVerifyTarget.java
  15. 1
    1
      src/main/java/com/yunzhi/shigongli/entity/TrPersonClick.java
  16. 10
    17
      src/main/java/com/yunzhi/shigongli/event/SendMessageTask.java
  17. 21
    0
      src/main/java/com/yunzhi/shigongli/event/VerifyResultEvent.java
  18. 4
    3
      src/main/java/com/yunzhi/shigongli/event/listener/PaySuccessEventListener.java
  19. 24
    0
      src/main/java/com/yunzhi/shigongli/event/listener/VerifyResultEventListener.java
  20. 5
    0
      src/main/java/com/yunzhi/shigongli/mapper/TaOrderPayMapper.java
  21. 5
    0
      src/main/java/com/yunzhi/shigongli/mapper/TaVerifyTargetMapper.java
  22. 2
    0
      src/main/java/com/yunzhi/shigongli/service/ITaOrderPayService.java
  23. 2
    0
      src/main/java/com/yunzhi/shigongli/service/ITaVerifyTargetService.java
  24. 6
    23
      src/main/java/com/yunzhi/shigongli/service/impl/TaHotelWorkerServiceImpl.java
  25. 68
    6
      src/main/java/com/yunzhi/shigongli/service/impl/TaOrderPayServiceImpl.java
  26. 1
    0
      src/main/java/com/yunzhi/shigongli/service/impl/TaShopServiceImpl.java
  27. 1
    0
      src/main/java/com/yunzhi/shigongli/service/impl/TaTouristServiceImpl.java
  28. 59
    0
      src/main/java/com/yunzhi/shigongli/service/impl/TaVerifyTargetServiceImpl.java
  29. 9
    1
      src/main/java/com/yunzhi/shigongli/vo/ShopPackageVO.java
  30. 0
    4
      src/main/resources/application-dev.yml
  31. 18
    0
      src/main/resources/application-prod.yml
  32. 3
    3
      src/main/resources/application.yml
  33. 0
    0
      src/main/resources/logback.xml.bak
  34. 18
    0
      src/main/resources/mapper/TaOrderPayMapper.xml
  35. 1
    1
      src/main/resources/mapper/TaOrderSubMapper.xml
  36. 1
    0
      src/main/resources/mapper/TaSaveMapper.xml
  37. 1
    0
      src/main/resources/mapper/TaShopPackageMapper.xml
  38. 4
    1
      src/main/resources/mapper/TaTargetQuotaMapper.xml
  39. 11
    0
      src/main/resources/mapper/TaVerifyTargetMapper.xml

+ 1
- 1
pom.xml View File

10
 	</parent>
10
 	</parent>
11
 	<groupId>com.yunzhi</groupId>
11
 	<groupId>com.yunzhi</groupId>
12
 	<artifactId>shigongli</artifactId>
12
 	<artifactId>shigongli</artifactId>
13
-	<version>2.0.0</version>
13
+	<version>2.0.1</version>
14
 	<name>shigongli</name>
14
 	<name>shigongli</name>
15
 	<description>Shi Gong Li</description>
15
 	<description>Shi Gong Li</description>
16
 
16
 

+ 2
- 0
src/main/java/com/yunzhi/shigongli/common/Constants.java View File

72
     // 小程序消息模板
72
     // 小程序消息模板
73
     public final static String TPL_MESSAGE_HOTEL_CHECK_IN = "hotel_check_in";       // 民宿入住消息
73
     public final static String TPL_MESSAGE_HOTEL_CHECK_IN = "hotel_check_in";       // 民宿入住消息
74
     public final static String TPL_MESSAGE_HOTEL_CHECK_OUT = "hotel_check_out";     // 民宿离店消息
74
     public final static String TPL_MESSAGE_HOTEL_CHECK_OUT = "hotel_check_out";     // 民宿离店消息
75
+    public final static String TPL_MESSAGE_SHOP_PAY_SUCCESS = "shop_pay_success";   // 商铺下单成功通知
76
+    public final static String TPL_MESSAGE_SHOP_VERIFY_RESULT = "shop_verify_result";   // 商铺下单成功通知
75
 }
77
 }

+ 36
- 0
src/main/java/com/yunzhi/shigongli/common/WxUtils.java View File

3
 import cn.binarywang.wx.miniapp.api.WxMaService;
3
 import cn.binarywang.wx.miniapp.api.WxMaService;
4
 import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
4
 import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
5
 import cn.binarywang.wx.miniapp.bean.WxMaCodeLineColor;
5
 import cn.binarywang.wx.miniapp.bean.WxMaCodeLineColor;
6
+import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
6
 import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
7
 import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
7
 import com.github.binarywang.wxpay.config.WxPayConfig;
8
 import com.github.binarywang.wxpay.config.WxPayConfig;
8
 import com.github.binarywang.wxpay.constant.WxPayConstants;
9
 import com.github.binarywang.wxpay.constant.WxPayConstants;
10
 import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
11
 import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
11
 import com.yunzhi.shigongli.config.WeixinConfig;
12
 import com.yunzhi.shigongli.config.WeixinConfig;
12
 import lombok.Data;
13
 import lombok.Data;
14
+import lombok.extern.slf4j.Slf4j;
15
+import me.chanjar.weixin.common.error.WxErrorException;
13
 import org.springframework.beans.factory.annotation.Autowired;
16
 import org.springframework.beans.factory.annotation.Autowired;
17
+import org.springframework.scheduling.annotation.Async;
14
 import org.springframework.stereotype.Component;
18
 import org.springframework.stereotype.Component;
15
 
19
 
20
+import java.util.List;
21
+
22
+@Slf4j
16
 @Component
23
 @Component
17
 public class WxUtils {
24
 public class WxUtils {
18
     private static WxMaService service;
25
     private static WxMaService service;
69
         private WxMaCodeLineColor lineColor;
76
         private WxMaCodeLineColor lineColor;
70
         private boolean isHyaline;
77
         private boolean isHyaline;
71
     }
78
     }
79
+
80
+    /**
81
+     * 发送订阅消息
82
+     * @param templateId
83
+     * @param openid
84
+     * @param page
85
+     * @param dataList
86
+     * @throws Exception
87
+     */
88
+    @Async
89
+    public void sendMessage(String templateId, String openid, String page, List<WxMaSubscribeMessage.Data> dataList) throws Exception {
90
+        WxMaSubscribeMessage wxMaSubscribeMessage = WxMaSubscribeMessage
91
+                .builder()
92
+                .templateId(templateId)
93
+                .toUser(openid)
94
+                .page(page)
95
+                .data(dataList)
96
+                .build();
97
+
98
+        try {
99
+            service.getMsgService().sendSubscribeMsg(wxMaSubscribeMessage);
100
+        } catch (Exception e) {
101
+            e.printStackTrace();
102
+
103
+            // 再发送一次
104
+            Thread.sleep(1000);
105
+            service.getMsgService().sendSubscribeMsg(wxMaSubscribeMessage);
106
+        }
107
+    }
72
 }
108
 }

+ 1
- 1
src/main/java/com/yunzhi/shigongli/controller/TaOrderController.java View File

138
     public ResponseBean taOrderDelete(@ApiParam("订单ID") @PathVariable String id,
138
     public ResponseBean taOrderDelete(@ApiParam("订单ID") @PathVariable String id,
139
                                    HttpServletRequest request) throws Exception{
139
                                    HttpServletRequest request) throws Exception{
140
         TaOrder taOrder = iTaOrderService.getById(id);
140
         TaOrder taOrder = iTaOrderService.getById(id);
141
-        if (null == taOrder || Constants.STATUS_DELETED != taOrder.getStatus()) {
141
+        if (null == taOrder || Constants.STATUS_DELETED == taOrder.getStatus()) {
142
             return ResponseBean.error("订单不存在", ResponseBean.ERROR_ILLEGAL_PARAMS);
142
             return ResponseBean.error("订单不存在", ResponseBean.ERROR_ILLEGAL_PARAMS);
143
         }
143
         }
144
 
144
 

+ 3
- 0
src/main/java/com/yunzhi/shigongli/controller/TaRoomController.java View File

23
 import org.springframework.web.bind.annotation.RestController;
23
 import org.springframework.web.bind.annotation.RestController;
24
 
24
 
25
 import javax.servlet.http.HttpServletResponse;
25
 import javax.servlet.http.HttpServletResponse;
26
+import java.time.LocalDateTime;
26
 
27
 
27
 /**
28
 /**
28
  * <p>
29
  * <p>
94
     public ResponseBean taRoomAdd(@ApiParam(value = "客户端", allowableValues = "wx,admin") @PathVariable String plat,
95
     public ResponseBean taRoomAdd(@ApiParam(value = "客户端", allowableValues = "wx,admin") @PathVariable String plat,
95
                                   @ApiParam("保存内容") @RequestBody TaRoom taRoom) throws Exception{
96
                                   @ApiParam("保存内容") @RequestBody TaRoom taRoom) throws Exception{
96
 
97
 
98
+        taRoom.setCreateDate(LocalDateTime.now());
99
+
97
         if (iTaRoomService.save(taRoom)){
100
         if (iTaRoomService.save(taRoom)){
98
             return ResponseBean.success(taRoom);
101
             return ResponseBean.success(taRoom);
99
         }else {
102
         }else {

+ 3
- 2
src/main/java/com/yunzhi/shigongli/controller/TaShopController.java View File

164
             ResourceFieldVO resourceVO = iTaShopService.copyProperties(taShop);
164
             ResourceFieldVO resourceVO = iTaShopService.copyProperties(taShop);
165
             TaResource taResource = taResourceService.getByTarget(Constants.TARGET_SHOP, id);
165
             TaResource taResource = taResourceService.getByTarget(Constants.TARGET_SHOP, id);
166
             BeanUtils.copyProperties(resourceVO, taResource);
166
             BeanUtils.copyProperties(resourceVO, taResource);
167
+            taResource.setTargetName(taShop.getShopName());
167
 
168
 
168
             taResourceService.updateById(taResource);
169
             taResourceService.updateById(taResource);
169
             return ResponseBean.success(iTaShopService.getById(id));
170
             return ResponseBean.success(iTaShopService.getById(id));
304
             return ResponseBean.error("请先进行人员身份绑定", ResponseBean.ERROR_ILLEGAL_PARAMS);
305
             return ResponseBean.error("请先进行人员身份绑定", ResponseBean.ERROR_ILLEGAL_PARAMS);
305
         }
306
         }
306
 
307
 
307
-        // 获取所有的民宿信息
308
+        // 获取所有的商铺信息
308
         List<TaShop> shopList = iTaShopService.getListByPerson(taPerson);
309
         List<TaShop> shopList = iTaShopService.getListByPerson(taPerson);
309
         if (null == shopList || shopList.size() < 1) {
310
         if (null == shopList || shopList.size() < 1) {
310
-            return ResponseBean.error("数据异常, 未找到关联民宿", ResponseBean.ERROR_UNAVAILABLE);
311
+            return ResponseBean.error("数据异常, 未找到关联商铺", ResponseBean.ERROR_UNAVAILABLE);
311
         }
312
         }
312
 
313
 
313
         Map<String, Object> result = new HashMap<>();
314
         Map<String, Object> result = new HashMap<>();

+ 1
- 0
src/main/java/com/yunzhi/shigongli/controller/TaTouristController.java View File

160
             ResourceFieldVO resourceVO = iTaTouristService.copyProperties(taTourist);
160
             ResourceFieldVO resourceVO = iTaTouristService.copyProperties(taTourist);
161
             TaResource taResource = taResourceService.getByTarget(Constants.TARGET_TOURIST, id);
161
             TaResource taResource = taResourceService.getByTarget(Constants.TARGET_TOURIST, id);
162
             BeanUtils.copyProperties(resourceVO, taResource);
162
             BeanUtils.copyProperties(resourceVO, taResource);
163
+            taResource.setTargetName(taTourist.getTouristName());
163
             taResourceService.updateById(taResource);
164
             taResourceService.updateById(taResource);
164
 
165
 
165
             return ResponseBean.success(iTaTouristService.getById(id));
166
             return ResponseBean.success(iTaTouristService.getById(id));

+ 8
- 0
src/main/java/com/yunzhi/shigongli/controller/TaVerifyTargetController.java View File

8
 import com.yunzhi.shigongli.common.ResponseBean;
8
 import com.yunzhi.shigongli.common.ResponseBean;
9
 import com.yunzhi.shigongli.common.StringUtils;
9
 import com.yunzhi.shigongli.common.StringUtils;
10
 import com.yunzhi.shigongli.entity.*;
10
 import com.yunzhi.shigongli.entity.*;
11
+import com.yunzhi.shigongli.event.VerifyResultEvent;
11
 import com.yunzhi.shigongli.service.*;
12
 import com.yunzhi.shigongli.service.*;
12
 import com.yunzhi.shigongli.vo.VerifyTargetVO;
13
 import com.yunzhi.shigongli.vo.VerifyTargetVO;
13
 import io.swagger.annotations.Api;
14
 import io.swagger.annotations.Api;
16
 import org.slf4j.Logger;
17
 import org.slf4j.Logger;
17
 import org.slf4j.LoggerFactory;
18
 import org.slf4j.LoggerFactory;
18
 import org.springframework.beans.factory.annotation.Autowired;
19
 import org.springframework.beans.factory.annotation.Autowired;
20
+import org.springframework.context.ApplicationEventPublisher;
19
 import org.springframework.web.bind.annotation.*;
21
 import org.springframework.web.bind.annotation.*;
20
 
22
 
21
 import java.time.LocalDateTime;
23
 import java.time.LocalDateTime;
49
     @Autowired
51
     @Autowired
50
     public ITaShopWorkerService shopWorkerService;
52
     public ITaShopWorkerService shopWorkerService;
51
 
53
 
54
+    @Autowired
55
+    ApplicationEventPublisher eventPublisher;
56
+
52
     /**
57
     /**
53
      * 分页查询列表
58
      * 分页查询列表
54
      * @param pageNum
59
      * @param pageNum
117
             iTaOrderSubService.validation(taPerson, taOrder, taOrderSub);
122
             iTaOrderSubService.validation(taPerson, taOrder, taOrderSub);
118
         }
123
         }
119
 
124
 
125
+        //
126
+        eventPublisher.publishEvent(new VerifyResultEvent(this, taVerifyTarget));
127
+
120
         return ResponseBean.success("核销成功");
128
         return ResponseBean.success("核销成功");
121
     }
129
     }
122
 
130
 

+ 2
- 0
src/main/java/com/yunzhi/shigongli/controller/TdCityController.java View File

52
     public ResponseBean tdCityList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
     public ResponseBean tdCityList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
53
                                    @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
53
                                    @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
54
                                    @ApiParam("父级分类") @RequestParam(value ="areaPId", required = false) String areaPId,
54
                                    @ApiParam("父级分类") @RequestParam(value ="areaPId", required = false) String areaPId,
55
+                                   @ApiParam("等级") @RequestParam(value ="areaLevel", defaultValue = "3") String areaLevel,
55
                                    @ApiParam("名称") @RequestParam(value ="areaName", required = false) String areaName) throws Exception{
56
                                    @ApiParam("名称") @RequestParam(value ="areaName", required = false) String areaName) throws Exception{
56
 
57
 
57
         IPage<TdCity> pg = new Page<>(pageNum, pageSize);
58
         IPage<TdCity> pg = new Page<>(pageNum, pageSize);
58
         QueryWrapper<TdCity> queryWrapper = new QueryWrapper<>();
59
         QueryWrapper<TdCity> queryWrapper = new QueryWrapper<>();
59
         queryWrapper.eq(!StringUtils.isEmpty(areaPId),"area_p_id", areaPId);
60
         queryWrapper.eq(!StringUtils.isEmpty(areaPId),"area_p_id", areaPId);
61
+        queryWrapper.eq(!StringUtils.isEmpty(areaLevel),"area_level", areaLevel);
60
         queryWrapper.like(!StringUtils.isEmpty(areaName), "area_name","%"+areaName+"%");
62
         queryWrapper.like(!StringUtils.isEmpty(areaName), "area_name","%"+areaName+"%");
61
         queryWrapper.orderByAsc("area_id");
63
         queryWrapper.orderByAsc("area_id");
62
 
64
 

+ 3
- 0
src/main/java/com/yunzhi/shigongli/entity/TaResource.java View File

38
     @ApiModelProperty(value = "访问对象ID")
38
     @ApiModelProperty(value = "访问对象ID")
39
     private String targetId;
39
     private String targetId;
40
 
40
 
41
+    @ApiModelProperty(value = "访问对象ID")
42
+    private String targetName;
43
+
41
     @ApiModelProperty(value = "点赞数")
44
     @ApiModelProperty(value = "点赞数")
42
     private Integer likeNum;
45
     private Integer likeNum;
43
 
46
 

+ 6
- 0
src/main/java/com/yunzhi/shigongli/entity/TaRoom.java View File

42
     @ApiModelProperty(value = "定位")
42
     @ApiModelProperty(value = "定位")
43
     private String location;
43
     private String location;
44
 
44
 
45
+    @ApiModelProperty(value = "位置名称")
46
+    private String locName;
47
+
45
     @ApiModelProperty(value = "地址")
48
     @ApiModelProperty(value = "地址")
46
     private String address;
49
     private String address;
47
 
50
 
48
     @ApiModelProperty(value = "停车场定位")
51
     @ApiModelProperty(value = "停车场定位")
49
     private String parkingLocation;
52
     private String parkingLocation;
50
 
53
 
54
+    @ApiModelProperty(value = "停车场定位")
55
+    private String pkLocName;
56
+
51
     @ApiModelProperty(value = "停车场位置")
57
     @ApiModelProperty(value = "停车场位置")
52
     private String parkingAddress;
58
     private String parkingAddress;
53
 
59
 

+ 3
- 0
src/main/java/com/yunzhi/shigongli/entity/TaShop.java View File

74
     @ApiModelProperty(value = "服务评分")
74
     @ApiModelProperty(value = "服务评分")
75
     private BigDecimal serviceScore;
75
     private BigDecimal serviceScore;
76
 
76
 
77
+    @ApiModelProperty(value = "权重")
78
+    private Integer weight;
79
+
77
     @ApiModelProperty(value = "状态")
80
     @ApiModelProperty(value = "状态")
78
     private Integer status;
81
     private Integer status;
79
 
82
 

+ 5
- 2
src/main/java/com/yunzhi/shigongli/entity/TaShopPackage.java View File

42
     @ApiModelProperty(value = "描述")
42
     @ApiModelProperty(value = "描述")
43
     private String description;
43
     private String description;
44
 
44
 
45
-    @ApiModelProperty(value = "适用人数")
46
-    private Integer personNum;
45
+    @ApiModelProperty(value = "适用最少人数")
46
+    private Integer minPerson;
47
+
48
+    @ApiModelProperty(value = "适用最多人数")
49
+    private Integer maxPerson;
47
 
50
 
48
     @ApiModelProperty(value = "主图")
51
     @ApiModelProperty(value = "主图")
49
     private String poster;
52
     private String poster;

+ 3
- 0
src/main/java/com/yunzhi/shigongli/entity/TaVerifyTarget.java View File

52
     @ApiModelProperty(value = "返现金额/单位分")
52
     @ApiModelProperty(value = "返现金额/单位分")
53
     private Integer cashback;
53
     private Integer cashback;
54
 
54
 
55
+    @ApiModelProperty(value = "抽成金额/单位分")
56
+    private Integer commissionCharge;
57
+
55
     @ApiModelProperty(value = "发放时间")
58
     @ApiModelProperty(value = "发放时间")
56
     private LocalDateTime createDate;
59
     private LocalDateTime createDate;
57
 
60
 

+ 1
- 1
src/main/java/com/yunzhi/shigongli/entity/TrPersonClick.java View File

41
     private String eventType;
41
     private String eventType;
42
 
42
 
43
     @ApiModelProperty(value = "内容对象")
43
     @ApiModelProperty(value = "内容对象")
44
-    private Integer eventParams;
44
+    private String eventParams;
45
 
45
 
46
     @ApiModelProperty(value = "创建日期")
46
     @ApiModelProperty(value = "创建日期")
47
     private LocalDateTime createDate;
47
     private LocalDateTime createDate;

+ 10
- 17
src/main/java/com/yunzhi/shigongli/event/SendMessageTask.java View File

1
 package com.yunzhi.shigongli.event;
1
 package com.yunzhi.shigongli.event;
2
 
2
 
3
 
3
 
4
-import cn.binarywang.wx.miniapp.api.WxMaService;
5
 import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
4
 import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
6
 import com.yunzhi.shigongli.common.Constants;
5
 import com.yunzhi.shigongli.common.Constants;
7
 import com.yunzhi.shigongli.common.DateUtils;
6
 import com.yunzhi.shigongli.common.DateUtils;
10
 import com.yunzhi.shigongli.mapper.TaMiniappMessageTplMapper;
9
 import com.yunzhi.shigongli.mapper.TaMiniappMessageTplMapper;
11
 import com.yunzhi.shigongli.service.ITaRoomOrderService;
10
 import com.yunzhi.shigongli.service.ITaRoomOrderService;
12
 import lombok.extern.slf4j.Slf4j;
11
 import lombok.extern.slf4j.Slf4j;
13
-import me.chanjar.weixin.common.error.WxErrorException;
14
 import org.springframework.beans.factory.annotation.Autowired;
12
 import org.springframework.beans.factory.annotation.Autowired;
15
 import org.springframework.scheduling.annotation.Scheduled;
13
 import org.springframework.scheduling.annotation.Scheduled;
16
 import org.springframework.stereotype.Component;
14
 import org.springframework.stereotype.Component;
54
             return ;
52
             return ;
55
         }
53
         }
56
 
54
 
55
+        String templateId = messageTpl.getTemplateId();
57
         String remark = "请记得带好您的随身物品";
56
         String remark = "请记得带好您的随身物品";
58
-        WxMaService maService = wxUtils.getService();
59
 
57
 
60
         for (Map<String, Object> item : list) {
58
         for (Map<String, Object> item : list) {
61
             List<WxMaSubscribeMessage.Data> dataList = new ArrayList<>();
59
             List<WxMaSubscribeMessage.Data> dataList = new ArrayList<>();
66
             String hotelId = item.get("hotelId").toString();
64
             String hotelId = item.get("hotelId").toString();
67
             String page = messageTpl.getPage() + "&id=" + hotelId;
65
             String page = messageTpl.getPage() + "&id=" + hotelId;
68
 
66
 
69
-            WxMaSubscribeMessage wxMaSubscribeMessage = WxMaSubscribeMessage
70
-                    .builder()
71
-                    .templateId(messageTpl.getTemplateId())
72
-                    .toUser(openid)
73
-                    .page(page)
74
-                    .data(dataList)
75
-                    .build();
76
-
77
             try {
67
             try {
78
-                maService.getMsgService().sendSubscribeMsg(wxMaSubscribeMessage);
79
-                Thread.sleep(1000);
80
-            } catch (WxErrorException e) {
81
-                log.error("发送退房消息失败: {}", e.getMessage());
82
-                e.printStackTrace();
83
-            } catch (InterruptedException e) {
68
+                wxUtils.sendMessage(templateId, openid, page, dataList);
69
+            } catch (Exception e) {
84
                 e.printStackTrace();
70
                 e.printStackTrace();
71
+                log.error("发送离店消息给游客失败: {}", e.getMessage());
72
+            } finally {
73
+                try {
74
+                    Thread.sleep(1000);
75
+                } catch (InterruptedException e) {
76
+                    e.printStackTrace();
77
+                }
85
             }
78
             }
86
         }
79
         }
87
 
80
 

+ 21
- 0
src/main/java/com/yunzhi/shigongli/event/VerifyResultEvent.java View File

1
+package com.yunzhi.shigongli.event;
2
+
3
+import com.yunzhi.shigongli.entity.TaVerifyTarget;
4
+import org.springframework.context.ApplicationEvent;
5
+
6
+/**
7
+ * 核销结果
8
+ */
9
+public class VerifyResultEvent extends ApplicationEvent {
10
+
11
+    TaVerifyTarget taVerifyTarget;
12
+
13
+    public VerifyResultEvent(Object source, TaVerifyTarget taVerifyTarget) {
14
+        super(source);
15
+        this.taVerifyTarget = taVerifyTarget;
16
+    }
17
+
18
+    public TaVerifyTarget getTaVerifyTarget() {
19
+        return taVerifyTarget;
20
+    }
21
+}

+ 4
- 3
src/main/java/com/yunzhi/shigongli/event/listener/PaySuccessEventListener.java View File

1
 package com.yunzhi.shigongli.event.listener;
1
 package com.yunzhi.shigongli.event.listener;
2
 
2
 
3
 import com.yunzhi.shigongli.event.PaySuccessEvent;
3
 import com.yunzhi.shigongli.event.PaySuccessEvent;
4
-import com.yunzhi.shigongli.service.ITaPersonAccountService;
4
+import com.yunzhi.shigongli.service.ITaOrderPayService;
5
 import org.springframework.beans.factory.annotation.Autowired;
5
 import org.springframework.beans.factory.annotation.Autowired;
6
 import org.springframework.context.ApplicationListener;
6
 import org.springframework.context.ApplicationListener;
7
 import org.springframework.stereotype.Component;
7
 import org.springframework.stereotype.Component;
9
 @Component
9
 @Component
10
 public class PaySuccessEventListener implements ApplicationListener<PaySuccessEvent> {
10
 public class PaySuccessEventListener implements ApplicationListener<PaySuccessEvent> {
11
     @Autowired
11
     @Autowired
12
-    ITaPersonAccountService personAccountService;
12
+    ITaOrderPayService iTaOrderPayService;
13
 
13
 
14
     @Override
14
     @Override
15
     public void onApplicationEvent(PaySuccessEvent evt) {
15
     public void onApplicationEvent(PaySuccessEvent evt) {
16
         try {
16
         try {
17
-            // do nothing
17
+            // 发送消息给商家
18
+            iTaOrderPayService.sendPaySuccessNotifyToShop(evt.getTaOrderPay());
18
         } catch (Exception e) {
19
         } catch (Exception e) {
19
             e.printStackTrace();
20
             e.printStackTrace();
20
         }
21
         }

+ 24
- 0
src/main/java/com/yunzhi/shigongli/event/listener/VerifyResultEventListener.java View File

1
+package com.yunzhi.shigongli.event.listener;
2
+
3
+import com.yunzhi.shigongli.event.VerifyResultEvent;
4
+import com.yunzhi.shigongli.service.ITaVerifyTargetService;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.context.ApplicationListener;
7
+import org.springframework.stereotype.Component;
8
+
9
+@Component
10
+public class VerifyResultEventListener implements ApplicationListener<VerifyResultEvent> {
11
+
12
+    @Autowired
13
+    ITaVerifyTargetService iTaVerifyTargetService;
14
+
15
+    @Override
16
+    public void onApplicationEvent(VerifyResultEvent event) {
17
+        try {
18
+            // 发送消息给商家
19
+            iTaVerifyTargetService.sendVerifyResultNotifyToShop(event.getTaVerifyTarget());
20
+        } catch (Exception e) {
21
+            e.printStackTrace();
22
+        }
23
+    }
24
+}

+ 5
- 0
src/main/java/com/yunzhi/shigongli/mapper/TaOrderPayMapper.java View File

5
 import org.apache.ibatis.annotations.Mapper;
5
 import org.apache.ibatis.annotations.Mapper;
6
 import org.apache.ibatis.annotations.Param;
6
 import org.apache.ibatis.annotations.Param;
7
 
7
 
8
+import java.util.List;
9
+import java.util.Map;
10
+
8
 /**
11
 /**
9
  * <p>
12
  * <p>
10
  * 订单支付 Mapper 接口
13
  * 订单支付 Mapper 接口
21
     TaOrderPay getLastPayedRowByOrder(@Param("orderId") String orderId);
24
     TaOrderPay getLastPayedRowByOrder(@Param("orderId") String orderId);
22
 
25
 
23
     TaOrderPay getLastRowByOrderSub(@Param("orderId") String orderId, @Param("subOrderId") String subOrderId);
26
     TaOrderPay getLastRowByOrderSub(@Param("orderId") String orderId, @Param("subOrderId") String subOrderId);
27
+
28
+    List<Map<String, Object>> getShopWorkerBy(@Param("orderId") String orderId, @Param("subOrderId") String subOrderId);
24
 }
29
 }

+ 5
- 0
src/main/java/com/yunzhi/shigongli/mapper/TaVerifyTargetMapper.java View File

7
 import org.apache.ibatis.annotations.Mapper;
7
 import org.apache.ibatis.annotations.Mapper;
8
 import org.apache.ibatis.annotations.Param;
8
 import org.apache.ibatis.annotations.Param;
9
 
9
 
10
+import java.util.List;
11
+import java.util.Map;
12
+
10
 /**
13
 /**
11
  * <p>
14
  * <p>
12
  * 核销内容表 Mapper 接口
15
  * 核销内容表 Mapper 接口
27
     int existsNo(@Param("verifyNo") String verifyNo);
30
     int existsNo(@Param("verifyNo") String verifyNo);
28
 
31
 
29
     int getCountBy(@Param("orderId") String orderId, @Param("subOrderId") String subOrderId, @Param("isVerified") Integer isVerified);
32
     int getCountBy(@Param("orderId") String orderId, @Param("subOrderId") String subOrderId, @Param("isVerified") Integer isVerified);
33
+
34
+    List<String> getShopWorkerBy(@Param("shopId") String shopId);
30
 }
35
 }

+ 2
- 0
src/main/java/com/yunzhi/shigongli/service/ITaOrderPayService.java View File

30
     void refundOrder(TaPerson person, TaOrder taOrder, Integer totalCashback) throws Exception;
30
     void refundOrder(TaPerson person, TaOrder taOrder, Integer totalCashback) throws Exception;
31
 
31
 
32
     WxPayMpOrderResult prePay(TaPerson person, TaOrder taOrder, TaOrderSub taOrderSub) throws Exception;
32
     WxPayMpOrderResult prePay(TaPerson person, TaOrder taOrder, TaOrderSub taOrderSub) throws Exception;
33
+
34
+    void sendPaySuccessNotifyToShop(TaOrderPay taOrderPay);
33
 }
35
 }

+ 2
- 0
src/main/java/com/yunzhi/shigongli/service/ITaVerifyTargetService.java View File

22
     boolean removeBy(String orderId, String subOrderId);
22
     boolean removeBy(String orderId, String subOrderId);
23
 
23
 
24
     void verify(TaVerifyTarget taVerifyTarget) throws Exception;
24
     void verify(TaVerifyTarget taVerifyTarget) throws Exception;
25
+
26
+    void sendVerifyResultNotifyToShop(TaVerifyTarget taVerifyTarget);
25
 }
27
 }

+ 6
- 23
src/main/java/com/yunzhi/shigongli/service/impl/TaHotelWorkerServiceImpl.java View File

96
         dataList.add(new WxMaSubscribeMessage.Data("thing6", hotelName));
96
         dataList.add(new WxMaSubscribeMessage.Data("thing6", hotelName));
97
         dataList.add(new WxMaSubscribeMessage.Data("date2", taRoomOrder.getStartDate()));
97
         dataList.add(new WxMaSubscribeMessage.Data("date2", taRoomOrder.getStartDate()));
98
 
98
 
99
+        String templateId = messageTpl.getTemplateId();
99
         String page = messageTpl.getPage()
100
         String page = messageTpl.getPage()
100
                 + "?roomId=" + taRoom.getRoomId()
101
                 + "?roomId=" + taRoom.getRoomId()
102
+                + "&hotelId=" + taRoom.getHotelId()
101
                 + "&roomName=" + StringUtils.encodeURIComponent(taRoom.getRoomName());
103
                 + "&roomName=" + StringUtils.encodeURIComponent(taRoom.getRoomName());
102
 
104
 
103
         // 暂时先发送给所有店主, 1s 发送一个
105
         // 暂时先发送给所有店主, 1s 发送一个
104
         for (TaHotelWorker worker : workerList) {
106
         for (TaHotelWorker worker : workerList) {
105
             String toUser = taPersonMapper.getOpenid(worker.getPersonId());
107
             String toUser = taPersonMapper.getOpenid(worker.getPersonId());
106
             try {
108
             try {
107
-                sendMaSubscribeMessage(toUser, dataList, page, messageTpl.getTemplateId());
108
 
109
 
109
-                Thread.sleep(1000);
110
+                wxUtils.sendMessage(templateId, toUser, page, dataList);
110
             } catch (Exception e) {
111
             } catch (Exception e) {
111
                 log.error("发送订阅消息给店主失败: {}", e.getMessage());
112
                 log.error("发送订阅消息给店主失败: {}", e.getMessage());
112
                 e.printStackTrace();
113
                 e.printStackTrace();
113
-
114
-                // 再发一次
114
+            } finally {
115
                 try {
115
                 try {
116
-                    sendMaSubscribeMessage(toUser, dataList, page, messageTpl.getTemplateId());
117
-
118
                     Thread.sleep(1000);
116
                     Thread.sleep(1000);
119
-                } catch (Exception e1) {
120
-                    log.error("发送订阅消息给店主失败: {}", e1.getMessage());
121
-                    e1.printStackTrace();
117
+                } catch (InterruptedException e) {
118
+                    e.printStackTrace();
122
                 }
119
                 }
123
             }
120
             }
124
         }
121
         }
133
         return list(queryWrapper);
130
         return list(queryWrapper);
134
     }
131
     }
135
 
132
 
136
-
137
-    private void sendMaSubscribeMessage(String toUser, List<WxMaSubscribeMessage.Data> message, String page, String templateId) throws WxErrorException {
138
-        WxMaService maService = wxUtils.getService();
139
-        WxMaSubscribeMessage wxMaSubscribeMessage = WxMaSubscribeMessage
140
-                .builder()
141
-                .templateId(templateId)
142
-                .toUser(toUser)
143
-                .page(page)
144
-                .data(message)
145
-                .build();
146
-
147
-        maService.getMsgService().sendSubscribeMsg(wxMaSubscribeMessage);
148
-    }
149
-
150
 }
133
 }

+ 68
- 6
src/main/java/com/yunzhi/shigongli/service/impl/TaOrderPayServiceImpl.java View File

1
 package com.yunzhi.shigongli.service.impl;
1
 package com.yunzhi.shigongli.service.impl;
2
 
2
 
3
+import cn.binarywang.wx.miniapp.api.WxMaService;
4
+import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
3
 import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
5
 import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
4
 import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult;
6
 import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult;
5
 import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
7
 import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
6
 import com.github.binarywang.wxpay.constant.WxPayConstants;
8
 import com.github.binarywang.wxpay.constant.WxPayConstants;
7
-import com.yunzhi.shigongli.common.Constants;
8
-import com.yunzhi.shigongli.common.DateUtils;
9
-import com.yunzhi.shigongli.common.StringUtils;
10
-import com.yunzhi.shigongli.common.WxPayUtils;
9
+import com.yunzhi.shigongli.common.*;
11
 import com.yunzhi.shigongli.entity.*;
10
 import com.yunzhi.shigongli.entity.*;
12
 import com.yunzhi.shigongli.event.PaySuccessEvent;
11
 import com.yunzhi.shigongli.event.PaySuccessEvent;
13
 import com.yunzhi.shigongli.event.RefundSuccessEvent;
12
 import com.yunzhi.shigongli.event.RefundSuccessEvent;
15
 import com.yunzhi.shigongli.service.ITaOrderPayService;
14
 import com.yunzhi.shigongli.service.ITaOrderPayService;
16
 
15
 
17
 import lombok.extern.slf4j.Slf4j;
16
 import lombok.extern.slf4j.Slf4j;
17
+import me.chanjar.weixin.common.error.WxErrorException;
18
 import org.springframework.beans.factory.annotation.Autowired;
18
 import org.springframework.beans.factory.annotation.Autowired;
19
 import org.springframework.context.ApplicationEventPublisher;
19
 import org.springframework.context.ApplicationEventPublisher;
20
+import org.springframework.scheduling.annotation.Async;
20
 import org.springframework.stereotype.Service;
21
 import org.springframework.stereotype.Service;
21
 import org.springframework.transaction.annotation.Propagation;
22
 import org.springframework.transaction.annotation.Propagation;
22
 import org.springframework.transaction.annotation.Transactional;
23
 import org.springframework.transaction.annotation.Transactional;
24
 import java.time.LocalDateTime;
25
 import java.time.LocalDateTime;
25
 import java.util.ArrayList;
26
 import java.util.ArrayList;
26
 import java.util.List;
27
 import java.util.List;
28
+import java.util.Map;
27
 
29
 
28
 /**
30
 /**
29
  * <p>
31
  * <p>
76
     @Autowired
78
     @Autowired
77
     TaShopAccountLogMapper shopAccountLogMapper;
79
     TaShopAccountLogMapper shopAccountLogMapper;
78
 
80
 
81
+    @Autowired
82
+    TaMiniappMessageTplMapper messageTplMapper;
83
+
84
+    @Autowired
85
+    WxUtils wxUtils;
86
+
79
     /**
87
     /**
80
      * 支付回调
88
      * 支付回调
81
      * @param notifyResult
89
      * @param notifyResult
194
         }
202
         }
195
 
203
 
196
         Integer cashback = orderSubList.stream().mapToInt(TaOrderSub::getCashback).reduce(Integer::sum).getAsInt();
204
         Integer cashback = orderSubList.stream().mapToInt(TaOrderSub::getCashback).reduce(Integer::sum).getAsInt();
205
+        if (cashback <= 0) {
206
+            return ;
207
+        }
197
 
208
 
198
         TaOrderPay orderPay = null != taOrder ? createByOrder(taOrder) : createByOrderSub(taOrderSub, taPerson);
209
         TaOrderPay orderPay = null != taOrder ? createByOrder(taOrder) : createByOrderSub(taOrderSub, taPerson);
199
         orderPay.setDescription("返现");
210
         orderPay.setDescription("返现");
233
                 taVerifyTarget.setTargetId(item.getPackageId());
244
                 taVerifyTarget.setTargetId(item.getPackageId());
234
                 taVerifyTarget.setDescription(shopPackage.getDescription());
245
                 taVerifyTarget.setDescription(shopPackage.getDescription());
235
                 taVerifyTarget.setPoster(shopPackage.getPoster());
246
                 taVerifyTarget.setPoster(shopPackage.getPoster());
236
-                taVerifyTarget.setActualPrice(shopPackage.getActualPrice());
247
+                taVerifyTarget.setActualPrice(item.getUnitPrice());
237
                 taVerifyTarget.setStandPrice(shopPackage.getStandardPrice());
248
                 taVerifyTarget.setStandPrice(shopPackage.getStandardPrice());
238
-                taVerifyTarget.setCashback(shopPackage.getCashback());
249
+                taVerifyTarget.setCashback(item.getCashback() / item.getAmount());
250
+                taVerifyTarget.setCommissionCharge(item.getCommissionCharge() / item.getAmount());
239
                 taVerifyTarget.setCreateDate(now);
251
                 taVerifyTarget.setCreateDate(now);
240
                 taVerifyTarget.setExpireDate(shopPackage.getEndTime());
252
                 taVerifyTarget.setExpireDate(shopPackage.getEndTime());
241
                 taVerifyTarget.setOrderDate(item.getCreateDate());
253
                 taVerifyTarget.setOrderDate(item.getCreateDate());
409
         return wxPayUtils.createOrder(person, orderPay);
421
         return wxPayUtils.createOrder(person, orderPay);
410
     }
422
     }
411
 
423
 
424
+    /**
425
+     * 支付成功消息
426
+     * @param taOrderPay
427
+     */
428
+    @Async
429
+    @Override
430
+    public void sendPaySuccessNotifyToShop(TaOrderPay taOrderPay) {
431
+        try {
432
+            // 消息模板
433
+            TaMiniappMessageTpl messageTpl = messageTplMapper.selectByType(Constants.TPL_MESSAGE_SHOP_PAY_SUCCESS);
434
+            if (null == messageTpl) {
435
+                return ;
436
+            }
437
+
438
+            String templateId = messageTpl.getTemplateId();
439
+            String page = messageTpl.getPage();
440
+
441
+            String orderId = taOrderPay.getOrderId();
442
+            String subOrderId = taOrderPay.getSubOrderId();
443
+
444
+            List<Map<String, Object>> list = orderPayMapper.getShopWorkerBy(orderId, subOrderId);
445
+            if (null == list || list.size() == 0) return;
446
+
447
+            for (Map<String, Object> item : list) {
448
+                String openId = item.get("openid").toString();
449
+                if (StringUtils.isEmpty(openId)) continue;
450
+
451
+                List<WxMaSubscribeMessage.Data> dataList = new ArrayList<>();
452
+                dataList.add(new WxMaSubscribeMessage.Data("character_string7", orderId));
453
+                dataList.add(new WxMaSubscribeMessage.Data("thing13", "您有一个十公里订单,客人期待与你的见面哦"));
454
+
455
+                try {
456
+                   wxUtils.sendMessage(templateId, openId, page, dataList);
457
+                } catch (Exception e) {
458
+                    e.printStackTrace();
459
+                    log.error("发送订单消息失败: {}", e.getMessage());
460
+                } finally {
461
+                    try {
462
+                        Thread.sleep(1000);
463
+                    } catch (InterruptedException e) {
464
+                        e.printStackTrace();
465
+                    }
466
+                }
467
+            }
468
+
469
+        } catch (Exception e) {
470
+            e.printStackTrace();
471
+        }
472
+    }
473
+
412
     private TaOrderPay createByOrder(TaOrder taOrder) throws Exception {
474
     private TaOrderPay createByOrder(TaOrder taOrder) throws Exception {
413
         // 发给微信的订单号为  订单ID-01 这种
475
         // 发给微信的订单号为  订单ID-01 这种
414
         Integer no = taSequenceMapper.nextval(taOrder.getOrderId());
476
         Integer no = taSequenceMapper.nextval(taOrder.getOrderId());

+ 1
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TaShopServiceImpl.java View File

81
         BeanUtils.copyProperties(taShop, taResource);
81
         BeanUtils.copyProperties(taShop, taResource);
82
         taResource.setTargetType(Constants.TARGET_SHOP);
82
         taResource.setTargetType(Constants.TARGET_SHOP);
83
         taResource.setTargetId(taShop.getShopId());
83
         taResource.setTargetId(taShop.getShopId());
84
+        taResource.setTargetName(taShop.getShopName());
84
         taResource.setLikeNum(taShop.getLikeNum());
85
         taResource.setLikeNum(taShop.getLikeNum());
85
         if (!StringUtils.isEmpty(taShop.getLocaton())) {
86
         if (!StringUtils.isEmpty(taShop.getLocaton())) {
86
             String[] loc = taShop.getLocaton().split(",");
87
             String[] loc = taShop.getLocaton().split(",");

+ 1
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TaTouristServiceImpl.java View File

79
         BeanUtils.copyProperties(taTourist, taResource);
79
         BeanUtils.copyProperties(taTourist, taResource);
80
         taResource.setTargetType(Constants.TARGET_TOURIST);
80
         taResource.setTargetType(Constants.TARGET_TOURIST);
81
         taResource.setTargetId(taTourist.getTouristId());
81
         taResource.setTargetId(taTourist.getTouristId());
82
+        taResource.setTargetName(taTourist.getTouristName());
82
         if (!StringUtils.isEmpty(taTourist.getLocaton())) {
83
         if (!StringUtils.isEmpty(taTourist.getLocaton())) {
83
             String[] loc = taTourist.getLocaton().split(",");
84
             String[] loc = taTourist.getLocaton().split(",");
84
             taResource.setLng(loc[0].trim());
85
             taResource.setLng(loc[0].trim());

+ 59
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TaVerifyTargetServiceImpl.java View File

1
 package com.yunzhi.shigongli.service.impl;
1
 package com.yunzhi.shigongli.service.impl;
2
 
2
 
3
+import cn.binarywang.wx.miniapp.api.WxMaService;
4
+import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
3
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
5
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
6
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.yunzhi.shigongli.common.Constants;
7
 import com.yunzhi.shigongli.common.Constants;
6
 import com.yunzhi.shigongli.common.StringUtils;
8
 import com.yunzhi.shigongli.common.StringUtils;
9
+import com.yunzhi.shigongli.common.WxUtils;
7
 import com.yunzhi.shigongli.entity.*;
10
 import com.yunzhi.shigongli.entity.*;
8
 import com.yunzhi.shigongli.mapper.*;
11
 import com.yunzhi.shigongli.mapper.*;
9
 import com.yunzhi.shigongli.service.ITaVerifyTargetService;
12
 import com.yunzhi.shigongli.service.ITaVerifyTargetService;
10
 import com.yunzhi.shigongli.vo.VerifyTargetVO;
13
 import com.yunzhi.shigongli.vo.VerifyTargetVO;
14
+import lombok.extern.slf4j.Slf4j;
11
 import org.springframework.beans.factory.annotation.Autowired;
15
 import org.springframework.beans.factory.annotation.Autowired;
12
 import org.springframework.jdbc.object.UpdatableSqlQuery;
16
 import org.springframework.jdbc.object.UpdatableSqlQuery;
17
+import org.springframework.scheduling.annotation.Async;
13
 import org.springframework.stereotype.Service;
18
 import org.springframework.stereotype.Service;
14
 import org.springframework.transaction.annotation.Transactional;
19
 import org.springframework.transaction.annotation.Transactional;
15
 
20
 
16
 import java.time.LocalDateTime;
21
 import java.time.LocalDateTime;
22
+import java.util.ArrayList;
17
 import java.util.List;
23
 import java.util.List;
24
+import java.util.Map;
18
 
25
 
19
 /**
26
 /**
20
  * <p>
27
  * <p>
24
  * @author yansen
31
  * @author yansen
25
  * @since 2021-08-17
32
  * @since 2021-08-17
26
  */
33
  */
34
+@Slf4j
27
 @Service
35
 @Service
28
 public class TaVerifyTargetServiceImpl extends BaseServiceImpl<TaVerifyTargetMapper, TaVerifyTarget> implements ITaVerifyTargetService {
36
 public class TaVerifyTargetServiceImpl extends BaseServiceImpl<TaVerifyTargetMapper, TaVerifyTarget> implements ITaVerifyTargetService {
29
 
37
 
48
     @Autowired
56
     @Autowired
49
     TaHotelAccountLogMapper hotelAccountLogMapper;
57
     TaHotelAccountLogMapper hotelAccountLogMapper;
50
 
58
 
59
+    @Autowired
60
+    TaMiniappMessageTplMapper messageTplMapper;
61
+
62
+    @Autowired
63
+    WxUtils wxUtils;
64
+
51
     @Override
65
     @Override
52
     public IPage<VerifyTargetVO> getWxPagedBy(IPage<VerifyTargetVO> pg, String personId, String shopId, String phone, Integer isVerified) {
66
     public IPage<VerifyTargetVO> getWxPagedBy(IPage<VerifyTargetVO> pg, String personId, String shopId, String phone, Integer isVerified) {
53
         return baseMapper.getWxPagedBy(pg, personId, shopId, phone, isVerified);
67
         return baseMapper.getWxPagedBy(pg, personId, shopId, phone, isVerified);
79
         }
93
         }
80
     }
94
     }
81
 
95
 
96
+    @Async
97
+    @Override
98
+    public void sendVerifyResultNotifyToShop(TaVerifyTarget taVerifyTarget) {
99
+        try {
100
+            // 消息模板
101
+            TaMiniappMessageTpl messageTpl = messageTplMapper.selectByType(Constants.TPL_MESSAGE_SHOP_VERIFY_RESULT);
102
+            if (null == messageTpl) {
103
+                return ;
104
+            }
105
+
106
+            String templateId = messageTpl.getTemplateId();
107
+            String page = messageTpl.getPage();
108
+
109
+            String orderId = taVerifyTarget.getOrderId();
110
+            String shopId = taVerifyTarget.getShopId();
111
+
112
+            List<String> list = baseMapper.getShopWorkerBy(shopId);
113
+            if (null == list || list.size() == 0) return;
114
+
115
+            for (String openId : list) {
116
+                if (StringUtils.isEmpty(openId)) continue;
117
+
118
+                List<WxMaSubscribeMessage.Data> dataList = new ArrayList<>();
119
+                dataList.add(new WxMaSubscribeMessage.Data("character_string1", orderId));
120
+                dataList.add(new WxMaSubscribeMessage.Data("thing5", "您有新的十公里订单已核销,请注意查收"));
121
+
122
+                try {
123
+                    wxUtils.sendMessage(templateId, openId, page, dataList);
124
+                } catch (Exception e) {
125
+                    e.printStackTrace();
126
+                    log.error("发送订单核销消息失败: {}", e.getMessage());
127
+                } finally {
128
+                    try {
129
+                        Thread.sleep(1000);
130
+                    } catch (InterruptedException e) {
131
+                        e.printStackTrace();
132
+                    }
133
+                }
134
+            }
135
+
136
+        } catch (Exception e) {
137
+            e.printStackTrace();
138
+        }
139
+    }
140
+
82
 }
141
 }

+ 9
- 1
src/main/java/com/yunzhi/shigongli/vo/ShopPackageVO.java View File

41
     @ApiModelProperty(value = "描述")
41
     @ApiModelProperty(value = "描述")
42
     private String description;
42
     private String description;
43
 
43
 
44
+    @ExcelIgnore
45
+    @ApiModelProperty(value = "最小适用人数")
46
+    private Integer minPerson;
47
+
48
+    @ExcelIgnore
49
+    @ApiModelProperty(value = "最大适用人数")
50
+    private Integer maxPerson;
51
+
44
     @ExcelProperty(value = "适用人数", index = 2)
52
     @ExcelProperty(value = "适用人数", index = 2)
45
     @ColumnWidth(20)
53
     @ColumnWidth(20)
46
     @ApiModelProperty(value = "适用人数")
54
     @ApiModelProperty(value = "适用人数")
47
-    private Integer personNum;
55
+    private String personNum;
48
 
56
 
49
     @ExcelIgnore
57
     @ExcelIgnore
50
     @ApiModelProperty(value = "主图")
58
     @ApiModelProperty(value = "主图")

+ 0
- 4
src/main/resources/application-dev.yml View File

14
   level:
14
   level:
15
     root: info
15
     root: info
16
     springfox: info
16
     springfox: info
17
-
18
-weixin:
19
-  pay:
20
-    keyPath: E:/work/shigongli/v2/service/cert/apiclient_cert.p12

+ 18
- 0
src/main/resources/application-prod.yml View File

10
     url: jdbc:mysql://rm-uf6z3z6jq11x653d77o.mysql.rds.aliyuncs.com:3306/shigongli-v2?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
10
     url: jdbc:mysql://rm-uf6z3z6jq11x653d77o.mysql.rds.aliyuncs.com:3306/shigongli-v2?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
11
     username: shigongli
11
     username: shigongli
12
     password: shigongli@123
12
     password: shigongli@123
13
+
14
+
15
+weixin:
16
+  miniapp:
17
+    appid: wx06a7372d48d56843
18
+    secret: ead0c7b1dd40ce828b1fd9bf18183584
19
+    token:
20
+    aesKey:
21
+    msgDataFormat: JSON
22
+  pay:
23
+    appId: wx06a7372d48d56843
24
+    mchId: 1612121997
25
+    mchKey: fUbYPldU5bUCYRl97vMv69JQujsJ8dj5
26
+    subAppId:
27
+    subMchId:
28
+    keyPath: /opt/yunzhi/sgl-v2/cert/apiclient_cert.p12
29
+    notifyUrl: https://sgl-v2.njyunzhi.com/api/wxpay/notify/order
30
+    refundNotifyUrl: https://sgl-v2.njyunzhi.com/api/wxpay/notify/refund

+ 3
- 3
src/main/resources/application.yml View File

59
     mchKey: fUbYPldU5bUCYRl97vMv69JQujsJ8dj5
59
     mchKey: fUbYPldU5bUCYRl97vMv69JQujsJ8dj5
60
     subAppId:
60
     subAppId:
61
     subMchId:
61
     subMchId:
62
-    keyPath: /yunpan/shigongli/cert/apiclient_cert.p12
63
-    notifyUrl: https://sgl-v2.njyunzhi.com/api/wxpay/notify/order
64
-    refundNotifyUrl: https://sgl-v2.njyunzhi.com/api/wxpay/notify/refund
62
+    keyPath: E:/work/shigongli/v2/service/cert/apiclient_cert.p12
63
+    notifyUrl: https://sgl-v2-test.njyunzhi.com/api/wxpay/notify/order
64
+    refundNotifyUrl: https://sgl-v2-test.njyunzhi.com/api/wxpay/notify/refund
65
 
65
 
66
 ## 高德地图
66
 ## 高德地图
67
 amap:
67
 amap:

src/main/resources/logback.xml → src/main/resources/logback.xml.bak View File


+ 18
- 0
src/main/resources/mapper/TaOrderPayMapper.xml View File

42
             t.create_date DESC
42
             t.create_date DESC
43
             LIMIT 1
43
             LIMIT 1
44
     </select>
44
     </select>
45
+    <select id="getShopWorkerBy" resultType="java.util.Map">
46
+        SELECT DISTINCT
47
+            t.shop_id,
48
+            p.openid
49
+        FROM
50
+            ta_order_sub t
51
+                INNER JOIN ta_shop_worker s ON s.shop_id = t.shop_id
52
+                INNER JOIN ta_person p ON p.person_id = s.person_id
53
+        WHERE
54
+            t.order_id = #{orderId}
55
+          <if test="subOrderId != null and subOrderId != ''">
56
+              AND t.sub_order_id = #{subOrderId}
57
+          </if>
58
+          AND t.`status` = 1
59
+          AND s.`status` = 1
60
+          AND p.`status` = 1
61
+    </select>
62
+
45
 </mapper>
63
 </mapper>

+ 1
- 1
src/main/resources/mapper/TaOrderSubMapper.xml View File

173
             t.shop_id,
173
             t.shop_id,
174
             s.shop_name,
174
             s.shop_name,
175
             t.description,
175
             t.description,
176
-            sum( t.charges ) AS charges,
176
+            sum( IF( t.`status` = 0, 0 , t.charges) ) AS charges,
177
             sum( t.amount ) AS amount,
177
             sum( t.amount ) AS amount,
178
             sum( t.cashback ) AS cashback,
178
             sum( t.cashback ) AS cashback,
179
             sum( IF ( t.is_verified = 1, t.charges - t.commission_charge - t.cashback, 0 ) ) AS verfied_charge,
179
             sum( IF ( t.is_verified = 1, t.charges - t.commission_charge - t.cashback, 0 ) ) AS verfied_charge,

+ 1
- 0
src/main/resources/mapper/TaSaveMapper.xml View File

32
                         NULL                                     AS resource_no,
32
                         NULL                                     AS resource_no,
33
                         a.target_type,
33
                         a.target_type,
34
                         a.target_id,
34
                         a.target_id,
35
+                        '' as target_name,
35
                         0                                        AS like_num,
36
                         0                                        AS like_num,
36
                         0                                        AS pv_num,
37
                         0                                        AS pv_num,
37
                         0                                        AS uv_num,
38
                         0                                        AS uv_num,

+ 1
- 0
src/main/resources/mapper/TaShopPackageMapper.xml View File

10
     <sql id="queryShopPackage">
10
     <sql id="queryShopPackage">
11
         SELECT
11
         SELECT
12
             t.*,
12
             t.*,
13
+            concat(t.min_person, '-', t.max_person) as person_num,
13
             m.shop_name,
14
             m.shop_name,
14
             s.traffic_rate,
15
             s.traffic_rate,
15
             s.platform_rate,
16
             s.platform_rate,

+ 4
- 1
src/main/resources/mapper/TaTargetQuotaMapper.xml View File

67
                 ) AS is_saved
67
                 ) AS is_saved
68
             FROM
68
             FROM
69
                 ta_resource t
69
                 ta_resource t
70
-            WHERE LOWER(t.title) like LOWER(CONCAT('%', #{word}, '%'))
70
+            WHERE (
71
+                LOWER(t.title) like LOWER(CONCAT('%', #{word}, '%'))
72
+                OR LOWER(t.target_name) like LOWER(CONCAT('%', #{word}, '%'))
73
+                    )
71
               <if test="targetType != null and targetType != ''">
74
               <if test="targetType != null and targetType != ''">
72
                   AND t.target_type = #{targetType}
75
                   AND t.target_type = #{targetType}
73
               </if>
76
               </if>

+ 11
- 0
src/main/resources/mapper/TaVerifyTargetMapper.xml View File

49
         </if>
49
         </if>
50
             AND t.`status` &gt; - 1
50
             AND t.`status` &gt; - 1
51
     </select>
51
     </select>
52
+    <select id="getShopWorkerBy" resultType="java.lang.String">
53
+        SELECT
54
+            s.openid
55
+        FROM
56
+            ta_shop_worker t
57
+                INNER JOIN ta_person s ON s.person_id = t.person_id
58
+        WHERE
59
+            t.shop_id = #{shopId}
60
+          AND t.`status` = 1
61
+          AND s.`status` = 1
62
+    </select>
52
 </mapper>
63
 </mapper>