|
@@ -1,6 +1,7 @@
|
|
|
package com.usky.dxtop.service.listener;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.usky.dxtop.common.utils.DateUtils;
|
|
|
import com.usky.dxtop.common.utils.StringUtils;
|
|
|
import com.usky.dxtop.model.Dish;
|
|
|
import com.usky.dxtop.model.Staff;
|
|
@@ -26,6 +27,8 @@ import java.util.Map;
|
|
|
@Component
|
|
|
public class DishTransMqListener {
|
|
|
|
|
|
+
|
|
|
+ private static final String URL = "https://smartpark.caih.com/vuepay/#/record?id=2";
|
|
|
@Autowired
|
|
|
private DishService dishService;
|
|
|
@Autowired
|
|
@@ -48,14 +51,29 @@ public class DishTransMqListener {
|
|
|
staff.setBalance(dish.getBalance());
|
|
|
staffService.updateById(staff);
|
|
|
if (StringUtils.isNotBlank(staff.getOpenId())){
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- Map<String, Object> firstMap = new HashMap<>();
|
|
|
- firstMap.put("value","消费成功");
|
|
|
- map.put("first",firstMap);
|
|
|
- wxApi.sendMessageApi(staff.getOpenId(),map,wxApi.getToken(WxApi.APP_ID,WxApi.SECRET));
|
|
|
+ wxApi.sendMessageApi(staff.getOpenId(),getMessageData(dish),wxApi.getToken(WxApi.APP_ID,WxApi.SECRET), WxApi.DISH_TEMPLATE_ID,URL);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
log.info("dish_trade_produce"+"异常信息:" + e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public Map<String,Object> getMessageData(Dish dish){
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("first",getMap("尊敬的客户,您的订单已支付成功",null));
|
|
|
+ map.put("keyword1",getMap(dish.getSeq(),null));
|
|
|
+ map.put("keyword2",getMap(dish.getShopName(),null));
|
|
|
+ map.put("keyword3",getMap(String.format("%s%s", dish.getAmt()," 元"),null));
|
|
|
+ map.put("keyword4",getMap(DateUtils.format(dish.getCreateTime(),null),null));
|
|
|
+ map.put("keyword5",getMap(DateUtils.format(dish.getCreateTime(),null),null));
|
|
|
+ map.put("remark",getMap("如有疑问,请及时在线联系我们的客服!",null));
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Map<String,Object> getMap(Object value,String color){
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ map.put("value",value);
|
|
|
+ map.put("color",color);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
}
|