commit
94a2d09bdc
11
pom.xml
11
pom.xml
@ -204,6 +204,17 @@
|
|||||||
<artifactId>vod20170321</artifactId>
|
<artifactId>vod20170321</artifactId>
|
||||||
<version>2.0.0</version>
|
<version>2.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- 阿里云短信-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>aliyun-java-sdk-core</artifactId>
|
||||||
|
<version>4.0.6</version> <!-- 注:如提示报错,先升级基础包版,无法解决可联系技术支持 -->
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
|
||||||
|
<version>1.1.0</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
@ -7,11 +7,7 @@ import com.stdiet.common.core.redis.RedisCache;
|
|||||||
import com.stdiet.common.utils.StringUtils;
|
import com.stdiet.common.utils.StringUtils;
|
||||||
import com.stdiet.common.utils.file.FileUploadUtils;
|
import com.stdiet.common.utils.file.FileUploadUtils;
|
||||||
import com.stdiet.common.utils.file.FileUtils;
|
import com.stdiet.common.utils.file.FileUtils;
|
||||||
import com.stdiet.custom.domain.wechat.WxAccessToken;
|
|
||||||
import com.stdiet.custom.domain.wechat.WxFileUploadResult;
|
|
||||||
import com.stdiet.custom.utils.WxTokenUtils;
|
|
||||||
import com.stdiet.framework.config.ServerConfig;
|
import com.stdiet.framework.config.ServerConfig;
|
||||||
import org.aspectj.weaver.loadtime.Aj;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -23,7 +19,6 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用请求处理
|
* 通用请求处理
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
package com.stdiet.web.controller.custom;
|
|
||||||
|
|
||||||
import com.stdiet.common.core.controller.BaseController;
|
|
||||||
import com.stdiet.common.core.domain.AjaxResult;
|
|
||||||
import com.stdiet.common.core.redis.RedisCache;
|
|
||||||
import com.stdiet.custom.service.ISysWxService;
|
|
||||||
import com.stdiet.custom.utils.WxTokenUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/wx")
|
|
||||||
public class CusWxController extends BaseController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public ISysWxService sysWxService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public RedisCache redisCache;
|
|
||||||
|
|
||||||
@GetMapping("/checkSign")
|
|
||||||
public String wxCheckAuth(@RequestParam String signature, @RequestParam String timestamp, @RequestParam String nonce, @RequestParam String echostr) {
|
|
||||||
return sysWxService.wxCheckAuth(signature, timestamp, nonce, echostr);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/checkSign")
|
|
||||||
public String autoResponse(HttpServletRequest request) {
|
|
||||||
return sysWxService.autoResponse(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/accessToken")
|
|
||||||
public AjaxResult getAccessToken() {
|
|
||||||
return sysWxService.getAccessToken();
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/clearAccessToken")
|
|
||||||
public AjaxResult clearAccessToken() {
|
|
||||||
redisCache.deleteObject(WxTokenUtils.KEY_ACCESS_TOKEN);
|
|
||||||
return AjaxResult.success();
|
|
||||||
}
|
|
||||||
}
|
|
@ -451,17 +451,24 @@ public class WechatAppletController extends BaseController {
|
|||||||
if (StringUtils.isNotEmpty(sysWxUserInfo.getPhone())) {
|
if (StringUtils.isNotEmpty(sysWxUserInfo.getPhone())) {
|
||||||
SysCustomer sysCustomer = iSysCustomerService.getCustomerByPhone(sysWxUserInfo.getPhone());
|
SysCustomer sysCustomer = iSysCustomerService.getCustomerByPhone(sysWxUserInfo.getPhone());
|
||||||
if (StringUtils.isNull(sysCustomer)) {
|
if (StringUtils.isNull(sysCustomer)) {
|
||||||
return AjaxResult.error(5003, "未查到用户信息,请联系销售顾问");
|
// return AjaxResult.error(5003, "未查到用户信息,请联系销售顾问");
|
||||||
|
// 创建新客户
|
||||||
|
sysCustomer = new SysCustomer();
|
||||||
|
sysCustomer.setName(sysWxUserInfo.getNickName());
|
||||||
|
sysCustomer.setPhone(sysWxUserInfo.getPhone());
|
||||||
|
sysCustomer.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
sysCustomer.setCreateTime(DateUtils.getNowDate());
|
||||||
|
iSysCustomerService.insertSysCustomer(sysCustomer);
|
||||||
}
|
}
|
||||||
|
|
||||||
sysWxUserInfo.setCusId(sysCustomer.getId());
|
sysWxUserInfo.setCusId(sysCustomer.getId());
|
||||||
|
sysWxUserInfo.setUpdateTime(DateUtils.getNowDate());
|
||||||
if (StringUtils.isNull(curWxUserInfo)) {
|
if (StringUtils.isNull(curWxUserInfo)) {
|
||||||
// 新增sys_wx_user_info
|
// 新增sys_wx_user_info
|
||||||
sysWxUserInfo.setCreateTime(DateUtils.getNowDate());
|
sysWxUserInfo.setCreateTime(DateUtils.getNowDate());
|
||||||
sysWxUserInfoService.insertSysWxUserInfo(sysWxUserInfo);
|
sysWxUserInfoService.insertSysWxUserInfo(sysWxUserInfo);
|
||||||
} else {
|
} else {
|
||||||
// 更新sys_wx_user_info数据,
|
// 更新sys_wx_user_info数据,
|
||||||
sysWxUserInfo.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
sysWxUserInfoService.updateSysWxUserInfo(sysWxUserInfo);
|
sysWxUserInfoService.updateSysWxUserInfo(sysWxUserInfo);
|
||||||
}
|
}
|
||||||
// 更新对象
|
// 更新对象
|
||||||
@ -486,6 +493,23 @@ public class WechatAppletController extends BaseController {
|
|||||||
|
|
||||||
List<SysRecipesPlanListInfo> plans = sysRecipesPlanService.selectRecipesPlanListInfoByCusId(cusId);
|
List<SysRecipesPlanListInfo> plans = sysRecipesPlanService.selectRecipesPlanListInfoByCusId(cusId);
|
||||||
|
|
||||||
|
SysRecipesPlanListInfo tmpPlan;
|
||||||
|
for (int i = 0; i < plans.size(); i++) {
|
||||||
|
tmpPlan = plans.get(i);
|
||||||
|
tmpPlan.setStatus(1);
|
||||||
|
if (StringUtils.isNull(tmpPlan.getSendFlag()) || tmpPlan.getSendFlag() == 0) {
|
||||||
|
tmpPlan.setSendFlag(0);
|
||||||
|
tmpPlan.setMenus(new ArrayList<>());
|
||||||
|
}
|
||||||
|
// 从excel转到线上的客户,之前的食谱无效
|
||||||
|
if (i > 0 && plans.get(i - 1).getRecipesId() == null && i < plans.size() - 1 && plans.get(i + 1).getRecipesId() != null) {
|
||||||
|
for (int j = 0; j < i; j++) {
|
||||||
|
plans.get(j).setStatus(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SysOrderPause orderPause = new SysOrderPause();
|
SysOrderPause orderPause = new SysOrderPause();
|
||||||
orderPause.setCusId(cusId);
|
orderPause.setCusId(cusId);
|
||||||
List<SysOrderPause> pauses = sysOrderPauseService.selectSysOrderPauseList(orderPause);
|
List<SysOrderPause> pauses = sysOrderPauseService.selectSysOrderPauseList(orderPause);
|
||||||
@ -534,10 +558,27 @@ public class WechatAppletController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/getToken")
|
@GetMapping("/getToken")
|
||||||
public String getToken(@RequestParam String appId) throws Exception {
|
public String getToken(@RequestParam String appId) {
|
||||||
return iWechatAppletService.getAccessToken(appId);
|
return iWechatAppletService.getAccessToken(appId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/subscribe")
|
||||||
|
public AjaxResult subscribe(@RequestParam String customerId, @RequestParam Long planId, @RequestParam Integer subscribed) {
|
||||||
|
// Long cusId = StringUtils.isNotEmpty(customerId) ? Long.parseLong(AesUtils.decrypt(customerId)) : 0L;
|
||||||
|
|
||||||
|
SysRecipesPlan info = new SysRecipesPlan();
|
||||||
|
info.setId(planId);
|
||||||
|
info.setSubscribed(subscribed);
|
||||||
|
|
||||||
|
return AjaxResult.success(sysRecipesPlanService.updateSysRecipesPlan(info));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/subscribe/post")
|
||||||
|
public AjaxResult subscribePost(@RequestParam Long cusId, @RequestParam Long planId, @RequestParam String name, @RequestParam String startDate, @RequestParam String endDate, @RequestParam String remark) {
|
||||||
|
return AjaxResult.success(iWechatAppletService.postSubscribeMessage(cusId, planId, name, startDate, endDate, remark));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BIN
stdiet-custom/libs/aliyun-java-sdk-core-3.3.1.jar
Normal file
BIN
stdiet-custom/libs/aliyun-java-sdk-core-3.3.1.jar
Normal file
Binary file not shown.
BIN
stdiet-custom/libs/aliyun-java-sdk-dysmsapi-1.0.0.jar
Normal file
BIN
stdiet-custom/libs/aliyun-java-sdk-dysmsapi-1.0.0.jar
Normal file
Binary file not shown.
@ -148,4 +148,15 @@ public class SysRecipesPlan {
|
|||||||
|
|
||||||
// 0-普通 1-模板
|
// 0-普通 1-模板
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订阅推送
|
||||||
|
*/
|
||||||
|
private Integer subscribed;
|
||||||
|
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
private Integer subSend;
|
||||||
|
|
||||||
|
private Integer smsSend;
|
||||||
}
|
}
|
@ -25,4 +25,10 @@ public class SysRecipesPlanListInfo {
|
|||||||
|
|
||||||
private List<SysRecipesPlan> menus;
|
private List<SysRecipesPlan> menus;
|
||||||
|
|
||||||
|
private Integer sendFlag;
|
||||||
|
|
||||||
|
private Integer subscribed;
|
||||||
|
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
package com.stdiet.custom.domain;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
public class WxPush implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
package com.stdiet.custom.domain;
|
|
||||||
|
|
||||||
|
|
||||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@XStreamAlias("xml")
|
|
||||||
public class WxXmlData implements Serializable {
|
|
||||||
@XStreamAlias("ToUserName")
|
|
||||||
private String toUserName;
|
|
||||||
@XStreamAlias("FromUserName")
|
|
||||||
private String fromUserName;
|
|
||||||
@XStreamAlias("CreateTime")
|
|
||||||
private Long createTime;
|
|
||||||
@XStreamAlias("MsgType")
|
|
||||||
private String msgType;
|
|
||||||
@XStreamAlias("Content")
|
|
||||||
private String content;
|
|
||||||
@XStreamAlias("MsgId")
|
|
||||||
private String msgId;
|
|
||||||
//
|
|
||||||
@XStreamAlias("Title")
|
|
||||||
private String title;
|
|
||||||
@XStreamAlias("Description")
|
|
||||||
private String description;
|
|
||||||
@XStreamAlias("Url")
|
|
||||||
private String url;
|
|
||||||
/**
|
|
||||||
* 订阅或者取消订阅的事件
|
|
||||||
*/
|
|
||||||
@XStreamAlias("Event")
|
|
||||||
private String event;
|
|
||||||
@XStreamAlias("EventKey")
|
|
||||||
private String eventkey;
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.stdiet.custom.domain.wechat;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class WxSubscribePostLog {
|
||||||
|
Long id;
|
||||||
|
String appid;
|
||||||
|
String openid;
|
||||||
|
String phone;
|
||||||
|
Long planId;
|
||||||
|
Date sendTime;
|
||||||
|
JSONObject result;
|
||||||
|
JSONObject data;
|
||||||
|
Integer type;
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.stdiet.custom.mapper;
|
||||||
|
|
||||||
|
import com.stdiet.custom.domain.wechat.WxSubscribePostLog;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface SysWxSubscribePostLogMapper {
|
||||||
|
public int insertWxSubscribePostLog(WxSubscribePostLog postLog);
|
||||||
|
|
||||||
|
public List<WxSubscribePostLog> selectWxSubscribePostLog(WxSubscribePostLog postLog);
|
||||||
|
}
|
@ -19,6 +19,8 @@ public interface SysWxUserInfoMapper
|
|||||||
*/
|
*/
|
||||||
public SysWxUserInfo selectSysWxUserInfoById(String openid);
|
public SysWxUserInfo selectSysWxUserInfoById(String openid);
|
||||||
|
|
||||||
|
public SysWxUserInfo selectSysWxUserInfoByCusId(Long cusId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询微信用户列表
|
* 查询微信用户列表
|
||||||
*
|
*
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
package com.stdiet.custom.service;
|
|
||||||
|
|
||||||
import com.stdiet.common.core.domain.AjaxResult;
|
|
||||||
import com.stdiet.custom.domain.WxXmlData;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
public interface ISysWxService {
|
|
||||||
/**
|
|
||||||
* 微信token验证
|
|
||||||
*
|
|
||||||
* @param signature
|
|
||||||
* @param timestamp
|
|
||||||
* @param nonce
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String wxCheckAuth(String signature, String timestamp, String nonce, String echostr);
|
|
||||||
|
|
||||||
public String autoResponse(HttpServletRequest request);
|
|
||||||
|
|
||||||
public AjaxResult getAccessToken();
|
|
||||||
}
|
|
@ -19,6 +19,8 @@ public interface ISysWxUserInfoService
|
|||||||
*/
|
*/
|
||||||
public SysWxUserInfo selectSysWxUserInfoById(String openid);
|
public SysWxUserInfo selectSysWxUserInfoById(String openid);
|
||||||
|
|
||||||
|
public SysWxUserInfo selectSysWxUserInfoByCusId(Long cusId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询微信用户列表
|
* 查询微信用户列表
|
||||||
*
|
*
|
||||||
|
@ -2,7 +2,9 @@ package com.stdiet.custom.service;
|
|||||||
|
|
||||||
public interface IWechatAppletService {
|
public interface IWechatAppletService {
|
||||||
|
|
||||||
public String getAccessToken(String appId) throws Exception;
|
public String getAccessToken(String appId);
|
||||||
|
|
||||||
public void postRecipesMessage(String appId, String openId, String name, String startDate, String endDate, String remark) throws Exception;
|
public Integer postSubscribeMessage(Long cusId, Long planId, String name, String startDate, String endDate, String remark);
|
||||||
|
|
||||||
|
public Integer postSms(Long cusId, Long planId, String plan);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.stdiet.custom.service;
|
||||||
|
|
||||||
|
import com.stdiet.custom.domain.wechat.WxSubscribePostLog;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface IWxSubscribePostLogService {
|
||||||
|
public int insertWxSubscribePostLog(WxSubscribePostLog postLog);
|
||||||
|
|
||||||
|
public List<WxSubscribePostLog> selectWxSubscribePostLog(WxSubscribePostLog postLog);
|
||||||
|
}
|
@ -9,14 +9,13 @@ import com.stdiet.custom.domain.SysOrderPause;
|
|||||||
import com.stdiet.custom.domain.SysRecipesPlan;
|
import com.stdiet.custom.domain.SysRecipesPlan;
|
||||||
import com.stdiet.custom.domain.SysRecipesPlanListInfo;
|
import com.stdiet.custom.domain.SysRecipesPlanListInfo;
|
||||||
import com.stdiet.custom.mapper.SysRecipesPlanMapper;
|
import com.stdiet.custom.mapper.SysRecipesPlanMapper;
|
||||||
import com.stdiet.custom.service.ISysOrderPauseService;
|
import com.stdiet.custom.service.*;
|
||||||
import com.stdiet.custom.service.ISysOrderService;
|
|
||||||
import com.stdiet.custom.service.ISysRecipesPlanService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -30,8 +29,8 @@ import java.util.*;
|
|||||||
@Service("sysRecipesPlanService")
|
@Service("sysRecipesPlanService")
|
||||||
@Transactional
|
@Transactional
|
||||||
public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
|
public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
|
||||||
|
|
||||||
public static final String generateRecipesPlanLockKey = "generateRecipesPlanLock::%s";
|
public static final String generateRecipesPlanLockKey = "generateRecipesPlanLock::%s";
|
||||||
|
static final SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysRecipesPlanMapper sysRecipesPlanMapper;
|
private SysRecipesPlanMapper sysRecipesPlanMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -40,6 +39,10 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
|
|||||||
private ISysOrderPauseService sysOrderPauseService;
|
private ISysOrderPauseService sysOrderPauseService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SynchrolockUtil synchrolockUtil;
|
private SynchrolockUtil synchrolockUtil;
|
||||||
|
@Autowired
|
||||||
|
private IWechatAppletService wechatAppletService;
|
||||||
|
@Autowired
|
||||||
|
private ISysCustomerService sysCustomerService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询食谱计划
|
* 查询食谱计划
|
||||||
@ -83,9 +86,36 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateSysRecipesPlan(SysRecipesPlan sysRecipesPlan) {
|
public int updateSysRecipesPlan(SysRecipesPlan sysRecipesPlan) {
|
||||||
|
|
||||||
sysRecipesPlan.setUpdateTime(DateUtils.getNowDate());
|
sysRecipesPlan.setUpdateTime(DateUtils.getNowDate());
|
||||||
//目前只能修改发送状态,所以修改时加上发送时间
|
if (StringUtils.isNotNull(sysRecipesPlan.getSubscribed())) {
|
||||||
|
// 客户端修改订阅状态
|
||||||
|
} else if (StringUtils.isNotNull(sysRecipesPlan.getSendFlag())) {
|
||||||
|
// 后台修改发送状态
|
||||||
sysRecipesPlan.setSendTime(DateUtils.getNowDate());
|
sysRecipesPlan.setSendTime(DateUtils.getNowDate());
|
||||||
|
SysRecipesPlan recipesPlan = sysRecipesPlanMapper.selectSysRecipesPlanById(sysRecipesPlan.getId());
|
||||||
|
if (StringUtils.isNotNull(sysRecipesPlan.getSendFlag()) && sysRecipesPlan.getSendFlag() == 1) {
|
||||||
|
// 未发送过
|
||||||
|
String name = "第" + recipesPlan.getStartNumDay() + "至" + recipesPlan.getEndNumDay() + "天";
|
||||||
|
String startDate = ft.format(recipesPlan.getStartDate());
|
||||||
|
String endDate = ft.format(recipesPlan.getEndDate());
|
||||||
|
// 发送微信订阅
|
||||||
|
if (StringUtils.isNotNull(recipesPlan) && recipesPlan.getSubSend() == 0) {
|
||||||
|
Integer code = wechatAppletService.postSubscribeMessage(recipesPlan.getCusId(), recipesPlan.getId(), name, startDate, endDate, recipesPlan.getRemark());
|
||||||
|
if (code == 0) {
|
||||||
|
sysRecipesPlan.setSubSend(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 发送通知短信
|
||||||
|
if(StringUtils.isNotNull(recipesPlan) && recipesPlan.getSmsSend() == 0) {
|
||||||
|
Integer smsCode = wechatAppletService.postSms(recipesPlan.getCusId(), recipesPlan.getId(), name);
|
||||||
|
if (smsCode == 0) {
|
||||||
|
sysRecipesPlan.setSmsSend(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return sysRecipesPlanMapper.updateSysRecipesPlan(sysRecipesPlan);
|
return sysRecipesPlanMapper.updateSysRecipesPlan(sysRecipesPlan);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,11 +267,11 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
|
|||||||
if (beforeOrderLastPlan != null && sysOrder.getRecipesPlanContinue().intValue() == 1) {
|
if (beforeOrderLastPlan != null && sysOrder.getRecipesPlanContinue().intValue() == 1) {
|
||||||
long differDay = ChronoUnit.DAYS.between(DateUtils.dateToLocalDate(beforeOrderLastPlan.getEndDate()), serverStartDate);
|
long differDay = ChronoUnit.DAYS.between(DateUtils.dateToLocalDate(beforeOrderLastPlan.getEndDate()), serverStartDate);
|
||||||
//检查之前食谱的结束时间和目前该订单的开始时间是否连续
|
//检查之前食谱的结束时间和目前该订单的开始时间是否连续
|
||||||
if(differDay <= 1){
|
if (differDay <= 1) {
|
||||||
//判断前一个订单食谱是否满七天,不满则需要接上
|
//判断前一个订单食谱是否满七天,不满则需要接上
|
||||||
int differNum = beforeOrderLastPlan.getEndNumDay() - beforeOrderLastPlan.getStartNumDay();
|
int differNum = beforeOrderLastPlan.getEndNumDay() - beforeOrderLastPlan.getStartNumDay();
|
||||||
|
|
||||||
if(differNum < 6){
|
if (differNum < 6) {
|
||||||
//更新该食谱计划
|
//更新该食谱计划
|
||||||
beforeOrderLastPlan.setEndNumDay(beforeOrderLastPlan.getStartNumDay() + 6);
|
beforeOrderLastPlan.setEndNumDay(beforeOrderLastPlan.getStartNumDay() + 6);
|
||||||
beforeOrderLastPlan.setEndDate(DateUtils.localDateToDate(DateUtils.dateToLocalDate(beforeOrderLastPlan.getEndDate()).plusDays(6 - differNum)));
|
beforeOrderLastPlan.setEndDate(DateUtils.localDateToDate(DateUtils.dateToLocalDate(beforeOrderLastPlan.getEndDate()).plusDays(6 - differNum)));
|
||||||
|
@ -1,65 +0,0 @@
|
|||||||
package com.stdiet.custom.service.impl;
|
|
||||||
|
|
||||||
import com.stdiet.common.core.domain.AjaxResult;
|
|
||||||
import com.stdiet.common.utils.StringUtils;
|
|
||||||
import com.stdiet.custom.domain.WxXmlData;
|
|
||||||
import com.stdiet.custom.service.ISysWxService;
|
|
||||||
import com.stdiet.custom.utils.WechatMessageUtil;
|
|
||||||
import com.stdiet.custom.utils.WxTokenUtils;
|
|
||||||
import com.thoughtworks.xstream.XStream;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
@Transactional
|
|
||||||
public class SysWxServiceImpl implements ISysWxService {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String wxCheckAuth(String signature, String timestamp, String nonce, String echostr) {
|
|
||||||
return WxTokenUtils.checkSignature(signature, timestamp, nonce) ? echostr : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String autoResponse(HttpServletRequest request) {
|
|
||||||
try {
|
|
||||||
WxXmlData wxData = WxTokenUtils.resolveXmlData(request.getInputStream());
|
|
||||||
|
|
||||||
WxXmlData resultXmlData = new WxXmlData();
|
|
||||||
resultXmlData.setToUserName(wxData.getFromUserName()); //收到的消息是谁发来的再发给谁
|
|
||||||
resultXmlData.setFromUserName(wxData.getToUserName()); //
|
|
||||||
if (wxData.getMsgType().equals(WechatMessageUtil.MESSAGE_EVENT)) {
|
|
||||||
if (wxData.getEvent().equals(WechatMessageUtil.MESSAGE_EVENT_SUBSCRIBE)) {
|
|
||||||
resultXmlData.setMsgType("text");
|
|
||||||
resultXmlData.setCreateTime(System.currentTimeMillis());
|
|
||||||
resultXmlData.setContent("欢迎来到胜唐体控,这是一条测试用的关注信息");
|
|
||||||
} else if (wxData.getEvent().equals(WechatMessageUtil.MESSAGE_EVENT_UNSUBSCRIBE)) {
|
|
||||||
|
|
||||||
}
|
|
||||||
} else if (wxData.getMsgType().equals(WechatMessageUtil.MESSAGE_TEXT)) {
|
|
||||||
resultXmlData.setMsgType("text");
|
|
||||||
resultXmlData.setCreateTime(System.currentTimeMillis());
|
|
||||||
resultXmlData.setContent("<a href=\"https://my.openwrite.cn/code/generate?blogId=18931-1576559666626-322\">点击该链接,获取博客解锁验证码</a>");
|
|
||||||
} else {
|
|
||||||
resultXmlData.setMsgType("text");
|
|
||||||
resultXmlData.setCreateTime(System.currentTimeMillis());
|
|
||||||
resultXmlData.setContent("公众号正在开发中。后期请多多关注!");
|
|
||||||
}
|
|
||||||
XStream xstream = new XStream();
|
|
||||||
xstream.processAnnotations(WxXmlData.class);
|
|
||||||
xstream.setClassLoader(WxXmlData.class.getClassLoader());
|
|
||||||
return xstream.toXML(resultXmlData); //XStream的方法,直接将对象转换成 xml数据
|
|
||||||
} catch (IOException e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AjaxResult getAccessToken() {
|
|
||||||
return AjaxResult.success(WxTokenUtils.fetchAccessToken());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,12 +1,13 @@
|
|||||||
package com.stdiet.custom.service.impl;
|
package com.stdiet.custom.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.stdiet.common.utils.DateUtils;
|
import com.stdiet.common.utils.DateUtils;
|
||||||
|
import com.stdiet.custom.domain.SysWxUserInfo;
|
||||||
|
import com.stdiet.custom.mapper.SysWxUserInfoMapper;
|
||||||
|
import com.stdiet.custom.service.ISysWxUserInfoService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.stdiet.custom.mapper.SysWxUserInfoMapper;
|
|
||||||
import com.stdiet.custom.domain.SysWxUserInfo;
|
import java.util.List;
|
||||||
import com.stdiet.custom.service.ISysWxUserInfoService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信用户Service业务层处理
|
* 微信用户Service业务层处理
|
||||||
@ -15,8 +16,7 @@ import com.stdiet.custom.service.ISysWxUserInfoService;
|
|||||||
* @date 2020-11-28
|
* @date 2020-11-28
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SysWxUserInfoServiceImpl implements ISysWxUserInfoService
|
public class SysWxUserInfoServiceImpl implements ISysWxUserInfoService {
|
||||||
{
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysWxUserInfoMapper sysWxUserInfoMapper;
|
private SysWxUserInfoMapper sysWxUserInfoMapper;
|
||||||
|
|
||||||
@ -27,11 +27,15 @@ public class SysWxUserInfoServiceImpl implements ISysWxUserInfoService
|
|||||||
* @return 微信用户
|
* @return 微信用户
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysWxUserInfo selectSysWxUserInfoById(String openid)
|
public SysWxUserInfo selectSysWxUserInfoById(String openid) {
|
||||||
{
|
|
||||||
return sysWxUserInfoMapper.selectSysWxUserInfoById(openid);
|
return sysWxUserInfoMapper.selectSysWxUserInfoById(openid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysWxUserInfo selectSysWxUserInfoByCusId(Long cusId) {
|
||||||
|
return sysWxUserInfoMapper.selectSysWxUserInfoByCusId(cusId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询微信用户列表
|
* 查询微信用户列表
|
||||||
*
|
*
|
||||||
@ -39,8 +43,7 @@ public class SysWxUserInfoServiceImpl implements ISysWxUserInfoService
|
|||||||
* @return 微信用户
|
* @return 微信用户
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysWxUserInfo> selectSysWxUserInfoList(SysWxUserInfo sysWxUserInfo)
|
public List<SysWxUserInfo> selectSysWxUserInfoList(SysWxUserInfo sysWxUserInfo) {
|
||||||
{
|
|
||||||
return sysWxUserInfoMapper.selectSysWxUserInfoList(sysWxUserInfo);
|
return sysWxUserInfoMapper.selectSysWxUserInfoList(sysWxUserInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,8 +59,7 @@ public class SysWxUserInfoServiceImpl implements ISysWxUserInfoService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertSysWxUserInfo(SysWxUserInfo sysWxUserInfo)
|
public int insertSysWxUserInfo(SysWxUserInfo sysWxUserInfo) {
|
||||||
{
|
|
||||||
sysWxUserInfo.setCreateTime(DateUtils.getNowDate());
|
sysWxUserInfo.setCreateTime(DateUtils.getNowDate());
|
||||||
return sysWxUserInfoMapper.insertSysWxUserInfo(sysWxUserInfo);
|
return sysWxUserInfoMapper.insertSysWxUserInfo(sysWxUserInfo);
|
||||||
}
|
}
|
||||||
@ -69,8 +71,7 @@ public class SysWxUserInfoServiceImpl implements ISysWxUserInfoService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateSysWxUserInfo(SysWxUserInfo sysWxUserInfo)
|
public int updateSysWxUserInfo(SysWxUserInfo sysWxUserInfo) {
|
||||||
{
|
|
||||||
sysWxUserInfo.setUpdateTime(DateUtils.getNowDate());
|
sysWxUserInfo.setUpdateTime(DateUtils.getNowDate());
|
||||||
return sysWxUserInfoMapper.updateSysWxUserInfo(sysWxUserInfo);
|
return sysWxUserInfoMapper.updateSysWxUserInfo(sysWxUserInfo);
|
||||||
}
|
}
|
||||||
@ -82,8 +83,7 @@ public class SysWxUserInfoServiceImpl implements ISysWxUserInfoService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteSysWxUserInfoByIds(String[] openids)
|
public int deleteSysWxUserInfoByIds(String[] openids) {
|
||||||
{
|
|
||||||
return sysWxUserInfoMapper.deleteSysWxUserInfoByIds(openids);
|
return sysWxUserInfoMapper.deleteSysWxUserInfoByIds(openids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,8 +94,7 @@ public class SysWxUserInfoServiceImpl implements ISysWxUserInfoService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteSysWxUserInfoById(String openid)
|
public int deleteSysWxUserInfoById(String openid) {
|
||||||
{
|
|
||||||
return sysWxUserInfoMapper.deleteSysWxUserInfoById(openid);
|
return sysWxUserInfoMapper.deleteSysWxUserInfoById(openid);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,21 +1,36 @@
|
|||||||
package com.stdiet.custom.service.impl;
|
package com.stdiet.custom.service.impl;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.google.gson.JsonObject;
|
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
|
||||||
import com.stdiet.common.core.redis.RedisCache;
|
import com.stdiet.common.core.redis.RedisCache;
|
||||||
|
import com.stdiet.common.utils.DateUtils;
|
||||||
import com.stdiet.common.utils.StringUtils;
|
import com.stdiet.common.utils.StringUtils;
|
||||||
|
import com.stdiet.custom.domain.SysCustomer;
|
||||||
|
import com.stdiet.custom.domain.SysWxUserInfo;
|
||||||
|
import com.stdiet.custom.domain.wechat.WxSubscribePostLog;
|
||||||
|
import com.stdiet.custom.service.ISysCustomerService;
|
||||||
|
import com.stdiet.custom.service.ISysWxUserInfoService;
|
||||||
import com.stdiet.custom.service.IWechatAppletService;
|
import com.stdiet.custom.service.IWechatAppletService;
|
||||||
|
import com.stdiet.custom.service.IWxSubscribePostLogService;
|
||||||
|
import com.stdiet.custom.utils.SmsUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class WeChartAppletServiceImp implements IWechatAppletService {
|
public class WeChartAppletServiceImp implements IWechatAppletService {
|
||||||
|
static final String WX_TEM_ID = "Ow0j0Jt4OJhjy6GruBstOMLTGjAVagM4hTZRLAaxqJo";
|
||||||
|
|
||||||
|
static final String SMS_TEM_ID = "SMS_216839183";
|
||||||
|
static final String SMS_SIGN_NAME = "胜唐体控";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisCache redisCache;
|
private RedisCache redisCache;
|
||||||
@ -23,8 +38,17 @@ public class WeChartAppletServiceImp implements IWechatAppletService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private RestTemplate restTemplate;
|
private RestTemplate restTemplate;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysWxUserInfoService sysWxUserInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IWxSubscribePostLogService wxSubscribePostLogService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysCustomerService sysCustomerService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getAccessToken(String appId) throws Exception {
|
public String getAccessToken(String appId) {
|
||||||
String accessToken = redisCache.getCacheObject(appId);
|
String accessToken = redisCache.getCacheObject(appId);
|
||||||
if (StringUtils.isNull(accessToken)) {
|
if (StringUtils.isNull(accessToken)) {
|
||||||
String appSecret = "";
|
String appSecret = "";
|
||||||
@ -49,35 +73,88 @@ public class WeChartAppletServiceImp implements IWechatAppletService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postRecipesMessage(String appId, String openId, String name, String startDate, String endDate, String remark) throws Exception {
|
public Integer postSubscribeMessage(Long cusId, Long planId, String name, String startDate, String endDate, String remark) {
|
||||||
String accessToken = getAccessToken(appId);
|
SysWxUserInfo sysWxUserInfo = sysWxUserInfoService.selectSysWxUserInfoByCusId(cusId);
|
||||||
if (StringUtils.isNull(accessToken)) {
|
if (StringUtils.isNull(sysWxUserInfo)) {
|
||||||
return;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String accessToken = getAccessToken(sysWxUserInfo.getAppid());
|
||||||
|
if (StringUtils.isNull(accessToken)) {
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
String tmpId = "";
|
|
||||||
String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + accessToken;
|
String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + accessToken;
|
||||||
|
|
||||||
|
|
||||||
JsonObject param = new JsonObject();
|
JSONObject param = new JSONObject();
|
||||||
param.addProperty("access_token", accessToken);
|
param.put("access_token", accessToken);
|
||||||
param.addProperty("touser", openId);
|
param.put("touser", sysWxUserInfo.getOpenid());
|
||||||
param.addProperty("template_id", tmpId);
|
param.put("template_id", WX_TEM_ID);
|
||||||
param.addProperty("page", "pages/recipes/index");
|
param.put("page", "pages/recipes/index");
|
||||||
|
|
||||||
JsonObject dataParam = new JsonObject();
|
|
||||||
dataParam.addProperty("key1", name);
|
|
||||||
dataParam.addProperty("key2", startDate);
|
|
||||||
dataParam.addProperty("key3", endDate);
|
|
||||||
dataParam.addProperty("key4", remark);
|
|
||||||
|
|
||||||
param.add("data", dataParam);
|
JSONObject dataParam = new JSONObject();
|
||||||
|
dataParam.put("thing1", JSONObject.parse("{\"value\":\"" + name + "\"}"));
|
||||||
|
dataParam.put("time2", JSONObject.parse("{\"value\":\"" + startDate + "\"}"));
|
||||||
|
dataParam.put("time3", JSONObject.parse("{\"value\":\"" + endDate + "\"}"));
|
||||||
|
String mRemark = StringUtils.isNull(remark) ? "" : remark;
|
||||||
|
dataParam.put("thing4", JSONObject.parse("{\"value\":\"" + mRemark + "\"}"));
|
||||||
|
|
||||||
ResponseEntity<String> entity = restTemplate.postForEntity(url, param, String.class);
|
param.put("data", dataParam);
|
||||||
|
|
||||||
|
restTemplate.getMessageConverters()
|
||||||
|
.add(0, new StringHttpMessageConverter(StandardCharsets.UTF_8));
|
||||||
|
ResponseEntity<String> entity = restTemplate.postForEntity(url, param.toJSONString(), String.class);
|
||||||
|
|
||||||
JSONObject resultObj = JSONObject.parseObject(entity.getBody());
|
JSONObject resultObj = JSONObject.parseObject(entity.getBody());
|
||||||
|
|
||||||
System.out.println(resultObj.toJSONString());
|
WxSubscribePostLog postLog = new WxSubscribePostLog();
|
||||||
// Integer errcode = resultObj.getInteger("errcode");
|
postLog.setAppid(sysWxUserInfo.getAppid());
|
||||||
|
postLog.setOpenid(sysWxUserInfo.getOpenid());
|
||||||
|
int errCode = resultObj.getInteger("errcode");
|
||||||
|
postLog.setType(0);
|
||||||
|
postLog.setResult(resultObj);
|
||||||
|
postLog.setSendTime(DateUtils.getNowDate());
|
||||||
|
postLog.setPlanId(planId);
|
||||||
|
//
|
||||||
|
dataParam.put("tmpId", WX_TEM_ID);
|
||||||
|
postLog.setData(dataParam);
|
||||||
|
wxSubscribePostLogService.insertWxSubscribePostLog(postLog);
|
||||||
|
|
||||||
|
return errCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer postSms(Long cusId, Long planId, String plan) {
|
||||||
|
try {
|
||||||
|
SysCustomer customer = sysCustomerService.selectSysCustomerById(cusId);
|
||||||
|
SendSmsResponse response = SmsUtils.sendSms(customer.getPhone(), plan, SMS_TEM_ID, SMS_SIGN_NAME);
|
||||||
|
|
||||||
|
WxSubscribePostLog postLog = new WxSubscribePostLog();
|
||||||
|
postLog.setPhone(customer.getPhone());
|
||||||
|
postLog.setPlanId(planId);
|
||||||
|
JSONObject resultObj = new JSONObject();
|
||||||
|
resultObj.put("requestId", response.getRequestId());
|
||||||
|
resultObj.put("bizId", response.getBizId());
|
||||||
|
resultObj.put("code", response.getCode());
|
||||||
|
resultObj.put("message", response.getMessage());
|
||||||
|
postLog.setResult(resultObj);
|
||||||
|
JSONObject dataParam = new JSONObject();
|
||||||
|
dataParam.put("phone", customer.getPhone());
|
||||||
|
dataParam.put("plan", plan);
|
||||||
|
dataParam.put("tmpCode", SMS_TEM_ID);
|
||||||
|
dataParam.put("signName", SMS_SIGN_NAME);
|
||||||
|
postLog.setData(dataParam);
|
||||||
|
postLog.setSendTime(DateUtils.getNowDate());
|
||||||
|
postLog.setType(1);
|
||||||
|
wxSubscribePostLogService.insertWxSubscribePostLog(postLog);
|
||||||
|
|
||||||
|
return response.getCode().equals("OK") ? 0 : -1;
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println(e);
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.stdiet.custom.service.impl;
|
||||||
|
|
||||||
|
import com.stdiet.custom.domain.wechat.WxSubscribePostLog;
|
||||||
|
import com.stdiet.custom.mapper.SysWxSubscribePostLogMapper;
|
||||||
|
import com.stdiet.custom.service.IWxSubscribePostLogService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class WxSubscribePostLogServiceImp implements IWxSubscribePostLogService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
SysWxSubscribePostLogMapper sysWxSubscribePostLogMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int insertWxSubscribePostLog(WxSubscribePostLog postLog) {
|
||||||
|
return sysWxSubscribePostLogMapper.insertWxSubscribePostLog(postLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<WxSubscribePostLog> selectWxSubscribePostLog(WxSubscribePostLog postLog) {
|
||||||
|
return sysWxSubscribePostLogMapper.selectWxSubscribePostLog(postLog);
|
||||||
|
}
|
||||||
|
}
|
@ -1,193 +0,0 @@
|
|||||||
package com.stdiet.custom.utils;
|
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [url=home.php?mod=space&uid=49329]@author[/url] Sunlight
|
|
||||||
*/
|
|
||||||
public class HttpPostUtil {
|
|
||||||
private URL url;
|
|
||||||
private HttpURLConnection conn;
|
|
||||||
private String boundary = "--------httppost123";
|
|
||||||
private HashMap<String, String> textParams = new HashMap<String, String>();
|
|
||||||
private HashMap<String, File> fileparams = new HashMap<String, File>();
|
|
||||||
private DataOutputStream outputStream;
|
|
||||||
|
|
||||||
public HttpPostUtil(String url) throws Exception {
|
|
||||||
this.url = new URL(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 重新设置要请求的服务器地址,即上传文件的地址。
|
|
||||||
*
|
|
||||||
* @param url
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public void setUrl(String url) throws Exception {
|
|
||||||
this.url = new URL(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 增加一个普通字符串数据到form表单数据中
|
|
||||||
*
|
|
||||||
* @param name
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
public void addParameter(String name, String value) {
|
|
||||||
textParams.put(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 增加一个文件到form表单数据中
|
|
||||||
*
|
|
||||||
* @param name
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
public void addParameter(String name, File value) {
|
|
||||||
fileparams.put(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 清空所有已添加的form表单数据
|
|
||||||
*/
|
|
||||||
public void clearAllParameters() {
|
|
||||||
textParams.clear();
|
|
||||||
fileparams.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发送数据到服务器,返回一个字节包含服务器的返回结果的数组
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public String send() throws Exception {
|
|
||||||
initConnection();
|
|
||||||
conn.connect();
|
|
||||||
outputStream = new DataOutputStream(conn.getOutputStream());
|
|
||||||
writeFileParams();
|
|
||||||
writeStringParams();
|
|
||||||
paramsEnd();
|
|
||||||
int code = conn.getResponseCode();
|
|
||||||
if (code == 200) {
|
|
||||||
InputStream in = conn.getInputStream();
|
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
|
||||||
byte[] buf = new byte[1024 * 8];
|
|
||||||
int len;
|
|
||||||
while ((len = in.read(buf)) != -1) {
|
|
||||||
out.write(buf, 0, len);
|
|
||||||
}
|
|
||||||
conn.disconnect();
|
|
||||||
String s = new String(out.toByteArray(), "utf-8");
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件上传的connection的一些必须设置
|
|
||||||
*
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
private void initConnection() throws Exception {
|
|
||||||
conn = (HttpURLConnection) this.url.openConnection();
|
|
||||||
conn.setDoOutput(true);
|
|
||||||
conn.setUseCaches(false);
|
|
||||||
conn.setConnectTimeout(10000); // 连接超时为10秒
|
|
||||||
conn.setRequestMethod("POST");
|
|
||||||
conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 普通字符串数据
|
|
||||||
*
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
private void writeStringParams() throws Exception {
|
|
||||||
Set<String> keySet = textParams.keySet();
|
|
||||||
for (Iterator<String> it = keySet.iterator(); it.hasNext(); ) {
|
|
||||||
String name = it.next();
|
|
||||||
String value = textParams.get(name);
|
|
||||||
outputStream.writeBytes("--" + boundary + "\r\n");
|
|
||||||
outputStream.writeBytes("Content-Disposition: form-data; name=" + name + "\r\n");
|
|
||||||
outputStream.writeBytes("\r\n");
|
|
||||||
outputStream.writeBytes(encode(value) + "\r\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件数据
|
|
||||||
*
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
private void writeFileParams() throws Exception {
|
|
||||||
Set<String> keySet = fileparams.keySet();
|
|
||||||
for (Iterator<String> it = keySet.iterator(); it.hasNext(); ) {
|
|
||||||
String name = it.next();
|
|
||||||
File value = fileparams.get(name);
|
|
||||||
outputStream.writeBytes("--" + boundary + "\r\n");
|
|
||||||
outputStream.writeBytes("Content-Disposition: form-data; name=" + name + "; filename=" + encode(value.getName()) + "\r\n");
|
|
||||||
outputStream.writeBytes("Content-Type: " + getContentType(value) + "\r\n");
|
|
||||||
outputStream.writeBytes("\r\n");
|
|
||||||
outputStream.write(getBytes(value));
|
|
||||||
outputStream.writeBytes("\r\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取文件的上传类型,图片格式为image/png,image/jpeg等。非图片为application /octet-stream
|
|
||||||
*
|
|
||||||
* @param f
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
private String getContentType(File f) throws Exception {
|
|
||||||
return "application/octet-stream";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 把文件转换成字节数组
|
|
||||||
*
|
|
||||||
* @param f
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
private byte[] getBytes(File f) throws Exception {
|
|
||||||
FileInputStream in = new FileInputStream(f);
|
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
|
||||||
byte[] b = new byte[1024];
|
|
||||||
int n;
|
|
||||||
while ((n = in.read(b)) != -1) {
|
|
||||||
out.write(b, 0, n);
|
|
||||||
}
|
|
||||||
in.close();
|
|
||||||
return out.toByteArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加结尾数据
|
|
||||||
*
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
private void paramsEnd() throws Exception {
|
|
||||||
outputStream.writeBytes("--" + boundary + "--" + "\r\n");
|
|
||||||
outputStream.writeBytes("\r\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 对包含中文的字符串进行转码,此为UTF-8。服务器那边要进行一次解码
|
|
||||||
*
|
|
||||||
* @param value
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
private String encode(String value) throws Exception {
|
|
||||||
return URLEncoder.encode(value, "UTF-8");
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,91 @@
|
|||||||
|
package com.stdiet.custom.utils;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.aliyuncs.DefaultAcsClient;
|
||||||
|
import com.aliyuncs.IAcsClient;
|
||||||
|
import com.aliyuncs.dysmsapi.model.v20170525.QuerySendDetailsRequest;
|
||||||
|
import com.aliyuncs.dysmsapi.model.v20170525.QuerySendDetailsResponse;
|
||||||
|
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
|
||||||
|
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
|
||||||
|
import com.aliyuncs.exceptions.ClientException;
|
||||||
|
import com.aliyuncs.profile.DefaultProfile;
|
||||||
|
import com.aliyuncs.profile.IClientProfile;
|
||||||
|
import com.stdiet.common.config.AliyunOSSConfig;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class SmsUtils {
|
||||||
|
//产品名称:云通信短信API产品,开发者无需替换
|
||||||
|
static final String product = "Dysmsapi";
|
||||||
|
//产品域名,开发者无需替换
|
||||||
|
static final String domain = "dysmsapi.aliyuncs.com";
|
||||||
|
|
||||||
|
public static SendSmsResponse sendSms(String phone, String plan, String tmpCode, String signName) throws ClientException {
|
||||||
|
|
||||||
|
//可自助调整超时时间
|
||||||
|
System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
|
||||||
|
System.setProperty("sun.net.client.defaultReadTimeout", "10000");
|
||||||
|
|
||||||
|
//初始化acsClient,暂不支持region化
|
||||||
|
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", AliyunOSSConfig.AccessKeyID, AliyunOSSConfig.AccessKeySecret);
|
||||||
|
DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
|
||||||
|
IAcsClient acsClient = new DefaultAcsClient(profile);
|
||||||
|
|
||||||
|
//组装请求对象-具体描述见控制台-文档部分内容
|
||||||
|
SendSmsRequest request = new SendSmsRequest();
|
||||||
|
//必填:待发送手机号
|
||||||
|
request.setPhoneNumbers(phone);
|
||||||
|
//必填:短信签名-可在短信控制台中找到
|
||||||
|
request.setSignName(signName);
|
||||||
|
//必填:短信模板-可在短信控制台中找到
|
||||||
|
request.setTemplateCode(tmpCode);
|
||||||
|
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
|
||||||
|
JSONObject paramObj = new JSONObject();
|
||||||
|
paramObj.put("plan", plan);
|
||||||
|
request.setTemplateParam(paramObj.toJSONString());
|
||||||
|
|
||||||
|
//选填-上行短信扩展码(无特殊需求用户请忽略此字段)
|
||||||
|
//request.setSmsUpExtendCode("90997");
|
||||||
|
|
||||||
|
//可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
|
||||||
|
request.setOutId("yourOutId");
|
||||||
|
|
||||||
|
//hint 此处可能会抛出异常,注意catch
|
||||||
|
SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
|
||||||
|
|
||||||
|
return sendSmsResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static QuerySendDetailsResponse querySendDetails(String bizId) throws ClientException {
|
||||||
|
|
||||||
|
//可自助调整超时时间
|
||||||
|
System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
|
||||||
|
System.setProperty("sun.net.client.defaultReadTimeout", "10000");
|
||||||
|
|
||||||
|
//初始化acsClient,暂不支持region化
|
||||||
|
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", AliyunOSSConfig.AccessKeyID, AliyunOSSConfig.AccessKeySecret);
|
||||||
|
DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
|
||||||
|
IAcsClient acsClient = new DefaultAcsClient(profile);
|
||||||
|
|
||||||
|
//组装请求对象
|
||||||
|
QuerySendDetailsRequest request = new QuerySendDetailsRequest();
|
||||||
|
//必填-号码
|
||||||
|
request.setPhoneNumber("15000000000");
|
||||||
|
//可选-流水号
|
||||||
|
request.setBizId(bizId);
|
||||||
|
//必填-发送日期 支持30天内记录查询,格式yyyyMMdd
|
||||||
|
SimpleDateFormat ft = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
request.setSendDate(ft.format(new Date()));
|
||||||
|
//必填-页大小
|
||||||
|
request.setPageSize(10L);
|
||||||
|
//必填-当前页码从1开始计数
|
||||||
|
request.setCurrentPage(1L);
|
||||||
|
|
||||||
|
//hint 此处可能会抛出异常,注意catch
|
||||||
|
QuerySendDetailsResponse querySendDetailsResponse = acsClient.getAcsResponse(request);
|
||||||
|
|
||||||
|
return querySendDetailsResponse;
|
||||||
|
}
|
||||||
|
}
|
@ -1,63 +0,0 @@
|
|||||||
package com.stdiet.custom.utils;
|
|
||||||
|
|
||||||
public class WechatMessageUtil {
|
|
||||||
// 各种消息类型,除了扫带二维码事件
|
|
||||||
/**
|
|
||||||
* 文本消息
|
|
||||||
*/
|
|
||||||
public static final String MESSAGE_TEXT = "text";
|
|
||||||
/**
|
|
||||||
* 图片消息
|
|
||||||
*/
|
|
||||||
public static final String MESSAtGE_IMAGE = "image";
|
|
||||||
/**
|
|
||||||
* 图文消息
|
|
||||||
*/
|
|
||||||
public static final String MESSAGE_NEWS = "news";
|
|
||||||
/**
|
|
||||||
* 语音消息
|
|
||||||
*/
|
|
||||||
public static final String MESSAGE_VOICE = "voice";
|
|
||||||
/**
|
|
||||||
* 视频消息
|
|
||||||
*/
|
|
||||||
public static final String MESSAGE_VIDEO = "video";
|
|
||||||
/**
|
|
||||||
* 小视频消息
|
|
||||||
*/
|
|
||||||
public static final String MESSAGE_SHORTVIDEO = "shortvideo";
|
|
||||||
/**
|
|
||||||
* 地理位置消息
|
|
||||||
*/
|
|
||||||
public static final String MESSAGE_LOCATION = "location";
|
|
||||||
/**
|
|
||||||
* 链接消息
|
|
||||||
*/
|
|
||||||
public static final String MESSAGE_LINK = "link";
|
|
||||||
/**
|
|
||||||
* 事件推送消息
|
|
||||||
*/
|
|
||||||
public static final String MESSAGE_EVENT = "event";
|
|
||||||
/**
|
|
||||||
* 事件推送消息中,事件类型,subscribe(订阅)
|
|
||||||
*/
|
|
||||||
public static final String MESSAGE_EVENT_SUBSCRIBE = "subscribe";
|
|
||||||
/**
|
|
||||||
* 事件推送消息中,事件类型,unsubscribe(取消订阅)
|
|
||||||
*/
|
|
||||||
public static final String MESSAGE_EVENT_UNSUBSCRIBE = "unsubscribe";
|
|
||||||
/**
|
|
||||||
* 事件推送消息中,上报地理位置事件
|
|
||||||
*/
|
|
||||||
public static final String MESSAGE_EVENT_LOCATION_UP = "LOCATION";
|
|
||||||
/**
|
|
||||||
* 事件推送消息中,自定义菜单事件,点击菜单拉取消息时的事件推送
|
|
||||||
*/
|
|
||||||
public static final String MESSAGE_EVENT_CLICK = "CLICK";
|
|
||||||
/**
|
|
||||||
* 事件推送消息中,自定义菜单事件,点击菜单跳转链接时的事件推送
|
|
||||||
*/
|
|
||||||
public static final String MESSAGE_EVENT_VIEW = "VIEW";
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,166 +0,0 @@
|
|||||||
package com.stdiet.custom.utils;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.stdiet.common.utils.StringUtils;
|
|
||||||
import com.stdiet.common.utils.http.HttpUtils;
|
|
||||||
import com.stdiet.custom.domain.WxXmlData;
|
|
||||||
import com.stdiet.custom.domain.wechat.WxAccessToken;
|
|
||||||
import com.stdiet.custom.domain.wechat.WxFileUploadResult;
|
|
||||||
import com.thoughtworks.xstream.XStream;
|
|
||||||
import org.apache.commons.io.IOUtils;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.security.MessageDigest;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
|
|
||||||
public class WxTokenUtils {
|
|
||||||
|
|
||||||
public static final String KEY_ACCESS_TOKEN = "wx:access_token";
|
|
||||||
public static final String KEY_ACCESS_TOKEN_WATHER = "wx:access_token_watcher";
|
|
||||||
|
|
||||||
// 与接口配置信息中的Token要一致
|
|
||||||
private static String token = "shengtangdiet";
|
|
||||||
// 胜唐体控
|
|
||||||
private static String appId = "wx4a9c1fc9dba53202";
|
|
||||||
private static String appSecret = "fff029ade5d3575df755f4cf9e52f8da";
|
|
||||||
// 胜唐体控李晓
|
|
||||||
// private static String appId = "wxaf10fe560ea043a0";
|
|
||||||
// private static String appSecret = "afb47e477337df23b7562c3c1f965826";
|
|
||||||
private static String tokenUrl = "https://api.weixin.qq.com/cgi-bin/token";
|
|
||||||
private static String uploadMaterialUrl = "https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=ACCESS_TOKEN&type=image";
|
|
||||||
|
|
||||||
|
|
||||||
public static WxAccessToken fetchAccessToken() {
|
|
||||||
try {
|
|
||||||
String resStr = HttpUtils.sendGet(tokenUrl, "grant_type=client_credential&appid=" + appId + "&secret=" + appSecret);
|
|
||||||
if (StringUtils.isEmpty(resStr)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
JSONObject obj = JSONObject.parseObject(resStr);
|
|
||||||
|
|
||||||
WxAccessToken token = JSONObject.toJavaObject(obj, WxAccessToken.class);
|
|
||||||
return token;
|
|
||||||
} catch (Exception e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 模拟form表单的形式 ,上传文件 以输出流的形式把文件写入到url中,然后用输入流来获取url的响应
|
|
||||||
*
|
|
||||||
* @return String url的响应信息返回值
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
public static WxFileUploadResult uploadImage(String filePath, String fileName, String accessToken) throws Exception {
|
|
||||||
String[] cmds = {"curl", uploadMaterialUrl.replaceAll("ACCESS_TOKEN", accessToken), "-F"
|
|
||||||
, "media=@" + filePath + ";filename=" + fileName};//必须分开写,不能有空格
|
|
||||||
|
|
||||||
ProcessBuilder process = new ProcessBuilder(cmds);
|
|
||||||
Process p = process.start();
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
String line = null;
|
|
||||||
while ((line = reader.readLine()) != null) {
|
|
||||||
builder.append(line);
|
|
||||||
builder.append(System.getProperty("line.separator"));
|
|
||||||
}
|
|
||||||
JSONObject obj = JSONObject.parseObject(builder.toString());
|
|
||||||
return JSONObject.toJavaObject(obj, WxFileUploadResult.class);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 验证签名
|
|
||||||
*
|
|
||||||
* @param signature
|
|
||||||
* @param timestamp
|
|
||||||
* @param nonce
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static boolean checkSignature(String signature, String timestamp, String nonce) {
|
|
||||||
String[] arr = new String[]{token, timestamp, nonce};
|
|
||||||
// 将token、timestamp、nonce三个参数进行字典序排序
|
|
||||||
// Arrays.sort(arr);
|
|
||||||
sort(arr);
|
|
||||||
StringBuilder content = new StringBuilder();
|
|
||||||
for (int i = 0; i < arr.length; i++) {
|
|
||||||
content.append(arr[i]);
|
|
||||||
}
|
|
||||||
MessageDigest md = null;
|
|
||||||
String tmpStr = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
md = MessageDigest.getInstance("SHA-1");
|
|
||||||
// 将三个参数字符串拼接成一个字符串进行sha1加密
|
|
||||||
byte[] digest = md.digest(content.toString().getBytes());
|
|
||||||
tmpStr = byteToStr(digest);
|
|
||||||
} catch (NoSuchAlgorithmException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
content = null;
|
|
||||||
// 将sha1加密后的字符串可与signature对比,标识该请求来源于微信
|
|
||||||
return tmpStr != null ? tmpStr.equals(signature.toUpperCase()) : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将字节数组转换为十六进制字符串
|
|
||||||
*
|
|
||||||
* @param byteArray
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private static String byteToStr(byte[] byteArray) {
|
|
||||||
String strDigest = "";
|
|
||||||
for (int i = 0; i < byteArray.length; i++) {
|
|
||||||
strDigest += byteToHexStr(byteArray[i]);
|
|
||||||
}
|
|
||||||
return strDigest;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将字节转换为十六进制字符串
|
|
||||||
*
|
|
||||||
* @param mByte
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private static String byteToHexStr(byte mByte) {
|
|
||||||
char[] Digit = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
|
|
||||||
char[] tempArr = new char[2];
|
|
||||||
tempArr[0] = Digit[(mByte >>> 4) & 0X0F];
|
|
||||||
tempArr[1] = Digit[mByte & 0X0F];
|
|
||||||
String s = new String(tempArr);
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void sort(String a[]) {
|
|
||||||
for (int i = 0; i < a.length - 1; i++) {
|
|
||||||
for (int j = i + 1; j < a.length; j++) {
|
|
||||||
if (a[j].compareTo(a[i]) < 0) {
|
|
||||||
String temp = a[i];
|
|
||||||
a[i] = a[j];
|
|
||||||
a[j] = temp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static WxXmlData resolveXmlData(InputStream in) {
|
|
||||||
WxXmlData wxXmlData = null;
|
|
||||||
try {
|
|
||||||
String xmlData = IOUtils.toString(in, StandardCharsets.UTF_8.name());
|
|
||||||
XStream xstream = new XStream();
|
|
||||||
//这个必须要加 不然无法转换成WxXmlData对象
|
|
||||||
xstream.setClassLoader(WxXmlData.class.getClassLoader());
|
|
||||||
xstream.processAnnotations(WxXmlData.class);
|
|
||||||
xstream.alias("xml", WxXmlData.class);
|
|
||||||
wxXmlData = (WxXmlData) xstream.fromXML(xmlData);
|
|
||||||
// log.info("【wxXmlData: {}】 ", wxXmlData);
|
|
||||||
} catch (Exception e) {
|
|
||||||
// log.error("【error】{}", e.getMessage());
|
|
||||||
}
|
|
||||||
return wxXmlData;
|
|
||||||
}
|
|
||||||
}
|
|
@ -22,6 +22,9 @@
|
|||||||
<result property="delFlag" column="del_flag"/>
|
<result property="delFlag" column="del_flag"/>
|
||||||
<result property="cusId" column="cus_id"/>
|
<result property="cusId" column="cus_id"/>
|
||||||
<result property="outId" column="out_id"/>
|
<result property="outId" column="out_id"/>
|
||||||
|
<result property="subscribed" column="subscribed"/>
|
||||||
|
<result property="subSend" column="sub_send"/>
|
||||||
|
<result property="smsSend" column="sms_send"/>
|
||||||
<!-- 非持久化字段 -->
|
<!-- 非持久化字段 -->
|
||||||
<!-- <result property="customerId" column="cus_id"></result><!– 客户ID –>-->
|
<!-- <result property="customerId" column="cus_id"></result><!– 客户ID –>-->
|
||||||
<result property="customer" column="customer"/><!-- 客户姓名 -->
|
<result property="customer" column="customer"/><!-- 客户姓名 -->
|
||||||
@ -37,7 +40,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<sql id="selectSysRecipesPlanVo">
|
<sql id="selectSysRecipesPlanVo">
|
||||||
select id, order_id, cus_id, out_id, start_date, end_date, start_num_day, end_num_day, recipes_id, send_flag, send_time, pause_date, create_time, create_by, update_time, update_by, del_flag, review_status from sys_recipes_plan
|
select id, order_id, cus_id, out_id, start_date, end_date, start_num_day, end_num_day, recipes_id, send_flag, send_time, pause_date, create_time, create_by, update_time, update_by, del_flag, review_status, sub_send, sms_send from sys_recipes_plan
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectSysRecipesPlanList" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult">
|
<select id="selectSysRecipesPlanList" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult">
|
||||||
@ -135,6 +138,9 @@
|
|||||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||||
<if test="reviewStatus != null">review_status = #{reviewStatus},</if>
|
<if test="reviewStatus != null">review_status = #{reviewStatus},</if>
|
||||||
|
<if test="subscribed != null">subscribed = #{subscribed},</if>
|
||||||
|
<if test="subSend != null">sub_send = #{subSend},</if>
|
||||||
|
<if test="smsSend != null">sms_send = #{smsSend},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id} and del_flag = 0
|
where id = #{id} and del_flag = 0
|
||||||
</update>
|
</update>
|
||||||
@ -153,10 +159,12 @@
|
|||||||
<!-- 批量插入食谱计划 -->
|
<!-- 批量插入食谱计划 -->
|
||||||
<insert id="insertBatch">
|
<insert id="insertBatch">
|
||||||
INSERT INTO sys_recipes_plan
|
INSERT INTO sys_recipes_plan
|
||||||
(order_id, cus_id, out_id, start_date, end_date, start_num_day, end_num_day, send_flag, send_time, pause_date, recipes_id)
|
(order_id, cus_id, out_id, start_date, end_date, start_num_day, end_num_day, send_flag, send_time, pause_date,
|
||||||
|
recipes_id)
|
||||||
VALUES
|
VALUES
|
||||||
<foreach collection="list" item="plan" separator=",">
|
<foreach collection="list" item="plan" separator=",">
|
||||||
(#{plan.orderId}, #{plan.cusId}, #{plan.outId}, #{plan.startDate}, #{plan.endDate}, #{plan.startNumDay}, #{plan.endNumDay},
|
(#{plan.orderId}, #{plan.cusId}, #{plan.outId}, #{plan.startDate}, #{plan.endDate}, #{plan.startNumDay},
|
||||||
|
#{plan.endNumDay},
|
||||||
#{plan.sendFlag}, #{plan.sendTime}, #{plan.pauseDate}, #{plan.recipesId})
|
#{plan.sendFlag}, #{plan.sendTime}, #{plan.pauseDate}, #{plan.recipesId})
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
@ -177,8 +185,10 @@
|
|||||||
FROM sys_recipes_plan srp
|
FROM sys_recipes_plan srp
|
||||||
LEFT JOIN sys_order sr ON sr.order_id = srp.order_id
|
LEFT JOIN sys_order sr ON sr.order_id = srp.order_id
|
||||||
LEFT JOIN sys_customer sc ON sc.id = srp.cus_id
|
LEFT JOIN sys_customer sc ON sc.id = srp.cus_id
|
||||||
LEFT JOIN sys_user su_nutritionist ON su_nutritionist.user_id = sr.nutritionist_id AND su_nutritionist.del_flag = 0
|
LEFT JOIN sys_user su_nutritionist ON su_nutritionist.user_id = sr.nutritionist_id AND su_nutritionist.del_flag
|
||||||
LEFT JOIN sys_user su_nutritionist_assis ON su_nutritionist_assis.user_id = sr.nutri_assis_id AND su_nutritionist_assis.del_flag = 0
|
= 0
|
||||||
|
LEFT JOIN sys_user su_nutritionist_assis ON su_nutritionist_assis.user_id = sr.nutri_assis_id AND
|
||||||
|
su_nutritionist_assis.del_flag = 0
|
||||||
WHERE srp.del_flag = 0 AND sr.del_flag = 0 AND srp.type = 0
|
WHERE srp.del_flag = 0 AND sr.del_flag = 0 AND srp.type = 0
|
||||||
<if test="orderId != null">AND srp.order_id = #{orderId}</if>
|
<if test="orderId != null">AND srp.order_id = #{orderId}</if>
|
||||||
<if test="sendFlag != null">AND srp.send_flag = #{sendFlag}</if>
|
<if test="sendFlag != null">AND srp.send_flag = #{sendFlag}</if>
|
||||||
@ -238,16 +248,21 @@
|
|||||||
<result property="startNumDay" column="start_num_day"/>
|
<result property="startNumDay" column="start_num_day"/>
|
||||||
<result property="endNumDay" column="end_num_day"/>
|
<result property="endNumDay" column="end_num_day"/>
|
||||||
<result property="recipesId" column="recipes_id"/>
|
<result property="recipesId" column="recipes_id"/>
|
||||||
|
<result property="sendFlag" column="send_flag"/>
|
||||||
|
<result property="subscribed" column="subscribed"/>
|
||||||
<association property="menus" column="recipes_id" select="selectMenuIds"/>
|
<association property="menus" column="recipes_id" select="selectMenuIds"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!-- 通过outId查询食谱计划简要-->
|
<!-- 通过outId查询食谱计划简要
|
||||||
|
and review_status = 2 and send_flag = 1
|
||||||
|
-->
|
||||||
<select id="selectRecipesPlanListInfo" resultMap="SysRecipesPlanListInfoResult">
|
<select id="selectRecipesPlanListInfo" resultMap="SysRecipesPlanListInfoResult">
|
||||||
select id, start_date, end_date, start_num_day, end_num_day, recipes_id from sys_recipes_plan where out_id=#{outId} and del_flag = 0 and review_status = 2 and send_flag = 1
|
select id, start_date, end_date, start_num_day, end_num_day, recipes_id, send_flag, subscribed from sys_recipes_plan where out_id=#{outId} and del_flag = 0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- and review_status = 2 and send_flag = 1-->
|
||||||
<select id="selectRecipesPlanListInfoByCusId" resultMap="SysRecipesPlanListInfoResult">
|
<select id="selectRecipesPlanListInfoByCusId" resultMap="SysRecipesPlanListInfoResult">
|
||||||
select id, start_date, end_date, start_num_day, end_num_day, recipes_id from sys_recipes_plan where cus_id=#{cusId} and del_flag = 0 and review_status = 2 and send_flag = 1
|
select id, start_date, end_date, start_num_day, end_num_day, recipes_id, send_flag, subscribed from sys_recipes_plan where cus_id=#{cusId} and del_flag = 0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<resultMap type="SysRecipesDaily" id="SysRecipesResult">
|
<resultMap type="SysRecipesDaily" id="SysRecipesResult">
|
||||||
@ -265,6 +280,7 @@
|
|||||||
<!--<foreach collection="list" item="item" separator=";" open="" close="">
|
<!--<foreach collection="list" item="item" separator=";" open="" close="">
|
||||||
|
|
||||||
</foreach>-->
|
</foreach>-->
|
||||||
update sys_recipes_plan set start_date = #{startDate},end_date = #{endDate},pause_date=#{pauseDate} where id = #{id}
|
update sys_recipes_plan set start_date = #{startDate},end_date = #{endDate},pause_date=#{pauseDate} where id =
|
||||||
|
#{id}
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
@ -0,0 +1,55 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.stdiet.custom.mapper.SysWxSubscribePostLogMapper">
|
||||||
|
<resultMap type="WxSubscribePostLog" id="WxSubscribePostLogResult">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="appid" column="appid"/>
|
||||||
|
<result property="openid" column="openid"/>
|
||||||
|
<result property="sendTime" column="send_time"/>
|
||||||
|
<result property="planId" column="plan_id"/>
|
||||||
|
<result property="phone" column="phone"/>
|
||||||
|
<result property="result" column="result" typeHandler="com.stdiet.custom.typehandler.ObjectJsonHandler"/>
|
||||||
|
<result property="data" column="data" typeHandler="com.stdiet.custom.typehandler.ObjectJsonHandler"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<insert id="insertWxSubscribePostLog" parameterType="WxSubscribePostLog" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into sys_wx_subscribe_post_log
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="appid != null">appid,</if>
|
||||||
|
<if test="openid != null">openid,</if>
|
||||||
|
<if test="planId != null">plan_id,</if>
|
||||||
|
<if test="sendTime != null">send_time,</if>
|
||||||
|
<if test="result != null">result,</if>
|
||||||
|
<if test="phone != null">phone,</if>
|
||||||
|
<if test="data != null">data,</if>
|
||||||
|
<if test="type != null">type,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="appid != null">#{appid},</if>
|
||||||
|
<if test="openid != null">#{openid},</if>
|
||||||
|
<if test="planId != null">#{planId},</if>
|
||||||
|
<if test="sendTime != null">#{sendTime},</if>
|
||||||
|
<if test="result != null">#{result, jdbcType=OTHER, typeHandler=com.stdiet.custom.typehandler.ObjectJsonHandler},</if>
|
||||||
|
<if test="phone != null">#{phone},</if>
|
||||||
|
<if test="data != null">#{data, jdbcType=OTHER, typeHandler=com.stdiet.custom.typehandler.ObjectJsonHandler},</if>
|
||||||
|
<if test="type != null">#{type},</if>
|
||||||
|
</trim>
|
||||||
|
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<select id="selectWxSubscribePostLog" parameterType="WxSubscribePostLog" resultMap="WxSubscribePostLogResult">
|
||||||
|
select * from sys_wx_subscribe_post_log
|
||||||
|
<where>
|
||||||
|
<if test="id != null">AND id = #{id}</if>
|
||||||
|
<if test="openid != null">AND openid = #{openid}</if>
|
||||||
|
<if test="appid != null">AND appid = #{appid}</if>
|
||||||
|
<if test="planId != null">AND plan_id = #{planId}</if>
|
||||||
|
<if test="phone != null">AND phone = #{phone}</if>
|
||||||
|
<if test="type != null">AND type = #{type}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
@ -32,6 +32,7 @@
|
|||||||
<where>
|
<where>
|
||||||
<if test="nickName != null and nickName != ''">and nick_name like concat('%', #{nickName}, '%')</if>
|
<if test="nickName != null and nickName != ''">and nick_name like concat('%', #{nickName}, '%')</if>
|
||||||
<if test="appid != null and appid != ''">and appid = #{appid}</if>
|
<if test="appid != null and appid != ''">and appid = #{appid}</if>
|
||||||
|
<if test="cusId != null and cusId != ''">and cus_id = #{cusId}</if>
|
||||||
<if test="phone != null and phone != ''">and phone = #{phone}</if>
|
<if test="phone != null and phone != ''">and phone = #{phone}</if>
|
||||||
<if test="sex != null and sex != ''">and sex = #{sex}</if>
|
<if test="sex != null and sex != ''">and sex = #{sex}</if>
|
||||||
</where>
|
</where>
|
||||||
@ -45,6 +46,11 @@
|
|||||||
order by wxuser.update_time desc
|
order by wxuser.update_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectSysWxUserInfoByCusId" parameterType="Long" resultMap="SysWxUserInfoResult">
|
||||||
|
<include refid="selectSysWxUserInfoVo"/>
|
||||||
|
where cus_id = #{cusId}
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectSysWxUserInfoById" parameterType="String" resultMap="SysWxUserInfoResult">
|
<select id="selectSysWxUserInfoById" parameterType="String" resultMap="SysWxUserInfoResult">
|
||||||
<include refid="selectSysWxUserInfoVo"/>
|
<include refid="selectSysWxUserInfoVo"/>
|
||||||
where openid = #{openid}
|
where openid = #{openid}
|
||||||
|
BIN
stdiet-framework/src/main/java/com/stdiet/framework/.DS_Store
vendored
Normal file
BIN
stdiet-framework/src/main/java/com/stdiet/framework/.DS_Store
vendored
Normal file
Binary file not shown.
146
stdiet-ui/src/components/ScrollingNum/index.vue
Normal file
146
stdiet-ui/src/components/ScrollingNum/index.vue
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
<template>
|
||||||
|
<div class="scrolling_num_wrapper">
|
||||||
|
<h3 class="orderTitle">订单总量</h3>
|
||||||
|
<div class="box-item">
|
||||||
|
<li
|
||||||
|
:class="{ 'number-item': !isNaN(item), 'mark-item': isNaN(item) }"
|
||||||
|
v-for="(item, index) in orderNum"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
<span v-if="!isNaN(item)">
|
||||||
|
<i ref="numberItem">0123456789</i>
|
||||||
|
</span>
|
||||||
|
<span class="comma" v-else>{{ item }}</span>
|
||||||
|
</li>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
// https://www.pianshen.com/article/80951378341/
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
num: 0,
|
||||||
|
orderNum: ["0", "0", ",", "0", "0", "0", ",", "0", "0", "0"], // 默认订单总数
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
// this.toOrderNum(0); // 这里输入数字即可调用
|
||||||
|
// this.setNumberTransform();
|
||||||
|
this.increaseNumber();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 定时增长数字
|
||||||
|
increaseNumber() {
|
||||||
|
this.timer = setInterval(() => {
|
||||||
|
this.num += this.getRandomNumber(1, 100);
|
||||||
|
this.toOrderNum(this.num);
|
||||||
|
this.setNumberTransform();
|
||||||
|
}, 3000);
|
||||||
|
},
|
||||||
|
getRandomNumber(min, max) {
|
||||||
|
return Math.floor(Math.random() * (max - min + 1) + min);
|
||||||
|
},
|
||||||
|
// 设置文字滚动
|
||||||
|
setNumberTransform() {
|
||||||
|
const numberItems = this.$refs.numberItem; // 拿到数字的ref,计算元素数量
|
||||||
|
const numberArr = this.orderNum.filter((item) => !isNaN(item));
|
||||||
|
// 结合CSS 对数字字符进行滚动,显示订单数量
|
||||||
|
for (let index = 0; index < numberItems.length; index++) {
|
||||||
|
const elem = numberItems[index];
|
||||||
|
elem.style.transform = `translate(-50%, -${numberArr[index] * 10}%)`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 处理总订单数字
|
||||||
|
toOrderNum(num) {
|
||||||
|
num = num.toString();
|
||||||
|
// 把订单数变成字符串
|
||||||
|
if (num.length < 8) {
|
||||||
|
num = "0" + num; // 如未满八位数,添加"0"补位
|
||||||
|
this.toOrderNum(num); // 递归添加"0"补位
|
||||||
|
} else if (num.length === 8) {
|
||||||
|
// 订单数中加入逗号
|
||||||
|
num = num.slice(0, 2) + "," + num.slice(2, 5) + "," + num.slice(5, 8);
|
||||||
|
this.orderNum = num.split(""); // 将其便变成数据,渲染至滚动数组
|
||||||
|
} else {
|
||||||
|
// 订单总量数字超过八位显示异常
|
||||||
|
this.$message.warning("订单总量数字过大,显示异常,请联系客服");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style scoped lang='scss'>
|
||||||
|
.scrolling_num_wrapper {
|
||||||
|
/*订单总量滚动数字设置*/
|
||||||
|
.box-item {
|
||||||
|
position: relative;
|
||||||
|
height: 100px;
|
||||||
|
font-size: 54px;
|
||||||
|
line-height: 41px;
|
||||||
|
text-align: center;
|
||||||
|
list-style: none;
|
||||||
|
color: #2d7cff;
|
||||||
|
writing-mode: vertical-lr;
|
||||||
|
text-orientation: upright;
|
||||||
|
/*文字禁止编辑*/
|
||||||
|
-moz-user-select: none; /*火狐*/
|
||||||
|
-webkit-user-select: none; /*webkit浏览器*/
|
||||||
|
-ms-user-select: none; /*IE10*/
|
||||||
|
-khtml-user-select: none; /*早期浏览器*/
|
||||||
|
user-select: none;
|
||||||
|
/* overflow: hidden; */
|
||||||
|
}
|
||||||
|
/* 默认逗号设置 */
|
||||||
|
.mark-item {
|
||||||
|
width: 10px;
|
||||||
|
height: 75px;
|
||||||
|
margin-right: 5px;
|
||||||
|
line-height: 10px;
|
||||||
|
font-size: 48px;
|
||||||
|
position: relative;
|
||||||
|
& > span {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
bottom: 0;
|
||||||
|
writing-mode: vertical-rl;
|
||||||
|
text-orientation: upright;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*滚动数字设置*/
|
||||||
|
.number-item {
|
||||||
|
width: 41px;
|
||||||
|
height: 75px;
|
||||||
|
background: #ccc;
|
||||||
|
list-style: none;
|
||||||
|
margin-right: 5px;
|
||||||
|
background: rgba(250, 250, 250, 1);
|
||||||
|
border-radius: 4px;
|
||||||
|
border: 1px solid rgba(221, 221, 221, 1);
|
||||||
|
& > span {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 10px;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
writing-mode: vertical-rl;
|
||||||
|
text-orientation: upright;
|
||||||
|
overflow: hidden;
|
||||||
|
& > i {
|
||||||
|
font-style: normal;
|
||||||
|
position: absolute;
|
||||||
|
top: 11px;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, 0);
|
||||||
|
transition: transform 1s ease-in-out;
|
||||||
|
letter-spacing: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.number-item:last-child {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -13,7 +13,8 @@ const whiteList = [
|
|||||||
"/bind",
|
"/bind",
|
||||||
"/register",
|
"/register",
|
||||||
"/question",
|
"/question",
|
||||||
"/subhealthyInvestigation"
|
"/subhealthyInvestigation",
|
||||||
|
"/live"
|
||||||
];
|
];
|
||||||
|
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
|
@ -160,6 +160,12 @@ export const constantRoutes = [
|
|||||||
hidden: true,
|
hidden: true,
|
||||||
meta: { title: "胜唐体控健康评估表" }
|
meta: { title: "胜唐体控健康评估表" }
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/live",
|
||||||
|
component: resolve => require(["@/components/ScrollingNum"], resolve),
|
||||||
|
hidden: true,
|
||||||
|
meta: { title: "直播数据" }
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "/foodHeatCalculator/:id",
|
path: "/foodHeatCalculator/:id",
|
||||||
component: resolve =>
|
component: resolve =>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user