Commit 30d29a09 by wuwenlong

Merge remote-tracking branch 'origin/main'

parents bc3b0ee6 d1a3a1b4
......@@ -53,11 +53,7 @@
<artifactId>hutool-all</artifactId>
<version>5.8.16</version>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-miniapp</artifactId>
<version>4.5.0</version>
</dependency>
</dependencies>
<build>
......
......@@ -6,13 +6,16 @@ import cn.hutool.core.date.LocalDateTimeUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import share.system.config.WxMaProperties;
import share.system.domain.vo.SendTemplateMessageItemVo;
import share.system.domain.vo.TemplateMessageVo;
import share.system.service.WechatNewService;
import share.system.util.WXMsgPushUtils;
import share.web.core.config.WxMaProperties;
import java.time.LocalDateTime;
......@@ -63,6 +66,22 @@ public class WxMsgPushController {
@GetMapping("/getOpenId")
public void getOpenId(String openId) throws Exception {
// HashMap<String, SendTemplateMessageItemVo> data = new HashMap<>();
// TemplateMessageVo templateMessageVo = new TemplateMessageVo();
// templateMessageVo.setTouser(openId);
// templateMessageVo.setTemplate_id("oTc000e4NHkoc7v9OLBZiwM6Q6SFzguemrx6d0iuVS8");
// templateMessageVo.setUrl("http://www.baidu.com");
// data.put("thing4", new SendTemplateMessageItemVo("预约门店"));
// data.put("thing7", new SendTemplateMessageItemVo("服务名称"));
// data.put("date3", new SendTemplateMessageItemVo(LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss")));
// data.put("thing5", new SendTemplateMessageItemVo("地址"));
// templateMessageVo.setData(data);
// log.info("开始发送消息!!!!");
// Boolean b = wechatNewService.sendMiniSubscribeMessage(templateMessageVo);
// if(b){
// log.info("消息发送成功!!!!");
// }
Map<String, String> map = new HashMap<>();
map.put("thing4", "预约门店");
map.put("thing7", "服务名称");
......
......@@ -16,10 +16,8 @@ import share.common.constant.Constants;
import share.common.core.redis.RedisUtil;
import share.common.enums.*;
import share.common.exception.base.BaseException;
import share.system.domain.SConsumer;
import share.system.domain.SConsumerCoupon;
import share.system.domain.SOrder;
import share.system.domain.SRoom;
import share.system.domain.*;
import share.system.domain.vo.TemplateMessageVo;
import share.system.service.*;
import java.util.*;
......@@ -63,6 +61,10 @@ public class OrderTask {
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private WechatNewService wechatNewService;
final int ZERO = 0;
//10分钟的常量
final long TEN_MINUTES = 60 * 10;
......@@ -227,7 +229,8 @@ public class OrderTask {
//时间到期前10分钟到9分
long expire = (expirationTime.getTime() - new Date().getTime()) / 1000;
if (expire < TEN_MINUTES && expire > NINE_MINUTES) {
SOrder byOrderNo = orderService.getByOrderNo(String.valueOf(o));
wechatNewService.sendMiniSubscribeMessage(byOrderNo, MessageReminderEnum.RESERVER);
}
if (expirationTime.getTime() < new Date().getTime()) {
sOrders.add(orderService.getByOrderNo(String.valueOf(o)));
......@@ -255,6 +258,8 @@ public class OrderTask {
room.setUpdateTime(new Date());
}
});
//推送订单开始预定消息
wechatNewService.sendMiniSubscribeMessage(item, MessageReminderEnum.START);
//到达预定时间进行通电
deviceOpService.openOrCloseDevice(item.getRoomId(), item.getConsumerPhone(), OpTypeEnum.GET_ELECTRIC.getCode(), false, ZERO);
}
......
......@@ -47,6 +47,9 @@ public class RedisTask {
@Autowired
private DeviceOpService deviceOpService;
@Autowired
private WechatNewService wechatNewService;
//15分钟的常量
final long FIFTEEN_MINUTES = 60 * 15;
//14分钟的常量
......@@ -158,6 +161,8 @@ public class RedisTask {
if (b) {
//删除redis中的值
redisUtil.delete(o);
//推送订单结束消息
wechatNewService.sendMiniSubscribeMessage(sOrder, MessageReminderEnum.END);
deviceOpService.actionExecute(sOrder.getRoomId(), sOrder.getConsumerPhone(), VoiceEnum.SEND_CUSTOMER.getCode(),
DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN),
DateUtil.format(DateUtil.offsetMinute(new Date(), 1), DatePattern.NORM_DATETIME_PATTERN), "1");
......
package share.web.core.config;
package share.system.config;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
......
package share.web.core.config;
package share.system.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
......
package share.system.service;
import com.alibaba.fastjson.JSONObject;
import share.common.enums.MessageReminderEnum;
import share.system.domain.SOrder;
import share.system.domain.vo.*;
import share.system.response.WeChatJsSdkConfigResponse;
......@@ -94,6 +96,8 @@ public interface WechatNewService {
*/
Boolean sendMiniSubscribeMessage(TemplateMessageVo templateMessage);
Boolean sendMiniSubscribeMessage(SOrder byOrderNo, MessageReminderEnum messageReminderEnum);
/**
* 获取微信公众号自定义菜单配置
* (使用本自定义菜单查询接口可以获取默认菜单和全部个性化菜单信息)
......
......@@ -347,6 +347,11 @@ public class QPServiceImpl implements QPService {
}
/**
* 适用店铺查询接口
*
* @return
*/
@Override
public List<CustomerKeyShopScopeResponseEntity> scope() {
Boolean b = redisUtil.exists(ReceiptRdeisEnum.MT_SESSION_KEY.getValue());
......
......@@ -93,7 +93,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
private ISConsumptionRecordsService sConsumptionRecordsService;
@Autowired
private MqttxService mqttxService;
private WechatNewService wechatNewService;
/**
* 查询订单
......@@ -335,6 +335,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
sConsumptionRecords.setPayType(PayTypeEnum.WECHAT.getName());
sConsumptionRecords.setSign(SignEnum.BURDEN.getValue());
sConsumptionRecordsService.insertSConsumptionRecords(sConsumptionRecords);
Map<String, String> map = new HashMap<>();
map.put("orderNo", sOrder.getOrderNo());
map.put("expirationTime", sOrder.getPreStartDate().toString());
JSONObject jsonObject = new JSONObject(map);
redisUtils.set(ReceiptRdeisEnum.ORDER_NO.getValue() + sOrder.getOrderNo(), jsonObject.toString());
}
if (sOrder.getOrderType().equals(OrderTypeEnum.RENEW.getCode())) {
sOrder.setStartDate(sOrder.getPreStartDate());
......@@ -656,7 +661,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
map.put("expirationTime", sOrder.getEndDate().toString());
JSONObject jsonObject = new JSONObject(map);
redisUtils.set(ReceiptRdeisEnum.ORDER_NO_KEY.getValue() + sOrder.getOrderNo(), jsonObject.toString());
} else {
} else if (sOrder.getOrderType().equals(OrderTypeEnum.RESERVER.getCode())) {
Map<String, String> map = new HashMap<>();
map.put("orderNo", sOrder.getOrderNo());
map.put("expirationTime", sOrder.getPreStartDate().toString());
......@@ -883,6 +888,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if (ObjectUtils.isEmpty(device2)) {
throw new BaseException("设备不存在!");
}
redisUtils.delete(ReceiptRdeisEnum.ORDER_NO.getValue() + sOrder.getOrderNo());
wechatNewService.sendMiniSubscribeMessage(sOrder, MessageReminderEnum.START);
//开门、取电
deviceOpService.openDoor(sRoomVo.getId(), sOrder.getConsumerPhone());
//语音
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment