|
@@ -1,6 +1,7 @@
|
|
|
package com.ylx.massage.service.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
@@ -23,6 +24,7 @@ import com.ylx.massage.service.*;
|
|
|
import com.ylx.massage.utils.DateTimeUtils;
|
|
|
import com.ylx.massage.utils.MassageUtil;
|
|
|
import com.ylx.massage.utils.OrderNumberGenerator;
|
|
|
+import com.ylx.massage.utils.WeChatUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.compress.utils.Lists;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -76,6 +78,10 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
|
|
|
@Resource
|
|
|
private CouponService couponService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private WeChatUtil weChatUtil;
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
public Boolean isFree(String jsId, BigDecimal distance) {
|
|
@@ -219,6 +225,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
|
|
|
if (order.getPayType().equals(MassageConstants.INTEGER_ONE)) {
|
|
|
//微信支付
|
|
|
R resp = rechargeService.getPay(orderNew.getOrderNo(), orderNew.getTotalPrice(), orderNew.getcOpenId(), BillTypeEnum.WX_PAY.getInfo(),BillTypeEnum.WX_PAY.getCode().toString());
|
|
|
+ this.newOrderNotification(orderNew);
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
@@ -231,10 +238,36 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
|
|
|
throw new ServiceException("账户金额不够请充值");
|
|
|
} else {
|
|
|
orderPayManage(user, orderNew);
|
|
|
+ this.newOrderNotification(orderNew);
|
|
|
return R.ok();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public void newOrderNotification(TOrder order) {
|
|
|
+
|
|
|
+ cn.hutool.json.JSONObject param = JSONUtil.createObj();
|
|
|
+ //订单号
|
|
|
+ param.set("character_string9", JSONUtil.createObj().set("value", order.getOrderNo()));
|
|
|
+ //点话
|
|
|
+ param.set("phone_number14",JSONUtil.createObj().set("value", order.getcPhone()));
|
|
|
+ param.set("thing18",JSONUtil.createObj().set("value", order.getcName()));
|
|
|
+ param.set("time6",JSONUtil.createObj().set("value", DateTimeUtils.formatDate(new Date(), DateTimeUtils.DATE_NUMBER_YEAR_MONTH_FORMAT)));
|
|
|
+ String caddress = order.getcAddress();
|
|
|
+ Object parse = JSONObject.parse(caddress);
|
|
|
+ String addres = " ";
|
|
|
+ if (parse instanceof JSONObject) {
|
|
|
+ JSONObject jsonObject = (JSONObject) parse;
|
|
|
+ String name = jsonObject.getString("name");
|
|
|
+ String address = jsonObject.getString("address");
|
|
|
+ addres = name + " " + address;
|
|
|
+ }
|
|
|
+ param.set("thing27",JSONUtil.createObj().set("value", addres));
|
|
|
+ TJs js = jsService.getById(order.getcJsId());
|
|
|
+ weChatUtil.notification(js.getcOpenId(), param);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void orderPayManage(TWxUser user, TOrder orderNew) {
|
|
|
|