消息通知
This commit is contained in:
@@ -20,3 +20,13 @@ values (1002,'1.0.0.2','http://mall.yyundong.com/apks/mall-1002.apk','BUG修复
|
|||||||
|
|
||||||
insert into app_version(versionCode,versionName,downloadUrl,versionInfo,fileName)
|
insert into app_version(versionCode,versionName,downloadUrl,versionInfo,fileName)
|
||||||
values (1003,'1.0.0.3','http://mall.yyundong.com/apks/mall-1003.apk','登录方式切换的Bug修复;登录及退出后本地缓存数据问题的修复。','mall-1003.apk')
|
values (1003,'1.0.0.3','http://mall.yyundong.com/apks/mall-1003.apk','登录方式切换的Bug修复;登录及退出后本地缓存数据问题的修复。','mall-1003.apk')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE `push_cids` (
|
||||||
|
`id` bigint(32) NOT NULL AUTO_INCREMENT COMMENT 'ID,唯一编号',
|
||||||
|
`getuiCid` varchar(100) NOT NULL COMMENT '个推的ClientID',
|
||||||
|
`userPhone` varchar(100) DEFAULT NULL COMMENT '用户手机号',
|
||||||
|
`userId` bigint(32) DEFAULT NULL COMMENT '用户ID',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
@@ -5,11 +5,10 @@ import com.getui.push.v2.sdk.GtApiConfiguration;
|
|||||||
import com.getui.push.v2.sdk.api.PushApi;
|
import com.getui.push.v2.sdk.api.PushApi;
|
||||||
import com.getui.push.v2.sdk.common.ApiResult;
|
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.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.PushDTO;
|
||||||
import com.getui.push.v2.sdk.dto.req.message.PushMessage;
|
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.GTNotification;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -17,6 +16,36 @@ import java.util.Map;
|
|||||||
@Component
|
@Component
|
||||||
public class UniPushService {
|
public class UniPushService {
|
||||||
|
|
||||||
|
// @Value("${unipush.appid:UBUIDJ8NQm50rGJsB6LYx1}")
|
||||||
|
// private String appid;
|
||||||
|
|
||||||
|
private static String apiurl = "https://restapi.getui.com/v2/";
|
||||||
|
private static String appid = "UBUIDJ8NQm50rGJsB6LYx1";
|
||||||
|
private static String appkey = "RS3UZfeS509hcNEkmfS6R";
|
||||||
|
private static String appsecret = "6QuFcPWFga8DQzSa03ruR7";
|
||||||
|
private static String mastersecret = "6fjUinwRfDA3BcEnDQvTl5";
|
||||||
|
private static String apppackage = "org.jbase.yxt.yyd.pyw";
|
||||||
|
|
||||||
|
private static PushApi pushApi = null;
|
||||||
|
|
||||||
|
private PushApi singlePushApi() {
|
||||||
|
if (pushApi == null) {
|
||||||
|
System.setProperty("http.maxConnections", "200");
|
||||||
|
GtApiConfiguration apiConfiguration = new GtApiConfiguration();
|
||||||
|
//填写应用配置
|
||||||
|
apiConfiguration.setAppId(appid);
|
||||||
|
apiConfiguration.setAppKey(appkey);
|
||||||
|
apiConfiguration.setMasterSecret(mastersecret);
|
||||||
|
// 接口调用前缀,请查看文档: 接口调用规范 -> 接口前缀, 可不填写appId
|
||||||
|
apiConfiguration.setDomain(apiurl);
|
||||||
|
// 实例化ApiHelper对象,用于创建接口对象
|
||||||
|
ApiHelper apiHelper = ApiHelper.build(apiConfiguration);
|
||||||
|
// 创建对象,建议复用。目前有PushApi、StatisticApi、UserApi
|
||||||
|
pushApi = apiHelper.creatApi(PushApi.class);
|
||||||
|
}
|
||||||
|
return pushApi;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void test() {
|
public void test() {
|
||||||
// 设置httpClient最大连接数,当并发较大时建议调大此参数。或者启动参数加上 -Dhttp.maxConnections=200
|
// 设置httpClient最大连接数,当并发较大时建议调大此参数。或者启动参数加上 -Dhttp.maxConnections=200
|
||||||
@@ -106,5 +135,4 @@ public class UniPushService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -83,3 +83,10 @@ jwt.expiration=604800
|
|||||||
#JWT\u8D1F\u8F7D\u4E2D\u62FF\u5230\u5F00\u5934
|
#JWT\u8D1F\u8F7D\u4E2D\u62FF\u5230\u5F00\u5934
|
||||||
jwt.tokenHead=Bearer
|
jwt.tokenHead=Bearer
|
||||||
#===JWT end===
|
#===JWT end===
|
||||||
|
|
||||||
|
unipush.baseurl=https://restapi.getui.com/v2/UBUIDJ8NQm50rGJsB6LYx1
|
||||||
|
unipush.appid=UBUIDJ8NQm50rGJsB6LYx1
|
||||||
|
unipush.appkey=RS3UZfeS509hcNEkmfS6R
|
||||||
|
unipush.appsecret=6QuFcPWFga8DQzSa03ruR7
|
||||||
|
unipush.mastersecret=6fjUinwRfDA3BcEnDQvTl5
|
||||||
|
unipush.apppackage=org.jbase.yxt.yyd.pyw
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
/*********************************************************
|
||||||
|
*********************************************************
|
||||||
|
******************** *******************
|
||||||
|
************* ************
|
||||||
|
******* _oo0oo_ *******
|
||||||
|
*** o8888888o ***
|
||||||
|
* 88" . "88 *
|
||||||
|
* (| -_- |) *
|
||||||
|
* 0\ = /0 *
|
||||||
|
* ___/`---'\___ *
|
||||||
|
* .' \\| |// '. *
|
||||||
|
* / \\||| : |||// \ *
|
||||||
|
* / _||||| -:- |||||- \ *
|
||||||
|
* | | \\\ - /// | | *
|
||||||
|
* | \_| ''\---/'' |_/ | *
|
||||||
|
* \ .-\__ '-' ___/-. / *
|
||||||
|
* ___'. .' /--.--\ `. .'___ *
|
||||||
|
* ."" '< `.___\_<|>_/___.' >' "". *
|
||||||
|
* | | : `- \`.;`\ _ /`;.`/ - ` : | | *
|
||||||
|
* \ \ `_. \_ __\ /__ _/ .-` / / *
|
||||||
|
* =====`-.____`.___ \_____/___.-`___.-'===== *
|
||||||
|
* `=---=' *
|
||||||
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
|
||||||
|
*********__佛祖保佑__永无BUG__验收通过__钞票多多__*********
|
||||||
|
*********************************************************/
|
||||||
|
package com.zscat.mallplus.unipush.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Project: mallplus <br/>
|
||||||
|
* File: PushCids.java <br/>
|
||||||
|
* Class: com.zscat.mallplus.unipush.entity.PushCids <br/>
|
||||||
|
* Description: <描述类的功能>. <br/>
|
||||||
|
* Copyright: Copyright (c) 2011 <br/>
|
||||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||||
|
* Makedate: 2023/3/16 21:36 <br/>
|
||||||
|
*
|
||||||
|
* @author liupopo
|
||||||
|
* @version 1.0
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("push_cids")
|
||||||
|
public class PushCids implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public PushCids() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public PushCids(String getuiCid) {
|
||||||
|
this.getuiCid = getuiCid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PushCids(String getuiCid, String userPhone) {
|
||||||
|
this.getuiCid = getuiCid;
|
||||||
|
this.userPhone = userPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private String getuiCid;// 个推的ClientID
|
||||||
|
private String userPhone;// 用户手机号
|
||||||
|
private Long userId;// 用户ID
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*********************************************************
|
||||||
|
*********************************************************
|
||||||
|
******************** *******************
|
||||||
|
************* ************
|
||||||
|
******* _oo0oo_ *******
|
||||||
|
*** o8888888o ***
|
||||||
|
* 88" . "88 *
|
||||||
|
* (| -_- |) *
|
||||||
|
* 0\ = /0 *
|
||||||
|
* ___/`---'\___ *
|
||||||
|
* .' \\| |// '. *
|
||||||
|
* / \\||| : |||// \ *
|
||||||
|
* / _||||| -:- |||||- \ *
|
||||||
|
* | | \\\ - /// | | *
|
||||||
|
* | \_| ''\---/'' |_/ | *
|
||||||
|
* \ .-\__ '-' ___/-. / *
|
||||||
|
* ___'. .' /--.--\ `. .'___ *
|
||||||
|
* ."" '< `.___\_<|>_/___.' >' "". *
|
||||||
|
* | | : `- \`.;`\ _ /`;.`/ - ` : | | *
|
||||||
|
* \ \ `_. \_ __\ /__ _/ .-` / / *
|
||||||
|
* =====`-.____`.___ \_____/___.-`___.-'===== *
|
||||||
|
* `=---=' *
|
||||||
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
|
||||||
|
*********__佛祖保佑__永无BUG__验收通过__钞票多多__*********
|
||||||
|
*********************************************************/
|
||||||
|
package com.zscat.mallplus.unipush.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.zscat.mallplus.unipush.entity.PushCids;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Project: mallplus <br/>
|
||||||
|
* File: PushCidsMapper.java <br/>
|
||||||
|
* Class: com.zscat.mallplus.unipush.entity.PushCidsMapper <br/>
|
||||||
|
* Description: <描述类的功能>. <br/>
|
||||||
|
* Copyright: Copyright (c) 2011 <br/>
|
||||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||||
|
* Makedate: 2023/3/16 21:46 <br/>
|
||||||
|
*
|
||||||
|
* @author liupopo
|
||||||
|
* @version 1.0
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
public interface PushCidsMapper extends BaseMapper<PushCids> {
|
||||||
|
}
|
||||||
@@ -204,12 +204,12 @@
|
|||||||
<artifactId>wsdl4j</artifactId>
|
<artifactId>wsdl4j</artifactId>
|
||||||
<version>1.6.3</version>
|
<version>1.6.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>com.getui.push</groupId>
|
<!-- <groupId>com.getui.push</groupId>-->
|
||||||
<artifactId>restful-sdk</artifactId>
|
<!-- <artifactId>restful-sdk</artifactId>-->
|
||||||
<version>1.0.0.11</version>
|
<!-- <version>1.0.0.11</version>-->
|
||||||
<scope>compile</scope>
|
<!-- <scope>compile</scope>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.zscat.mallplus.single;
|
package com.zscat.mallplus.single;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.thread.ThreadUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.zscat.mallplus.annotation.IgnoreAuth;
|
import com.zscat.mallplus.annotation.IgnoreAuth;
|
||||||
@@ -25,6 +26,7 @@ import com.zscat.mallplus.ums.service.IAdminSysNoticeService;
|
|||||||
import com.zscat.mallplus.ums.service.IUmsMemberLocationService;
|
import com.zscat.mallplus.ums.service.IUmsMemberLocationService;
|
||||||
import com.zscat.mallplus.ums.service.IUmsMemberService;
|
import com.zscat.mallplus.ums.service.IUmsMemberService;
|
||||||
import com.zscat.mallplus.ums.service.RedisService;
|
import com.zscat.mallplus.ums.service.RedisService;
|
||||||
|
import com.zscat.mallplus.unipush.PushCidsService;
|
||||||
import com.zscat.mallplus.util.JsonUtils;
|
import com.zscat.mallplus.util.JsonUtils;
|
||||||
import com.zscat.mallplus.util.OssAliyunUtil;
|
import com.zscat.mallplus.util.OssAliyunUtil;
|
||||||
import com.zscat.mallplus.utils.CommonResult;
|
import com.zscat.mallplus.utils.CommonResult;
|
||||||
@@ -98,10 +100,14 @@ public class SingelHomeController {
|
|||||||
@Resource
|
@Resource
|
||||||
private MallplusProperties mallplusProperties;
|
private MallplusProperties mallplusProperties;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PushCidsService pushCidsService;
|
||||||
|
|
||||||
@RequestMapping(value = "/sysInfo", method = RequestMethod.GET)
|
@RequestMapping(value = "/sysInfo", method = RequestMethod.GET)
|
||||||
public Object sysInfo() {
|
public Object sysInfo() {
|
||||||
return new CommonResult().success(mallplusProperties);
|
return new CommonResult().success(mallplusProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
@IgnoreAuth
|
@IgnoreAuth
|
||||||
@ApiOperation("首页内容页信息展示")
|
@ApiOperation("首页内容页信息展示")
|
||||||
@SysLog(MODULE = "home", REMARK = "首页内容页信息展示")
|
@SysLog(MODULE = "home", REMARK = "首页内容页信息展示")
|
||||||
@@ -348,7 +354,8 @@ public class SingelHomeController {
|
|||||||
@ApiOperation(value = "手机号 密码登录")
|
@ApiOperation(value = "手机号 密码登录")
|
||||||
@PostMapping(value = "/login")
|
@PostMapping(value = "/login")
|
||||||
public Object login(@RequestParam("phone") String phone,
|
public Object login(@RequestParam("phone") String phone,
|
||||||
@RequestParam("password") String password) {
|
@RequestParam("password") String password,
|
||||||
|
@RequestParam(required = false) String cid) {
|
||||||
if (phone == null || "".equals(phone)) {
|
if (phone == null || "".equals(phone)) {
|
||||||
return new CommonResult().validateFailed("用户名或密码错误");
|
return new CommonResult().validateFailed("用户名或密码错误");
|
||||||
}
|
}
|
||||||
@@ -361,6 +368,9 @@ public class SingelHomeController {
|
|||||||
log.info("用户名或密码错误");
|
log.info("用户名或密码错误");
|
||||||
return new CommonResult().failed("用户名或密码错误");
|
return new CommonResult().failed("用户名或密码错误");
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isNotBlank(cid) && StringUtils.isNotBlank(phone)) {
|
||||||
|
ThreadUtil.execute(() -> pushCidsService.bindPhone(cid, phone));
|
||||||
|
}
|
||||||
return new CommonResult().success(token);
|
return new CommonResult().success(token);
|
||||||
} catch (AuthenticationException e) {
|
} catch (AuthenticationException e) {
|
||||||
log.info("用户名或密码错误");
|
log.info("用户名或密码错误");
|
||||||
@@ -376,7 +386,8 @@ public class SingelHomeController {
|
|||||||
@ApiOperation(value = "手机和验证码登录")
|
@ApiOperation(value = "手机和验证码登录")
|
||||||
@PostMapping(value = "/loginByCode")
|
@PostMapping(value = "/loginByCode")
|
||||||
public Object loginByCode(@RequestParam String phone,
|
public Object loginByCode(@RequestParam String phone,
|
||||||
@RequestParam String authCode) {
|
@RequestParam String authCode,
|
||||||
|
@RequestParam(required = false) String cid) {
|
||||||
if (phone == null || "".equals(phone)) {
|
if (phone == null || "".equals(phone)) {
|
||||||
return new CommonResult().validateFailed("用户名或密码错误");
|
return new CommonResult().validateFailed("用户名或密码错误");
|
||||||
}
|
}
|
||||||
@@ -388,6 +399,9 @@ public class SingelHomeController {
|
|||||||
if (token.get("token") == null) {
|
if (token.get("token") == null) {
|
||||||
return new CommonResult().validateFailed("用户名或密码错误");
|
return new CommonResult().validateFailed("用户名或密码错误");
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isNotBlank(cid) && StringUtils.isNotBlank(phone)) {
|
||||||
|
ThreadUtil.execute(() -> pushCidsService.bindPhone(cid, phone));
|
||||||
|
}
|
||||||
return new CommonResult().success(token);
|
return new CommonResult().success(token);
|
||||||
} catch (AuthenticationException e) {
|
} catch (AuthenticationException e) {
|
||||||
return new CommonResult().validateFailed("用户名或密码错误");
|
return new CommonResult().validateFailed("用户名或密码错误");
|
||||||
@@ -448,19 +462,19 @@ public class SingelHomeController {
|
|||||||
@IgnoreAuth
|
@IgnoreAuth
|
||||||
@ApiOperation("获取验证码")
|
@ApiOperation("获取验证码")
|
||||||
@PostMapping(value = "/sms/codes")
|
@PostMapping(value = "/sms/codes")
|
||||||
public Object sendSmsCode(@RequestParam("phone") String phone,@RequestParam(value = "type")String type) {
|
public Object sendSmsCode(@RequestParam("phone") String phone, @RequestParam(value = "type") String type) {
|
||||||
try {
|
try {
|
||||||
if (!PhoneUtil.checkPhone(phone)) {
|
if (!PhoneUtil.checkPhone(phone)) {
|
||||||
throw new IllegalArgumentException("手机号格式不正确");
|
throw new IllegalArgumentException("手机号格式不正确");
|
||||||
}
|
}
|
||||||
if(StringUtils.isBlank(type)){
|
if (StringUtils.isBlank(type)) {
|
||||||
return new CommonResult().failed("参数错误:type");
|
return new CommonResult().failed("参数错误:type");
|
||||||
}
|
}
|
||||||
//缓存识别码
|
//缓存识别码
|
||||||
String redisKey = "";
|
String redisKey = "";
|
||||||
if(SmsEnum.SendEnum.LOGIN.getCode().equals(type)){
|
if (SmsEnum.SendEnum.LOGIN.getCode().equals(type)) {
|
||||||
redisKey = REDIS_KEY_PREFIX_LOGIN_CODE;
|
redisKey = REDIS_KEY_PREFIX_LOGIN_CODE;
|
||||||
}else if(SmsEnum.SendEnum.FORGET.getCode().equals(type)){
|
} else if (SmsEnum.SendEnum.FORGET.getCode().equals(type)) {
|
||||||
redisKey = REDIS_KEY_PREFIX_FORGET_CODE;
|
redisKey = REDIS_KEY_PREFIX_FORGET_CODE;
|
||||||
}
|
}
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
@@ -473,7 +487,7 @@ public class SingelHomeController {
|
|||||||
return new CommonResult().failed("请等待一分钟后再次重试!");
|
return new CommonResult().failed("请等待一分钟后再次重试!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SmsCode smsCode = memberService.generateCode(phone,type,date);
|
SmsCode smsCode = memberService.generateCode(phone, type, date);
|
||||||
|
|
||||||
return new CommonResult().success(smsCode);
|
return new CommonResult().success(smsCode);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -606,4 +620,15 @@ public class SingelHomeController {
|
|||||||
SecurityContextHolder.getContext().setAuthentication(null);
|
SecurityContextHolder.getContext().setAuthentication(null);
|
||||||
return new CommonResult().success(null);
|
return new CommonResult().success(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@IgnoreAuth
|
||||||
|
@ApiOperation("提供unipush的ClientID")
|
||||||
|
@PostMapping(value = "/pushCid")
|
||||||
|
public Object pushCid(@RequestParam String cid) {
|
||||||
|
if (StringUtils.isNotBlank(cid)) {
|
||||||
|
ThreadUtil.execute(() -> pushCidsService.pushCid(cid));
|
||||||
|
}
|
||||||
|
return new CommonResult().success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
/*********************************************************
|
||||||
|
*********************************************************
|
||||||
|
******************** *******************
|
||||||
|
************* ************
|
||||||
|
******* _oo0oo_ *******
|
||||||
|
*** o8888888o ***
|
||||||
|
* 88" . "88 *
|
||||||
|
* (| -_- |) *
|
||||||
|
* 0\ = /0 *
|
||||||
|
* ___/`---'\___ *
|
||||||
|
* .' \\| |// '. *
|
||||||
|
* / \\||| : |||// \ *
|
||||||
|
* / _||||| -:- |||||- \ *
|
||||||
|
* | | \\\ - /// | | *
|
||||||
|
* | \_| ''\---/'' |_/ | *
|
||||||
|
* \ .-\__ '-' ___/-. / *
|
||||||
|
* ___'. .' /--.--\ `. .'___ *
|
||||||
|
* ."" '< `.___\_<|>_/___.' >' "". *
|
||||||
|
* | | : `- \`.;`\ _ /`;.`/ - ` : | | *
|
||||||
|
* \ \ `_. \_ __\ /__ _/ .-` / / *
|
||||||
|
* =====`-.____`.___ \_____/___.-`___.-'===== *
|
||||||
|
* `=---=' *
|
||||||
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
|
||||||
|
*********__佛祖保佑__永无BUG__验收通过__钞票多多__*********
|
||||||
|
*********************************************************/
|
||||||
|
package com.zscat.mallplus.unipush;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.zscat.mallplus.unipush.entity.PushCids;
|
||||||
|
import com.zscat.mallplus.unipush.mapper.PushCidsMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Project: mallplus <br/>
|
||||||
|
* File: IPushCidsService.java <br/>
|
||||||
|
* Class: com.zscat.mallplus.unipush.service.IPushCidsService <br/>
|
||||||
|
* Description: <描述类的功能>. <br/>
|
||||||
|
* Copyright: Copyright (c) 2011 <br/>
|
||||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||||
|
* Makedate: 2023/3/16 22:18 <br/>
|
||||||
|
*
|
||||||
|
* @author liupopo
|
||||||
|
* @version 1.0
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PushCidsService extends ServiceImpl<PushCidsMapper, PushCids> {
|
||||||
|
public void pushCid(String cid) {
|
||||||
|
List<PushCids> list = listByCid(cid);
|
||||||
|
if (list == null || list.isEmpty()) {
|
||||||
|
baseMapper.insert(new PushCids(cid));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PushCids> listByCid(String cid) {
|
||||||
|
QueryWrapper<PushCids> qw = new QueryWrapper<>();
|
||||||
|
qw.eq("getuiCid", cid);
|
||||||
|
return baseMapper.selectList(qw);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void bindPhone(String cid, String phone) {
|
||||||
|
List<PushCids> list = listByCid(cid);
|
||||||
|
if (list != null && list.size() == 1) { // 只有一条cid数据,判断是否和手机号相同
|
||||||
|
PushCids pc = list.get(0);
|
||||||
|
if (!phone.equals(pc.getUserPhone())) { // 手机号不同或为空,更新手机号
|
||||||
|
UpdateWrapper<PushCids> uw = new UpdateWrapper<>();
|
||||||
|
uw.set("userPhone", phone);
|
||||||
|
uw.eq("getuiCid", cid);
|
||||||
|
baseMapper.update(null, uw);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (list == null || list.isEmpty()) { // 如果没有cid,直接插入
|
||||||
|
baseMapper.insert(new PushCids(cid, phone));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// cid不为空且多于1条,全部删除只保留一条
|
||||||
|
deleteByCid(cid);
|
||||||
|
baseMapper.insert(new PushCids(cid, phone));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteByCid(String cid) {
|
||||||
|
UpdateWrapper<PushCids> uw = new UpdateWrapper<>();
|
||||||
|
uw.eq("getuiCid", cid);
|
||||||
|
baseMapper.delete(uw);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -135,10 +135,3 @@ wxsubpay.partnerKey=xxxx
|
|||||||
wxsubpay.certPath=xxxx
|
wxsubpay.certPath=xxxx
|
||||||
wxsubpay.domain=xxxx
|
wxsubpay.domain=xxxx
|
||||||
|
|
||||||
unipush.baseurl=https://restapi.getui.com/v2/UBUIDJ8NQm50rGJsB6LYx1
|
|
||||||
unipush.appid=UBUIDJ8NQm50rGJsB6LYx1
|
|
||||||
unipush.appkey=RS3UZfeS509hcNEkmfS6R
|
|
||||||
unipush.appsecret=6QuFcPWFga8DQzSa03ruR7
|
|
||||||
unipush.mastersecret=6fjUinwRfDA3BcEnDQvTl5
|
|
||||||
unipush.apppackage=org.jbase.yxt.yyd.pyw
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user