|
@@ -6,6 +6,7 @@ import com.miaxis.common.config.WxpayConfig;
|
|
|
import com.miaxis.common.constant.Constants;
|
|
|
import com.miaxis.common.enums.OrderStatusEnum;
|
|
|
import com.miaxis.common.exception.CustomException;
|
|
|
+import com.miaxis.common.utils.SecurityUtils;
|
|
|
import com.miaxis.feign.dto.WxSend;
|
|
|
import com.miaxis.feign.service.IWxSendService;
|
|
|
import com.miaxis.wx.domain.WxOrder;
|
|
@@ -26,6 +27,11 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.Date;
|
|
|
+
|
|
|
import static com.miaxis.common.utils.OrderCodeFactory.getOrderCode;
|
|
|
|
|
|
@RestController
|
|
@@ -52,7 +58,7 @@ public class FilmNotifyController {
|
|
|
@Autowired
|
|
|
IWxXcxMessageService wxXcxMessageService;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private IWxSendService wxSendService;
|
|
|
|
|
|
|
|
@@ -89,7 +95,7 @@ public class FilmNotifyController {
|
|
|
//如果订单状态成功,则调用小程序推送服务
|
|
|
if ("TICKET_SUCCESS".equals(wxOrderNotifyDTO.getEventName())){
|
|
|
wxOrder.setOrderStatus(OrderStatusEnum.SUCCESS.getCode());
|
|
|
- sendXcxMessage();
|
|
|
+ sendXcxMessage(wxOrder);
|
|
|
|
|
|
|
|
|
}
|
|
@@ -123,29 +129,42 @@ public class FilmNotifyController {
|
|
|
return filmNotifyReturnDTO;
|
|
|
}
|
|
|
|
|
|
- private void sendXcxMessage() {
|
|
|
+ private void sendXcxMessage(WxOrder wxOrder) {
|
|
|
String xcxMessageToken = wxXcxMessageService.getXcxMessageToken();
|
|
|
WxSend wxSend = new WxSend();
|
|
|
//wxSend.setAccess_token(xcxMessageToken);
|
|
|
- wxSend.setTouser("oO7PJ5JxqYj0kVYLb1e3FG55mD8E");
|
|
|
- wxSend.setTemplate_id("NlZAFJj1p5aHFOg6BBesP7xFAJh5kIZ0kp_YwtJje0g");
|
|
|
- wxSend.setPage("/pages/index/index?active=user");
|
|
|
+ String openid = SecurityUtils.getLoginUser().getStudent().getOpenid();
|
|
|
+ wxSend.setTouser(openid);
|
|
|
+ wxSend.setTemplate_id("Q4-tQrDwtzFUSLt_PR2kuTxBJ3d62V4Yp2iwx4PAcIE");
|
|
|
+ wxSend.setPage("/pages/cinema/orderdes?outTradeNo="+wxOrder.getOutTradeNo());
|
|
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
JSONObject jsonObject1 = new JSONObject();
|
|
|
JSONObject jsonObject2 = new JSONObject();
|
|
|
JSONObject jsonObject3 = new JSONObject();
|
|
|
- jsonObject1.put("value","2019年10月1日");
|
|
|
- jsonObject2.put("value","林霖强");
|
|
|
- jsonObject3.put("value","3");
|
|
|
- jsonObject.put("time3",jsonObject1);
|
|
|
- jsonObject.put("name1",jsonObject2);
|
|
|
- jsonObject.put("thing2",jsonObject3);
|
|
|
+ JSONObject jsonObject4 = new JSONObject();
|
|
|
+ JSONObject jsonObject5 = new JSONObject();
|
|
|
+
|
|
|
+ jsonObject1.put("value",wxOrder.getOutTradeNo());
|
|
|
+ jsonObject2.put("value","¥"+wxOrder.getTotal());
|
|
|
+ jsonObject3.put("value",new SimpleDateFormat("yyyy年MM月dd日 HH:mm").format(new Date()));
|
|
|
+ jsonObject4.put("value","电影票");
|
|
|
+ jsonObject5.put("value","点击查看取票二维码");
|
|
|
+
|
|
|
+ jsonObject.put("character_string1",jsonObject1);
|
|
|
+ jsonObject.put("amount3",jsonObject2);
|
|
|
+ jsonObject.put("date4",jsonObject3);
|
|
|
+ jsonObject.put("thing6",jsonObject4);
|
|
|
+ jsonObject.put("thing5",jsonObject5);
|
|
|
+
|
|
|
|
|
|
wxSend.setData(jsonObject);
|
|
|
- wxSend.setMiniprogram_state("developer");
|
|
|
+
|
|
|
+ log.info("发送推送请求数据:"+jsonObject);
|
|
|
+// wxSend.setMiniprogram_state("developer");
|
|
|
wxSend.setLang("zh_CN");
|
|
|
String result = wxSendService.sendMessage(xcxMessageToken,wxSend);
|
|
|
+ log.info("小程序推送请求数据返回值:"+result);
|
|
|
}
|
|
|
|
|
|
|