记得上下班打卡 | git大法好,push需谨慎

Commit 92af0477 authored by anjiabin's avatar anjiabin

实现环信相关代码

parent 2fd3e7fa
package com.liquidnet.service.chime.dto;
import io.swagger.annotations.ApiModelProperty;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: PerformanceDto
* @Package com.liquidnet.service.chime.dto
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2021/9/3 18:26
*/
public class PerformanceDto {
private String performancesId;
private String title;
@ApiModelProperty(value = "演出开始时间")
private String timeStart;
@ApiModelProperty(value = "演出结束时间")
private String timeEnd;
}
package com.liquidnet.service.chime.service;
public interface IChimeUserTagsService {
}
package com.liquidnet.service.chime.vo.mongo;
import io.swagger.annotations.ApiModelProperty;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: ChimeUserTagsMappingVo
* @Package com.liquidnet.service.chime.vo.mongo
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2021/9/3 16:50
*/
public class ChimeUserTagsMappingVo {
private Integer mid;
private static final long serialVersionUID = 5325511589667456213L;
@ApiModelProperty(position = 0, value = "用户ID[64]")
private String userId;
@ApiModelProperty(position = 1, value = "性别")
private String sex;
@ApiModelProperty(position = 2, value = "用户昵称")
private String userName;
@ApiModelProperty(position = 3, value = "用户手机号")
private String userMobile;
@ApiModelProperty(position = 4, value = "头像")
private String avatar;
@ApiModelProperty(position = 5, value = "在场ID")
private String joinPerformanceId;
private static final ChimeUserTagsMappingVo obj = new ChimeUserTagsMappingVo();
public static ChimeUserTagsMappingVo getNew() {
try {
return (ChimeUserTagsMappingVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new ChimeUserTagsMappingVo();
}
}
}
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<module>liquidnet-service-adam-api</module> <module>liquidnet-service-adam-api</module>
<module>liquidnet-service-kylin-api</module> <module>liquidnet-service-kylin-api</module>
<module>liquidnet-service-dragon-api</module> <module>liquidnet-service-dragon-api</module>
<module>liquidnet-service-chime-api</module>
</modules> </modules>
<dependencies> <dependencies>
<dependency> <dependency>
......
...@@ -64,6 +64,53 @@ public class HttpUtil { ...@@ -64,6 +64,53 @@ public class HttpUtil {
return request(url, params, headers, HttpMethod.POST); return request(url, params, headers, HttpMethod.POST);
} }
public static String postJson(String url,String jsonStr) {
MultiValueMap<String, String> headers = new LinkedMultiValueMap();
headers.add("Content-Type", "application/json;charset=UTF-8");
headers.add("Accept", "application/json;charset=UTF-8");
if (url == null || url.trim().isEmpty()) {
return null;
}
// header
HttpHeaders httpHeaders = new HttpHeaders();
if (headers != null) {
httpHeaders.addAll(headers);
}
HttpEntity<Object> httpEntity = new HttpEntity(jsonStr, httpHeaders);
// 提交方式:表单、json
// ResponseEntity<String> response = restTemplate.exchange(url, method, httpEntity, String.class);
Object respObj = restTemplate.postForEntity(url,httpEntity,Object.class).getBody();;
return JsonUtils.toJson(respObj);
}
public static String postJson(String url,String jsonStr,MultiValueMap<String, String> headers) {
MultiValueMap<String, String> commonHeader = new LinkedMultiValueMap();
commonHeader.add("Content-Type", "application/json;charset=UTF-8");
commonHeader.add("Accept", "application/json;charset=UTF-8");
if (url == null || url.trim().isEmpty()) {
return null;
}
// header
HttpHeaders httpHeaders = new HttpHeaders();
if (commonHeader != null) {
httpHeaders.addAll(commonHeader);
}
if (headers != null) {
httpHeaders.addAll(headers);
}
HttpEntity<Object> httpEntity = new HttpEntity(jsonStr, httpHeaders);
// 提交方式:表单、json
// ResponseEntity<String> response = restTemplate.exchange(url, method, httpEntity, String.class);
Object respObj = restTemplate.postForEntity(url,httpEntity,Object.class).getBody();;
return JsonUtils.toJson(respObj);
}
/** /**
* put请求 * put请求
* *
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>liquidnet-common-third</artifactId>
<groupId>com.liquidnet</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>liquidnet-common-third-easemob</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.liquidnet</groupId>
<artifactId>liquidnet-common-base</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.liquidnet</groupId>
<artifactId>liquidnet-common-cache-redis</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.easemob.im</groupId>
<artifactId>im-sdk-core</artifactId>
<version>0.3.0</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-bom</artifactId>
<version>4.1.59.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-bom</artifactId>
<version>2020.0.4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
\ No newline at end of file
package com.liquidnet.common.third.easemob.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: EasemobConfig
* @Package com.liquidnet.common.third.easemob.config
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2021/9/7 10:42
*/
@Configuration
public class EasemobConfig {
@Value("${liquidnet.easemob.api-url}")
private String REQUEST_HOST;
@Value("${liquidnet.easemob.org-name}")
private String ORG_NAME;
@Value("${liquidnet.easemob.app-name}")
private String APP_NAME;
@Value("${liquidnet.easemob.client-id}")
private String CLIENT_ID;
@Value("${liquidnet.easemob.client-secret}")
private String CLIENT_SECRET;
// private String APPKEY = easemobConfig.ORG_NAME+"#"+this.APP_NAME;
public String getPreUrl() {
return REQUEST_HOST + "/" + ORG_NAME + "/" + APP_NAME;
}
public String getClientId() {
return this.CLIENT_ID;
}
public String getClientSecret() {
return this.CLIENT_SECRET;
}
}
package com.liquidnet.common.third.easemob.constant;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: EasemobConstant
* @Package com.liquidnet.common.third.easemob.constant
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2021/9/7 10:43
*/
public class EasemobConstant {
//获取api访问token 默认60天
public static String GET_TOKEN_URL = "/token";
//api访问过期时间
public static String API_ACCESS_TOKEN_REDIS_KEY = "chime:easemob:API_ACCESS_KEY";
public static long API_ACCESS_TOKEN_EXPIRES_TIME_SECOND = 2592000;
//注册单个用户
public static String CREATE_USER_URL = "/users";
}
package com.liquidnet.common.third.easemob.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.time.LocalDateTime;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: CreateUserRespDto
* @Package com.liquidnet.common.third.easemob.dto
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2021/9/7 14:31
*/
@Data
public class CreateUserRespDto {
@JsonProperty("uuid")
private String uuid;
@JsonProperty("type")
private String type;
@JsonProperty("created")
private LocalDateTime created;
@JsonProperty("modified")
private LocalDateTime modified;
@JsonProperty("username")
private String username;
@JsonProperty("activated")
private boolean activated;
@Override
public String toString() {
return "UserResource{" +
"username='" + username + '\'' +
", uuid='" + uuid + '\'' +
", type='" + type + '\'' +
", created='" + created + '\'' +
", modified='" + modified + '\'' +
", activated=" + activated +
'}';
}
}
package com.liquidnet.common.third.easemob.util;
import com.alibaba.fastjson.JSONObject;
import com.easemob.im.server.api.token.allocate.TokenResponse;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.common.third.easemob.config.EasemobConfig;
import com.liquidnet.common.third.easemob.constant.EasemobConstant;
import com.liquidnet.commons.lang.util.HttpUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.commons.lang.util.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.HttpClientErrorException;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: EasemobUtil
* @Package com.liquidnet.common.third.easemob.util
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2021/9/6 16:08
*/
@Slf4j
@Component
public class EasemobUtil{
@Autowired
private EasemobConfig easemobConfig;
@Autowired
private RedisUtil redisUtil;
private String getAccessToken(){
//构造请求参数
// LinkedMultiValueMap<String, String> reqParam = CollectionUtil.linkedMultiValueMapStringString();
// reqParam.add("grant_type", "client_credentials");
// reqParam.add("client_id",CLIENT_ID);
// reqParam.add("client_secret", CLIENT_SECRET);
Object redisValue = redisUtil.get(EasemobConstant.API_ACCESS_TOKEN_REDIS_KEY);
if(StringUtil.isNotNull(redisValue)&&StringUtil.isNotBlank(redisValue.toString())){
log.info("getAccessToken cache token : {} ",redisValue);
return redisValue.toString();
}
JSONObject json = new JSONObject();
json.put("grant_type", "client_credentials");
json.put("client_id", easemobConfig.getClientId());
json.put("client_secret", easemobConfig.getClientSecret());
String requestUrl = easemobConfig.getPreUrl() + EasemobConstant.GET_TOKEN_URL;
log.info("getAccessToken--->>> request url : {} body : {} ",requestUrl, json.toString());
String response = HttpUtil.postJson(requestUrl,json.toString());
log.info("getAccessToken--->>> response : {} ",response);
TokenResponse tokenResponse = JsonUtils.fromJson(response,TokenResponse.class);
log.info("getAccessToken--->>> response access_token : {} ",tokenResponse.asToken().getValue());
log.info("getAccessToken--->>> token isValid json : {} ",tokenResponse.asToken().isValid());
//设置缓存
String token = tokenResponse.asToken().getValue();
redisUtil.set(EasemobConstant.API_ACCESS_TOKEN_REDIS_KEY,token,EasemobConstant.API_ACCESS_TOKEN_EXPIRES_TIME_SECOND);
return token;
//result
// {application=c785eced-c603-41c3-afe8-13ee3378540c, access_token=YWMt_rE7Rg8DEeyy6gf--JvBcwAAAAAAAAAAAAAAAAAAAAHHheztxgNBw6_oE-4zeFQMAgMAAAF7utOj1gBPGgANws4VZcHltyc-SPep4q09E0mqitzKe5IA6Npu-MqLBg, expires_in=5184000}
//YWMtofR7bg8FEeyuuledizf-EgAAAAAAAAAAAAAAAAAAAAHHheztxgNBw6_oE-4zeFQMAgMAAAF7ut5fhQBPGgA4h21-XSZ9vq_q69wQlp3racC2cpUtlNHJfma547Ygkg
}
public void createUser(String userName,String password){
this.createUser(userName,password,null);
}
public String createUser(String userName, String password, String nickName){
MultiValueMap<String, String> commonHeader = new LinkedMultiValueMap();
commonHeader.add("Authorization", "Bearer "+this.getAccessToken());
JSONObject json = new JSONObject();
json.put("username", userName);
json.put("password", password);
if(StringUtil.isNotEmpty(nickName)){
json.put("nickname", nickName);
}
String requestUrl = easemobConfig.getPreUrl() + EasemobConstant.CREATE_USER_URL;
log.info("createUsers--->>> request url : {} body : {} ",requestUrl, json.toString());
String response = null;
// ObjectNode objectNode = JsonUtils.OM().createObjectNode();
try {
response = HttpUtil.postJson(requestUrl,json.toString(),commonHeader);
}
catch(HttpClientErrorException e){
if(e.getRawStatusCode() == 400){
JSONObject jsonObject = JsonUtils.fromJson(e.getResponseBodyAsString(), new TypeReference<JSONObject>() {});
log.info("createUser error : {}",jsonObject.get("error"));
log.info("createUser error_description : {}",jsonObject.get("error_description"));
return jsonObject.toJSONString();
}
}catch (Exception e) {
e.printStackTrace();
log.error("createUser error : {}",e);
}
log.info("createUsers--->>> response : {} ",response);
ObjectNode jsonObject = JsonUtils.fromJson(response,ObjectNode.class);
log.info("createUsers--->>> response : {} ",jsonObject.toString());
ArrayNode arrayNode = (ArrayNode)jsonObject.get("entities");
response = arrayNode.get(0).toString();
return response;
//result
// {application=c785eced-c603-41c3-afe8-13ee3378540c, access_token=YWMt_rE7Rg8DEeyy6gf--JvBcwAAAAAAAAAAAAAAAAAAAAHHheztxgNBw6_oE-4zeFQMAgMAAAF7utOj1gBPGgANws4VZcHltyc-SPep4q09E0mqitzKe5IA6Npu-MqLBg, expires_in=5184000}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>liquidnet-common-third</artifactId>
<groupId>com.liquidnet</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>liquidnet-common-third-shumei</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.liquidnet</groupId>
<artifactId>liquidnet-common-base</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>liquidnet-bus-common</artifactId>
<groupId>com.liquidnet</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>liquidnet-common-third</artifactId>
<packaging>pom</packaging>
<modules>
<module>liquidnet-common-third-easemob</module>
<module>liquidnet-common-third-shumei</module>
</modules>
</project>
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
<module>liquidnet-common-service-base</module> <module>liquidnet-common-service-base</module>
<module>liquidnet-common-feign</module> <module>liquidnet-common-feign</module>
<module>liquidnet-common-sms</module> <module>liquidnet-common-sms</module>
<module>liquidnet-common-third</module>
<!-- <module>liquidnet-common-mybatis</module>--> <!-- <module>liquidnet-common-mybatis</module>-->
</modules> </modules>
<dependencies> <dependencies>
......
...@@ -132,6 +132,15 @@ liquidnet: ...@@ -132,6 +132,15 @@ liquidnet:
android: android:
appkey: 5c6cf6cbb465f592e4000bae appkey: 5c6cf6cbb465f592e4000bae
appMasterSecret: dmsho74wlpd1hp7vrwp9bjehzwo29pza appMasterSecret: dmsho74wlpd1hp7vrwp9bjehzwo29pza
shumei:
url:
easemob:
api-url: https://a1.easemob.com
org-name: 1106210901175651
app-name: demo
client-id: YXA6x4Xs7cYDQcOv6BPuM3hUDA
client-secret: YXA6olr2qaW65xlkFixS81kiWnplrW4
#application-dev-end #application-dev-end
liquidnet:
system:
updating:
switch: false
info:
port: 9011
context: /chime
name: liquidnet-service-chime
logfile:
path: /data/logs
name: service-chime
config: classpath:logback-spring.xml
file-max-size: 200MB
pattern-file: '%d{yyyy-MM-dd HH:mm:ss.SSS} [ %-5level] %thread [%logger{96}:%line] - %msg%n'
pattern-console: '%d{yyyy-MM-dd HH:mm:ss.SSS} [ %-5level] %thread [%logger{96}:%line] - %msg%n'
pattern-rolling-file-name: ${liquidnet.logfile.path}/${liquidnet.logfile.name}-%d{yyyy-MM-dd}.%i.log
level: debug
mongodb:
sslEnabled: false
database: dev_ln_scene
liquidnet:
system:
updating:
switch: false
info:
port: 9011
context: /chime
name: liquidnet-service-chime
logfile:
path: /data/logs
name: service-chime
config: classpath:logback-spring.xml
file-max-size: 200MB
pattern-file: '%d{yyyy-MM-dd HH:mm:ss.SSS} [ %-5level] %thread [%logger{96}:%line] - %msg%n'
pattern-console: '%d{yyyy-MM-dd HH:mm:ss.SSS} [ %-5level] %thread [%logger{96}:%line] - %msg%n'
pattern-rolling-file-name: ${liquidnet.logfile.path}/${liquidnet.logfile.name}-%d{yyyy-MM-dd}.%i.log
level: debug
mongodb:
sslEnabled: false
database: test_ln_scene
server:
port: ${liquidnet.info.port}
tomcat:
uri-encoding: UTF-8
maxThreads: 200 #默认200
minSpareThreads: 30 #默认10
maxConnections: 12000 #默认10000
acceptCount: 5000 #默认100
processorCache: 200 #默认200
servlet:
context-path: ${liquidnet.info.context}
# -----------------------------------------------------------
knife4j:
enable: true
production: ${liquidnet.knife4j.disable}
basic:
enable: true
username: ${liquidnet.security.username}
password: ${liquidnet.security.password}
# -----------------------------------------------------------
logging:
# config: ${liquidnet.logfile.config}
file:
name: ${liquidnet.logfile.path}/${liquidnet.logfile.name}.log
max-size: ${liquidnet.logfile.file-max-size}
pattern:
file: '%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %X{lnsTranceId} [%logger{96}:%line] - %msg%n'
console: '%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %X{lnsTranceId} [%logger{96}:%line] - %msg%n'
rolling-file-name: ${liquidnet.logfile.path}/${liquidnet.logfile.name}-%d{yyyy-MM-dd}.%i.log
level:
root: info
#以下是为指定包设置日志级别
com:
liquidnet: ${liquidnet.logfile.level}
# -----------------------------------------------------------
eureka:
# client:
# register-with-eureka: true
# fetch-registry: true
# serviceUrl:
# defaultZone: http://${liquidnet.security.username}:${liquidnet.security.password}@${liquidnet.eureka.host}/eureka-server/eureka
instance:
hostname: ${spring.cloud.client.ip-address}
lease-expiration-duration-in-seconds: 15 #服务过期时间配置,超过这个时间没有接收到心跳EurekaServer就会将这个实例剔除
lease-renewal-interval-in-seconds: 5 #服务刷新时间配置,每隔这个时间会主动心跳一次
prefer-ip-address: true
instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${spring.application.instance_id:${server.port}}
# -----------------------------------------------------------
#actuator/info
info:
app:
name: ${liquidnet.info.name}
company:
name: lightnet.io
build:
groupId: '@project.groupId@'
artifactId: '@project.artifactId@'
version: '@project.version@'
# -----------------------------------------------------------
mybatis-plus:
mapper-locations: classpath:com.liquidnet.service.order.mapper/*Mapper.xml
# -----------------------------------------------------------
spring:
application:
name: ${liquidnet.info.name}
servlet:
multipart:
max-file-size: 5MB
max-request-size: 10MB
profiles:
include: common-service #这里加载management相关公共配置
autoconfigure:
exclude:
- org.springframework.cloud.bus.BusAutoConfiguration
- org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
redis:
database: 15
dbs: ${liquidnet.redis.dbs}
port: ${liquidnet.redis.port}
host: ${liquidnet.redis.host}
password: ${liquidnet.redis.password}
lettuce:
pool:
max-active: 8
max-wait: -1
max-idle: 8
min-idle: 0
redisson:
singleServerConfig:
address: redis://${liquidnet.redis.host}:${liquidnet.redis.port}
password: ${liquidnet.redis.password}
clientName: null
database: 7 #选择使用哪个数据库0~15
idleConnectionTimeout: 10000
connectTimeout: 10000
timeout: 3000
retryAttempts: 3
retryInterval: 1500
subscriptionsPerConnection: 5
subscriptionConnectionMinimumIdleSize: 1
subscriptionConnectionPoolSize: 50
connectionMinimumIdleSize: 32
connectionPoolSize: 64
dnsMonitoringInterval: 5000
threads: 16
nettyThreads: 32
codec:
class: "org.redisson.codec.JsonJacksonCodec"
transportMode: "NIO"
data:
mongodb:
uri: mongodb://${liquidnet.mongodb.user}:${liquidnet.mongodb.pwd}@${liquidnet.mongodb.host}/?authSource=admin&maxPoolSize=2000&waitQueueMultiple=100
sslEnabled: ${liquidnet.mongodb.sslEnabled}
database: ${liquidnet.mongodb.database}
# -----------------------------------------------------------
# -----------------------------------------------------------
global-auth:
exclude-url-pattern:
- ${liquidnet.info.context}/doc.html
- ${liquidnet.info.context}/webjars/**
- ${liquidnet.info.context}/swagger-resources/**
- ${liquidnet.info.context}/v2/api-docs*
# -----------------------------------------------------------
# -----------------------------------------------------------
\ No newline at end of file
package com.liquidnet.service.chime.controller;
import com.liquidnet.service.base.ResponseDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: 演出相关
* @class: ChimePerformanceController
* @Package com.liquidnet.service.chime.controller
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2021/9/6 11:43
*/
@Api(tags = "在场-演出列表")
@RestController
@RequestMapping("performance")
@Validated
public class ChimePerformanceController {
@GetMapping("myList")
@ApiOperation("已购票的演出")
@ApiImplicitParams({
@ApiImplicitParam(type = "query", dataType = "String", name = "cityName", value = "城市名称", required = true),
@ApiImplicitParam(type = "query", dataType = "int", name = "days", value = "时间范围 几天 今天1 三天3。。。"),
@ApiImplicitParam(type = "query", dataType = "int", name = "type", value = "演出类型 101音乐节 102小型演出(livehouse演出) 103巡演 演出类型只有这几个了"),
@ApiImplicitParam(type = "query", dataType = "Integer", name = "isDiscount", value = "是否会员优惠 0 1"),
@ApiImplicitParam(type = "query", dataType = "Integer", name = "isAdvance", value = "是否优先 0 1"),
@ApiImplicitParam(type = "query", dataType = "Integer", name = "isExclusive", value = "是否会员专属 0 1"),
@ApiImplicitParam(type = "query", dataType = "String", name = "orderBy", value = "排序字段 时间timeStart"),
@ApiImplicitParam(type = "query", dataType = "String", name = "sort", value = "排序方式[DESC ASC]"),
})
public ResponseDto<HashMap<String, Object>> myList(
@RequestParam(defaultValue = "") String cityName,
@RequestParam(defaultValue = "0") int days,
@RequestParam(defaultValue = "0") int type,
@RequestParam(defaultValue = "") Integer isDiscount,
@RequestParam(defaultValue = "") Integer isAdvance,
@RequestParam(defaultValue = "") Integer isExclusive,
// 排序
@RequestParam(defaultValue = "") String orderBy,
@RequestParam(defaultValue = "") String sort
) {
// HashMap<String, Object> result = kylinPerformancesService.localList(
// days, cityName, type,
// isDiscount, isAdvance, isExclusive,
// orderBy, sort
// );
// return ResponseDto.success(result);
return null;
}
@GetMapping("localList")
@ApiOperation("本地最近演出列表")
@ApiImplicitParams({
@ApiImplicitParam(type = "query", dataType = "String", name = "cityName", value = "城市名称", required = true),
@ApiImplicitParam(type = "query", dataType = "int", name = "days", value = "时间范围 几天 今天1 三天3。。。"),
@ApiImplicitParam(type = "query", dataType = "int", name = "type", value = "演出类型 101音乐节 102小型演出(livehouse演出) 103巡演 演出类型只有这几个了"),
@ApiImplicitParam(type = "query", dataType = "Integer", name = "isDiscount", value = "是否会员优惠 0 1"),
@ApiImplicitParam(type = "query", dataType = "Integer", name = "isAdvance", value = "是否优先 0 1"),
@ApiImplicitParam(type = "query", dataType = "Integer", name = "isExclusive", value = "是否会员专属 0 1"),
@ApiImplicitParam(type = "query", dataType = "String", name = "orderBy", value = "排序字段 时间timeStart"),
@ApiImplicitParam(type = "query", dataType = "String", name = "sort", value = "排序方式[DESC ASC]"),
})
public ResponseDto<HashMap<String, Object>> localList(
@RequestParam(defaultValue = "") String cityName,
@RequestParam(defaultValue = "0") int days,
@RequestParam(defaultValue = "0") int type,
@RequestParam(defaultValue = "") Integer isDiscount,
@RequestParam(defaultValue = "") Integer isAdvance,
@RequestParam(defaultValue = "") Integer isExclusive,
// 排序
@RequestParam(defaultValue = "") String orderBy,
@RequestParam(defaultValue = "") String sort
) {
// HashMap<String, Object> result = kylinPerformancesService.localList(
// days, cityName, type,
// isDiscount, isAdvance, isExclusive,
// orderBy, sort
// );
// return ResponseDto.success(result);
return null;
}
@GetMapping("getUserListByCon")
@ApiOperation("查询用户列表")
@ApiImplicitParams({
@ApiImplicitParam(type = "query", dataType = "String", name = "cityName", value = "城市名称", required = true),
@ApiImplicitParam(type = "query", dataType = "int", name = "days", value = "时间范围 几天 今天1 三天3。。。"),
@ApiImplicitParam(type = "query", dataType = "int", name = "type", value = "演出类型 101音乐节 102小型演出(livehouse演出) 103巡演 演出类型只有这几个了"),
@ApiImplicitParam(type = "query", dataType = "Integer", name = "isDiscount", value = "是否会员优惠 0 1"),
@ApiImplicitParam(type = "query", dataType = "Integer", name = "isAdvance", value = "是否优先 0 1"),
@ApiImplicitParam(type = "query", dataType = "Integer", name = "isExclusive", value = "是否会员专属 0 1"),
@ApiImplicitParam(type = "query", dataType = "String", name = "orderBy", value = "排序字段 时间timeStart"),
@ApiImplicitParam(type = "query", dataType = "String", name = "sort", value = "排序方式[DESC ASC]"),
})
public ResponseDto<HashMap<String, Object>> getUserListByCon(
@RequestParam(defaultValue = "") String cityName,
@RequestParam(defaultValue = "0") int days,
@RequestParam(defaultValue = "0") int type,
@RequestParam(defaultValue = "") Integer isDiscount,
@RequestParam(defaultValue = "") Integer isAdvance,
@RequestParam(defaultValue = "") Integer isExclusive,
// 排序
@RequestParam(defaultValue = "") String orderBy,
@RequestParam(defaultValue = "") String sort
) {
// HashMap<String, Object> result = kylinPerformancesService.localList(
// days, cityName, type,
// isDiscount, isAdvance, isExclusive,
// orderBy, sort
// );
// return ResponseDto.success(result);
return null;
}
}
package com.liquidnet.service.chime.service.impl;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: ChimeUserTagsServiceImpl
* @Package com.liquidnet.service.chime.service.impl
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2021/9/3 16:49
*/
public class ChimeUserTagsServiceImpl {
}
package com.liquidnet.service.chime.test;
import com.liquidnet.common.third.easemob.util.EasemobUtil;
import lombok.extern.slf4j.Slf4j;
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.SpringJUnit4ClassRunner;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: TestEasemob
* @Package com.liquidnet.service.chime.test
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2021/9/7 11:35
*/
@Slf4j
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
public class TestEasemob {
@Autowired
private EasemobUtil easemobUtil;
// @Value("${liquidnet.easemob.api-url}")
// private static String REQUEST_HOST = "https://a1.easemob.com";
// @Value("${liquidnet.easemob.org-name}")
// private static String ORG_NAME = "1106210901175651";
// @Value("${liquidnet.easemob.app-name}")
// private static String APP_NAME = "demo";
// @Value("${liquidnet.easemob.client-id}")
// private static String CLIENT_ID = "YXA6x4Xs7cYDQcOv6BPuM3hUDA";
// @Value("${liquidnet.easemob.client-secret}")
// private static String CLIENT_SECRET = "YXA6olr2qaW65xlkFixS81kiWnplrW4";
@Test
public void createUser(){
easemobUtil.createUser("anjiabin11","anjiabin11");
// EasemobUtil.createUsers();
}
}
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
<module>liquidnet-service-executor-all</module> <module>liquidnet-service-executor-all</module>
<module>liquidnet-service-consumer-all</module> <module>liquidnet-service-consumer-all</module>
<module>liquidnet-service-sweet</module> <module>liquidnet-service-sweet</module>
<module>liquidnet-service-chime</module>
<!-- <module>liquidnet-service-example</module>--> <!-- <module>liquidnet-service-example</module>-->
<!-- <module>liquidnet-service-sequence</module>--> <!-- <module>liquidnet-service-sequence</module>-->
<!-- <module>liquidnet-service-account</module>--> <!-- <module>liquidnet-service-account</module>-->
......
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