提交查询门店和积分返利

yy_dev
袁野 1 year ago
parent 54bfc357a5
commit d5573788ad
  1. 47
      cweb/src/main/java/com/cweb/controller/TestController.java
  2. 37
      service/src/main/java/com/hfkj/model/HwPushModel/HwPushBody.java
  3. 35
      service/src/main/java/com/hfkj/model/HwPushModel/HwPushMessage.java

@ -20,6 +20,7 @@ import com.hfkj.config.CommonSysConst;
import com.hfkj.config.device.SoundService; import com.hfkj.config.device.SoundService;
import com.hfkj.config.mqtt.MqttProviderService; import com.hfkj.config.mqtt.MqttProviderService;
import com.hfkj.entity.*; import com.hfkj.entity.*;
import com.hfkj.model.HwPushModel.HwPushMessage;
import com.hfkj.model.MerBasisModel; import com.hfkj.model.MerBasisModel;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
import com.hfkj.service.*; import com.hfkj.service.*;
@ -27,7 +28,6 @@ import com.hfkj.sysenum.MerStatusEnum;
import com.hfkj.sysenum.PlatformTypeEnum; import com.hfkj.sysenum.PlatformTypeEnum;
import com.hfkj.sysenum.StoreCreateTypeEnum; import com.hfkj.sysenum.StoreCreateTypeEnum;
import com.hfkj.sysenum.StoreStatusEnum; import com.hfkj.sysenum.StoreStatusEnum;
import com.hfkj.tts.HWYunSisService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
@ -640,16 +640,21 @@ public class TestController {
} }
@RequestMapping(value="/ttsCustomDemo",method = RequestMethod.GET) @RequestMapping(value="/getHwToken",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "ttsCustomDemo") @ApiOperation(value = "getHwToken")
public ResponseData ttsCustomDemo() { public ResponseData getHwToken() {
try { try {
JSONObject object = new JSONObject(); Map<String , Object> object = new HashMap<>();
object.put("price" , "374.87");
object.put("grant_type" , "client_credentials");
object.put("client_id" , "108509887");
object.put("client_secret" , "e40883f0edf09d1083b497d4e994eafbbdb5517ae548449c5b44977640a75d9a");
return ResponseMsgUtil.success(HWYunSisService.ttsCustomDemo(object)); JSONObject post = HttpsUtils.doPost("https://oauth-login.cloud.huawei.com/oauth2/v3/token" , object);
return ResponseMsgUtil.success(post);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
@ -657,6 +662,34 @@ public class TestController {
} }
} }
@RequestMapping(value="/getHwPushMsg",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "getHwPushMsg")
public ResponseData getHwPushMsg(@RequestParam(name = "token", required = true) String token , @RequestParam(name = "hwToken", required = true) String hwToken ) {
try {
HwPushMessage pushMessage = new HwPushMessage();
pushMessage.setData("测试数据");
String[] pushToken = {hwToken};
pushMessage.setToken(pushToken);
Map<String , Object> map = new HashMap<>();
map.put("setValidate_only" , true);
map.put("message" , pushMessage);
// 头部参数
Map<String, Object> heard = new HashMap<>();
heard.put("Authorization", token);
JSONObject post = HttpsUtils.doPost("https://push-api.cloud.huawei.com/v2/388421841221523062/messages:send" , map , heard);
return ResponseMsgUtil.success(post);
} catch (Exception e) {
log.error(e.getMessage(), e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/uniPush",method = RequestMethod.GET) @RequestMapping(value="/uniPush",method = RequestMethod.GET)
@ResponseBody @ResponseBody

@ -0,0 +1,37 @@
package com.hfkj.model.HwPushModel;
/**
* @author sum1dream
*/
public class HwPushBody {
/**
* @Author Sum1Dream
* @Description // 控制当前是否为测试消息,测试消息只做格式合法性校验,不会推送给用户设备,取值如下:
* true测试消息
* false正式消息默认值
*/
private Boolean validate_only;
/**
* @Author Sum1Dream
* @Description // 推送消息结构体,message结构体中必须存在有效消息负载以及有效发送目标
*/
private HwPushMessage hwPushMessage;
public Boolean getValidate_only() {
return validate_only;
}
public void setValidate_only(Boolean validate_only) {
this.validate_only = validate_only;
}
public HwPushMessage getHwPushMessage() {
return hwPushMessage;
}
public void setHwPushMessage(HwPushMessage hwPushMessage) {
this.hwPushMessage = hwPushMessage;
}
}

@ -0,0 +1,35 @@
package com.hfkj.model.HwPushModel;
/**
* @author sum1dream
*/
public class HwPushMessage {
/**
* @Author Sum1Dream
* @Description // 自定义消息负载,通知栏消息支持JSON格式字符串,透传消息支持普通字符串或者JSON格式字符串。
*/
private String data;
/**
* @Author Sum1Dream
* @Description // 按照Token向目标用户推消息。
*/
private String[] token;
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public String[] getToken() {
return token;
}
public void setToken(String[] token) {
this.token = token;
}
}
Loading…
Cancel
Save