From 5e43281d1d7a103c8f211ae5c86df7c89466e13b Mon Sep 17 00:00:00 2001 From: jyy <935090232@qq.com> Date: Tue, 26 Jan 2021 14:16:59 +0800 Subject: [PATCH] Merge branch 'api' into hive2.0 --- 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/resources/mybatis/mapper/hive/SysVipLabelDao.xml | 8 zq-erp/src/main/resources/templates/views/admin/hive/operate/label-list.html | 19 + 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 | 8 zq-erp/pom.xml | 15 zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/messageBulderDemo/YydsTemplateMessageBulder.java | 116 +++++++++ zq-erp/src/main/resources/templates/views/admin/hive/operate/label-form.html | 8 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/java/com/matrix/system/app/action/ApiCommonAction.java | 6 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/hive/dao/SysVipLabelDao.java | 2 zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/UniformMsgSentTask.java | 8 zq-erp/src/main/java/com/matrix/system/hive/action/SysVipLabelController.java | 16 zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/messageBulderDemo/YycgTemplateMessageBulder.java | 10 zq-erp/src/main/java/com/matrix/system/app/utils/Sms106Send.java | 65 +++++ 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 | 43 ++- 22 files changed, 661 insertions(+), 59 deletions(-) diff --git a/zq-erp/pom.xml b/zq-erp/pom.xml index 9b8b408..0b139a5 100644 --- a/zq-erp/pom.xml +++ b/zq-erp/pom.xml @@ -371,6 +371,12 @@ <artifactId>mapstruct</artifactId> <version>1.3.0.Final</version> </dependency> + + <dependency> + <groupId>cn.hutool</groupId> + <artifactId>hutool-all</artifactId> + <version>5.3.1</version> + </dependency> </dependencies> <build> <resources> @@ -384,11 +390,12 @@ <exclude>config/test/*</exclude> <exclude>config/xcx/*</exclude> - <!-- --> + <!-- - <exclude>config/config.json</exclude> - <exclude>config/application.properties</exclude> - <exclude>config/system.properties</exclude> + <exclude>config/config.json</exclude> + <exclude>config/application.properties</exclude> + <exclude>config/system.properties</exclude> + --> <exclude>**/*.woff</exclude> diff --git a/zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java b/zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java index dfd5149..f7b9c42 100644 --- a/zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java +++ b/zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java @@ -9,6 +9,7 @@ import com.matrix.system.app.dto.PwdResetDto; import com.matrix.system.app.dto.SmsCodeDto; import com.matrix.system.app.dto.UploadPhotoDto; +import com.matrix.system.app.utils.Sms106Send; import com.matrix.system.app.vo.UserInfoVo; import com.matrix.system.common.authority.DefaultAuthorityManager; import com.matrix.system.common.authority.strategy.AccountPasswordLogin; @@ -174,7 +175,10 @@ if (StringUtils.isNotBlank(codeExist)) { return AjaxResult.buildFailInstance("请勿重复发送验证码"); } - redisClient.saveValue(smsCodeDto.getTelphone(), "123456", 120); + + Integer code =(int) ((Math.random() * 9 + 1) * 100000); + Sms106Send.sendVerifyCode(smsCodeDto.getTelphone(), code.toString(), 2); + redisClient.saveValue(smsCodeDto.getTelphone(), code.toString(), 120); return AjaxResult.buildSuccessInstance("发送成功"); } diff --git a/zq-erp/src/main/java/com/matrix/system/app/utils/Sms106Send.java b/zq-erp/src/main/java/com/matrix/system/app/utils/Sms106Send.java new file mode 100644 index 0000000..4926ebb --- /dev/null +++ b/zq-erp/src/main/java/com/matrix/system/app/utils/Sms106Send.java @@ -0,0 +1,65 @@ +package com.matrix.system.app.utils; + +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.core.util.XmlUtil; +import cn.hutool.http.HttpUtil; +import com.matrix.core.exception.GlobleException; +import com.matrix.core.tools.LogUtil; + +import java.util.Date; +import java.util.HashMap; + +/** + * @author wzy + * @date 2020-07-14 + **/ +public class Sms106Send { + + private static final String URL = "http://www.qf106.com/sms.aspx"; + private static final String ID = "16655"; + private static final String ACCOUNT = "taiyan"; + private static final String PASSWORD = "123456"; + + + /** + * @param phone 手机号 + * @param code 验证码 + * @param time 失效时间 + * @return + */ + public static boolean sendVerifyCode(String phone, String code, int time) { + String msg = "您的验证码是{},请在{}分钟内输入,请勿泄露给他人,如非本人操作,请及时修改密码。"; + String content = StrUtil.format(msg, code, time); + return request(phone, content, "验证码"); + } + + private static boolean request(String phone, String content, String tagName) { + HashMap<String, Object> param = new HashMap<>(); + param.put("userid", ID); + param.put("account", ACCOUNT); + param.put("password", PASSWORD); + param.put("mobile", phone); + param.put("content", content); + param.put("sendTime", DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN)); + param.put("action", "send"); + param.put("checkcontent", 0); + param.put("taskName", tagName); + param.put("countnumber", 1); + param.put("mobilenumber", 1); + param.put("telephonenumber", 0); + + String response = HttpUtil.post(URL, param); + LogUtil.info("短信发送:{}, {}", tagName, response); + if ("Success".equals(XmlUtil.xmlToMap(response).get("returnstatus"))) { + return true; + } else { + throw new GlobleException((String) XmlUtil.xmlToMap(response).get("message")); + } + } + + public static void main(String[] args) { + System.out.println(sendVerifyCode("15773002834", "123456", 2)); + } +} 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/action/SysVipLabelController.java b/zq-erp/src/main/java/com/matrix/system/hive/action/SysVipLabelController.java index cbb8ac3..8d149de 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/action/SysVipLabelController.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/action/SysVipLabelController.java @@ -2,6 +2,7 @@ import com.matrix.core.pojo.AjaxResult; import com.matrix.core.pojo.PaginationVO; +import com.matrix.core.tools.StringUtils; import com.matrix.core.tools.WebUtil; import com.matrix.system.common.bean.SysUsers; import com.matrix.system.constance.Dictionary; @@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; +import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Random; @@ -85,23 +87,27 @@ int i = sysVipLabelDao.update(sysVipLabel); if (i > 0) { - AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("添加成功"); + AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("编辑成功"); ajaxResult.putInMap("label", sysVipLabel); return ajaxResult; } - return AjaxResult.buildFailInstance("添加失败"); + return AjaxResult.buildFailInstance("编辑失败"); } @RequestMapping(value = "/del") @ResponseBody - public AjaxResult del(Long id) { - int i = sysVipLabelDao.deleteById(id); + public AjaxResult del(String keys) { + List<Long> ids = StringUtils.strToCollToLong(keys, ","); + int i = sysVipLabelDao.deleteByIds(ids); if (i > 0) { return AjaxResult.buildSuccessInstance("删除成功"); + } else { + return AjaxResult.buildFailInstance("删除失败"); } - return AjaxResult.buildFailInstance("删除失败"); } + + @RequestMapping(value = "/edit") public String edit(Long id) { if (id != null) { 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/dao/SysVipLabelDao.java b/zq-erp/src/main/java/com/matrix/system/hive/dao/SysVipLabelDao.java index 87b5716..25774ab 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/dao/SysVipLabelDao.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/dao/SysVipLabelDao.java @@ -21,6 +21,8 @@ int deleteById(@Param("id") Long id); + int deleteByIds(@Param("list") List<Long> list); + List<SysVipLabel> selectByVipId(@Param("vipId") Long vipId); List<SysVipLabel> selectByModel(@Param("record") SysVipLabel sysVipLabel); 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/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/mybatis/mapper/hive/SysVipLabelDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipLabelDao.xml index 4e8d321..cae0a7a 100644 --- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipLabelDao.xml +++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipLabelDao.xml @@ -121,6 +121,14 @@ where id=#{id} </delete> + <delete id="deleteByIds" parameterType="java.util.List"> + delete from sys_vip_label where id in + <foreach collection="list" index="index" item="item" open="(" + separator="," close=")"> + #{item} + </foreach> + </delete> + <select id="selectByVipId" resultType="com.matrix.system.hive.bean.SysVipLabel"> select b.* 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 1c21de3..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"> @@ -835,17 +835,29 @@ } item.count = 1; - - //加入业绩 - this.achieveList.push({ - orderItem: item, - staff: this.loginUser, - saleId: this.loginUser.suId, - achieveMoney: item.payMoney, - t3 : '现金业绩', - commission : 0, - isShare: false, - }); + if (this.staffUser.suId) { + //加入业绩 + this.achieveList.push({ + orderItem: item, + staff: this.staffUser, + saleId: this.staffUser.suId, + achieveMoney: item.payMoney, + t3: '现金业绩', + commission: 0, + isShare: false, + }); + } else { + //加入业绩 + this.achieveList.push({ + orderItem: item, + staff: this.loginUser, + saleId: this.loginUser.suId, + achieveMoney: item.payMoney, + t3: '现金业绩', + commission: 0, + isShare: false, + }); + } this.order.items.push(item); } @@ -887,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 81b22a2..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 @@ -159,7 +159,6 @@ size="small" :key="tag.label" v-for="tag in tags.tags" - closable :disable-transitions="false" @close="handleClose(tag)"> {{tag.label}} @@ -173,15 +172,12 @@ @keyup.enter.native="handleInputConfirm" @blur="handleInputConfirm" ></el-input> - <el-button v-else class="button-new-tag" size="mini" @click="showInput">+</el-button> +<!-- <el-button v-else class="button-new-tag" size="mini" @click="showInput">+</el-button>--> </el-row> <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> diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/operate/label-form.html b/zq-erp/src/main/resources/templates/views/admin/hive/operate/label-form.html index 07c7835..6614330 100644 --- a/zq-erp/src/main/resources/templates/views/admin/hive/operate/label-form.html +++ b/zq-erp/src/main/resources/templates/views/admin/hive/operate/label-form.html @@ -21,7 +21,7 @@ <div class="form-group"> <label class="col-sm-2 control-label">标签<span class="text-danger">*</span></label> <div class="col-sm-4"> - <input autocomplete="off" dataType="*" class="form-control" name="label" ></input> + <input autocomplete="off" dataType="*" class="form-control" th:value="${obj?.label}" name="label" ></input> <div class="Validform_checktip"></div> </div> </div> @@ -44,9 +44,9 @@ var obj=/*[[${obj}]]*/ /*]]>*/ - var invokeUrl=basePath+"/admin/operate/add"; - if(obj.id!=null){ - invokeUrl = basePath+"/admin/operate/modify"; + var invokeUrl=basePath+"/admin/label/add"; + if(obj!=null&& obj.id!=null){ + invokeUrl = basePath+"/admin/label/modify"; } var myForm=MForm.initForm({ invokeUrl:invokeUrl, diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/operate/label-list.html b/zq-erp/src/main/resources/templates/views/admin/hive/operate/label-list.html index 3973f5c..9d6bce4 100644 --- a/zq-erp/src/main/resources/templates/views/admin/hive/operate/label-list.html +++ b/zq-erp/src/main/resources/templates/views/admin/hive/operate/label-list.html @@ -110,9 +110,14 @@ + '<ul class="dropdown-menu" role="menu">' + '<li><a href="javascript:void(0)" style="display:' + value - + '" onClick="lookInfo(\'' + + '" onClick="openEdit(\'' + value - + '\')" title="编辑">查看</a></li>' + + '\')" title="编辑">编辑</a></li>' + + '<li><a href="javascript:void(0)" style="display:' + + value + + '" onClick="myGrid.delItem(\'' + + value + + '\')" title="删除">删除</a></li>' + '</ul>' + '</div>'; html += ''; return html; } @@ -126,6 +131,16 @@ content : [ basePath+'/admin/label/edit'] }); } + + function openEdit(id) { + layer.open({ + type : 2, + title : "添加标签", + area : [ MUI.SIZE_L, '400px' ], + maxmin : true, + content : [ basePath+'/admin/label/edit?id=' + id] + }); + } </script> </body> </html> -- Gitblit v1.9.1