Commit 8430754d by giaogiao

AppKeyTest

parent ff324a3a
package io.geekidea.springbootplus;
import com.wecloud.im.tillo.netty.core.NettyStart;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
......@@ -8,8 +9,8 @@ import javax.annotation.Resource;
@Component
public class StartNettyService implements CommandLineRunner {
// @Value("${netty.port}")
// private int port;
@Value("${netty.port}")
private int port;
@Resource
private NettyStart nettyServer;
......@@ -17,8 +18,7 @@ public class StartNettyService implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
// nettyServer.run(port);
nettyServer.run(8899);
nettyServer.run(port);
}
}
package io.geekidea.springbootplus.test;
import com.wecloud.im.tillo.app_ws.utils.RSAGenerator;
import io.geekidea.springbootplus.SpringBootPlusApplication;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SpringBootPlusApplication.class)
public class AppKeyTest {
public static void main(String[] args) {
String appKey = RSAGenerator.getAppKey(); //定义变量接收
String appSecret = RSAGenerator.getAppSecret(appKey);
int i=1;
}
}
......@@ -28,4 +28,6 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SpringBootPlusApplication.class)
public class BaseTest {
}
package io.geekidea.springbootplus.test;
import com.wecloud.im.factory.PushFactory;
import com.wecloud.im.service.DonationRecordService;
import com.wecloud.im.vo.DonationRankAndTotal;
import me.chanjar.weixin.common.bean.WxOAuth2UserInfo;
import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
import me.chanjar.weixin.mp.api.WxMpService;
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 SpiringPlusTest {
@Autowired
private PushFactory pushFactory;
@Autowired
private WxMpService wxMpService;
@Autowired
private DonationRecordService donationRecordService;
/**
* app推送:1.您有一条新消息(客服回复推送)
* 2.您的订单已报价(商家端报价完后推送)
* 3.您的订单已完成(商家端完成行程完后推送
*
* @throws Exception
*/
@Test
public void push() throws Exception {
pushFactory.getService(1).unicast("Ar4opHQcGn-UA1-fZ7O6PAeNSJs9rCEEI5XRvS_0rQke", "2", "您的订单已报价");
pushFactory.getService(1).unicast("Ar4opHQcGn-UA1-fZ7O6PAeNSJs9rCEEI5XRvS_0rQke", "3", "您的订单已完成");
}
@Test
public void wxGetOpenId() throws Exception {
String code = "071iQYGa1jwhCA06vtFa1OHuHE2iQYGq";
WxOAuth2AccessToken accessToken = wxMpService.getOAuth2Service().getAccessToken(code);
// 获取用户头像
WxOAuth2UserInfo userInfo = wxMpService.getOAuth2Service().getUserInfo(accessToken, null);
int ii = 1;
}
@Test
public void donationTest() throws Exception {
DonationRankAndTotal donationRankAndTotal = donationRecordService.getDonationRankAndTotal(1L);
int ii = 1;
};
}
package com.wecloud.im.config;
import io.geekidea.springbootplus.config.properties.WxMpProperties;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.List;
import java.util.stream.Collectors;
/**
* wechat mp configuration
*
* @author Binary Wang(https://github.com/binarywang)
*/
@Configuration
//@EnableConfigurationProperties(WxMpProperties.class)
public class WxMpConfiguration {
// private final LogHandler logHandler;
// private final NullHandler nullHandler;
// private final KfSessionHandler kfSessionHandler;
// private final StoreCheckNotifyHandler storeCheckNotifyHandler;
// private final LocationHandler locationHandler;
// private final MenuHandler menuHandler;
// private final MsgHandler msgHandler;
// private final UnsubscribeHandler unsubscribeHandler;
// private final SubscribeHandler subscribeHandler;
// private final ScanHandler scanHandler;
// private final WxMpProperties properties;
@Autowired
private WxMpProperties properties;
@Bean
public WxMpService wxMpService() {
// 代码里 getConfigs()处报错的同学,请注意仔细阅读项目说明,你的IDE需要引入lombok插件!!!!
final List<WxMpProperties.MpConfig> configs = this.properties.getConfigs();
if (configs == null) {
throw new RuntimeException("添加下相关配置,注意别配错了!");
}
WxMpService service = new WxMpServiceImpl();
service.setMultiConfigStorages(configs
.stream().map(a -> {
WxMpDefaultConfigImpl configStorage;
// if (this.properties.isUseRedis()) {
// final WxMpProperties.RedisConfig redisConfig = this.properties.getRedisConfig();
// JedisPool jedisPool = new JedisPool(redisConfig.getHost(), redisConfig.getPort());
// configStorage = new WxMpRedisConfigImpl(new JedisWxRedisOps(jedisPool), a.getAppId());
// } else {
configStorage = new WxMpDefaultConfigImpl();
// }
configStorage.setAppId(a.getAppId());
configStorage.setSecret(a.getSecret());
configStorage.setToken(a.getToken());
configStorage.setAesKey(a.getAesKey());
return configStorage;
}).collect(Collectors.toMap(WxMpDefaultConfigImpl::getAppId, a -> a, (o, n) -> o)));
return service;
}
// @Bean
// public WxMpMessageRouter messageRouter(WxMpService wxMpService) {
// final WxMpMessageRouter newRouter = new WxMpMessageRouter(wxMpService);
//
// // 记录所有事件的日志 (异步执行)
// newRouter.rule().handler(this.logHandler).next();
//
// // 接收客服会话管理事件
// newRouter.rule().async(false).msgType(EVENT).event(KF_CREATE_SESSION)
// .handler(this.kfSessionHandler).end();
// newRouter.rule().async(false).msgType(EVENT).event(KF_CLOSE_SESSION)
// .handler(this.kfSessionHandler).end();
// newRouter.rule().async(false).msgType(EVENT).event(KF_SWITCH_SESSION)
// .handler(this.kfSessionHandler).end();
//
// // 门店审核事件
// newRouter.rule().async(false).msgType(EVENT).event(POI_CHECK_NOTIFY).handler(this.storeCheckNotifyHandler).end();
//
// // 自定义菜单事件
// newRouter.rule().async(false).msgType(EVENT).event(EventType.CLICK).handler(this.menuHandler).end();
//
// // 点击菜单连接事件
// newRouter.rule().async(false).msgType(EVENT).event(EventType.VIEW).handler(this.nullHandler).end();
//
// // 关注事件
// newRouter.rule().async(false).msgType(EVENT).event(SUBSCRIBE).handler(this.subscribeHandler).end();
//
// // 取消关注事件
// newRouter.rule().async(false).msgType(EVENT).event(UNSUBSCRIBE).handler(this.unsubscribeHandler).end();
//
// // 上报地理位置事件
// newRouter.rule().async(false).msgType(EVENT).event(EventType.LOCATION).handler(this.locationHandler).end();
//
// // 接收地理位置消息
// newRouter.rule().async(false).msgType(XmlMsgType.LOCATION).handler(this.locationHandler).end();
//
// // 扫码事件
// newRouter.rule().async(false).msgType(EVENT).event(EventType.SCAN).handler(this.scanHandler).end();
//
// // 默认
// newRouter.rule().async(false).handler(this.msgHandler).end();
//
// return newRouter;
// }
}
package com.wecloud.im.config;
import com.github.binarywang.wxpay.config.WxPayConfig;
import com.github.binarywang.wxpay.service.WxPayService;
import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
import io.geekidea.springbootplus.config.properties.WxPayProperties;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author Binary Wang
*/
@Configuration
@ConditionalOnClass(WxPayService.class)
@EnableConfigurationProperties(WxPayProperties.class)
@AllArgsConstructor
public class WxPayConfiguration {
private WxPayProperties properties;
@Bean
@ConditionalOnMissingBean
public WxPayService wxService() {
WxPayConfig payConfig = new WxPayConfig();
payConfig.setAppId(StringUtils.trimToNull(this.properties.getAppId()));
payConfig.setMchId(StringUtils.trimToNull(this.properties.getMchId()));
payConfig.setMchKey(StringUtils.trimToNull(this.properties.getMchKey()));
payConfig.setSubAppId(StringUtils.trimToNull(this.properties.getSubAppId()));
payConfig.setSubMchId(StringUtils.trimToNull(this.properties.getSubMchId()));
payConfig.setKeyPath(StringUtils.trimToNull(this.properties.getKeyPath()));
// 可以指定是否使用沙箱环境
payConfig.setUseSandboxEnv(false);
WxPayService wxPayService = new WxPayServiceImpl();
wxPayService.setConfig(payConfig);
return wxPayService;
}
}
package com.wecloud.im.controller;
/**
* 替他人捐款记录表 控制器
*
* @author hewei
* @since 2021-02-25
*/
//@Slf4j
//@RestController
//@RequestMapping("/donationAgent")
//@Api(value = "替他人捐款记录表API", tags = {"替他人捐款记录表"})
//public class DonationAgentController extends BaseController {
//
// @Autowired
// private DonationAgentService donationAgentService;
//
// /**
// * 添加替他人捐款记录表
// */
// @PostMapping("/add")
// @OperationLog(name = "添加替他人捐款记录表", type = OperationLogType.ADD)
// @ApiOperation(value = "添加替他人捐款记录表")
// public ApiResult<Boolean> addDonationAgent(@Validated(Add.class) @RequestBody DonationAgent donationAgent) throws Exception {
// boolean flag = donationAgentService.saveDonationAgent(donationAgent);
// return ApiResult.result(flag);
// }
//
// /**
// * 修改替他人捐款记录表
// */
// @PostMapping("/update")
// @OperationLog(name = "修改替他人捐款记录表", type = OperationLogType.UPDATE)
// @ApiOperation(value = "修改替他人捐款记录表")
// public ApiResult<Boolean> updateDonationAgent(@Validated(Update.class) @RequestBody DonationAgent donationAgent)throws Exception{
// boolean flag= donationAgentService.updateDonationAgent(donationAgent);
// return ApiResult.result(flag);
// }
//
// /**
// * 删除替他人捐款记录表
// */
// @PostMapping("/delete/{id}")
// @OperationLog(name = "删除替他人捐款记录表", type = OperationLogType.DELETE)
// @ApiOperation(value = "删除替他人捐款记录表")
// public ApiResult<Boolean> deleteDonationAgent(@PathVariable("id") Long id)throws Exception{
// boolean flag= donationAgentService.deleteDonationAgent(id);
// return ApiResult.result(flag);
// }
//
// /**
// * 获取替他人捐款记录表详情
// */
// @GetMapping("/info/{id}")
// @OperationLog(name = "替他人捐款记录表详情", type = OperationLogType.INFO)
// @ApiOperation(value = "替他人捐款记录表详情")
// public ApiResult<DonationAgentQueryVo> getDonationAgent(@PathVariable("id") Long id)throws Exception{
// DonationAgentQueryVo donationAgentQueryVo = donationAgentService.getDonationAgentById(id);
// return ApiResult.ok(donationAgentQueryVo);
// }
//
// /**
// * 替他人捐款记录表分页列表
// */
// @PostMapping("/getPageList")
// @OperationLog(name = "替他人捐款记录表分页列表", type = OperationLogType.PAGE)
// @ApiOperation(value = "替他人捐款记录表分页列表")
// public ApiResult<Paging<DonationAgentQueryVo>>getDonationAgentPageList(@Validated @RequestBody DonationAgentPageParam donationAgentPageParam)throws Exception{
// Paging<DonationAgentQueryVo> paging = donationAgentService.getDonationAgentPageList(donationAgentPageParam);
// return ApiResult.ok(paging);
// }
//}
package com.wecloud.im.controller;
import com.wecloud.im.entity.VipPrice;
import com.wecloud.im.service.VipPriceService;
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.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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.List;
/**
* 会员价格表 控制器
*
* @author xxx
* @since 2021-03-11
*/
@Slf4j
@RestController
@RequestMapping("/vipPrice")
@Api(value = "会员价格表API", tags = {"会员价格表"})
public class VipPriceController extends BaseController {
@Autowired
private VipPriceService vipPriceService;
/**
* 会员价格表所有列表
*/
@PostMapping("/getAllList")
@OperationLog(name = "会员价格表所有列表", type = OperationLogType.PAGE)
@ApiOperation(value = "会员价格表所有列表")
public ApiResult<List<VipPrice>> getVipPricePageList() throws Exception {
return ApiResult.ok(vipPriceService.list());
}
// /**
// * 会员价格表分页列表
// */
// @PostMapping("/getPageList")
// @OperationLog(name = "会员价格表分页列表", type = OperationLogType.PAGE)
// @ApiOperation(value = "会员价格表分页列表")
// public ApiResult<Paging<VipPriceQueryVo>> getVipPricePageList(@Validated @RequestBody VipPricePageParam vipPricePageParam) throws Exception {
// Paging<VipPriceQueryVo> paging = vipPriceService.getVipPricePageList(vipPricePageParam);
// return ApiResult.ok(paging);
// }
// /**
// * 添加会员价格表
// */
// @PostMapping("/add")
// @OperationLog(name = "添加会员价格表", type = OperationLogType.ADD)
// @ApiOperation(value = "添加会员价格表")
// public ApiResult<Boolean> addVipPrice(@Validated(Add.class) @RequestBody VipPrice vipPrice) throws Exception {
// boolean flag = vipPriceService.saveVipPrice(vipPrice);
// return ApiResult.result(flag);
// }
//
// /**
// * 修改会员价格表
// */
// @PostMapping("/update")
// @OperationLog(name = "修改会员价格表", type = OperationLogType.UPDATE)
// @ApiOperation(value = "修改会员价格表")
// public ApiResult<Boolean> updateVipPrice(@Validated(Update.class) @RequestBody VipPrice vipPrice) throws Exception {
// boolean flag = vipPriceService.updateVipPrice(vipPrice);
// return ApiResult.result(flag);
// }
//
// /**
// * 删除会员价格表
// */
// @PostMapping("/delete/{id}")
// @OperationLog(name = "删除会员价格表", type = OperationLogType.DELETE)
// @ApiOperation(value = "删除会员价格表")
// public ApiResult<Boolean> deleteVipPrice(@PathVariable("id") Long id) throws Exception {
// boolean flag = vipPriceService.deleteVipPrice(id);
// return ApiResult.result(flag);
// }
//
// /**
// * 获取会员价格表详情
// */
// @GetMapping("/info/{id}")
// @OperationLog(name = "会员价格表详情", type = OperationLogType.INFO)
// @ApiOperation(value = "会员价格表详情")
// public ApiResult<VipPriceQueryVo> getVipPrice(@PathVariable("id") Long id) throws Exception {
// VipPriceQueryVo vipPriceQueryVo = vipPriceService.getVipPriceById(id);
// return ApiResult.ok(vipPriceQueryVo);
// }
}
/*
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wecloud.im.convert;
import com.wecloud.im.entity.SysUser;
import io.geekidea.springbootplus.framework.shiro.vo.LoginUserVo;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* 系统用户对象属性转换器
*
* @author geekidea
* @date 2019-10-05
**/
@Mapper
public interface UserConvert {
UserConvert INSTANCE = Mappers.getMapper(UserConvert.class);
/**
* 系统用户实体对象转换成登录用户VO对象
*
* @param sysUser
* @return
*/
LoginUserVo sysUserToLoginSysUserVo(SysUser sysUser);
}
package com.wecloud.im.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.geekidea.springbootplus.framework.core.validator.groups.Update;
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 hewei
* @since 2021-02-25
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "DonationAgent对象")
public class DonationAgent extends BaseEntity {
private static final long serialVersionUID = 1L;
@NotNull(message = "id不能为空", groups = {Update.class})
@ApiModelProperty("主键")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@NotNull(message = "外键_捐款人_用户表id不能为空")
@ApiModelProperty("外键_捐款人_用户表id")
private Long fkUserId;
@NotNull(message = "外键_捐款表id不能为空")
@ApiModelProperty("外键_捐款表id")
private Long fkRecordId;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("创建时间")
private Date createTime;
@ApiModelProperty("修改时间")
private Date updateTime;
}
package com.wecloud.im.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.geekidea.springbootplus.framework.core.validator.groups.Update;
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.math.BigDecimal;
import java.util.Date;
/**
* 捐款记录
*
* @author hewei
* @since 2021-02-25
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "DonationRecord对象")
public class DonationRecord extends BaseEntity {
private static final long serialVersionUID = 1L;
@NotNull(message = "id不能为空", groups = {Update.class})
@ApiModelProperty("主键")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@NotNull(message = "外键_捐款人_用户表id不能为空")
@ApiModelProperty("外键_捐款人_用户表id")
private Long fkUserId;
@ApiModelProperty("捐款金额")
private BigDecimal money;
@ApiModelProperty("捐款用途;直接录入字符串: 助学助教,资助病残;慰问孤老,其他")
private String purpose;
@ApiModelProperty("捐款方式;1正常.2匿名,替他人捐款记录在donation_r agent表")
private Integer way;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("创建时间")
private Date createTime;
@ApiModelProperty("修改时间")
private Date updateTime;
@ApiModelProperty("是否为别人替我捐款")
private Integer isReplace;
@ApiModelProperty("微信商家订单id")
private String wxMerPayId;
@ApiModelProperty("支付状态,1已支付, 0未支付")
private Integer payStatus;
@ApiModelProperty("支付时间")
private Date payTime;
}
package com.wecloud.im.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.geekidea.springbootplus.framework.core.validator.groups.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.sql.Timestamp;
/**
* 优惠行程表
*
* @author xxx
* @since 2020-10-14
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "StrokeDiscount对象")
public class StrokeDiscount extends BaseEntity {
private static final long serialVersionUID = 1L;
@NotNull(message = "id不能为空", groups = {Update.class})
@ApiModelProperty("主键ID")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@NotNull(message = "出发城市id不能为空")
@ApiModelProperty("出发城市id")
private Long cityOutsetId;
@NotBlank(message = "出发城市名称不能为空")
@ApiModelProperty("出发城市名称")
private String cityOutsetName;
@NotNull(message = "到达城市id不能为空")
@ApiModelProperty("到达城市id")
private Long cityArriveId;
@NotBlank(message = "到达城市名称不能为空")
@ApiModelProperty("到达城市名称")
private String cityArriveName;
@NotNull(message = "座位数不能为空")
@ApiModelProperty("座位数")
private Integer seatNum;
@NotNull(message = "飞机型号ID不能为空")
@ApiModelProperty("飞机型号ID")
private Long plainTypeId;
@ApiModelProperty("飞机型号名称")
private String plainTypeName;
@NotNull(message = "出发时间不能为空")
@ApiModelProperty("出发时间")
private Timestamp outsetTime;
@ApiModelProperty("返程时间")
private Timestamp returnTime;
@NotNull(message = "状态,0-正常,1-完成,99-删除不能为空")
@ApiModelProperty("状态,0-正常,1-完成,99-删除")
private Integer status;
@NotNull(message = "创建时间不能为空")
@ApiModelProperty("创建时间")
private Timestamp createTime;
@ApiModelProperty("更新时间")
private Timestamp updateTime;
@ApiModelProperty("备注")
private String remarks;
@ApiModelProperty("价格")
private BigDecimal money;
@NotNull(message = "商家ID不能为空")
@ApiModelProperty("商家ID")
private Long mcId;
}
/*
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wecloud.im.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.Version;
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.NotBlank;
import javax.validation.constraints.Null;
import java.util.Date;
/**
* <pre>
* 部门
* </pre>
*
* @author geekidea
* @since 2019-10-24
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "SysDepartment对象", description = "部门")
public class SysDepartment extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("主键")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ApiModelProperty("部门名称")
@NotBlank(message = "部门名称不能为空")
private String name;
@ApiModelProperty("父id")
private Long parentId;
@ApiModelProperty("状态,0:禁用,1:启用")
private Integer state;
@ApiModelProperty("排序")
private Integer sort;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("版本")
@Null(message = "版本不用传")
@Version
private Integer version;
@ApiModelProperty("创建时间")
@Null(message = "创建时间不用传")
private Date createTime;
@ApiModelProperty("修改时间")
@Null(message = "修改时间不用传")
private Date updateTime;
}
package com.wecloud.im.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.wecloud.im.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;
}
/*
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wecloud.im.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.Version;
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.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.util.Date;
/**
* <pre>
* 系统权限
* </pre>
*
* @author geekidea
* @since 2019-10-24
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "SysPermission对象", description = "系统权限")
public class SysPermission extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("主键")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ApiModelProperty("权限名称")
private String name;
@ApiModelProperty("父id")
private Long parentId;
@ApiModelProperty("路径")
private String url;
@ApiModelProperty("唯一编码")
@NotBlank(message = "唯一编码不能为空")
private String code;
@ApiModelProperty("图标")
private String icon;
@ApiModelProperty("类型,1:菜单,2:按钮")
@NotNull(message = "类型,1:菜单,2:按钮不能为空")
private Integer type;
@ApiModelProperty("层级,1:第一级,2:第二级,N:第N级")
@NotNull(message = "层级,1:第一级,2:第二级,N:第N级不能为空")
private Integer level;
@ApiModelProperty("状态,0:禁用,1:启用")
private Integer state;
@ApiModelProperty("排序")
private Integer sort;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("版本")
@Null(message = "版本不用传")
@Version
private Integer version;
@ApiModelProperty("创建时间")
@Null(message = "创建时间不用传")
private Date createTime;
@ApiModelProperty("修改时间")
@Null(message = "修改时间不用传")
private Date updateTime;
}
/*
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wecloud.im.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.Version;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.geekidea.springbootplus.framework.core.validator.groups.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.util.Date;
/**
* <pre>
* 系统角色
* </pre>
*
* @author geekidea
* @since 2019-10-24
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "SysRole对象", description = "系统角色")
public class SysRole extends BaseEntity {
private static final long serialVersionUID = -487738234353456553L;
@ApiModelProperty("主键")
@TableId(value = "id", type = IdType.AUTO)
@NotNull(groups = Update.class, message = "角色ID不能为空")
private Long id;
@ApiModelProperty("角色名称")
@NotBlank(message = "角色名称不能为空")
private String name;
@ApiModelProperty("角色唯一编码")
private String code;
@ApiModelProperty("角色类型")
private Integer type;
@ApiModelProperty("角色状态,0:禁用,1:启用")
private Integer state;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("版本")
@Null(message = "版本不用传")
@Version
private Integer version;
@ApiModelProperty("创建时间")
@Null(message = "创建时间不用传")
private Date createTime;
@ApiModelProperty("修改时间")
@Null(message = "修改时间不用传")
private Date updateTime;
}
/*
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wecloud.im.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.Version;
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 javax.validation.constraints.Null;
import java.util.Date;
/**
* <pre>
* 角色权限关系
* </pre>
*
* @author geekidea
* @since 2019-10-24
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "SysRolePermission对象", description = "角色权限关系")
public class SysRolePermission extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("主键")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ApiModelProperty("角色id")
@NotNull(message = "角色id不能为空")
private Long roleId;
@ApiModelProperty("权限id")
@NotNull(message = "权限id不能为空")
private Long permissionId;
@ApiModelProperty("状态,0:禁用,1:启用")
private Integer state;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("版本")
@Null(message = "版本不用传")
@Version
private Integer version;
@ApiModelProperty("创建时间")
@Null(message = "创建时间不用传")
private Date createTime;
@ApiModelProperty("修改时间")
@Null(message = "修改时间不用传")
private Date updateTime;
}
/*
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wecloud.im.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.Version;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.geekidea.springbootplus.framework.core.validator.groups.Add;
import io.geekidea.springbootplus.framework.core.validator.groups.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.util.Date;
/**
* <pre>
* 系统用户
* </pre>
*
* @author geekidea
* @since 2019-10-24
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "SysUser对象", description = "系统用户")
public class SysUser extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("主键")
@NotNull(message = "ID不能为空", groups = {Update.class})
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ApiModelProperty("用户名")
@NotNull(message = "用户名不能为空", groups = {Add.class})
private String username;
@ApiModelProperty("昵称")
private String nickname;
@ApiModelProperty("密码")
private String password;
@ApiModelProperty("盐值")
private String salt;
@ApiModelProperty("手机号码")
@NotBlank(message = "手机号码不能为空")
private String phone;
@ApiModelProperty("性别,0:女,1:男,默认1")
private Integer gender;
@ApiModelProperty("头像")
private String head;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("状态,0:禁用,1:启用,2:锁定")
private Integer state;
@ApiModelProperty("部门id")
@NotNull(message = "部门id不能为空")
private Long departmentId;
@ApiModelProperty("角色id")
@NotNull(message = "角色id不能为空")
private Long roleId;
@ApiModelProperty("逻辑删除,0:未删除,1:已删除")
@Null(message = "逻辑删除不用传")
@TableLogic
private Integer deleted;
@ApiModelProperty("版本")
@Null(message = "版本不用传")
@Version
private Integer version;
@ApiModelProperty("创建时间")
@Null(message = "创建时间不用传")
private Date createTime;
@ApiModelProperty("修改时间")
@Null(message = "修改时间不用传")
private Date updateTime;
}
package com.wecloud.im.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;
/**
* app用户活跃记录表
*
* @author giao
* @since 2020-10-21
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "UserActiveRecord对象")
public class UserActiveRecord extends BaseEntity {
private static final long serialVersionUID = 1L;
@NotNull(message = "主键id不能为空")
@ApiModelProperty("主键id")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@NotNull(message = "用户id不能为空")
@ApiModelProperty("用户id")
private Long userId;
@NotNull(message = "记录日期不能为空")
@ApiModelProperty("记录日期")
private Date recordDate;
@ApiModelProperty("创建时间")
private Date createTime;
@ApiModelProperty("更新时间")
private Date modifyTime;
}
package com.wecloud.im.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.geekidea.springbootplus.framework.core.validator.groups.Update;
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.sql.Timestamp;
/**
* App版本控制
*
* @author giao
* @since 2020-10-26
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "VersionControl对象")
public class VersionControl extends BaseEntity {
private static final long serialVersionUID = 1L;
@NotNull(message = "id不能为空", groups = {Update.class})
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ApiModelProperty("版本号")
private String versionName;
@ApiModelProperty("设备类型,1安卓,2 ios")
private Integer deviceType;
@ApiModelProperty("下载地址")
private String downloadUrl;
@ApiModelProperty("1:强更,0不强制")
private Integer forceUpdate;
@ApiModelProperty("创建时间")
private Timestamp createTime;
@ApiModelProperty("修改时间")
private Timestamp updateTime;
}
package com.wecloud.im.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.geekidea.springbootplus.framework.core.validator.groups.Update;
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.math.BigDecimal;
import java.util.Date;
/**
* 会员价格表
*
* @author xxx
* @since 2021-03-11
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "VipPrice对象")
public class VipPrice extends BaseEntity {
private static final long serialVersionUID = 1L;
@NotNull(message = "id不能为空", groups = {Update.class})
@ApiModelProperty("id")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ApiModelProperty("会员价格")
private BigDecimal price;
@ApiModelProperty("会员类型(名称)")
private String memberShips;
@ApiModelProperty("创建时间")
private Date createTime;
@ApiModelProperty("修改时间")
private Date updateTime;
@ApiModelProperty("状态,0:禁用,1:启用")
private Integer state;
}
package com.wecloud.im.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.geekidea.springbootplus.framework.core.validator.groups.Update;
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.math.BigDecimal;
import java.util.Date;
/**
* 捐款记录
*
* @author hewei
* @since 2021-02-25
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "VipRecord对象")
public class VipRecord extends BaseEntity {
private static final long serialVersionUID = 1L;
@NotNull(message = "id不能为空", groups = {Update.class})
@ApiModelProperty("主键")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@NotNull(message = "外键_用户表不能为空")
@ApiModelProperty("外键_用户表")
private Long fkUserId;
@NotNull(message = "开通人,因为可以给其他人开通,所以要有对应的谁给我充值的不能为空")
@ApiModelProperty("开通人,因为可以给其他人开通,所以要有对应的谁给我充值的")
private Long fkRechargeUser;
@ApiModelProperty("开通会员金额")
private BigDecimal money;
@ApiModelProperty("到期时间")
private Date expiredAt;
@NotNull(message = "开通多久不能为空")
@ApiModelProperty("开通多久")
private Integer years;
// @NotBlank(message = "会员等级不能为空")
// @ApiModelProperty("会员等级")
// private String vipLevel;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("创建时间")
private Date createTime;
@ApiModelProperty("修改时间")
private Date updateTime;
@ApiModelProperty("微信商家订单id")
private String wxMerPayId;
@ApiModelProperty("支付状态,1已支付, 0未支付")
private Integer payStatus;
@ApiModelProperty("支付时间")
private Date payTime;
}
package com.wecloud.im.entity.base;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @ClassName ImgJson
* @Descripteion 请写点注释吧!
* @Date 2020/10/22 11:21
* @Version 1.0
**/
@Data
@ApiModel(value = "图片json对象")
public class ImgJson implements Serializable {
@ApiModelProperty("地址url")
private String url;
@ApiModelProperty("高")
private Long height;
@ApiModelProperty("宽")
private Long width;
}
package com.wecloud.im.enums;
import io.geekidea.springbootplus.framework.common.enums.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 审核状态,0审核中,1审核通过,2审核未通过
*/
@Getter
@AllArgsConstructor
public enum StrokeAuditStatusEnum implements BaseEnum {
UNDER_REVIEW(0, "审核中"),
AUDIT_OK(1, "审核通过"),
AUDIT_FAILED(2, "审核未通过"),
;
/**
* 编号
*/
private final Integer code;
/**
* 名称
*/
private final String desc;
}
package com.wecloud.im.enums;
import io.geekidea.springbootplus.framework.common.enums.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 状态,0-正常,1-完成,99-删除
*/
@Getter
@AllArgsConstructor
public enum StrokeDiscountStatusEnum implements BaseEnum {
OK(0, "正常"),
COMPLETE(1, "完成"),
CANCEL(99, "取消");
/**
* 编号
*/
private final Integer code;
/**
* 名称
*/
private final String desc;
}
package com.wecloud.im.enums;
import io.geekidea.springbootplus.framework.common.enums.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 状态,0-审核中,1-进行中,2-已完成,99-取消
*/
@Getter
@AllArgsConstructor
public enum StrokeStatusEnum implements BaseEnum {
UNDER_REVIEW(0, "审核中"),
PROCESSING(1, "进行中"),
COMPLETED(2, "已完成"),
CANCEL(99, "取消");
/**
* 编号
*/
private final Integer code;
/**
* 名称
*/
private final String desc;
}
package com.wecloud.im.enums;
import io.geekidea.springbootplus.framework.common.enums.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 行程类型,0-单程,1-往返行程,2-货运,3-医疗
*/
@Getter
@AllArgsConstructor
public enum StrokeTypeEnum implements BaseEnum {
ONE_WAY(0, "单程"),
ROUND_TRIP(1, "往返"),
CARGO_FLIGHT(2, "货运"),
MEDICAL_FLIGHT(3, "医疗"),
;
/**
* 编号
*/
private final Integer code;
/**
* 名称
*/
private final String desc;
}
package com.wecloud.im.factory;
import io.geekidea.springbootplus.config.properties.WxMpProperties;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.stream.Collectors;
public class GetWx {
private static WxMpProperties properties;
public static WxMpService getWxMpService() {
// 代码里 getConfigs()处报错的同学,请注意仔细阅读项目说明,你的IDE需要引入lombok插件!!!!
final List<WxMpProperties.MpConfig> configs = properties.getConfigs();
if (configs == null) {
throw new RuntimeException("添加下相关配置,注意别配错了!");
}
WxMpService service = new WxMpServiceImpl();
service.setMultiConfigStorages(configs
.stream().map(a -> {
WxMpDefaultConfigImpl configStorage;
//
configStorage = new WxMpDefaultConfigImpl();
configStorage.setAppId(a.getAppId());
configStorage.setSecret(a.getSecret());
configStorage.setToken(a.getToken());
configStorage.setAesKey(a.getAesKey());
return configStorage;
}).collect(Collectors.toMap(WxMpDefaultConfigImpl::getAppId, a -> a, (o, n) -> o)));
return service;
}
@Autowired
public void setProperties(WxMpProperties properties) {
this.properties = properties;
}
}
package com.wecloud.im.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.wecloud.im.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.wecloud.im.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.wecloud.im.entity.AppUser;
import com.wecloud.im.param.AppUserPageParam;
import com.wecloud.im.vo.AppUserQueryVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.io.Serializable;
/**
* APP用户 Mapper 接口
*
* @author wei
* @since 2020-09-23
*/
@Repository
public interface AppUserMapper extends BaseMapper<AppUser> {
/**
* 根据ID获取查询对象
*
* @param id
* @return
*/
AppUserQueryVo getAppUserById(Serializable id);
/**
* 获取分页对象
*
* @param page
* @param appUserPageParam
* @return
*/
IPage<AppUserQueryVo> getAppUserPageList(@Param("page") Page page, @Param("param") AppUserPageParam appUserPageParam);
}
package com.wecloud.im.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wecloud.im.entity.DonationAgent;
import com.wecloud.im.param.DonationAgentPageParam;
import com.wecloud.im.vo.DonationAgentQueryVo;
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 hewei
* @since 2021-02-25
*/
@Repository
public interface DonationAgentMapper extends BaseMapper<DonationAgent> {
/**
* 根据ID获取查询对象
*
* @param id
* @return
*/
DonationAgentQueryVo getDonationAgentById(Serializable id);
/**
* 获取分页对象
*
* @param page
* @param donationAgentPageParam
* @return
*/
IPage<DonationAgentQueryVo> getDonationAgentPageList(@Param("page") Page page,@Param("param") DonationAgentPageParam donationAgentPageParam);
}
package com.wecloud.im.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.wecloud.im.entity.DonationRecord;
import com.wecloud.im.param.DonationRecordPageParam;
import com.wecloud.im.vo.DonationRankAndTotal;
import com.wecloud.im.vo.DonationRecordQueryVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.io.Serializable;
/**
* 捐款记录 Mapper 接口
*
* @author hewei
* @since 2021-02-25
*/
@Repository
public interface DonationRecordMapper extends BaseMapper<DonationRecord> {
/**
* 根据ID获取查询对象
*
* @param id
* @return
*/
DonationRecordQueryVo getDonationRecordById(Serializable id);
/**
* 获取分页对象
*
* @param page
* @param donationRecordPageParam
* @return
*/
IPage<DonationRecordQueryVo> getDonationRecordPageList(@Param("page") Page page, @Param("param") DonationRecordPageParam donationRecordPageParam, @Param("userId") Long userId);
/**
* 查询捐款排名
*
* @param userId
* @return
*/
DonationRankAndTotal getDonationRankAndTotal(@Param("userId") Long userId);
}
package com.wecloud.im.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.wecloud.im.entity.VipPrice;
import com.wecloud.im.param.VipPricePageParam;
import com.wecloud.im.vo.app.VipPriceQueryVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.io.Serializable;
/**
* 会员价格表 Mapper 接口
*
* @author xxx
* @since 2021-03-11
*/
@Repository
public interface VipPriceMapper extends BaseMapper<VipPrice> {
/**
* 根据ID获取查询对象
*
* @param id
* @return
*/
VipPriceQueryVo getVipPriceById(Serializable id);
/**
* 获取分页对象
*
* @param page
* @param vipPricePageParam
* @return
*/
IPage<VipPriceQueryVo> getVipPricePageList(@Param("page") Page page, @Param("param") VipPricePageParam vipPricePageParam);
}
package com.wecloud.im.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.wecloud.im.entity.VipRecord;
import com.wecloud.im.param.VipRecordPageParam;
import com.wecloud.im.vo.VipRecordQueryVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.io.Serializable;
/**
* Vip开通记录 Mapper 接口
*
* @author hewei
* @since 2021-02-25
*/
@Repository
public interface VipRecordMapper extends BaseMapper<VipRecord> {
/**
* 根据ID获取查询对象
*
* @param id
* @return
*/
VipRecordQueryVo getVipRecordById(Serializable id);
/**
* 获取分页对象
*
* @param page
* @param vipRecordPageParam
* @return
*/
IPage<VipRecordQueryVo> getVipRecordPageList(@Param("page") Page page, @Param("param") VipRecordPageParam vipRecordPageParam);
}
/*
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wecloud.im.param;
import io.geekidea.springbootplus.framework.shiro.service.LoginUsername;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* 登录参数
*
* @author geekidea
* @date 2019-05-15
**/
@Data
@ApiModel("登录参数")
public class LoginParam implements LoginUsername {
private static final long serialVersionUID = 2854217576695117356L;
@NotBlank(message = "请输入账号")
@ApiModelProperty(value = "账号", example = "admin")
private String username;
@NotBlank(message = "请输入密码")
@ApiModelProperty(value = "密码", example = "123456")
private String password;
@ApiModelProperty("验证码Token")
private String verifyToken;
@ApiModelProperty("验证码")
private String code;
}
package com.wecloud.im.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 wei
* @date 2020-10-09
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "飞机型号表分页参数")
public class PlainTypePageParam extends BasePageOrderParam {
private static final long serialVersionUID = 1L;
}
/*
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wecloud.im.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 注册参数
*
* @author geekidea
* @date 2019-05-15
**/
@Data
@ApiModel("登录参数")
public class RegisterParam implements Serializable {
private static final long serialVersionUID = 2854217576695117357L;
@NotBlank(message = "请输入手机号")
@ApiModelProperty(value = "手机号", example = "admin")
private String phone;
@NotBlank(message = "请输入密码")
@ApiModelProperty(value = "密码", example = "123456")
private String password;
//
// @ApiModelProperty("验证码Token")
// private String verifyToken;
//
// @ApiModelProperty("验证码")
// private String code;
}
package com.wecloud.im.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* <pre>
* 开通会员参数对象
* </pre>
*
* @author hewei
* @date 2021-02-25
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "VipOpenParam")
public class VipOpenParam implements Serializable {
private static final long serialVersionUID = 1L;
// @ApiModelProperty("开通会员金额")
// private BigDecimal money;
@NotNull(message = "开通多久不能为空")
@ApiModelProperty("开通多少年")
private Integer years;
// @NotNull(message = "会员等级id不能为空")
@ApiModelProperty("会员等级id,传入由会员列表接口返回的id")
private Long vipLevelId;
@ApiModelProperty("是否代替他人开通")
private Integer isReplace;
@ApiModelProperty("捐款接收用户手机号,当isAgent=1为必填")
private String userPhone;
@ApiModelProperty("手机区号,当isAgent=1为必填")
private String phoneArea;
}
package com.wecloud.im.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 2021-03-11
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "会员价格表分页参数")
public class VipPricePageParam extends BasePageOrderParam {
private static final long serialVersionUID = 1L;
}
package com.wecloud.im.param;
import io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* <pre>
* 开通会员参数对象
* </pre>
*
* @author hewei
* @date 2021-02-25
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "捐款记录分页参数")
public class VipRecordOpenParam extends BasePageOrderParam {
private static final long serialVersionUID = 1L;
// @ApiModelProperty("开通会员金额")
// private BigDecimal money;
@NotNull(message = "开通多久不能为空")
@ApiModelProperty("开通多少年")
private Integer years;
@NotBlank(message = "会员等级id不能为空")
@ApiModelProperty("会员等级id,传入由会员列表接口返回的id")
private Long vipLevelId;
@NotBlank(message = "不能为空")
@ApiModelProperty("是否代替他人开通")
private Boolean isReplace;
@ApiModelProperty("捐款接收用户手机号,当isAgent=1为必填")
private String userPhone;
@ApiModelProperty("手机区号,当isAgent=1为必填")
private String phoneArea;
}
package com.wecloud.im.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 hewei
* @date 2021-02-25
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "捐款记录分页参数")
public class VipRecordPageParam extends BasePageOrderParam{
private static final long serialVersionUID=1L;
}
package com.wecloud.im.push.umeng;
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.wecloud.im.push.umeng;
public class App {
}
package com.wecloud.im.push.umeng;
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.wecloud.im.push.umeng;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
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();
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()));
StringBuffer result = new StringBuffer();
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;
}
// 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;
}
}
package com.wecloud.im.push.umeng;
import com.wecloud.im.factory.PushService;
import com.wecloud.im.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.wecloud.im.push.umeng;
import com.wecloud.im.factory.PushService;
import com.wecloud.im.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.wecloud.im.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",
"filter", "production_mode", "feedback", "description", "thirdparty_id", "mipush", "mi_activity", "channel_properties"));
// Keys can be set in the policy level
protected static final HashSet<String> POLICY_KEYS = new HashSet<String>(Arrays.asList("start_time", "expire_time", "max_send_num"));
// This JSONObject is used for constructing the whole request string.
protected final JSONObject rootJson = new JSONObject();
// The app master secret
protected String appMasterSecret;
// Set predefined keys in the rootJson, for extra keys(Android) or customized keys(IOS) please
// refer to corresponding methods in the subclass.
public abstract boolean setPredefinedKeyValue(String key, Object value) throws Exception;
public String getPostBody() {
return rootJson.toString();
}
protected final String getAppMasterSecret() {
return appMasterSecret;
}
public void setAppMasterSecret(String secret) {
appMasterSecret = secret;
}
protected void setProductionMode(Boolean prod) throws Exception {
setPredefinedKeyValue("production_mode", prod.toString());
}
///正式模式
public void setProductionMode() throws Exception {
setProductionMode(true);
}
///测试模式
public void setTestMode() throws Exception {
setProductionMode(false);
}
///发送消息描述,建议填写。
public void setDescription(String description) throws Exception {
setPredefinedKeyValue("description", description);
}
///定时发送时间,若不填写表示立即发送。格式: "YYYY-MM-DD hh:mm:ss"。
public void setStartTime(String startTime) throws Exception {
setPredefinedKeyValue("start_time", startTime);
}
///消息过期时间,格式: "YYYY-MM-DD hh:mm:ss"。
public void setExpireTime(String expireTime) throws Exception {
setPredefinedKeyValue("expire_time", expireTime);
}
///发送限速,每秒发送的最大条数。
public void setMaxSendNum(Integer num) throws Exception {
setPredefinedKeyValue("max_send_num", num);
}
//厂商弹窗activity
public void setChannelActivity(String activity) throws Exception {
setPredefinedKeyValue("mipush", "true");
setPredefinedKeyValue("mi_activity", activity);
}
//厂商属性配置
public void setChannelProperties(String xiaoMiChannelId) throws Exception {
JSONObject object = new JSONObject();
object.put("xiaomi_channel_id", xiaoMiChannelId);
setPredefinedKeyValue("channel_properties", object);
}
}
package com.wecloud.im.push.umeng.android;
import com.wecloud.im.push.umeng.AndroidNotification;
public class AndroidBroadcast extends AndroidNotification {
public AndroidBroadcast(String appkey, String appMasterSecret) throws Exception {
setAppMasterSecret(appMasterSecret);
setPredefinedKeyValue("appkey", appkey);
this.setPredefinedKeyValue("type", "broadcast");
}
}
package com.wecloud.im.push.umeng.android;
import com.wecloud.im.push.umeng.AndroidNotification;
public class AndroidCustomizedcast extends AndroidNotification {
public AndroidCustomizedcast(String appkey, String appMasterSecret) throws Exception {
setAppMasterSecret(appMasterSecret);
setPredefinedKeyValue("appkey", appkey);
this.setPredefinedKeyValue("type", "customizedcast");
}
public void setAlias(String alias, String aliasType) throws Exception {
setPredefinedKeyValue("alias", alias);
setPredefinedKeyValue("alias_type", aliasType);
}
public void setFileId(String fileId, String aliasType) throws Exception {
setPredefinedKeyValue("file_id", fileId);
setPredefinedKeyValue("alias_type", aliasType);
}
}
package com.wecloud.im.push.umeng.android;
import com.wecloud.im.push.umeng.AndroidNotification;
public class AndroidFilecast extends AndroidNotification {
public AndroidFilecast(String appkey, String appMasterSecret) throws Exception {
setAppMasterSecret(appMasterSecret);
setPredefinedKeyValue("appkey", appkey);
this.setPredefinedKeyValue("type", "filecast");
}
public void setFileId(String fileId) throws Exception {
setPredefinedKeyValue("file_id", fileId);
}
}
\ No newline at end of file
package com.wecloud.im.push.umeng.android;
import com.wecloud.im.push.umeng.AndroidNotification;
import org.json.JSONObject;
public class AndroidGroupcast extends AndroidNotification {
public AndroidGroupcast(String appkey, String appMasterSecret) throws Exception {
setAppMasterSecret(appMasterSecret);
setPredefinedKeyValue("appkey", appkey);
this.setPredefinedKeyValue("type", "groupcast");
}
public void setFilter(JSONObject filter) throws Exception {
setPredefinedKeyValue("filter", filter);
}
}
package com.wecloud.im.push.umeng.android;
import com.wecloud.im.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.wecloud.im.push.umeng.android;
import com.wecloud.im.push.umeng.AndroidNotification;
public class AndroidUnicast extends AndroidNotification {
public AndroidUnicast(String appkey, String appMasterSecret) throws Exception {
setAppMasterSecret(appMasterSecret);
setPredefinedKeyValue("appkey", appkey);
this.setPredefinedKeyValue("type", "unicast");
}
public void setDeviceToken(String token) throws Exception {
setPredefinedKeyValue("device_tokens", token);
}
}
\ No newline at end of file
package com.wecloud.im.push.umeng.ios;
import com.wecloud.im.push.umeng.IOSNotification;
public class IOSBroadcast extends IOSNotification {
public IOSBroadcast(String appkey, String appMasterSecret) throws Exception {
setAppMasterSecret(appMasterSecret);
setPredefinedKeyValue("appkey", appkey);
this.setPredefinedKeyValue("type", "broadcast");
}
}
package com.wecloud.im.push.umeng.ios;
import com.wecloud.im.push.umeng.IOSNotification;
public class IOSCustomizedcast extends IOSNotification {
public IOSCustomizedcast(String appkey, String appMasterSecret) throws Exception {
setAppMasterSecret(appMasterSecret);
setPredefinedKeyValue("appkey", appkey);
this.setPredefinedKeyValue("type", "customizedcast");
}
public void setAlias(String alias, String aliasType) throws Exception {
setPredefinedKeyValue("alias", alias);
setPredefinedKeyValue("alias_type", aliasType);
}
public void setFileId(String fileId, String aliasType) throws Exception {
setPredefinedKeyValue("file_id", fileId);
setPredefinedKeyValue("alias_type", aliasType);
}
}
package com.wecloud.im.push.umeng.ios;
import com.wecloud.im.push.umeng.IOSNotification;
public class IOSFilecast extends IOSNotification {
public IOSFilecast(String appkey, String appMasterSecret) throws Exception {
setAppMasterSecret(appMasterSecret);
setPredefinedKeyValue("appkey", appkey);
this.setPredefinedKeyValue("type", "filecast");
}
public void setFileId(String fileId) throws Exception {
setPredefinedKeyValue("file_id", fileId);
}
}
package com.wecloud.im.push.umeng.ios;
import com.wecloud.im.push.umeng.IOSNotification;
import org.json.JSONObject;
public class IOSGroupcast extends IOSNotification {
public IOSGroupcast(String appkey, String appMasterSecret) throws Exception {
setAppMasterSecret(appMasterSecret);
setPredefinedKeyValue("appkey", appkey);
this.setPredefinedKeyValue("type", "groupcast");
}
public void setFilter(JSONObject filter) throws Exception {
setPredefinedKeyValue("filter", filter);
}
}
package com.wecloud.im.push.umeng.ios;
import com.wecloud.im.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.wecloud.im.push.umeng.ios;
import com.wecloud.im.push.umeng.IOSNotification;
public class IOSUnicast extends IOSNotification {
public IOSUnicast(String appkey, String appMasterSecret) throws Exception {
setAppMasterSecret(appMasterSecret);
setPredefinedKeyValue("appkey", appkey);
this.setPredefinedKeyValue("type", "unicast");
}
public void setDeviceToken(String token) throws Exception {
setPredefinedKeyValue("device_tokens", token);
}
}
package com.wecloud.im.service;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
public interface AppSmsService {
void deleteRegisterCode(String area, String number);
void deleteUpdatePhoneCode(String area, String number);
void deleteUpdatePhoneCodeNew(String area, String number);
/**
* 获取注册验证码
*/
ApiResult<Object> registerOrLoginCode(String phoneArea, String phone);
ApiResult<Object> updatePhoneCodeSendToOld() throws Exception;
/**
* 修改手机号,向新手机号发验证码
*/
ApiResult<Object> updatePhoneCodeSendToNew(String phoneArea, String phone);
/**
* 修改手机号,校验旧手机验证码
*/
ApiResult<Boolean> checkPhoneCodeOld(String code) throws Exception;
/**
* 获取注册验证码
*/
ApiResult LoginType(String area, String number);
/**
* 校验注册验证码
*
* @param area
* @param number
* @param code
* @return
*/
boolean equalsRegisterCode(String area, String number, String code);
boolean equalsUpdatePhoneCodeOld(String area, String number, String code);
boolean equalsUpdatePhoneCodeNew(String area, String number, String code);
/**
* 校验验登陆证码
*
* @param area
* @param number
* @param code
* @return
*/
boolean equalsLoginCode(String area, String number, String code);
}
package com.wecloud.im.service;
import com.wecloud.im.entity.AppUser;
import com.wecloud.im.param.app.AppSmsRegisterParam;
import com.wecloud.im.param.app.AppUserInfoParam;
import com.wecloud.im.vo.app.LoginAppUserTokenVo;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import java.util.List;
import java.util.Set;
public interface AppUserApiService {
/**
* 注册
*
* @param loginParam
* @param language
* @return
* @throws Exception
*/
ApiResult<LoginAppUserTokenVo> register(AppSmsRegisterParam loginParam, String language) throws Exception;
// ApiResult<LoginAppUserTokenVo> login(AppSmsRegisterParam loginParam, String language) throws Exception;
/**
* 修改或补充用户信息
*
* @param appUserInfoParam
* @return
* @throws Exception
*/
boolean updateAppUser(AppUserInfoParam appUserInfoParam) throws Exception;
/**
* 修改手机号
*
* @param phoneArea
* @param phone
* @param code
* @return
* @throws Exception
*/
ApiResult<Boolean> updatePhone(String phoneArea, String phone, String code, String codeNew) throws Exception;
/**
* 获取用户信息
*
* @param userId
* @return
*/
AppUser getUserInfo(Long userId);
/**
* 批量获取用户信息
*
* @param uids
* @return
*/
ApiResult<List<AppUser>> getAppUserList(Set<Long> uids);
}
package com.wecloud.im.service;
import com.wecloud.im.entity.DonationAgent;
import com.wecloud.im.param.DonationAgentPageParam;
import com.wecloud.im.vo.DonationAgentQueryVo;
import io.geekidea.springbootplus.framework.common.service.BaseService;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
/**
* 替他人捐款记录表 服务类
*
* @author hewei
* @since 2021-02-25
*/
public interface DonationAgentService extends BaseService<DonationAgent> {
/**
* 保存
*
* @param donationAgent
* @return
* @throws Exception
*/
boolean saveDonationAgent(DonationAgent donationAgent)throws Exception;
/**
* 修改
*
* @param donationAgent
* @return
* @throws Exception
*/
boolean updateDonationAgent(DonationAgent donationAgent)throws Exception;
/**
* 删除
*
* @param id
* @return
* @throws Exception
*/
boolean deleteDonationAgent(Long id)throws Exception;
/**
* 根据ID获取查询对象
*
* @param id
* @return
* @throws Exception
*/
DonationAgentQueryVo getDonationAgentById(Long id)throws Exception;
/**
* 获取分页对象
*
* @param donationAgentPageParam
* @return
* @throws Exception
*/
Paging<DonationAgentQueryVo> getDonationAgentPageList(DonationAgentPageParam donationAgentPageParam) throws Exception;
}
package com.wecloud.im.service;
import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
import com.wecloud.im.entity.DonationRecord;
import com.wecloud.im.param.DonationRecordPageParam;
import com.wecloud.im.param.app.DonationRecordAdd;
import com.wecloud.im.vo.DonationRankAndTotal;
import com.wecloud.im.vo.DonationRecordQueryVo;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.service.BaseService;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
import java.util.List;
/**
* 捐款记录 服务类
*
* @author hewei
* @since 2021-02-25
*/
public interface DonationRecordService extends BaseService<DonationRecord> {
/**
* 查询捐款排名和总捐款
*
* @param userId
* @return
*/
DonationRankAndTotal getDonationRankAndTotal(Long userId);
/**
* 保存
*
* @param donationRecord
* @return
* @throws Exception
*/
boolean saveDonationRecord(DonationRecord donationRecord) throws Exception;
/**
* 回调
*/
String donationOrderNotifyResult(String xmlData);
/**
* 我要捐款
*
* @param donationRecordAdd
* @return
* @throws Exception
*/
ApiResult<WxPayMpOrderResult> add(DonationRecordAdd donationRecordAdd) throws Exception;
/**
* 修改
*
* @param donationRecord
* @return
* @throws Exception
*/
boolean updateDonationRecord(DonationRecord donationRecord) throws Exception;
/**
* 删除
*
* @param id
* @return
* @throws Exception
*/
boolean deleteDonationRecord(Long id) throws Exception;
/**
* 根据ID获取查询对象
*
* @param id
* @return
* @throws Exception
*/
DonationRecordQueryVo getDonationRecordById(Long id) throws Exception;
/**
* 获取分页对象
*
* @param donationRecordPageParam
* @return
* @throws Exception
*/
Paging<DonationRecordQueryVo> getDonationRecordPageList(DonationRecordPageParam donationRecordPageParam) throws Exception;
ApiResult<List<DonationRecord>> getDonationRecordAllList() throws Exception;
}
package com.wecloud.im.service;
import com.wecloud.im.entity.VipPrice;
import com.wecloud.im.param.VipPricePageParam;
import com.wecloud.im.vo.app.VipPriceQueryVo;
import io.geekidea.springbootplus.framework.common.service.BaseService;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
/**
* 会员价格表 服务类
*
* @author xxx
* @since 2021-03-11
*/
public interface VipPriceService extends BaseService<VipPrice> {
/**
* 保存
*
* @param vipPrice
* @return
* @throws Exception
*/
boolean saveVipPrice(VipPrice vipPrice) throws Exception;
/**
* 修改
*
* @param vipPrice
* @return
* @throws Exception
*/
boolean updateVipPrice(VipPrice vipPrice) throws Exception;
/**
* 删除
*
* @param id
* @return
* @throws Exception
*/
boolean deleteVipPrice(Long id) throws Exception;
/**
* 根据ID获取查询对象
*
* @param id
* @return
* @throws Exception
*/
VipPriceQueryVo getVipPriceById(Long id) throws Exception;
/**
* 获取分页对象
*
* @param vipPricePageParam
* @return
* @throws Exception
*/
Paging<VipPriceQueryVo> getVipPricePageList(VipPricePageParam vipPricePageParam) throws Exception;
}
package com.wecloud.im.service;
import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
import com.wecloud.im.entity.VipRecord;
import com.wecloud.im.param.VipOpenParam;
import com.wecloud.im.param.VipRecordPageParam;
import com.wecloud.im.vo.VipRecordQueryVo;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.service.BaseService;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
/**
* Vip开通记录 服务类
*
* @author hewei
* @since 2021-02-25
*/
public interface VipRecordService extends BaseService<VipRecord> {
/**
* 支付回调
* @param xmlData
* @return
*/
String vipOrderNotifyResult(String xmlData);
/**
* 保存
*
* @param vipRecord
* @return
* @throws Exception
*/
boolean saveVipRecord(VipRecord vipRecord)throws Exception;
/**
* 开通vip
*
* @param vipOpenParam
* @return
* @throws Exception
*/
ApiResult<WxPayMpOrderResult> openVip(VipOpenParam vipOpenParam) throws Exception;
/**
* 修改
*
* @param vipRecord
* @return
* @throws Exception
*/
boolean updateVipRecord(VipRecord vipRecord)throws Exception;
/**
* 删除
*
* @param id
* @return
* @throws Exception
*/
boolean deleteVipRecord(Long id)throws Exception;
/**
* 根据ID获取查询对象
*
* @param id
* @return
* @throws Exception
*/
VipRecordQueryVo getVipRecordById(Long id)throws Exception;
/**
* 获取分页对象
*
* @param vipRecordPageParam
* @return
* @throws Exception
*/
Paging<VipRecordQueryVo> getVipRecordPageList(VipRecordPageParam vipRecordPageParam) throws Exception;
}
package com.wecloud.im.service.impl;
import com.wecloud.im.entity.DonationAgent;
import com.wecloud.im.mapper.DonationAgentMapper;
import com.wecloud.im.service.DonationAgentService;
import com.wecloud.im.param.DonationAgentPageParam;
import com.wecloud.im.vo.DonationAgentQueryVo;
import io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
import io.geekidea.springbootplus.framework.core.pagination.PageInfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.transaction.annotation.Transactional;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
/**
* 替他人捐款记录表 服务实现类
*
* @author hewei
* @since 2021-02-25
*/
@Slf4j
@Service
public class DonationAgentServiceImpl extends BaseServiceImpl<DonationAgentMapper, DonationAgent> implements DonationAgentService {
@Autowired
private DonationAgentMapper donationAgentMapper;
@Transactional(rollbackFor = Exception.class)
@Override
public boolean saveDonationAgent(DonationAgent donationAgent)throws Exception{
return super.save(donationAgent);
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean updateDonationAgent(DonationAgent donationAgent)throws Exception{
return super.updateById(donationAgent);
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean deleteDonationAgent(Long id)throws Exception{
return super.removeById(id);
}
@Override
public DonationAgentQueryVo getDonationAgentById(Long id)throws Exception{
return donationAgentMapper.getDonationAgentById(id);
}
@Override
public Paging<DonationAgentQueryVo> getDonationAgentPageList(DonationAgentPageParam donationAgentPageParam)throws Exception{
Page<DonationAgentQueryVo> page=new PageInfo<>(donationAgentPageParam,OrderItem.desc(getLambdaColumn(DonationAgent::getCreateTime)));
IPage<DonationAgentQueryVo> iPage= donationAgentMapper.getDonationAgentPageList(page, donationAgentPageParam);
return new Paging<DonationAgentQueryVo>(iPage);
}
}
package com.wecloud.im.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.wecloud.im.entity.VipPrice;
import com.wecloud.im.mapper.VipPriceMapper;
import com.wecloud.im.param.VipPricePageParam;
import com.wecloud.im.service.VipPriceService;
import com.wecloud.im.vo.app.VipPriceQueryVo;
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 2021-03-11
*/
@Slf4j
@Service
public class VipPriceServiceImpl extends BaseServiceImpl<VipPriceMapper, VipPrice> implements VipPriceService {
@Autowired
private VipPriceMapper vipPriceMapper;
@Transactional(rollbackFor = Exception.class)
@Override
public boolean saveVipPrice(VipPrice vipPrice) throws Exception {
return super.save(vipPrice);
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean updateVipPrice(VipPrice vipPrice) throws Exception {
return super.updateById(vipPrice);
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean deleteVipPrice(Long id) throws Exception {
return super.removeById(id);
}
@Override
public VipPriceQueryVo getVipPriceById(Long id) throws Exception {
return vipPriceMapper.getVipPriceById(id);
}
@Override
public Paging<VipPriceQueryVo> getVipPricePageList(VipPricePageParam vipPricePageParam) throws Exception {
Page<VipPriceQueryVo> page = new PageInfo<>(vipPricePageParam, OrderItem.desc(getLambdaColumn(VipPrice::getCreateTime)));
IPage<VipPriceQueryVo> iPage = vipPriceMapper.getVipPricePageList(page, vipPricePageParam);
return new Paging<VipPriceQueryVo>(iPage);
}
}
......@@ -54,7 +54,6 @@ public class AppImHandler extends SimpleChannelInboundHandler<TextWebSocketFrame
ChannelFuture channelFuture = ctx.writeAndFlush(new TextWebSocketFrame(data));
log.debug("data:" + data);
try {
if (data.isEmpty()) {
return;
......@@ -77,7 +76,7 @@ public class AppImHandler extends SimpleChannelInboundHandler<TextWebSocketFrame
// Long userIdByChannel = appUserChannelsService.getUserIdByChannel(ctx);
//
// log.debug("appWS收到" + userIdByChannel + ":" + data + ",channelId:" + ctx.channel().id().asLongText());
System.out.println("appWS收到" + data);
log.debug("WS收到" + data);
String language = ctx.channel().attr(AppUserChannelsService.LANGUAGE).get();
// readWsData.convertModel(data, userIdByChannel, language);
......@@ -94,11 +93,11 @@ public class AppImHandler extends SimpleChannelInboundHandler<TextWebSocketFrame
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
//排除当客户端意外关闭的情况,不是发送指定指令通知服务器退出,就会产生此错误。
if (ctx.channel().isActive()) {
Long userIdByChannel = appUserChannelsService.getUserIdByChannel(ctx);
log.error("uid:" + userIdByChannel + ",ws异常,channelId:" + ctx.channel().id().asLongText(), cause);
}
// //排除当客户端意外关闭的情况,不是发送指定指令通知服务器退出,就会产生此错误。
// if (ctx.channel().isActive()) {
// Long userIdByChannel = appUserChannelsService.getUserIdByChannel(ctx);
// log.error("uid:" + userIdByChannel + ",ws异常,channelId:" + ctx.channel().id().asLongText(), cause);
// }
}
@Override
......@@ -106,7 +105,7 @@ public class AppImHandler extends SimpleChannelInboundHandler<TextWebSocketFrame
// Long userIdByChannel = appUserChannelsService.getUserIdByChannel(ctx);
//
// log.debug("uid:" + userIdByChannel + ",app端连接WS成功" + ",channelId:" + ctx.channel().id().asLongText());
System.out.println("连接WS成功");
log.debug("连接WS成功handlerAdded");
}
......@@ -118,9 +117,8 @@ public class AppImHandler extends SimpleChannelInboundHandler<TextWebSocketFrame
*/
@Override
public void channelInactive(ChannelHandlerContext ctx) {
log.debug("连接WS成功");
log.debug("连接WS成功channelInactive");
System.out.println("连接WS成功");
// Long userIdByChannel = appUserChannelsService.getUserIdByChannel(ctx);
// log.debug("uid:" + userIdByChannel + "," + "不活跃" + ",channelId:" + ctx.channel().id().asLongText());
......@@ -134,7 +132,7 @@ public class AppImHandler extends SimpleChannelInboundHandler<TextWebSocketFrame
@Override
public void handlerRemoved(ChannelHandlerContext ctx) {
System.out.println("handlerRemoved");
log.debug("handlerRemoved");
// Long userIdByChannel = appUserChannelsService.getUserIdByChannel(ctx);
// log.debug("uid:" + userIdByChannel + "," + "handlerRemoved" + ",channelId:" + ctx.channel().id().asLongText());
......
package com.wecloud.im.tillo.app_ws.utils;
import javax.crypto.Cipher;
import java.security.Key;
public class EncrypDES {
// 字符串默认键值
private static String strDefaultKey = "inventec2020@#$%^&";
//加密工具
private Cipher encryptCipher = null;
// 解密工具
private Cipher decryptCipher = null;
/**
* 默认构造方法,使用默认密钥
*/
public EncrypDES() throws Exception {
this(strDefaultKey);
}
/**
* 指定密钥构造方法
*
* @param strKey 指定的密钥
* @throws Exception
*/
public EncrypDES(String strKey) throws Exception {
// Security.addProvider(new com.sun.crypto.provider.SunJCE());
Key key = getKey(strKey.getBytes());
encryptCipher = Cipher.getInstance("DES");
encryptCipher.init(Cipher.ENCRYPT_MODE, key);
decryptCipher = Cipher.getInstance("DES");
decryptCipher.init(Cipher.DECRYPT_MODE, key);
}
/**
* 将byte数组转换为表示16进制值的字符串, 如:byte[]{8,18}转换为:0813,和public static byte[]
* <p>
* hexStr2ByteArr(String strIn) 互为可逆的转换过程
*
* @param arrB 需要转换的byte数组
* @return 转换后的字符串
* @throws Exception 本方法不处理任何异常,所有异常全部抛出
*/
public static String byteArr2HexStr(byte[] arrB) throws Exception {
int iLen = arrB.length;
// 每个byte用2个字符才能表示,所以字符串的长度是数组长度的2倍
StringBuffer sb = new StringBuffer(iLen * 2);
for (int i = 0; i < iLen; i++) {
int intTmp = arrB[i];
// 把负数转换为正数
while (intTmp < 0) {
intTmp = intTmp + 256;
}
// 小于0F的数需要在前面补0
if (intTmp < 16) {
sb.append("0");
}
sb.append(Integer.toString(intTmp, 16));
}
return sb.toString();
}
/**
* 将表示16进制值的字符串转换为byte数组,和public static String byteArr2HexStr(byte[] arrB)
* 互为可逆的转换过程
*
* @param strIn 需要转换的字符串
* @return 转换后的byte数组
*/
public static byte[] hexStr2ByteArr(String strIn) throws Exception {
byte[] arrB = strIn.getBytes();
int iLen = arrB.length;
// 两个字符表示一个字节,所以字节数组长度是字符串长度除以2
byte[] arrOut = new byte[iLen / 2];
for (int i = 0; i < iLen; i = i + 2) {
String strTmp = new String(arrB, i, 2);
arrOut[i / 2] = (byte) Integer.parseInt(strTmp, 16);
}
return arrOut;
}
/**
* 加密字节数组
*
* @param arrB 需加密的字节数组
* @return 加密后的字节数组
*/
public byte[] encrypt(byte[] arrB) throws Exception {
return encryptCipher.doFinal(arrB);
}
/**
* 加密字符串
*
* @param strIn 需加密的字符串
* @return 加密后的字符串
*/
public String encrypt(String strIn) throws Exception {
return byteArr2HexStr(encrypt(strIn.getBytes()));
}
/**
* 解密字节数组
*
* @param arrB 需解密的字节数组
* @return 解密后的字节数组
*/
public byte[] decrypt(byte[] arrB) throws Exception {
return decryptCipher.doFinal(arrB);
}
/**
* 解密字符串
*
* @param strIn 需解密的字符串
* @return 解密后的字符串
*/
public String decrypt(String strIn) throws Exception {
return new String(decrypt(hexStr2ByteArr(strIn)));
}
/**
* 从指定字符串生成密钥,密钥所需的字节数组长度为8位 不足8位时后面补0,超出8位只取前8位
*
* @param arrBTmp 构成该字符串的字节数组
* @return 生成的密钥
*/
private Key getKey(byte[] arrBTmp) throws Exception {
// 创建一个空的8位字节数组(默认值为0)
byte[] arrB = new byte[8];
// 将原始字节数组转换为8位
for (int i = 0; i < arrBTmp.length && i < arrB.length; i++) {
arrB[i] = arrBTmp[i];
}
// 生成密钥
Key key = new javax.crypto.spec.SecretKeySpec(arrB, "DES");
return key;
}
public static void main(String[] args) throws Exception {
String code = "427d68ae59e577f7b87f05d43670df58";
EncrypDES encrypDES = new EncrypDES();
//System.out.println(encrypDES.decrypt(code));
System.out.println(encrypDES.encrypt("18011953567"));
}
/*public static void main(String[] args) {
try {
*//*String msg1 = "1";
EncrypDES des1 = new EncrypDES();// 使用默认密钥
System.out.println("加密前的字符:" + msg1);
System.out.println("加密后的字符:" + des1.encrypt(msg1));
System.out.println("解密后的字符:" + des1.decrypt(des1.encrypt(msg1)));*//*
*//* System.out.println("--------优美分隔符------");
String msg2 = "1";
String key = "2020@#$2020";
EncrypDES des2 = new EncrypDES(key);// 自定义密钥
System.out.println("加密前的字符:" + msg2);
System.out.println("加密后的字符:" + des2.encrypt(msg2));
//c170d8716c90266d
System.out.println("解密后的字符:" + des2.decrypt(des2.encrypt(msg2)));*//*
} catch (Exception e) {
e.printStackTrace();
}
}*/
}
\ No newline at end of file
package com.wecloud.im.tillo.app_ws.utils;
import java.util.UUID;
public class RSAGenerator {
private final static String[] chars = new String[]{"a", "b", "c", "d", "e", "f",
"g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s",
"t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5",
"6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I",
"J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V",
"W", "X", "Y", "Z"};
//生成8位appKey
public static String getAppKey() {
StringBuffer shortBuffer = new StringBuffer();
//获取用户id进行字符串截取
String uuid = UUID.randomUUID().toString().replace("-", "");
for (int i = 0; i < 16; i++) {
String str = uuid.substring(i * 2, i * 2 + 2);
int x = Integer.parseInt(str, 16);
shortBuffer.append(chars[x % 0x3E]);
}
return shortBuffer.toString();
// return UUID.randomUUID().toString().replace("-", "");
}
//生成32位appSecret
public static String getAppSecret(String appId){
String EncryoAppSecret="";
try {
EncrypDES des1 = new EncrypDES();// 使用默认密钥
EncryoAppSecret=des1.encrypt(appId);
} catch (Exception e) {
e.printStackTrace();
}
return EncryoAppSecret;
}
}
<?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.wecloud.im.mapper.AppUserMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, username, wechat_open_id, nickname, idcard, nation, password, salt, phone, phone_area, gender, head, remark, state, deleted, version, create_time, update_time, date_of_birth, education_background, email, location, location_detail, profession, company, emergency_phone
</sql>
<select id="getAppUserById" resultType="com.wecloud.im.vo.AppUserQueryVo">
select
<include refid="Base_Column_List"/>
from app_user where id = #{id}
</select>
<select id="getAppUserPageList" parameterType="com.wecloud.im.param.AppUserPageParam" resultType="com.wecloud.im.vo.AppUserQueryVo">
select
<include refid="Base_Column_List"/>
from app_user
</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.wecloud.im.mapper.DonationAgentMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, fk_user_id, fk_record_id, remark, create_time, update_time
</sql>
<select id="getDonationAgentById" resultType="com.wecloud.im.vo.DonationAgentQueryVo">
select
<include refid="Base_Column_List"/>
from donation_agent where id = #{id}
</select>
<select id="getDonationAgentPageList" parameterType="com.wecloud.im.param.DonationAgentPageParam" resultType="com.wecloud.im.vo.DonationAgentQueryVo">
select
<include refid="Base_Column_List"/>
from donation_agent
</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.wecloud.im.mapper.DonationRecordMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id
, fk_user_id, money, purpose, way, remark, create_time, update_time, is_replace,wx_mer_pay_id,pay_status,pay_time
</sql>
<select id="getDonationRecordById" resultType="com.wecloud.im.vo.DonationRecordQueryVo">
select
<include refid="Base_Column_List"/>
from donation_record where id = #{id}
</select>
<select id="getDonationRecordPageList" parameterType="com.wecloud.im.param.DonationRecordPageParam"
resultType="com.wecloud.im.vo.DonationRecordQueryVo">
select
<include refid="Base_Column_List"/>
from donation_record
where pay_status=1
and fk_user_id=#{userId}
</select>
<select id="getDonationRankAndTotal" resultType="com.wecloud.im.vo.DonationRankAndTotal">
SELECT
*
FROM
(
SELECT
tb.*,
@curRank := @curRank + 1 AS rank
FROM
( SELECT fk_user_id, sum( money ) AS drTotal FROM donation_record WHERE donation_record.pay_status = 1 GROUP BY fk_user_id ORDER BY drTotal DESC ) AS tb,
( SELECT @curRank := 0 ) r
) AS giao
WHERE
giao.fk_user_id = #{userId}
</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.wecloud.im.mapper.VipPriceMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id
, price, member_ships, create_time, update_time, state
</sql>
<select id="getVipPriceById" resultType="com.wecloud.im.vo.app.VipPriceQueryVo">
select
<include refid="Base_Column_List"/>
from vip_price where id = #{id}
</select>
<select id="getVipPricePageList" parameterType="com.wecloud.im.param.VipPricePageParam"
resultType="com.wecloud.im.vo.app.VipPriceQueryVo">
select
<include refid="Base_Column_List"/>
from vip_price
</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.wecloud.im.mapper.VipRecordMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, fk_user_id, fk_recharge_user, money, expired_at, years, remark, create_time, update_time,wx_mer_pay_id,pay_status,pay_time
</sql>
<select id="getVipRecordById" resultType="com.wecloud.im.vo.VipRecordQueryVo">
select
<include refid="Base_Column_List"/>
from vip_record where id = #{id}
</select>
<select id="getVipRecordPageList" parameterType="com.wecloud.im.param.VipRecordPageParam" resultType="com.wecloud.im.vo.VipRecordQueryVo">
select
<include refid="Base_Column_List"/>
from vip_record
</select>
</mapper>
......@@ -10,7 +10,8 @@ server:
min-spare-threads: 5
uri-encoding: UTF-8
############################# 访问路径、端口tomcat end ###############################
netty:
port: 8899
################################ spring config start ###############################
spring:
application:
......
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