提交查询门店和积分返利

yy_dev
袁野 1 year ago
parent 18ca4dd49e
commit 3a0cd34915
  1. 65
      cweb/src/main/java/com/cweb/controller/TestController.java
  2. 7
      service/pom.xml
  3. 125
      service/src/main/java/com/hfkj/unipush/UniPushService.java

@ -2,61 +2,48 @@ package com.cweb.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.request.AlipaySystemOauthTokenRequest;
import com.alipay.api.response.AlipaySystemOauthTokenResponse;
import com.hfkj.channel.alipay.utils.AlipayRequest;
import com.hfkj.channel.alipay.utils.AlipayUtils;
import com.hfkj.channel.lakala.*;
import com.hfkj.channel.lakala.LaKaLaLedgerService;
import com.hfkj.channel.lakala.LaKaLaWalletService;
import com.hfkj.channel.lakala.config.LaKaLaConfig;
import com.hfkj.channel.saas.SaasActivityService;
import com.hfkj.channel.saas.SaasMerService;
import com.hfkj.channel.saas.config.SaasConfig;
import com.hfkj.channel.saas.utils.GenerateAgreementUtil;
import com.hfkj.channel.saas.utils.SaasCommon;
import com.hfkj.channel.saas.saasenum.FileImgType;
import com.hfkj.channel.saas.utils.SaasMerRequest;
import com.hfkj.channel.weixin.WeiXinMerService;
import com.hfkj.channel.weixin.utils.WxUtils;
import com.hfkj.channel.weixin.utils.sdk.WXPayConstants;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.common.utils.HttpsUtils;
import com.hfkj.common.utils.ImageUtils;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.config.CommonSysConst;
import com.hfkj.config.device.SoundService;
import com.hfkj.config.mqtt.MqttProviderService;
import com.hfkj.dao.BsStoreMapper;
import com.hfkj.dao.BsStoreMapperExt;
import com.hfkj.entity.*;
import com.hfkj.model.MerBasisModel;
import com.hfkj.model.ResponseData;
import com.hfkj.service.*;
import com.hfkj.sysenum.*;
import com.hfkj.sysenum.MerStatusEnum;
import com.hfkj.sysenum.PlatformTypeEnum;
import com.hfkj.sysenum.StoreCreateTypeEnum;
import com.hfkj.sysenum.StoreStatusEnum;
import com.hfkj.tts.HWYunSisService;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import com.hfkj.unipush.UniPushService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.coobird.thumbnailator.Thumbnails;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.io.*;
import java.io.File;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.function.Consumer;
@Controller
@RequestMapping(value = "/test")
@ -648,7 +635,7 @@ public class TestController {
@RequestMapping(value="/ttsCustomDemo",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "updateReview")
@ApiOperation(value = "ttsCustomDemo")
public ResponseData ttsCustomDemo() {
try {
@ -660,4 +647,30 @@ public class TestController {
}
}
@RequestMapping(value="/uniPush",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "uniPush")
public ResponseData uniPush(@RequestParam(name = "cid", required = true) String cid) {
try {
JSONObject object = new JSONObject();
object.put("cid" , cid);
object.put("title" , "测试测试");
object.put("body" , "惠支付收款88.8元");
UniPushService.androidTemplate(object);
return ResponseMsgUtil.success("audience");
} catch (Exception e) {
log.error(e.getMessage(), e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -378,6 +378,11 @@
<artifactId>huaweicloud-java-sdk-sis</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>com.getui.push</groupId>
<artifactId>restful-sdk</artifactId>
<version>1.0.0.13</version>
</dependency>
<!--<dependency>
<groupId>com.huaweicloud</groupId>
<artifactId>esdk-obs-java</artifactId>
@ -401,6 +406,7 @@
</resource>
</resources>
</build>
<repositories>
<repository>
<id>sis-repo</id>
@ -413,5 +419,6 @@
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</project>

@ -0,0 +1,125 @@
package com.hfkj.unipush;
import com.alibaba.fastjson.JSONObject;
import com.getui.push.v2.sdk.ApiHelper;
import com.getui.push.v2.sdk.GtApiConfiguration;
import com.getui.push.v2.sdk.api.PushApi;
import com.getui.push.v2.sdk.common.ApiResult;
import com.getui.push.v2.sdk.dto.req.Audience;
import com.getui.push.v2.sdk.dto.req.message.PushChannel;
import com.getui.push.v2.sdk.dto.req.message.PushDTO;
import com.getui.push.v2.sdk.dto.req.message.PushMessage;
import com.getui.push.v2.sdk.dto.req.message.android.AndroidDTO;
import com.getui.push.v2.sdk.dto.req.message.android.GTNotification;
import com.getui.push.v2.sdk.dto.req.message.android.ThirdNotification;
import com.getui.push.v2.sdk.dto.req.message.android.Ups;
import java.util.Map;
/**
* @author sum1dream
*/
public class UniPushService {
/**
* 创建请求
* @return
*/
private static PushApi createClient() {
// 设置httpClient最大连接数,当并发较大时建议调大此参数。或者启动参数加上 -Dhttp.maxConnections=200
System.setProperty("http.maxConnections", "200");
GtApiConfiguration apiConfiguration = new GtApiConfiguration();
//填写应用配置
apiConfiguration.setAppId("JwvQulOIsq8kcFGey8fxo4");
apiConfiguration.setAppKey("ERpW23I6gn8jo8NVcjP8H1");
apiConfiguration.setMasterSecret("t6HsZ4qwfK7YiBknIeaWy2");
// 接口调用前缀,请查看文档: 接口调用规范 -> 接口前缀, 可不填写appId
apiConfiguration.setDomain("https://restapi.getui.com/v2/");
// 实例化ApiHelper对象,用于创建接口对象
ApiHelper apiHelper = ApiHelper.build(apiConfiguration);
// 创建对象,建议复用。目前有PushApi、StatisticApi、UserApi
return apiHelper.creatApi(PushApi.class);
}
/**
* @Author Sum1Dream
* @Name androidTemplate
* @Description // 安卓模版
* @Date 16:08 2023/6/9
* @Param [uniPushModel]
* @Return void
*/
public static void androidTemplate(JSONObject object) {
PushApi pushApi = createClient();
/*设置接收人信息*/
//根据cid进行单推
PushDTO<Audience> pushDTO = new PushDTO<Audience>();
// 设置推送参数
pushDTO.setRequestId(System.currentTimeMillis() + "");
/**** 设置个推通道参数 *****/
PushMessage pushMessage = new PushMessage();
pushDTO.setPushMessage(pushMessage);
GTNotification notification = new GTNotification();
pushMessage.setNotification(notification);
notification.setTitle(object.getString("title"));
notification.setBody(object.getString("body"));
notification.setClickType("url");
notification.setUrl("https://www.getui.com");
/**** 设置个推通道参数,更多参数请查看文档或对象源码 *****/
/**** 设置厂商相关参数 ****/
PushChannel pushChannel = new PushChannel();
pushDTO.setPushChannel(pushChannel);
/*配置安卓厂商参数*/
AndroidDTO androidDTO = new AndroidDTO();
pushChannel.setAndroid(androidDTO);
Ups ups = new Ups();
androidDTO.setUps(ups);
ThirdNotification thirdNotification = new ThirdNotification();
ups.setNotification(thirdNotification);
thirdNotification.setTitle(object.getString("title"));
thirdNotification.setBody(object.getString("body"));
thirdNotification.setClickType("url");
thirdNotification.setUrl("https://www.getui.com");
// 两条消息的notify_id相同,新的消息会覆盖老的消息,取值范围:0-2147483647
// thirdNotification.setNotifyId("11177");
/*配置安卓厂商参数结束,更多参数请查看文档或对象源码*/
/*设置ios厂商参数*/
// IosDTO iosDTO = new IosDTO();
// pushChannel.setIos(iosDTO);
// // 相同的collapseId会覆盖之前的消息
// iosDTO.setApnsCollapseId("xxx");
// Aps aps = new Aps();
// iosDTO.setAps(aps);
// Alert alert = new Alert();
// aps.setAlert(alert);
// alert.setTitle("ios title");
// alert.setBody("ios body");
/*设置ios厂商参数结束,更多参数请查看文档或对象源码*/
/*设置接收人信息*/
Audience audience = new Audience();
pushDTO.setAudience(audience);
audience.addCid(object.getString("cid"));
/*设置接收人信息结束*/
/**** 设置厂商相关参数,更多参数请查看文档或对象源码 ****/
// 进行cid单推
ApiResult<Map<String, Map<String, String>>> apiResult = pushApi.pushToSingleByCid(pushDTO);
System.out.println("===========================================" + apiResult);
if (apiResult.isSuccess()) {
// success
System.out.println(apiResult.getData());
} else {
// failed
System.out.println("code:" + apiResult.getCode() + ", msg: " + apiResult.getMsg());
}
}
}
Loading…
Cancel
Save