Commit 05b1a369 by zhangjw

Merge branch 'master' of http://119.28.51.83/hewei/Jumeirah into Jw

parents bb632de4 0816366d
package com.jumeirah.api.app.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jumeirah.common.entity.SysNotice;
import com.jumeirah.common.entity.SysNoticeRead;
import com.jumeirah.common.param.SysNoticeQueryVo;
import com.jumeirah.common.service.SysNoticeReadService;
import com.jumeirah.common.service.SysNoticeService;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
import io.geekidea.springbootplus.framework.log.enums.OperationLogType;
import io.geekidea.springbootplus.framework.shiro.jwt.JwtToken;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
* 系统通知表 控制器
*
* @author xxx
* @since 2020-11-06
*/
@Slf4j
@RestController
@RequestMapping("/app/sysNotice")
@Api(value = "系统通知表API", tags = {"系统通知表"})
public class SysNoticeController extends BaseController {
@Autowired
private SysNoticeService sysNoticeService;
@Autowired
private SysNoticeReadService sysNoticeReadService;
@PostMapping("/getList")
@OperationLog(name = "系统通知表列表", type = OperationLogType.PAGE)
@ApiOperation(value = "系统通知表列表")
public ApiResult<List<SysNoticeQueryVo>> list() throws Exception {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
List<SysNotice> list = sysNoticeService.list();
List<SysNoticeQueryVo> sysNoticeQueryVoList = new ArrayList<>();
for (SysNotice sysNotice : list) {
SysNoticeQueryVo sysNoticeQueryVo = new SysNoticeQueryVo();
sysNoticeQueryVo.setId(sysNotice.getId());
sysNoticeQueryVo.setTheme(sysNotice.getTheme());
sysNoticeQueryVo.setMsgInfo(sysNotice.getContent());
sysNoticeQueryVo.setSendTime(sysNotice.getCreateTime());
}
// 修改为已读
SysNoticeRead sysNoticeRead = sysNoticeReadService.getOne(new QueryWrapper<SysNoticeRead>().lambda()
.eq(SysNoticeRead::getUserId, jwtToken.getUserId()));
if (sysNoticeRead != null) {
sysNoticeRead.setReadStatus(1);
sysNoticeReadService.updateById(sysNoticeRead);
}
return ApiResult.ok(sysNoticeQueryVoList);
}
//
// /**
// * 添加系统通知表
// */
// @PostMapping("/add")
// @OperationLog(name = "添加系统通知表", type = OperationLogType.ADD)
// @ApiOperation(value = "添加系统通知表")
// public ApiResult<Boolean> addSysNotice(@Validated(Add.class) @RequestBody SysNotice sysNotice) throws Exception {
// boolean flag = sysNoticeService.saveSysNotice(sysNotice);
// return ApiResult.result(flag);
// }
//
// /**
// * 修改系统通知表
// */
// @PostMapping("/update")
// @OperationLog(name = "修改系统通知表", type = OperationLogType.UPDATE)
// @ApiOperation(value = "修改系统通知表")
// public ApiResult<Boolean> updateSysNotice(@Validated(Update.class) @RequestBody SysNotice sysNotice) throws Exception {
// boolean flag = sysNoticeService.updateSysNotice(sysNotice);
// return ApiResult.result(flag);
// }
//
// /**
// * 删除系统通知表
// */
// @PostMapping("/delete/{id}")
// @OperationLog(name = "删除系统通知表", type = OperationLogType.DELETE)
// @ApiOperation(value = "删除系统通知表")
// public ApiResult<Boolean> deleteSysNotice(@PathVariable("id") Long id) throws Exception {
// boolean flag = sysNoticeService.deleteSysNotice(id);
// return ApiResult.result(flag);
// }
//
// /**
// * 获取系统通知表详情
// */
// @GetMapping("/info/{id}")
// @OperationLog(name = "系统通知表详情", type = OperationLogType.INFO)
// @ApiOperation(value = "系统通知表详情")
// public ApiResult<SysNoticeQueryVo> getSysNotice(@PathVariable("id") Long id) throws Exception {
// SysNoticeQueryVo sysNoticeQueryVo = sysNoticeService.getSysNoticeById(id);
// return ApiResult.ok(sysNoticeQueryVo);
// }
/**
* 系统通知表分页列表
*/
// @PostMapping("/getPageList")
// @OperationLog(name = "系统通知表分页列表", type = OperationLogType.PAGE)
// @ApiOperation(value = "系统通知表分页列表")
// public ApiResult<Paging<SysNoticeQueryVo>> getSysNoticePageList(@Validated @RequestBody SysNoticePageParam sysNoticePageParam) throws Exception {
// Paging<SysNoticeQueryVo> paging = sysNoticeService.getSysNoticePageList(sysNoticePageParam);
// return ApiResult.ok(paging);
// }
}
package com.jumeirah.api.app.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jumeirah.common.entity.SysNoticeRead;
import com.jumeirah.common.param.SysNoticeReadQueryVo;
import com.jumeirah.common.service.SysNoticeReadService;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
import io.geekidea.springbootplus.framework.log.enums.OperationLogType;
import io.geekidea.springbootplus.framework.shiro.jwt.JwtToken;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 系统通知已读 未读 控制器
*
* @author xxx
* @since 2020-11-06
*/
@Slf4j
@RestController
@RequestMapping("/app/sysNoticeRead")
@Api(value = "系统通知已读 未读API", tags = {"系统通知已读 未读"})
public class SysNoticeReadController extends BaseController {
@Autowired
private SysNoticeReadService sysNoticeReadService;
/**
* 获取系统通知已读 未读详情
*/
@GetMapping("/getNoticeReadByUser")
@OperationLog(name = "用户是否已读系统通知", type = OperationLogType.INFO)
@ApiOperation(value = "用户是否已读系统通知")
public ApiResult<SysNoticeReadQueryVo> getSysNoticeReadByUser() throws Exception {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
SysNoticeRead one = sysNoticeReadService.getOne(
new QueryWrapper<SysNoticeRead>().lambda().eq(SysNoticeRead::getUserId, jwtToken.getUserId()));
SysNoticeReadQueryVo sysNoticeReadQueryVo = new SysNoticeReadQueryVo();
if (null == one) {
SysNoticeRead sysNoticeRead = new SysNoticeRead();
sysNoticeRead.setUserId(jwtToken.getUserId());
sysNoticeRead.setReadStatus(0);
sysNoticeReadService.save(sysNoticeRead);
sysNoticeReadQueryVo.setRead(0);
} else {
sysNoticeReadQueryVo.setRead(one.getReadStatus());
}
return ApiResult.ok(sysNoticeReadQueryVo);
}
// /**
// * 添加系统通知已读 未读
// */
// @PostMapping("/add")
// @OperationLog(name = "添加系统通知已读 未读", type = OperationLogType.ADD)
// @ApiOperation(value = "添加系统通知已读 未读")
// public ApiResult<Boolean> addSysNoticeRead(@Validated(Add.class) @RequestBody SysNoticeRead sysNoticeRead)throws Exception{
// boolean flag= sysNoticeReadService.saveSysNoticeRead(sysNoticeRead);
// return ApiResult.result(flag);
// }
//
// /**
// * 修改系统通知已读 未读
// */
// @PostMapping("/update")
// @OperationLog(name = "修改系统通知已读 未读", type = OperationLogType.UPDATE)
// @ApiOperation(value = "修改系统通知已读 未读")
// public ApiResult<Boolean> updateSysNoticeRead(@Validated(Update.class) @RequestBody SysNoticeRead sysNoticeRead)throws Exception{
// boolean flag= sysNoticeReadService.updateSysNoticeRead(sysNoticeRead);
// return ApiResult.result(flag);
// }
//
// /**
// * 删除系统通知已读 未读
// */
// @PostMapping("/delete/{id}")
// @OperationLog(name = "删除系统通知已读 未读", type = OperationLogType.DELETE)
// @ApiOperation(value = "删除系统通知已读 未读")
// public ApiResult<Boolean> deleteSysNoticeRead(@PathVariable("id") Long id)throws Exception{
// boolean flag= sysNoticeReadService.deleteSysNoticeRead(id);
// return ApiResult.result(flag);
// }
//
// /**
// * 获取系统通知已读 未读详情
// */
// @GetMapping("/info/{id}")
// @OperationLog(name = "系统通知已读 未读详情", type = OperationLogType.INFO)
// @ApiOperation(value = "系统通知已读 未读详情")
// public ApiResult<SysNoticeReadQueryVo> getSysNoticeRead(@PathVariable("id") Long id)throws Exception{
// SysNoticeReadQueryVo sysNoticeReadQueryVo = sysNoticeReadService.getSysNoticeReadById(id);
// return ApiResult.ok(sysNoticeReadQueryVo);
// }
// /**
// * 系统通知已读 未读分页列表
// */
// @PostMapping("/getPageList")
// @OperationLog(name = "系统通知已读 未读分页列表", type = OperationLogType.PAGE)
// @ApiOperation(value = "系统通知已读 未读分页列表")
// public ApiResult<Paging<SysNoticeReadQueryVo>>getSysNoticeReadPageList(@Validated @RequestBody SysNoticeReadPageParam sysNoticeReadPageParam)throws Exception{
// Paging<SysNoticeReadQueryVo> paging = sysNoticeReadService.getSysNoticeReadPageList(sysNoticeReadPageParam);
// return ApiResult.ok(paging);
// }
}
package io.geekidea.springbootplus.test;
import com.jumeirah.common.factory.PushFactory;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class PushTest {
@Autowired
private PushFactory pushFactory;
/**
* app推送:1.您有一条新消息(客服回复推送)
* 2.您的订单已报价(商家端报价完后推送)
* 3.您的订单已完成(商家端完成行程完后推送
*
* @throws Exception
*/
@Test
public void pu() throws Exception {
pushFactory.getService(1).unicast("Ar4opHQcGn-UA1-fZ7O6PAeNSJs9rCEEI5XRvS_0rQke", "2", "您的订单已报价");
pushFactory.getService(1).unicast("Ar4opHQcGn-UA1-fZ7O6PAeNSJs9rCEEI5XRvS_0rQke", "3", "您的订单已完成");
}
}
......@@ -48,13 +48,18 @@
<version>3.4.7</version>
</dependency>
<!-- 极光 end -->
<!-- wecloud短信 start-->
<!-- <dependency>-->
<!-- <groupId>cn.wecloud</groupId>-->
<!-- <artifactId>we-cloud-sdk-sms</artifactId>-->
<!-- <version>0.0.1</version>-->
<!-- </dependency>-->
<dependency>
<groupId>cn.wecloud</groupId>
<artifactId>we-cloud-sdk-sms</artifactId>
<version>1.0.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- wecloud短信 end-->
</dependencies>
......
package com.jumeirah.common.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* 系统通知表
*
* @author xxx
* @since 2020-11-06
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "SysNotice对象")
public class SysNotice extends BaseEntity {
private static final long serialVersionUID = 1L;
@NotNull(message = "id不能为空")
@ApiModelProperty("id")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ApiModelProperty("主题")
private String theme;
@ApiModelProperty("内容")
private String content;
@ApiModelProperty("创建时间(时间戳)")
private Date createTime;
@ApiModelProperty("更新时间(时间戳)")
private Date updateTime;
@ApiModelProperty("状态,0-正常,1-禁用,99-删除")
private Integer status;
}
package com.jumeirah.common.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
/**
* 系统通知已读 未读
*
* @author xxx
* @since 2020-11-06
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "SysNoticeRead对象")
public class SysNoticeRead extends BaseEntity {
private static final long serialVersionUID = 1L;
@NotNull(message = "不能为空")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@NotNull(message = "用户ID不能为空")
@ApiModelProperty("用户ID")
private Long userId;
@ApiModelProperty("0未读 1已读")
private Integer readStatus;
}
package com.jumeirah.common.factory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @author: JJww
* @Date:2020/11/5
*/
@Component
public class PushFactory {
@Autowired
private PushService umengIosPushServiceImpl;
@Autowired
private PushService umengAndroidPushServiceImpl;
/**
* 创建对应实现类
*
* @param type
* @return
*/
public PushService getService(Integer type) {
switch (type) {
case 1:
return umengAndroidPushServiceImpl;
case 2:
return umengIosPushServiceImpl;
default:
return null;
}
}
}
package com.jumeirah.common.factory;
/**
* @author: JJww
* @Date:2020/11/5
*/
public interface PushService {
/**
* 单播
*
* @param deviceToken
*/
void unicast(String deviceToken);
void unicast(String deviceToken,String pushType,String title) throws Exception;
}
package com.jumeirah.common.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jumeirah.common.entity.SysNotice;
import com.jumeirah.common.param.SysNoticePageParam;
import com.jumeirah.common.param.SysNoticeQueryVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.io.Serializable;
/**
* 系统通知表 Mapper 接口
*
* @author xxx
* @since 2020-11-06
*/
@Repository
public interface SysNoticeMapper extends BaseMapper<SysNotice> {
/**
* 根据ID获取查询对象
*
* @param id
* @return
*/
SysNoticeQueryVo getSysNoticeById(Serializable id);
/**
* 获取分页对象
*
* @param page
* @param sysNoticePageParam
* @return
*/
IPage<SysNoticeQueryVo> getSysNoticePageList(@Param("page") Page page, @Param("param") SysNoticePageParam sysNoticePageParam);
}
package com.jumeirah.common.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jumeirah.common.entity.SysNoticeRead;
import com.jumeirah.common.param.SysNoticeReadPageParam;
import com.jumeirah.common.param.SysNoticeReadQueryVo;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.io.Serializable;
/**
* 系统通知已读 未读 Mapper 接口
*
* @author xxx
* @since 2020-11-06
*/
@Repository
public interface SysNoticeReadMapper extends BaseMapper<SysNoticeRead> {
/**
* 根据ID获取查询对象
*
* @param id
* @return
*/
SysNoticeReadQueryVo getSysNoticeReadById(Serializable id);
/**
* 获取分页对象
*
* @param page
* @param sysNoticeReadPageParam
* @return
*/
IPage<SysNoticeReadQueryVo> getSysNoticeReadPageList(@Param("page") Page page,@Param("param") SysNoticeReadPageParam sysNoticeReadPageParam);
}
......@@ -40,4 +40,7 @@ public class McStrokePageParam extends BasePageOrderParam {
@ApiModelProperty("申请人")
private String applicant;
@ApiModelProperty("是否是优惠调机,0-否,1-是")
private Boolean isDiscount = false;
}
package com.jumeirah.common.param;
import io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <pre>
* 系统通知表 分页参数对象
* </pre>
*
* @author xxx
* @date 2020-11-06
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "系统通知表分页参数")
public class SysNoticePageParam extends BasePageOrderParam {
private static final long serialVersionUID = 1L;
}
package com.jumeirah.common.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <pre>
* 系统通知表 查询结果对象
* </pre>
*
* @author xxx
* @date 2020-11-06
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "SysNoticeQueryVo对象")
public class SysNoticeQueryVo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("id")
private Long id;
@ApiModelProperty("主题")
private String theme;
@ApiModelProperty("内容")
private String msgInfo;
@ApiModelProperty("创建时间(时间戳)")
private Date sendTime;
private Long sendReceive = 1L;//0:用户 1:客服
private Long msgType = 0L;//0、聊天信息,1、图片,2、视频,4、文件,5、订单
private Long merchantId = 0L;//商户ID 给个0
}
\ No newline at end of file
package com.jumeirah.common.param;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam;
/**
* <pre>
* 系统通知已读 未读 分页参数对象
* </pre>
*
* @author xxx
* @date 2020-11-06
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "系统通知已读 未读分页参数")
public class SysNoticeReadPageParam extends BasePageOrderParam{
private static final long serialVersionUID=1L;
}
package com.jumeirah.common.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <pre>
* 系统通知已读 未读 查询结果对象
* </pre>
*
* @author xxx
* @date 2020-11-06
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "SysNoticeReadQueryVo对象")
public class SysNoticeReadQueryVo implements Serializable {
private static final long serialVersionUID = 1L;
// private Long id;
//
// @ApiModelProperty("用户ID")
// private Long userId;
@ApiModelProperty("0未读 1已读")
private Integer read;
}
\ No newline at end of file
package com.jumeirah.common.push;
package com.jumeirah.common.push.umeng;
public class App {
......
package com.jumeirah.common.push;
package com.jumeirah.common.push.umeng;
import com.jumeirah.common.push.android.AndroidBroadcast;
import com.jumeirah.common.push.android.AndroidCustomizedcast;
import com.jumeirah.common.push.android.AndroidFilecast;
import com.jumeirah.common.push.android.AndroidGroupcast;
import com.jumeirah.common.push.android.AndroidUnicast;
import com.jumeirah.common.push.ios.IOSBroadcast;
import com.jumeirah.common.push.ios.IOSCustomizedcast;
import com.jumeirah.common.push.ios.IOSFilecast;
import com.jumeirah.common.push.ios.IOSGroupcast;
import com.jumeirah.common.push.ios.IOSUnicast;
import com.jumeirah.common.push.umeng.android.AndroidBroadcast;
import com.jumeirah.common.push.umeng.android.AndroidCustomizedcast;
import com.jumeirah.common.push.umeng.android.AndroidFilecast;
import com.jumeirah.common.push.umeng.android.AndroidGroupcast;
import com.jumeirah.common.push.umeng.android.AndroidUnicast;
import com.jumeirah.common.push.umeng.ios.IOSBroadcast;
import com.jumeirah.common.push.umeng.ios.IOSCustomizedcast;
import com.jumeirah.common.push.umeng.ios.IOSFilecast;
import com.jumeirah.common.push.umeng.ios.IOSGroupcast;
import com.jumeirah.common.push.umeng.ios.IOSUnicast;
import org.json.JSONArray;
import org.json.JSONObject;
......
package com.jumeirah.common.push;
package com.jumeirah.common.push.umeng;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.http.HttpResponse;
......@@ -7,37 +7,42 @@ import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONObject;
import org.springframework.stereotype.Component;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
/**
* @author JJww
*/
@Component
public class PushClient {
// The host
protected static final String host = "http://msg.umeng.com";
// The upload path
protected static final String uploadPath = "/upload";
// The post path
protected static final String postPath = "/api/send";
// The user agent
protected final String USER_AGENT = "Mozilla/5.0";
// This object is used for sending the post request to Umeng
protected HttpClient client = new DefaultHttpClient();
// The host
protected static final String host = "http://msg.umeng.com";
// The upload path
protected static final String uploadPath = "/upload";
// The post path
protected static final String postPath = "/api/send";
// The user agent
protected final String USER_AGENT = "Mozilla/5.0";
// This object is used for sending the post request to Umeng
protected HttpClient client = new DefaultHttpClient();
public boolean send(UmengNotification msg) throws Exception {
String timestamp = Integer.toString((int) (System.currentTimeMillis() / 1000));
msg.setPredefinedKeyValue("timestamp", timestamp);
String url = host + postPath;
String postBody = msg.getPostBody();
String sign = DigestUtils.md5Hex(("POST" + url + postBody + msg.getAppMasterSecret()).getBytes(StandardCharsets.UTF_8));
url = url + "?sign=" + sign;
HttpPost post = new HttpPost(url);
post.setHeader("User-Agent", USER_AGENT);
StringEntity se = new StringEntity(postBody, "UTF-8");
post.setEntity(se);
// Send the post request and get the response
HttpResponse response = client.execute(post);
public boolean send(UmengNotification msg) throws Exception {
String timestamp = Integer.toString((int) (System.currentTimeMillis() / 1000));
msg.setPredefinedKeyValue("timestamp", timestamp);
String url = host + postPath;
String postBody = msg.getPostBody();
String sign = DigestUtils.md5Hex(("POST" + url + postBody + msg.getAppMasterSecret()).getBytes(StandardCharsets.UTF_8));
url = url + "?sign=" + sign;
HttpPost post = new HttpPost(url);
post.setHeader("User-Agent", USER_AGENT);
StringEntity se = new StringEntity(postBody, "UTF-8");
post.setEntity(se);
// Send the post request and get the response
HttpResponse response = client.execute(post);
int status = response.getStatusLine().getStatusCode();
System.out.println("Response Code : " + status);
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
......@@ -45,54 +50,54 @@ public class PushClient {
String line = "";
while ((line = rd.readLine()) != null) {
result.append(line);
}
System.out.println(result.toString());
if (status == 200) {
System.out.println("Notification sent successfully.");
} else {
System.out.println("Failed to send the notification!");
}
return true;
}
}
System.out.println(result.toString());
if (status == 200) {
System.out.println("Notification sent successfully.");
} else {
System.out.println("Failed to send the notification!");
}
return true;
}
// Upload file with device_tokens to Umeng
public String uploadContents(String appkey, String appMasterSecret, String contents) throws Exception {
// Construct the json string
JSONObject uploadJson = new JSONObject();
uploadJson.put("appkey", appkey);
String timestamp = Integer.toString((int) (System.currentTimeMillis() / 1000));
uploadJson.put("timestamp", timestamp);
uploadJson.put("content", contents);
// Construct the request
String url = host + uploadPath;
String postBody = uploadJson.toString();
String sign = DigestUtils.md5Hex(("POST" + url + postBody + appMasterSecret).getBytes(StandardCharsets.UTF_8));
url = url + "?sign=" + sign;
HttpPost post = new HttpPost(url);
post.setHeader("User-Agent", USER_AGENT);
StringEntity se = new StringEntity(postBody, "UTF-8");
post.setEntity(se);
// Send the post request and get the response
HttpResponse response = client.execute(post);
System.out.println("Response Code : " + response.getStatusLine().getStatusCode());
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuffer result = new StringBuffer();
String line = "";
while ((line = rd.readLine()) != null) {
result.append(line);
}
System.out.println(result.toString());
// Decode response string and get file_id from it
JSONObject respJson = new JSONObject(result.toString());
String ret = respJson.getString("ret");
if (!ret.equals("SUCCESS")) {
throw new Exception("Failed to upload file");
}
JSONObject data = respJson.getJSONObject("data");
String fileId = data.getString("file_id");
// Set file_id into rootJson using setPredefinedKeyValue
// Upload file with device_tokens to Umeng
public String uploadContents(String appkey, String appMasterSecret, String contents) throws Exception {
// Construct the json string
JSONObject uploadJson = new JSONObject();
uploadJson.put("appkey", appkey);
String timestamp = Integer.toString((int) (System.currentTimeMillis() / 1000));
uploadJson.put("timestamp", timestamp);
uploadJson.put("content", contents);
// Construct the request
String url = host + uploadPath;
String postBody = uploadJson.toString();
String sign = DigestUtils.md5Hex(("POST" + url + postBody + appMasterSecret).getBytes(StandardCharsets.UTF_8));
url = url + "?sign=" + sign;
HttpPost post = new HttpPost(url);
post.setHeader("User-Agent", USER_AGENT);
StringEntity se = new StringEntity(postBody, "UTF-8");
post.setEntity(se);
// Send the post request and get the response
HttpResponse response = client.execute(post);
System.out.println("Response Code : " + response.getStatusLine().getStatusCode());
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuffer result = new StringBuffer();
String line = "";
while ((line = rd.readLine()) != null) {
result.append(line);
}
System.out.println(result.toString());
// Decode response string and get file_id from it
JSONObject respJson = new JSONObject(result.toString());
String ret = respJson.getString("ret");
if (!ret.equals("SUCCESS")) {
throw new Exception("Failed to upload file");
}
JSONObject data = respJson.getJSONObject("data");
String fileId = data.getString("file_id");
// Set file_id into rootJson using setPredefinedKeyValue
return fileId;
}
return fileId;
}
}
package com.jumeirah.common.push.umeng;
import com.jumeirah.common.factory.PushService;
import com.jumeirah.common.push.umeng.android.AndroidNotification;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
/**
* @author: JJww
* @Date:2020/11/5
*/
@Component
public class UmengAndroidPushServiceImpl extends AndroidNotification implements PushService {
@Autowired
private PushClient pushClient;
private static final String APP_KEY = "5f963f3ea1491772a2aef713";
private static final String APP_MASTER_SECRET = "ti5gomxtvmkgehmwgtbq9rtsfhy0khsi";
@PostConstruct
public void init() throws Exception {
setAppMasterSecret(APP_MASTER_SECRET);
setPredefinedKeyValue("appkey", APP_KEY);
}
@Override
@SneakyThrows
public void unicast(String deviceToken) {
this.setTitle("您有一条新信息");
this.setText("");
this.goAppAfterOpen();
this.setPredefinedKeyValue("device_tokens", deviceToken);
this.setDisplayType(AndroidNotification.DisplayType.NOTIFICATION);
this.setProductionMode();
this.setExtraField("pushType", "1");//自定义字段 推送类型:客服消息
this.setPredefinedKeyValue("type", "unicast");//单播
pushClient.send(this);
}
@Override
public void unicast(String deviceToken, String pushType, String title) throws Exception {
this.setTitle(title);
this.setText("");
this.goAppAfterOpen();
this.setPredefinedKeyValue("device_tokens", deviceToken);
this.setDisplayType(AndroidNotification.DisplayType.NOTIFICATION);
this.setProductionMode();
this.setExtraField("pushType", pushType);//自定义字段 推送类型:客服消息
this.setPredefinedKeyValue("type", "unicast");//单播
pushClient.send(this);
}
}
package com.jumeirah.common.push.umeng;
import com.jumeirah.common.factory.PushService;
import com.jumeirah.common.push.umeng.ios.IOSNotification;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
/**
* @author: JJww
* @Date:2020/11/5
*/
@Component
public class UmengIosPushServiceImpl extends IOSNotification implements PushService {
@Autowired
private PushClient pushClient;
private static final String APP_KEY = "5f963f3ea1491772a2aef713";
private static final String APP_MASTER_SECRET = "ti5gomxtvmkgehmwgtbq9rtsfhy0khsi";
@PostConstruct
public void init() throws Exception {
setAppMasterSecret(APP_MASTER_SECRET);
setPredefinedKeyValue("appkey", APP_KEY);
}
@Override
@SneakyThrows
public void unicast(String deviceToken) {
this.setAlert("您有一条新信息");
this.setBadge(0);
this.setSound("default");
this.setProductionMode();
this.setPredefinedKeyValue("device_tokens", deviceToken);
this.setCustomizedField("pushType", "1");//自定义字段 推送类型:客服消息
this.setPredefinedKeyValue("type", "unicast");
pushClient.send(this);
}
@Override
public void unicast(String deviceToken, String pushType, String title) throws Exception {
this.setAlert(title);
this.setBadge(0);
this.setSound("default");
this.setProductionMode();
this.setPredefinedKeyValue("device_tokens", deviceToken);
this.setCustomizedField("pushType", pushType);//自定义字段 推送类型:客服消息
this.setPredefinedKeyValue("type", "unicast");
pushClient.send(this);
}
}
package com.jumeirah.common.push;
package com.jumeirah.common.push.umeng;
import org.json.JSONObject;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.HashSet;
@Component
public abstract class UmengNotification {
// Keys can be set in the root level
protected static final HashSet<String> ROOT_KEYS = new HashSet<String>(Arrays.asList("appkey", "timestamp", "type", "device_tokens", "alias", "alias_type", "file_id",
......
package com.jumeirah.common.push.android;
package com.jumeirah.common.push.umeng.android;
import com.jumeirah.common.push.AndroidNotification;
import com.jumeirah.common.push.umeng.AndroidNotification;
public class AndroidBroadcast extends AndroidNotification {
public AndroidBroadcast(String appkey, String appMasterSecret) throws Exception {
......
package com.jumeirah.common.push.android;
package com.jumeirah.common.push.umeng.android;
import com.jumeirah.common.push.AndroidNotification;
import com.jumeirah.common.push.umeng.AndroidNotification;
public class AndroidCustomizedcast extends AndroidNotification {
public AndroidCustomizedcast(String appkey, String appMasterSecret) throws Exception {
......
package com.jumeirah.common.push.android;
package com.jumeirah.common.push.umeng.android;
import com.jumeirah.common.push.AndroidNotification;
import com.jumeirah.common.push.umeng.AndroidNotification;
public class AndroidFilecast extends AndroidNotification {
public AndroidFilecast(String appkey, String appMasterSecret) throws Exception {
......
package com.jumeirah.common.push.android;
package com.jumeirah.common.push.umeng.android;
import com.jumeirah.common.push.AndroidNotification;
import com.jumeirah.common.push.umeng.AndroidNotification;
import org.json.JSONObject;
public class AndroidGroupcast extends AndroidNotification {
......
package com.jumeirah.common.push.umeng.android;
import com.jumeirah.common.push.umeng.UmengNotification;
import org.json.JSONObject;
import java.util.Arrays;
import java.util.HashSet;
public abstract class AndroidNotification extends UmengNotification {
// Keys can be set in the payload level
protected static final HashSet<String> PAYLOAD_KEYS = new HashSet<String>(Arrays.asList("display_type"));
// Keys can be set in the body level
protected static final HashSet<String> BODY_KEYS = new HashSet<String>(Arrays.asList("ticker", "title", "text", "builder_id", "icon", "largeIcon", "img", "play_vibrate", "play_lights", "play_sound",
"sound", "after_open", "url", "activity", "custom"));
// Set key/value in the rootJson, for the keys can be set please see ROOT_KEYS, PAYLOAD_KEYS,
// BODY_KEYS and POLICY_KEYS.
@Override
public boolean setPredefinedKeyValue(String key, Object value) throws Exception {
if (ROOT_KEYS.contains(key)) {
// This key should be in the root level
rootJson.put(key, value);
} else if (PAYLOAD_KEYS.contains(key)) {
// This key should be in the payload level
JSONObject payloadJson = null;
if (rootJson.has("payload")) {
payloadJson = rootJson.getJSONObject("payload");
} else {
payloadJson = new JSONObject();
rootJson.put("payload", payloadJson);
}
payloadJson.put(key, value);
} else if (BODY_KEYS.contains(key)) {
// This key should be in the body level
JSONObject bodyJson = null;
JSONObject payloadJson = null;
// 'body' is under 'payload', so build a payload if it doesn't exist
if (rootJson.has("payload")) {
payloadJson = rootJson.getJSONObject("payload");
} else {
payloadJson = new JSONObject();
rootJson.put("payload", payloadJson);
}
// Get body JSONObject, generate one if not existed
if (payloadJson.has("body")) {
bodyJson = payloadJson.getJSONObject("body");
} else {
bodyJson = new JSONObject();
payloadJson.put("body", bodyJson);
}
bodyJson.put(key, value);
} else if (POLICY_KEYS.contains(key)) {
// This key should be in the body level
JSONObject policyJson = null;
if (rootJson.has("policy")) {
policyJson = rootJson.getJSONObject("policy");
} else {
policyJson = new JSONObject();
rootJson.put("policy", policyJson);
}
policyJson.put(key, value);
} else {
if (key == "payload" || key == "body" || key == "policy" || key == "extra") {
throw new Exception("You don't need to set value for " + key + " , just set values for the sub keys in it.");
} else {
throw new Exception("Unknown key: " + key);
}
}
return true;
}
// Set extra key/value for Android notification
public boolean setExtraField(String key, String value) throws Exception {
JSONObject payloadJson = null;
JSONObject extraJson = null;
if (rootJson.has("payload")) {
payloadJson = rootJson.getJSONObject("payload");
} else {
payloadJson = new JSONObject();
rootJson.put("payload", payloadJson);
}
if (payloadJson.has("extra")) {
extraJson = payloadJson.getJSONObject("extra");
} else {
extraJson = new JSONObject();
payloadJson.put("extra", extraJson);
}
extraJson.put(key, value);
return true;
}
//
public void setDisplayType(DisplayType d) throws Exception {
setPredefinedKeyValue("display_type", d.getValue());
}
///通知栏提示文字
public void setTicker(String ticker) throws Exception {
setPredefinedKeyValue("ticker", ticker);
}
///通知标题
public void setTitle(String title) throws Exception {
setPredefinedKeyValue("title", title);
}
///通知文字描述
public void setText(String text) throws Exception {
setPredefinedKeyValue("text", text);
}
///用于标识该通知采用的样式。使用该参数时, 必须在SDK里面实现自定义通知栏样式。
public void setBuilderId(Integer builder_id) throws Exception {
setPredefinedKeyValue("builder_id", builder_id);
}
///状态栏图标ID, R.drawable.[smallIcon],如果没有, 默认使用应用图标。
public void setIcon(String icon) throws Exception {
setPredefinedKeyValue("icon", icon);
}
///通知栏拉开后左侧图标ID
public void setLargeIcon(String largeIcon) throws Exception {
setPredefinedKeyValue("largeIcon", largeIcon);
}
///通知栏大图标的URL链接。该字段的优先级大于largeIcon。该字段要求以http或者https开头。
public void setImg(String img) throws Exception {
setPredefinedKeyValue("img", img);
}
///收到通知是否震动,默认为"true"
public void setPlayVibrate(Boolean play_vibrate) throws Exception {
setPredefinedKeyValue("play_vibrate", play_vibrate.toString());
}
///收到通知是否闪灯,默认为"true"
public void setPlayLights(Boolean play_lights) throws Exception {
setPredefinedKeyValue("play_lights", play_lights.toString());
}
///收到通知是否发出声音,默认为"true"
public void setPlaySound(Boolean play_sound) throws Exception {
setPredefinedKeyValue("play_sound", play_sound.toString());
}
///通知声音,R.raw.[sound]. 如果该字段为空,采用SDK默认的声音
public void setSound(String sound) throws Exception {
setPredefinedKeyValue("sound", sound);
}
///收到通知后播放指定的声音文件
public void setPlaySound(String sound) throws Exception {
setPlaySound(true);
setSound(sound);
}
///点击"通知"的后续行为,默认为打开app。
public void goAppAfterOpen() throws Exception {
setAfterOpenAction(AfterOpenAction.go_app);
}
public void goUrlAfterOpen(String url) throws Exception {
setAfterOpenAction(AfterOpenAction.go_url);
setUrl(url);
}
public void goActivityAfterOpen(String activity) throws Exception {
setAfterOpenAction(AfterOpenAction.go_activity);
setActivity(activity);
}
public void goCustomAfterOpen(String custom) throws Exception {
setAfterOpenAction(AfterOpenAction.go_custom);
setCustomField(custom);
}
public void goCustomAfterOpen(JSONObject custom) throws Exception {
setAfterOpenAction(AfterOpenAction.go_custom);
setCustomField(custom);
}
///点击"通知"的后续行为,默认为打开app。原始接口
public void setAfterOpenAction(AfterOpenAction action) throws Exception {
setPredefinedKeyValue("after_open", action.toString());
}
public void setUrl(String url) throws Exception {
setPredefinedKeyValue("url", url);
}
public void setActivity(String activity) throws Exception {
setPredefinedKeyValue("activity", activity);
}
///can be a string of json
public void setCustomField(String custom) throws Exception {
setPredefinedKeyValue("custom", custom);
}
public void setCustomField(JSONObject custom) throws Exception {
setPredefinedKeyValue("custom", custom);
}
public enum DisplayType {
NOTIFICATION {
public String getValue() {
return "notification";
}
},///通知:消息送达到用户设备后,由友盟SDK接管处理并在通知栏上显示通知内容。
MESSAGE {
public String getValue() {
return "message";
}
};///消息:消息送达到用户设备后,消息内容透传给应用自身进行解析处理。
public abstract String getValue();
}
public enum AfterOpenAction {
go_app,//打开应用
go_url,//跳转到URL
go_activity,//打开特定的activity
go_custom//用户自定义内容。
}
}
package com.jumeirah.common.push.android;
package com.jumeirah.common.push.umeng.android;
import com.jumeirah.common.push.AndroidNotification;
import com.jumeirah.common.push.umeng.AndroidNotification;
public class AndroidUnicast extends AndroidNotification {
public AndroidUnicast(String appkey, String appMasterSecret) throws Exception {
......
package com.jumeirah.common.push.ios;
package com.jumeirah.common.push.umeng.ios;
import com.jumeirah.common.push.IOSNotification;
import com.jumeirah.common.push.umeng.IOSNotification;
public class IOSBroadcast extends IOSNotification {
public IOSBroadcast(String appkey, String appMasterSecret) throws Exception {
......
package com.jumeirah.common.push.ios;
package com.jumeirah.common.push.umeng.ios;
import com.jumeirah.common.push.IOSNotification;
import com.jumeirah.common.push.umeng.IOSNotification;
public class IOSCustomizedcast extends IOSNotification {
public IOSCustomizedcast(String appkey, String appMasterSecret) throws Exception {
......
package com.jumeirah.common.push.ios;
package com.jumeirah.common.push.umeng.ios;
import com.jumeirah.common.push.IOSNotification;
import com.jumeirah.common.push.umeng.IOSNotification;
public class IOSFilecast extends IOSNotification {
public IOSFilecast(String appkey, String appMasterSecret) throws Exception {
......
package com.jumeirah.common.push.ios;
package com.jumeirah.common.push.umeng.ios;
import com.jumeirah.common.push.IOSNotification;
import com.jumeirah.common.push.umeng.IOSNotification;
import org.json.JSONObject;
public class IOSGroupcast extends IOSNotification {
......
package com.jumeirah.common.push.umeng.ios;
import com.jumeirah.common.push.umeng.UmengNotification;
import org.json.JSONObject;
import java.util.Arrays;
import java.util.HashSet;
public abstract class IOSNotification extends UmengNotification {
// Keys can be set in the aps level
protected static final HashSet<String> APS_KEYS = new HashSet<String>(Arrays.asList("alert", "badge", "sound", "content-available"));
@Override
public boolean setPredefinedKeyValue(String key, Object value) throws Exception {
if (ROOT_KEYS.contains(key)) {
// This key should be in the root level
rootJson.put(key, value);
} else if (APS_KEYS.contains(key)) {
// This key should be in the aps level
JSONObject apsJson = null;
JSONObject payloadJson = null;
if (rootJson.has("payload")) {
payloadJson = rootJson.getJSONObject("payload");
} else {
payloadJson = new JSONObject();
rootJson.put("payload", payloadJson);
}
if (payloadJson.has("aps")) {
apsJson = payloadJson.getJSONObject("aps");
} else {
apsJson = new JSONObject();
payloadJson.put("aps", apsJson);
}
apsJson.put(key, value);
} else if (POLICY_KEYS.contains(key)) {
// This key should be in the body level
JSONObject policyJson = null;
if (rootJson.has("policy")) {
policyJson = rootJson.getJSONObject("policy");
} else {
policyJson = new JSONObject();
rootJson.put("policy", policyJson);
}
policyJson.put(key, value);
} else {
if (key == "payload" || key == "aps" || key == "policy") {
throw new Exception("You don't need to set value for " + key + " , just set values for the sub keys in it.");
} else {
throw new Exception("Unknownd key: " + key);
}
}
return true;
}
// Set customized key/value for IOS notification
public boolean setCustomizedField(String key, String value) throws Exception {
//rootJson.put(key, value);
JSONObject payloadJson = null;
if (rootJson.has("payload")) {
payloadJson = rootJson.getJSONObject("payload");
} else {
payloadJson = new JSONObject();
rootJson.put("payload", payloadJson);
}
payloadJson.put(key, value);
return true;
}
public void setAlert(String token) throws Exception {
setPredefinedKeyValue("alert", token);
}
public void setAlert(String title, String subtitle, String body) throws Exception {
JSONObject object = new JSONObject();
object.put("title", title);
object.put("subtitle", subtitle);
object.put("body", body);
setPredefinedKeyValue("alert", object);
}
public void setBadge(Integer badge) throws Exception {
setPredefinedKeyValue("badge", badge);
}
public void setSound(String sound) throws Exception {
setPredefinedKeyValue("sound", sound);
}
public void setContentAvailable(Integer contentAvailable) throws Exception {
setPredefinedKeyValue("content-available", contentAvailable);
}
}
package com.jumeirah.common.push.ios;
package com.jumeirah.common.push.umeng.ios;
import com.jumeirah.common.push.IOSNotification;
import com.jumeirah.common.push.umeng.IOSNotification;
public class IOSUnicast extends IOSNotification {
public IOSUnicast(String appkey, String appMasterSecret) throws Exception {
......
package com.jumeirah.common.service;
import com.jumeirah.common.entity.SysNoticeRead;
import com.jumeirah.common.param.SysNoticeReadPageParam;
import io.geekidea.springbootplus.framework.common.service.BaseService;
import com.jumeirah.common.param.SysNoticeReadQueryVo;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
/**
* 系统通知已读 未读 服务类
*
* @author xxx
* @since 2020-11-06
*/
public interface SysNoticeReadService extends BaseService<SysNoticeRead> {
/**
* 保存
*
* @param sysNoticeRead
* @return
* @throws Exception
*/
boolean saveSysNoticeRead(SysNoticeRead sysNoticeRead)throws Exception;
/**
* 修改
*
* @param sysNoticeRead
* @return
* @throws Exception
*/
boolean updateSysNoticeRead(SysNoticeRead sysNoticeRead)throws Exception;
/**
* 删除
*
* @param id
* @return
* @throws Exception
*/
boolean deleteSysNoticeRead(Long id)throws Exception;
/**
* 根据ID获取查询对象
*
* @param id
* @return
* @throws Exception
*/
SysNoticeReadQueryVo getSysNoticeReadById(Long id)throws Exception;
/**
* 获取分页对象
*
* @param sysNoticeReadPageParam
* @return
* @throws Exception
*/
Paging<SysNoticeReadQueryVo> getSysNoticeReadPageList(SysNoticeReadPageParam sysNoticeReadPageParam) throws Exception;
}
package com.jumeirah.common.service;
import com.jumeirah.common.entity.SysNotice;
import com.jumeirah.common.param.SysNoticePageParam;
import com.jumeirah.common.param.SysNoticeQueryVo;
import io.geekidea.springbootplus.framework.common.service.BaseService;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
/**
* 系统通知表 服务类
*
* @author xxx
* @since 2020-11-06
*/
public interface SysNoticeService extends BaseService<SysNotice> {
/**
* 保存
*
* @param sysNotice
* @return
* @throws Exception
*/
boolean saveSysNotice(SysNotice sysNotice) throws Exception;
/**
* 修改
*
* @param sysNotice
* @return
* @throws Exception
*/
boolean updateSysNotice(SysNotice sysNotice) throws Exception;
/**
* 删除
*
* @param id
* @return
* @throws Exception
*/
boolean deleteSysNotice(Long id) throws Exception;
/**
* 根据ID获取查询对象
*
* @param id
* @return
* @throws Exception
*/
SysNoticeQueryVo getSysNoticeById(Long id) throws Exception;
/**
* 获取分页对象
*
* @param sysNoticePageParam
* @return
* @throws Exception
*/
Paging<SysNoticeQueryVo> getSysNoticePageList(SysNoticePageParam sysNoticePageParam) throws Exception;
}
package com.jumeirah.common.service.impl;
import com.jumeirah.common.entity.SysNoticeRead;
import com.jumeirah.common.mapper.SysNoticeReadMapper;
import com.jumeirah.common.param.SysNoticeReadPageParam;
import com.jumeirah.common.param.SysNoticeReadQueryVo;
import com.jumeirah.common.service.SysNoticeReadService;
import io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* 系统通知已读 未读 服务实现类
*
* @author xxx
* @since 2020-11-06
*/
@Slf4j
@Service
public class SysNoticeReadServiceImpl extends BaseServiceImpl<SysNoticeReadMapper, SysNoticeRead> implements SysNoticeReadService {
@Autowired
private SysNoticeReadMapper sysNoticeReadMapper;
@Transactional(rollbackFor = Exception.class)
@Override
public boolean saveSysNoticeRead(SysNoticeRead sysNoticeRead)throws Exception{
return super.save(sysNoticeRead);
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean updateSysNoticeRead(SysNoticeRead sysNoticeRead)throws Exception{
return super.updateById(sysNoticeRead);
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean deleteSysNoticeRead(Long id)throws Exception{
return super.removeById(id);
}
@Override
public SysNoticeReadQueryVo getSysNoticeReadById(Long id)throws Exception{
return sysNoticeReadMapper.getSysNoticeReadById(id);
}
@Override
public Paging<SysNoticeReadQueryVo> getSysNoticeReadPageList(SysNoticeReadPageParam sysNoticeReadPageParam)throws Exception{
// Page<SysNoticeReadQueryVo> page=new PageInfo<>(sysNoticeReadPageParam,OrderItem.desc(getLambdaColumn(SysNoticeRead::getCreateTime)));
// IPage<SysNoticeReadQueryVo> iPage= sysNoticeReadMapper.getSysNoticeReadPageList(page, sysNoticeReadPageParam);
// return new Paging<SysNoticeReadQueryVo>(iPage);
return null;
}
}
package com.jumeirah.common.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jumeirah.common.entity.SysNotice;
import com.jumeirah.common.mapper.SysNoticeMapper;
import com.jumeirah.common.param.SysNoticePageParam;
import com.jumeirah.common.param.SysNoticeQueryVo;
import com.jumeirah.common.service.SysNoticeService;
import io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl;
import io.geekidea.springbootplus.framework.core.pagination.PageInfo;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* 系统通知表 服务实现类
*
* @author xxx
* @since 2020-11-06
*/
@Slf4j
@Service
public class SysNoticeServiceImpl extends BaseServiceImpl<SysNoticeMapper, SysNotice> implements SysNoticeService {
@Autowired
private SysNoticeMapper sysNoticeMapper;
@Transactional(rollbackFor = Exception.class)
@Override
public boolean saveSysNotice(SysNotice sysNotice) throws Exception {
return super.save(sysNotice);
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean updateSysNotice(SysNotice sysNotice) throws Exception {
return super.updateById(sysNotice);
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean deleteSysNotice(Long id) throws Exception {
return super.removeById(id);
}
@Override
public SysNoticeQueryVo getSysNoticeById(Long id) throws Exception {
return sysNoticeMapper.getSysNoticeById(id);
}
@Override
public Paging<SysNoticeQueryVo> getSysNoticePageList(SysNoticePageParam sysNoticePageParam) throws Exception {
Page<SysNoticeQueryVo> page = new PageInfo<>(sysNoticePageParam, OrderItem.desc(getLambdaColumn(SysNotice::getCreateTime)));
IPage<SysNoticeQueryVo> iPage = sysNoticeMapper.getSysNoticePageList(page, sysNoticePageParam);
return new Paging<SysNoticeQueryVo>(iPage);
}
}
package com.jumeirah.common.sms;
import cn.wecloud.sdk.common.exception.WeCloudApiException;
import cn.wecloud.sdk.sms.client.WeCloudSmsClient;
import cn.wecloud.sdk.sms.data.WeCloudSmsSingleSendResult;
import cn.wecloud.sdk.sms.model.WeCloudSmsAbroadModel;
import cn.wecloud.sdk.sms.request.WeCloudSmsDomesticSingleSendRequest;
import cn.wecloud.sdk.sms.response.WeCloudSmsDomesticSingleSendResponse;
//@Slf4j
public class SmsUtil {
public static void main(String[] args) throws WeCloudApiException {
// 创建连接对象
final WeCloudSmsClient client = new WeCloudSmsClient("9XPgCY9rAb1GG2yg");
// 创建请求信息对象
final WeCloudSmsAbroadModel model = new WeCloudSmsAbroadModel("855", "081612642", "1323474417736716290", "888888");
// 创建请求对象
final WeCloudSmsDomesticSingleSendRequest request = new WeCloudSmsDomesticSingleSendRequest(model);
// 执行请求
final WeCloudSmsDomesticSingleSendResponse execute = client.execute(request);
// 判断是否请求成功
if (execute.isSuccess()) {
// 获取返回业务对象
final WeCloudSmsSingleSendResult result = execute.getData();
} else {
// 输出请求失败信息
// log.error(execute.getMsg());
}
}
public static void send(String areaCode, String phone, String verificationCode) throws WeCloudApiException {
// 创建连接对象
final WeCloudSmsClient client = new WeCloudSmsClient("9XPgCY9rAb1GG2yg");
// 创建请求信息对象
String templateId = "1323474417736716290";
final WeCloudSmsAbroadModel model = new WeCloudSmsAbroadModel(areaCode, phone, templateId, verificationCode);
// 创建请求对象
final WeCloudSmsDomesticSingleSendRequest request = new WeCloudSmsDomesticSingleSendRequest(model);
// 执行请求
final WeCloudSmsDomesticSingleSendResponse execute = client.execute(request);
// 判断是否请求成功
if (execute.isSuccess()) {
// 获取返回业务对象
final WeCloudSmsSingleSendResult result = execute.getData();
} else {
// 输出请求失败信息
// log.error(execute.getMsg());
}
}
}
......@@ -12,7 +12,7 @@
plain_type_id,
outset_time,
return_time,
type,zuo
type,
STATUS,
money,
user_id,
......@@ -192,6 +192,7 @@
INNER JOIN city_three_code ctca ON ctca.id = s.city_arrive_id
<where>
s.mc_id = #{mcId}
AND s.is_discount = #{mcStrokePageParam.isDiscount}
<if test="mcStrokePageParam.status != null and mcStrokePageParam.status != -1">
AND s.status = #{mcStrokePageParam.status}
</if>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jumeirah.common.mapper.SysNoticeMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, theme, content, create_time, update_time, status
</sql>
<select id="getSysNoticeById" resultType="com.jumeirah.common.param.SysNoticeQueryVo">
select
<include refid="Base_Column_List"/>
from sys_notice where id = #{id}
</select>
<select id="getSysNoticePageList" parameterType="com.jumeirah.common.param.SysNoticePageParam"
resultType="com.jumeirah.common.param.SysNoticeQueryVo">
select
<include refid="Base_Column_List"/>
from sys_notice
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jumeirah.common.mapper.SysNoticeReadMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, user_id, read
</sql>
<select id="getSysNoticeReadById" resultType="com.jumeirah.common.param.SysNoticeReadQueryVo">
select
<include refid="Base_Column_List"/>
from sys_notice_read where id = #{id}
</select>
<select id="getSysNoticeReadPageList" parameterType="com.jumeirah.common.param.SysNoticeReadPageParam" resultType="com.jumeirah.common.param.SysNoticeReadQueryVo">
select
<include refid="Base_Column_List"/>
from sys_notice_read
</select>
</mapper>
......@@ -14,9 +14,9 @@ spring-boot-plus:
spring:
datasource:
url: jdbc:mysql://122.9.51.93:3306/jumeirah?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
username: web
password: wBT7bC9BeUkE
url: jdbc:mysql://47.99.47.225:3306/Jumeirah?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: temple123456
# Redis配置
redis:
......
......@@ -15,22 +15,22 @@ spring-boot-plus:
spring:
datasource:
url: jdbc:mysql://122.9.51.93:3306/jumeirah?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
username: web
password: wBT7bC9BeUkE
url: jdbc:mysql://47.99.47.225:3306/Jumeirah?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: temple123456
# Redis配置
redis:
database: 0
host: 127.0.0.1
password: LSlX0JKkD34U3oY3hwI5
password: temple123456
port: 6379
rabbitmq:
host: 127.0.0.1
host: 47.99.47.225
port: 5672
username: root
password: TYWu154pBpvr
password: root
order-queue-name: push.order
# 打印SQL语句和结果集,本地开发环境可开启,线上注释掉
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment