From ab2879bbcb846256cc182198b9c04e50fbc276c1 Mon Sep 17 00:00:00 2001
From: jyy <935090232@qq.com>
Date: Tue, 26 Jan 2021 14:15:42 +0800
Subject: [PATCH] 1、新增消息推送提醒 2、修改业绩计算bug
---
zq-erp/src/main/resources/mybatis/mapper/hive/SysProjServicesDao.xml | 43 +++
zq-erp/src/main/java/com/matrix/system/hive/action/MoneyCardUseController.java | 19 +
zq-erp/src/main/java/com/matrix/system/job/ServiceOvertimeNoticeJob.java | 65 ++++++
zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/messageBulderDemo/DdqxTemplateMessageBulder.java | 110 +++++++++++
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html | 5
zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/messageBulderDemo/YydsTemplateMessageBulder.java | 116 +++++++++++
zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/messageBulderDemo/CzcgTemplateMessageBulder.java | 110 +++++++++++
zq-erp/src/main/java/com/matrix/system/hive/dao/SysProjServicesDao.java | 11 +
zq-erp/src/main/resources/config/application.properties | 12
zq-erp/src/main/java/com/matrix/system/hive/action/ProjTypeController.java | 5
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java | 20 ++
zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/UniformMsgSentTask.java | 8
zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/messageBulderDemo/YycgTemplateMessageBulder.java | 10
zq-erp/src/main/java/com/matrix/system/hive/bean/SysProjServices.java | 13 +
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html | 9
15 files changed, 520 insertions(+), 36 deletions(-)
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/action/MoneyCardUseController.java b/zq-erp/src/main/java/com/matrix/system/hive/action/MoneyCardUseController.java
index 6db943c..97cf6ed 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/action/MoneyCardUseController.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/action/MoneyCardUseController.java
@@ -1,5 +1,6 @@
package com.matrix.system.hive.action;
+import com.matrix.component.rabbitmq.RabiitMqTemplate;
import com.matrix.core.constance.MatrixConstance;
import com.matrix.core.exception.GlobleException;
import com.matrix.core.pojo.AjaxResult;
@@ -15,7 +16,10 @@
import com.matrix.core.tools.DateUtil;
import com.matrix.system.hive.pojo.CzXkVo;
import com.matrix.system.hive.service.*;
+import com.matrix.system.shopXcx.mqTask.MQTaskRouting;
+import com.matrix.system.wechart.templateMsg.UniformMsgParam;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
@@ -55,6 +59,15 @@
private MoneyCardUseFlowDao moneyCardUseFlowDao;
@Autowired
private MoneyCardUseDao moneyCardUseDao;
+
+
+ @Value("${evn}")
+ private String evn;
+
+ @Autowired
+ private RabiitMqTemplate rabiitMqTemplate;
+
+
/**
* 跳转 充值页面
*
@@ -91,6 +104,12 @@
AjaxResult cz(@RequestBody CzXkVo czVo) {
SysOrder order= orderService.updateAddCardMoney(czVo);
AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, "充值成功");
+
+ //发送微信公众号提醒
+ UniformMsgParam uniformMsgParam=new UniformMsgParam(order.getCompanyId(),UniformMsgParam.GZH_CZCG);
+ uniformMsgParam.put("orderId",order.getId());
+ rabiitMqTemplate.sendMsg(MQTaskRouting.SEND_UNIFORM_TEMPLATE_MSG+evn,uniformMsgParam.toJSONString());
+
result.putInMap("orderId",order.getId());
return result;
}
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/action/ProjTypeController.java b/zq-erp/src/main/java/com/matrix/system/hive/action/ProjTypeController.java
index 20b81ff..15abb61 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/action/ProjTypeController.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/action/ProjTypeController.java
@@ -25,13 +25,8 @@
@RequestMapping(value = "/admin/projtype")
public class ProjTypeController extends BaseController {
-
@Resource
private SysProjTypeService currentService;
-
-
-
-
public static final String fnCode = "projType";
public static final String search = fnCode + ":search";
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysProjServices.java b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysProjServices.java
index dd76b14..11bca7e 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysProjServices.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysProjServices.java
@@ -251,6 +251,10 @@
private Integer totalTime;
+ /**
+ * 到时提醒次数
+ */
+ private Integer overtimeNotice;
@@ -332,6 +336,15 @@
@Extend
private String pageFlae;
+
+ public Integer getOvertimeNotice() {
+ return overtimeNotice;
+ }
+
+ public void setOvertimeNotice(Integer overtimeNotice) {
+ this.overtimeNotice = overtimeNotice;
+ }
+
public String getPageFlae() {
return pageFlae;
}
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/dao/SysProjServicesDao.java b/zq-erp/src/main/java/com/matrix/system/hive/dao/SysProjServicesDao.java
index 845b2e5..08933dd 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/dao/SysProjServicesDao.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/dao/SysProjServicesDao.java
@@ -59,5 +59,16 @@
*/
ErpServiceOrderListVo findWxServiceOrderById(Long id);
+ /**
+ * 查询预约时间在1小时之内且没有通知过的服务单
+ * @return
+ */
+ List<SysProjServices> selectNeedNoticeService();
+ /**
+ * 设置服务单为已通知
+ * @param noticedIds
+ * @return
+ */
+ int updateNoticeTimes(@Param("list")List<Long> noticedIds);
}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java
index 9cfcdec..2bc34e5 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java
@@ -1,5 +1,6 @@
package com.matrix.system.hive.service.imp;
+import com.matrix.component.rabbitmq.RabiitMqTemplate;
import com.matrix.core.constance.MatrixConstance;
import com.matrix.core.exception.GlobleException;
import com.matrix.core.pojo.PaginationVO;
@@ -27,8 +28,11 @@
import com.matrix.system.hive.pojo.ShoppingCarItem;
import com.matrix.system.hive.pojo.ShoppingCarItemsVo;
import com.matrix.system.hive.service.*;
+import com.matrix.system.shopXcx.mqTask.MQTaskRouting;
+import com.matrix.system.wechart.templateMsg.UniformMsgParam;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -106,6 +110,13 @@
@Autowired
private SysInstoreInfoService sysInstoreInfoService;
+
+
+ @Value("${evn}")
+ private String evn;
+
+ @Autowired
+ private RabiitMqTemplate rabiitMqTemplate;
@Override
@@ -256,6 +267,12 @@
order.setStatu(Dictionary.ORDER_STATU_YQX);
order.setArrears(0D);
+
+ //发送微信公众号提醒
+ UniformMsgParam uniformMsgParam=new UniformMsgParam(order.getCompanyId(),UniformMsgParam.GZH_DDQX);
+ uniformMsgParam.put("orderId",order.getId());
+ rabiitMqTemplate.sendMsg(MQTaskRouting.SEND_UNIFORM_TEMPLATE_MSG+evn,uniformMsgParam.toJSONString());
+
return sysOrderDao.update(order);
} else {
@@ -351,8 +368,11 @@
achieveNewService.removeByModel(achieveNew);
// 取消订单
order.setStatu(Dictionary.ORDER_STATU_YQX);
+
+
return sysOrderDao.update(order);
}
+
}
diff --git a/zq-erp/src/main/java/com/matrix/system/job/ServiceOvertimeNoticeJob.java b/zq-erp/src/main/java/com/matrix/system/job/ServiceOvertimeNoticeJob.java
new file mode 100644
index 0000000..87889ad
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/job/ServiceOvertimeNoticeJob.java
@@ -0,0 +1,65 @@
+package com.matrix.system.job;
+
+import com.matrix.component.rabbitmq.RabiitMqTemplate;
+import com.matrix.core.tools.LogUtil;
+import com.matrix.system.common.bean.SysUsers;
+import com.matrix.system.constance.Dictionary;
+import com.matrix.system.hive.bean.MoneyCardUse;
+import com.matrix.system.hive.bean.SysProjServices;
+import com.matrix.system.hive.bean.SysProjUse;
+import com.matrix.system.hive.dao.MoneyCardUseDao;
+import com.matrix.system.hive.dao.SysProjServicesDao;
+import com.matrix.system.hive.dao.SysProjUseDao;
+import com.matrix.system.hive.plugin.util.CollectionUtils;
+import com.matrix.system.shopXcx.mqTask.MQTaskRouting;
+import com.matrix.system.wechart.templateMsg.UniformMsgParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 预约服务到时提醒
+ * @author 姜友瑶
+ */
+@Component
+public class ServiceOvertimeNoticeJob {
+
+ @Autowired
+ private SysProjServicesDao projServicesDao;
+
+ @Value("${evn}")
+ private String evn;
+
+ @Autowired
+ private RabiitMqTemplate rabiitMqTemplate;
+
+ /**
+ * 每分钟执行一次
+ */
+ @Scheduled(cron = "0 0/1 * * * ?")
+ public void serviceOvertimeNotice() {
+
+ List<SysProjServices> needNoticeService=projServicesDao.selectNeedNoticeService();
+ if(CollectionUtils.isNotEmpty(needNoticeService)){
+ LogUtil.debug("执行服务单预约到时提醒任务,本次通知对象"+ needNoticeService.stream().map(SysProjServices::getVipName).collect(Collectors.joining(",")));
+ for(SysProjServices projServices : needNoticeService){
+ //发送微信公众号提醒
+ UniformMsgParam uniformMsgParam=new UniformMsgParam(projServices.getCompanyId(),UniformMsgParam.GZH_YYDS);
+ uniformMsgParam.put("serviceId",projServices.getId());
+ rabiitMqTemplate.sendMsg(MQTaskRouting.SEND_UNIFORM_TEMPLATE_MSG+evn,uniformMsgParam.toJSONString());
+ }
+ List<Long> noticedIds = needNoticeService.stream().map(SysProjServices::getId).collect(Collectors.toList());
+ projServicesDao.updateNoticeTimes(noticedIds);
+ }else{
+ LogUtil.debug("暂无需要提醒的服务单");
+ }
+
+ }
+
+
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/UniformMsgSentTask.java b/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/UniformMsgSentTask.java
index 058af77..7196340 100644
--- a/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/UniformMsgSentTask.java
+++ b/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/UniformMsgSentTask.java
@@ -57,8 +57,6 @@
@Override
public void handle(String consumerTag, Delivery message) throws IOException {
try {
-
-
String messages = new String(message.getBody(), "UTF-8");
JSONObject messageJsonParam=JSONObject.parseObject(messages);
@@ -88,15 +86,11 @@
bulderParam.put("gzhAppid", gzhAppid.getParamValue());
bulderParam.put("template_id", template.getUuid());
bulderParam.put("messageJsonParam", messageJsonParam);
-
-
//调用模板计算出消息体
Map msgResult = templateMessageBulder.buildMsg(bulderParam);
if(msgResult.containsKey("error")){
//错误消息处理
-
-
LogUtil.error("模板消息发送内容:"+msgResult.get("error"));
return;
}else{
@@ -114,10 +108,8 @@
LogUtil.debug("微信小程序模板消息推送结果:" + result.toString());
}
}
-
} catch (Exception e) {
LogUtil.error("消费者执行异常", e);
}
-
}
}
diff --git a/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/messageBulderDemo/CzcgTemplateMessageBulder.java b/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/messageBulderDemo/CzcgTemplateMessageBulder.java
new file mode 100644
index 0000000..44428c8
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/messageBulderDemo/CzcgTemplateMessageBulder.java
@@ -0,0 +1,110 @@
+package com.matrix.system.wechart.templateMsg.Task.messageBulderDemo;
+
+import com.alibaba.fastjson.JSONObject;
+import com.matrix.core.tools.DateUtil;
+import com.matrix.core.tools.StringUtils;
+import com.matrix.system.hive.bean.SysOrder;
+import com.matrix.system.hive.bean.SysOrderItem;
+import com.matrix.system.hive.bean.SysShopInfo;
+import com.matrix.system.hive.bean.SysVipInfo;
+import com.matrix.system.hive.dao.*;
+import com.matrix.system.wechart.templateMsg.GzhTemplateMessagePojo;
+import com.matrix.system.wechart.templateMsg.Task.TemplateMessageBulder;
+import com.matrix.system.wechart.templateMsg.UniformMsgPojo;
+import org.apache.commons.collections.map.HashedMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 充值成功提醒
+ */
+@Component
+public class CzcgTemplateMessageBulder implements TemplateMessageBulder {
+
+ @Autowired
+ SysOrderDao orderDao;
+
+ @Autowired
+ SysVipInfoDao vipInfoDao;
+
+ @Autowired
+ private SysBeauticianStateDao beauticianStateDao;
+
+ @Autowired
+ private SysShopInfoDao shopInfoDao;
+
+ @Autowired
+ private SysOrderItemDao orderItemDao;
+
+
+
+ @Override
+ public Map buildMsg(Map param) {
+
+ //返回参数
+ Map builParam=new HashedMap();
+ //获取基础公共参数
+ String gzhAppid= (String) param.get("gzhAppid");
+ String template_id= (String) param.get("template_id");
+ String xcxAppId= (String) param.get("xcxAppId");
+ //模板消息列表
+ List msgList=new ArrayList();
+
+ //触发点传送的json参数
+ JSONObject messageJsonParam= (JSONObject) param.get("messageJsonParam");
+ //构建消息主体
+ Long orderId= (Long) messageJsonParam.get("orderId");
+ SysOrder sysOrder = orderDao.selectById(orderId);
+ List<SysOrderItem> sysOrderItems = orderItemDao.selectByOrderId(orderId);
+
+ //校验客户openId (必须)
+ SysVipInfo vipInfo=vipInfoDao.selectById(sysOrder.getVipId());
+ String touser= vipInfo.getOpenId();
+ if(StringUtils.isBlank(touser)){
+ builParam.put("error","未获取到"+vipInfo.getVipName()+"用户小程序openid");
+ return builParam;
+ }
+
+
+ //自定义信息区START=========================================================================================================
+ SysShopInfo sysShopInfo = shopInfoDao.selectById(sysOrder.getShopId());
+ String time= DateUtil.dateFormatStr(sysOrder.getPayTime(),DateUtil.DATE_FORMAT_MM);
+
+ //如果一个项目存在多个护理项目则发送多次消息
+ String first="您好!充值余额成功";
+ for (SysOrderItem orderItem:sysOrderItems){
+ first+=orderItem.getShoppingGoods().getName()+"x"+orderItem.getCount()+",";
+ }
+ first=first.substring(0,first.length());
+ UniformMsgPojo uniformMsgPojo=new UniformMsgPojo();
+ GzhTemplateMessagePojo messagePojo=new GzhTemplateMessagePojo();
+ uniformMsgPojo.setTouser(touser);
+ messagePojo.setTemplate_id(template_id);
+ messagePojo.setAppid(gzhAppid);
+ //个性参数设置
+ messagePojo.setFirst(first,"#453454");
+ messagePojo.setKeyWord(sysShopInfo.getShopName(),"#453454");
+ messagePojo.setKeyWord(vipInfo.getVipNo(),"#453454");
+ messagePojo.setKeyWord(time,"#453454");
+ messagePojo.setKeyWord(sysOrder.getZkTotal()+"","#453454");
+ messagePojo.setRemark("点击【详情】可查询订单明细,若非本人或授权操作,请及时与门店联系","#453454");
+
+ //小程序配置
+ GzhTemplateMessagePojo.Miniprogram miniprogram=new GzhTemplateMessagePojo.Miniprogram(xcxAppId,
+ "pages/purchaseRecords/detail?id="+orderId);
+ messagePojo.setMiniprogram(miniprogram);
+
+
+ uniformMsgPojo.setMp_template_msg(messagePojo);
+ //自定义信息区END=========================================================================================================
+
+ //返回调用者使用的参数(必须)
+ msgList.add(uniformMsgPojo);
+ builParam.put("msgList",msgList);
+ return builParam;
+ }
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/messageBulderDemo/DdqxTemplateMessageBulder.java b/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/messageBulderDemo/DdqxTemplateMessageBulder.java
new file mode 100644
index 0000000..03efc5b
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/messageBulderDemo/DdqxTemplateMessageBulder.java
@@ -0,0 +1,110 @@
+package com.matrix.system.wechart.templateMsg.Task.messageBulderDemo;
+
+import com.alibaba.fastjson.JSONObject;
+import com.matrix.core.tools.DateUtil;
+import com.matrix.core.tools.StringUtils;
+import com.matrix.system.hive.bean.SysOrder;
+import com.matrix.system.hive.bean.SysOrderItem;
+import com.matrix.system.hive.bean.SysShopInfo;
+import com.matrix.system.hive.bean.SysVipInfo;
+import com.matrix.system.hive.dao.*;
+import com.matrix.system.wechart.templateMsg.GzhTemplateMessagePojo;
+import com.matrix.system.wechart.templateMsg.Task.TemplateMessageBulder;
+import com.matrix.system.wechart.templateMsg.UniformMsgPojo;
+import org.apache.commons.collections.map.HashedMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 订单取消提醒
+ */
+@Component
+public class DdqxTemplateMessageBulder implements TemplateMessageBulder {
+
+ @Autowired
+ SysOrderDao orderDao;
+
+ @Autowired
+ SysVipInfoDao vipInfoDao;
+
+ @Autowired
+ private SysBeauticianStateDao beauticianStateDao;
+
+ @Autowired
+ private SysShopInfoDao shopInfoDao;
+
+ @Autowired
+ private SysOrderItemDao orderItemDao;
+
+
+
+ @Override
+ public Map buildMsg(Map param) {
+
+ //返回参数
+ Map builParam=new HashedMap();
+ //获取基础公共参数
+ String gzhAppid= (String) param.get("gzhAppid");
+ String template_id= (String) param.get("template_id");
+ String xcxAppId= (String) param.get("xcxAppId");
+ //模板消息列表
+ List msgList=new ArrayList();
+
+ //触发点传送的json参数
+ JSONObject messageJsonParam= (JSONObject) param.get("messageJsonParam");
+ //构建消息主体
+ Long orderId= (Long) messageJsonParam.get("orderId");
+ SysOrder sysOrder = orderDao.selectById(orderId);
+ List<SysOrderItem> sysOrderItems = orderItemDao.selectByOrderId(orderId);
+
+ //校验客户openId (必须)
+ SysVipInfo vipInfo=vipInfoDao.selectById(sysOrder.getVipId());
+ String touser= vipInfo.getOpenId();
+ if(StringUtils.isBlank(touser)){
+ builParam.put("error","未获取到"+vipInfo.getVipName()+"用户小程序openid");
+ return builParam;
+ }
+
+
+ //自定义信息区START=========================================================================================================
+ SysShopInfo sysShopInfo = shopInfoDao.selectById(sysOrder.getShopId());
+ String time= DateUtil.dateFormatStr(sysOrder.getPayTime(),DateUtil.DATE_FORMAT_MM);
+
+ //如果一个项目存在多个护理项目则发送多次消息
+ String first="您好!您的订单已取消!";
+ String goodsName="";
+ for (SysOrderItem orderItem:sysOrderItems){
+ goodsName+=orderItem.getShoppingGoods().getName()+"x"+orderItem.getCount()+",";
+ }
+ goodsName=goodsName.substring(0,first.length());
+ UniformMsgPojo uniformMsgPojo=new UniformMsgPojo();
+ GzhTemplateMessagePojo messagePojo=new GzhTemplateMessagePojo();
+ uniformMsgPojo.setTouser(touser);
+ messagePojo.setTemplate_id(template_id);
+ messagePojo.setAppid(gzhAppid);
+ //个性参数设置
+ messagePojo.setFirst(first,"#453454");
+ messagePojo.setKeyWord(sysOrder.getOrderNo(),"#453454");
+ messagePojo.setKeyWord(goodsName,"#453454");
+ messagePojo.setKeyWord(time,"#453454");
+ messagePojo.setRemark("如有需要,请重新下单 ,点击【详情】可查询订单明细,若非本人或授权操作,请及时与门店联系","#453454");
+
+ //小程序配置
+ GzhTemplateMessagePojo.Miniprogram miniprogram=new GzhTemplateMessagePojo.Miniprogram(xcxAppId,
+ "pages/purchaseRecords/detail?id="+orderId);
+ messagePojo.setMiniprogram(miniprogram);
+
+
+ uniformMsgPojo.setMp_template_msg(messagePojo);
+ //自定义信息区END=========================================================================================================
+
+ //返回调用者使用的参数(必须)
+ msgList.add(uniformMsgPojo);
+ builParam.put("msgList",msgList);
+ return builParam;
+ }
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/messageBulderDemo/YycgTemplateMessageBulder.java b/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/messageBulderDemo/YycgTemplateMessageBulder.java
index 2e70fcc..82a4a06 100644
--- a/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/messageBulderDemo/YycgTemplateMessageBulder.java
+++ b/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/messageBulderDemo/YycgTemplateMessageBulder.java
@@ -18,9 +18,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
/**
* 预约成功提醒
@@ -77,13 +75,13 @@
//如果一个项目存在多个护理项目则发送多次消息
String projectInfo="";
- String staffName="";
+ Set<String> staffNames=new HashSet<>();
for (SysBeauticianState beauticianState:beauticianStateList){
projectInfo+=beauticianState.getProjInfo().getName()+beauticianState.getCount()+"次,";
- staffName+=beauticianState.getBeautiStaffInfo().getSuName()+",";
+ staffNames.add(beauticianState.getBeautiStaffInfo().getSuName());
}
projectInfo=projectInfo.substring(0,projectInfo.length()-1);
- staffName=staffName.substring(0,staffName.length()-1);
+ String staffName=StringUtils.collToStr(staffNames,",");
UniformMsgPojo uniformMsgPojo=new UniformMsgPojo();
GzhTemplateMessagePojo messagePojo=new GzhTemplateMessagePojo();
uniformMsgPojo.setTouser(touser);
diff --git a/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/messageBulderDemo/YydsTemplateMessageBulder.java b/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/messageBulderDemo/YydsTemplateMessageBulder.java
new file mode 100644
index 0000000..0eac830
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/messageBulderDemo/YydsTemplateMessageBulder.java
@@ -0,0 +1,116 @@
+package com.matrix.system.wechart.templateMsg.Task.messageBulderDemo;
+
+import com.alibaba.fastjson.JSONObject;
+import com.matrix.core.tools.DateUtil;
+import com.matrix.core.tools.StringUtils;
+import com.matrix.system.hive.bean.SysBeauticianState;
+import com.matrix.system.hive.bean.SysProjServices;
+import com.matrix.system.hive.bean.SysShopInfo;
+import com.matrix.system.hive.bean.SysVipInfo;
+import com.matrix.system.hive.dao.SysBeauticianStateDao;
+import com.matrix.system.hive.dao.SysProjServicesDao;
+import com.matrix.system.hive.dao.SysShopInfoDao;
+import com.matrix.system.hive.dao.SysVipInfoDao;
+import com.matrix.system.wechart.templateMsg.GzhTemplateMessagePojo;
+import com.matrix.system.wechart.templateMsg.Task.TemplateMessageBulder;
+import com.matrix.system.wechart.templateMsg.UniformMsgPojo;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections.map.HashedMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.*;
+
+/**
+ * 预约到时提醒
+ */
+@Component
+public class YydsTemplateMessageBulder implements TemplateMessageBulder {
+
+ @Autowired
+ SysProjServicesDao projServicesDao;
+
+ @Autowired
+ SysVipInfoDao vipInfoDao;
+
+ @Autowired
+ private SysBeauticianStateDao beauticianStateDao;
+
+ @Autowired
+ private SysShopInfoDao shopInfoDao;
+
+
+
+ @Override
+ public Map buildMsg(Map param) {
+
+ //返回参数
+ Map builParam=new HashedMap();
+ //获取基础公共参数
+ String gzhAppid= (String) param.get("gzhAppid");
+ String template_id= (String) param.get("template_id");
+ String xcxAppId= (String) param.get("xcxAppId");
+ //模板消息列表
+ List msgList=new ArrayList();
+
+ //触发点传送的json参数
+ JSONObject messageJsonParam= (JSONObject) param.get("messageJsonParam");
+ //构建消息主体
+ Long serviceId= (Long) messageJsonParam.get("serviceId");
+ SysProjServices sysProjServices = projServicesDao.selectById(serviceId);
+
+
+ //校验客户openId (必须)
+ SysVipInfo vipInfo=vipInfoDao.selectById(sysProjServices.getVipId());
+ String touser= vipInfo.getOpenId();
+ if(StringUtils.isBlank(touser)){
+ builParam.put("error","未获取到"+vipInfo.getVipName()+"用户小程序openid");
+ return builParam;
+ }
+
+
+ //自定义信息区START=========================================================================================================
+ SysShopInfo sysShopInfo = shopInfoDao.selectById(sysProjServices.getShopId());
+ List<SysBeauticianState> beauticianStateList = beauticianStateDao.selectBySerIds(sysProjServices.getId());
+ String time= DateUtil.dateFormatStr(sysProjServices.getConsumeTime(),DateUtil.DATE_FORMAT_MM);
+
+ //如果一个项目存在多个护理项目则发送多次消息
+ String projectInfo="";
+ Set<String> staffNames=new HashSet<>();
+ for (SysBeauticianState beauticianState:beauticianStateList){
+ projectInfo+=beauticianState.getProjInfo().getName()+beauticianState.getCount()+"次,";
+ staffNames.add(beauticianState.getBeautiStaffInfo().getSuName());
+ }
+ projectInfo=projectInfo.substring(0,projectInfo.length()-1);
+ String staffName=StringUtils.collToStr(staffNames,",");
+ UniformMsgPojo uniformMsgPojo=new UniformMsgPojo();
+ GzhTemplateMessagePojo messagePojo=new GzhTemplateMessagePojo();
+ uniformMsgPojo.setTouser(touser);
+ messagePojo.setTemplate_id(template_id);
+ messagePojo.setAppid(gzhAppid);
+ //个性参数设置
+ messagePojo.setFirst("您好!您在"+sysShopInfo.getShopName()+"店的预约将在1小时后开始,请准时到店。","#453454");
+ messagePojo.setKeyWord(time,"#453454");
+
+ messagePojo.setKeyWord(sysShopInfo.getShopName(),"#453454");
+ messagePojo.setKeyWord(sysShopInfo.getShopAddr(),"#453454");
+ messagePojo.setKeyWord(projectInfo,"#453454");
+ messagePojo.setKeyWord(staffName,"#453454");
+
+ messagePojo.setRemark("请记得准时前往,点击【详情】可查询服务详情。","#453454");
+
+ //小程序配置
+ GzhTemplateMessagePojo.Miniprogram miniprogram=new GzhTemplateMessagePojo.Miniprogram(xcxAppId,
+ "pages/yuyue/showYyInfo?id="+serviceId);
+ messagePojo.setMiniprogram(miniprogram);
+
+
+ uniformMsgPojo.setMp_template_msg(messagePojo);
+ //自定义信息区END=========================================================================================================
+
+ //返回调用者使用的参数(必须)
+ msgList.add(uniformMsgPojo);
+ builParam.put("msgList",msgList);
+ return builParam;
+ }
+}
diff --git a/zq-erp/src/main/resources/config/application.properties b/zq-erp/src/main/resources/config/application.properties
index 66e104b..0c3083e 100644
--- a/zq-erp/src/main/resources/config/application.properties
+++ b/zq-erp/src/main/resources/config/application.properties
@@ -4,13 +4,13 @@
#线上测试环境
-#spring.datasource.username=ct_test
-#spring.datasource.password=123456
-#spring.datasource.url=jdbc:mysql://120.27.238.55:3306/hive_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8
+spring.datasource.username=ct_test
+spring.datasource.password=123456
+spring.datasource.url=jdbc:mysql://120.27.238.55:3306/hive_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8
-spring.datasource.username=chuhuan
-spring.datasource.password=chuhuan
-spring.datasource.url=jdbc:mysql://175.6.132.141:3306/hive_v2_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8
+#spring.datasource.username=chuhuan
+#spring.datasource.password=chuhuan
+#spring.datasource.url=jdbc:mysql://175.6.132.141:3306/hive_v2_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjServicesDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjServicesDao.xml
index f5b7550..01462d3 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjServicesDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjServicesDao.xml
@@ -40,6 +40,8 @@
<result property="companyId" column="company_id"/>
<result property="comment" column="comment"/>
<result property="reply" column="reply"/>
+ <result property="overtimeNotice" column="overtime_notice"/>
+
<result property="beautiName" column="beautiName"/>
@@ -47,6 +49,7 @@
<result property="shopName" column="shopName"/>
<result property="createStaffName" column="createStaffName"/>
<result property="bedName" column="bedName"/>
+ <result property="vipName" column="VIP_Name"/>
<association property="vipInfo" resultMap="com.matrix.system.hive.dao.SysVipInfoDao.SysVipInfoMapSimple" ></association>
@@ -91,7 +94,8 @@
consume_time,
company_id,
comment,
- reply
+ reply,
+ overtime_notice
)
VALUES (
#{id},
@@ -128,7 +132,8 @@
#{consumeTime},
#{companyId},
#{comment},
- #{reply}
+ #{reply},
+ #{overtimeNotice}
)
</insert>
@@ -137,6 +142,18 @@
<update id="updateOrderTime">
UPDATE sys_proj_services set CREATE_TIME=#{createTime} WHERE id=#{id}
</update>
+
+ <!-- 设置服务单为已通知 -->
+ <update id="updateNoticeTimes" >
+ UPDATE sys_proj_services set overtime_notice=1
+ where ID in
+ <foreach collection="list" index="index" item="item" open="("
+ separator="," close=")">
+ #{item}
+ </foreach>
+ </update>
+
+
<update id="update">
UPDATE sys_proj_services
@@ -241,12 +258,13 @@
<if test="comment != null ">
comment = #{comment}
</if>
+ <if test="overtimeNotice != null ">
+ overtime_notice = #{overtimeNotice}
+ </if>
</set>
WHERE id=#{id}
</update>
- <update id="comment">
- </update>
<!-- 批量删除 -->
<delete id="deleteByIds" parameterType="java.util.List">
@@ -410,7 +428,21 @@
left join sys_beautician_state c on a.id=c.SERVICES_ID
where a.ID=#{id}
</select>
-
+
+ <select id="selectNeedNoticeService" resultMap="SysProjServicesMap">
+ select
+ a.id,
+ a.company_id,
+ b.VIP_Name
+ FROM sys_proj_services a
+ LEFT JOIN sys_vip_info b on b.ID=a.VIP_ID
+ where a.YY_TIME > now()
+ and DATE_ADD(now(),INTERVAL 1 HOUR) > a.YY_TIME
+ and overtime_notice is null
+ </select>
+
+
+
<!-- 根据对象查询-->
<select id="selectByModel" resultMap="SysProjServicesMap">
select distinct
@@ -664,7 +696,6 @@
left join shopping_goods m on g.proj_id=m.id
where a.id=#{id}
</select>
-
</mapper>
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html
index c0baf45..039e6be 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html
@@ -382,7 +382,7 @@
title="业绩设置"
:visible.sync="drawer"
:direction="direction"
- size="50%"
+ size="90%"
>
<el-row>
<el-col :span="24">
@@ -899,7 +899,14 @@
item.payMoney = zkPrice * count;
}
_this.order.payMoney += parseFloat(item.payMoney);
+
+ _this.achieveList.forEach(achieve=>{
+ if(achieve.orderItem==item){
+ achieve.achieveMoney=item.payMoney;
+ }
+ })
});
+
//计算欠款
// _this.order.arrears = _this.order.zkTotal - _this.order.payMoney;
// if (_this.order.arrears < 0) {
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html
index 00ed863..ec5869c 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html
@@ -177,10 +177,7 @@
<el-row style="padding: 10px 0;">
<h4>消费门店</h4>
<el-row style="text-align: center">
- <el-col :span="10" v-for="item in vipInfo.shopNames">
- <el-avatar size="small" :src="circleUrl"></el-avatar>
- <span class="col-style">{{item}}</span>
- </el-col>
+ <el-tag v-for="item in vipInfo.shopNames" >{{item}}</el-tag>
</el-row>
</el-row>
</el-row>
--
Gitblit v1.9.1