Commit b6361171 by huluobin

模版消息日志记录

parent df54851c
......@@ -21,6 +21,7 @@ public class AccessTokenService {
* @return accessToken
*/
public AccessToken getAccessToken() {
String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + wxProperties.getCustomerMiniAppId() + "&secret=" + wxProperties.getCustomerMiniSecret();
RestTemplate restTemplate = new RestTemplate();
......
package com.gogirl.infrastructure.constant;
/**
* 全局变量工具类
*/
public class Constans {
public static final String WX_PAY_ORDER_PREFIX = "000000";
public static final String WX_BALANCE_PAY_ORDER_PREFIX = "000000";
}
package com.gogirl.infrastructure.constant;
public class Constant {
public static final int ATTACH_CONSUME_WECHAT = 1;//用户端微信支付
public static final int ATTACH_CONSUME_BALANCE = 2;//用户端余额支付
public static final int ATTACH_CONSUME_OTHER = 3;//其他(目前没用到)
public static final int ATTACH_CHARGE_BALANCE = 4;//用户端微信支付充值
public static final int ATTACH_CONSUME_POS = 5;//pos收款
public static final int ATTACH_CONSUME_CASH = 6;//现金收款
public static final int ATTACH_CONSUME_MEITUAN = 7;//大众点评收款
public static final int ATTACH_CHARGE_WECHAT = 8;//微信扫码支付
public static final int CONSUME_WECHAT = 1;//用户端微信支付
public static final int CONSUME_BALANCE = 2;//用户端余额支付
public static final int CONSUME_OTHER = 3;//其他(目前没用到)
public static final int CHARGE_BALANCE = 4;//用户端微信支付充值
public static final int CONSUME_POS = 5;//pos收款
public static final int CONSUME_CASH = 6;//现金收款
public static final int CONSUME_MEITUAN = 7;//大众点评收款
public static final int CHARGE_WECHAT = 8;//微信扫码支付
public static final int PLUS_INTEGRAL = 1;
public static final int MINUS_INTEGRAL = 2;
}
package com.gogirl.infrastructure.constant;
public class MiniappConstant {
public static String appId = "wxd5e3224465422206";
public static String mchId = "1516547781";
public static String mchKey = "gogirl2018gogirl2018gogirl2018go";
}
package com.gogirl.infrastructure.feign.wx;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
import com.gogirl.infrastructure.common.base.JsonResult;
import com.gogirl.infrastructure.common.util.JsonUtilByFsJson;
import com.gogirl.shared.wx.WxSubscribeMessageRequest;
......@@ -22,10 +20,9 @@ import java.util.Map;
@Slf4j
public class WxSubscribeController implements WxSubscribeControllerFeign {
private final WxMaService wxMaService = new WxMaServiceImpl();
@Override
public JsonResult<Void> send(@RequestBody WxSubscribeMessageRequest request) {
public <T> JsonResult<Void> send(@RequestBody WxSubscribeMessageRequest<T> request) {
String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + request.getAccessToken();
......@@ -35,12 +32,11 @@ public class WxSubscribeController implements WxSubscribeControllerFeign {
map.put("touser", request.getToUser());
map.put("page", request.getPage());
log.info("access_token :{}", request.getAccessToken());
log.info("发送模板消息参数:{}", JsonUtilByFsJson.beanToJson(map));
log.info("推送订阅消息参数:{}", JsonUtilByFsJson.beanToJson(map));
String s = new RestTemplate().postForEntity(url, map, String.class).getBody();
String jsonResp = new RestTemplate().postForEntity(url, map, String.class).getBody();
log.info("发送模板消息响应:{}", s);
log.info("推送订阅消息响应:{}", jsonResp);
return JsonResult.success();
}
}
......@@ -2,11 +2,15 @@ package com.gogirl.infrastructure.feign.wx;
import com.gogirl.infrastructure.common.base.JsonResult;
import com.gogirl.shared.wx.WxSubscribeMessageRequest;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
public interface WxSubscribeControllerFeign {
@PostMapping("/subscribe/send")
JsonResult<Void> send(@RequestBody WxSubscribeMessageRequest request);
/**
* 发送评价消息
*
* @param request
* @return
*/
<T> JsonResult<Void> send(@RequestBody WxSubscribeMessageRequest<T> request);
}
......@@ -79,6 +79,11 @@ public class Schedule {
private final StoreTechnicianService storeTechnicianService;
private final StoreManageService storeManageService;
private final ScheduleManageService scheduleManageService;
private final SubscribeService subscribeService;
private final CustomerService customerService;
private final MallOrderService mallOrderService;
private final ProduceSalesService produceSalesService;
private final FeaturesMappingService featuresMappingService;
/**
* repository
......@@ -87,31 +92,29 @@ public class Schedule {
private final CustomerBalanceRecordMapper balanceRecordDao;
private final ScheduleManageMapper scheduleManageMapper;
private final MallOrderMapper mallOrderMapper;
private final SubscribeService subscribeService;
private final CustomerService customerService;
private final MallOrderService mallOrderService;
private final ProduceSalesMapper produceSalesMapper;
private final BaseFeaturesMapper baseFeaturesMapper;
private final FeaturesMappingMapper featuresMappingMapper;
private final ProduceSalesService produceSalesService;
private final FeaturesMappingService featuresMappingService;
private final OrderServeMapper orderServeMapper;
private final WeekConfigMapper weekConfigMapper;
private final StoreTechnicianMapper storeTechnicianMapper;
private final CareerMapper careerMapper;
private final StoreManageMapper storeManageMapper;
private final StoreDataMapper storeDataMapper;
private OrderManageMapper orderManageMapper;
/**
* rpc
*/
private final RestTemplate restTemplate;
/**
* config
*/
private final GogirlProperties gogirlProperties;
/**
* 每天定时任务,判断优惠券是否过期
*/
@Scheduled(cron = "0 0 3 * * ?")
......@@ -322,6 +325,9 @@ public class Schedule {
orderServeMapper.syncOrderServeTimes();
}
/**
* 同步闲时预约周信息
*/
@Scheduled(cron = "0 0/1 * * * *")
public void weekTest() {
log.debug("同步闲时折扣周");
......@@ -339,7 +345,6 @@ public class Schedule {
log.debug("同步闲时折扣周 结束");
}
/**
* 定时同步美甲师成长历程
*/
......@@ -595,15 +600,12 @@ public class Schedule {
log.info("定时同步门店数据** 任务结束");
}
private final GogirlProperties gogirlProperties;
private OrderManageMapper orderManageMapper;
/**
* 每30分钟一次评价提醒图推送
*/
@Scheduled(cron = "0 0/30 * * * *")
@Scheduled(cron = "0 0/1 * * * *")
public void testPaper() {
log.info("评价提醒推送");
log.info("评价提醒推送定时任务开始");
Date date = new Date(System.currentTimeMillis() - gogirlProperties.getTestPaperTime() * 60000L);
List<OrderManage> orderManageList = orderManageMapper.selectList(
......@@ -624,6 +626,6 @@ public class Schedule {
log.error("推送失败 订单id:{}", orderManage.getId());
}
});
log.info("评价提醒推送");
log.info("评价提醒推送定时任务结束");
}
}
......@@ -31,6 +31,7 @@ public class SubscribeServiceImpl implements SubscribeService {
@Async
@Override
public void sendScheduleMsg(String openId, String scheduleName, Date arriveTime, String departmentName, String address) {
log.info("推送预约提醒订阅消息");
String tips = "距预约剩余1小时,请准时到店,超时将取消";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
......@@ -63,6 +64,8 @@ public class SubscribeServiceImpl implements SubscribeService {
String departmentName,
String address) {
log.info("推送超时取消订阅消息");
String tips = "您已超时15分钟,预约已取消,请重新预约";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
wxSubscribeControllerFeign.send(WxSubscribeMessageRequest.builder()
......@@ -96,6 +99,7 @@ public class SubscribeServiceImpl implements SubscribeService {
Date paymentTime,
BigDecimal paymentAmount,
BigDecimal balance) {
log.info("推送支付成功消息 订单id:{}", orderId);
String tips = "点击即可查看详情,如有疑问请联系客服";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
......@@ -155,6 +159,8 @@ public class SubscribeServiceImpl implements SubscribeService {
@Override
public void testPaper(String openId,
Integer orderId) {
log.info("推送提醒评价订阅消息,订单id:{}", orderId);
wxSubscribeControllerFeign.send(WxSubscribeMessageRequest
.builder()
.toUser(openId)
......
......@@ -26,14 +26,6 @@ mybatis-plus:
mapper-locations:
- classpath:mapper/**/*.xml
#分页插件
pagehelper:
helperDialect: mysql
reasonable: true
supportMethodsArguments: true
params: count=countSql
server:
undertow:
io-threads: 6
......
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