init project
commit
0c494944a4
@ -0,0 +1,33 @@
|
|||||||
|
HELP.md
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
@ -0,0 +1,7 @@
|
|||||||
|
# 项目框架
|
||||||
|
数据层 - JPA
|
||||||
|
容器 - SpringBoot
|
||||||
|
表现层 - SpringMVC
|
||||||
|
|
||||||
|
# 项目代码
|
||||||
|
AB单处理逻辑代码
|
@ -0,0 +1,63 @@
|
|||||||
|
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>2.3.2.RELEASE</version>
|
||||||
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
|
</parent>
|
||||||
|
<groupId>com.yuyou.openapi</groupId>
|
||||||
|
<artifactId>openapi</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<name>openapi</name>
|
||||||
|
<description>Open API Center for Spring Boot</description>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!--<dependency>-->
|
||||||
|
<!--<groupId>org.springframework.boot</groupId>-->
|
||||||
|
<!--<artifactId>spring-boot-starter-data-jpa</artifactId>-->
|
||||||
|
<!--</dependency>-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.junit.vintage</groupId>
|
||||||
|
<artifactId>junit-vintage-engine</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.yuyou.openapi.openapi;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class OpenapiApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(OpenapiApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
package com.yuyou.openapi.openapi.api;
|
||||||
|
|
||||||
|
import com.yuyou.openapi.openapi.common.CommonResponse;
|
||||||
|
import com.yuyou.openapi.openapi.model.dto.ABMessageDTO;
|
||||||
|
import com.yuyou.openapi.openapi.model.vo.ABClientInterMessageVO;
|
||||||
|
import com.yuyou.openapi.openapi.service.ABClientService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (C), 2012 - 2018, qyx
|
||||||
|
* FileName: DBABClient
|
||||||
|
* Author: x
|
||||||
|
* Date: 2020/8/4 5:26 PM
|
||||||
|
* Description: 用于接收上游公司推送AB单的接口
|
||||||
|
* History:
|
||||||
|
* <author> <time> <version> <desc>
|
||||||
|
* x 2020/8/4 v1.0 创建此文件
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@Slf4j
|
||||||
|
public class ABClient {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ABClientService abClientService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取上游公司的数据推送接口
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/api/req/taginfo")
|
||||||
|
@ResponseBody
|
||||||
|
public CommonResponse getDBTagInfo(@RequestBody ABClientInterMessageVO vo) {
|
||||||
|
// 记录日志
|
||||||
|
log.info("====== [ one request comming,request content is {} ] ======", vo.toString());
|
||||||
|
// 转换实体类映射
|
||||||
|
ABMessageDTO dto = new ABMessageDTO();
|
||||||
|
BeanUtils.copyProperties(vo, dto);
|
||||||
|
// 调用业务处理接口
|
||||||
|
abClientService.recordAndSendABClientMsg(dto);
|
||||||
|
// 返回校验成功的结果
|
||||||
|
return CommonResponse.createBySuccess();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
package com.yuyou.openapi.openapi.common;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FileName: ResponseCode
|
||||||
|
* Author: x
|
||||||
|
* Date: 2019/12/11 20:30
|
||||||
|
* Description: 自定义Response响应返回体 -> 这边采用的是
|
||||||
|
* History:
|
||||||
|
* <author> <time> <version> <desc>
|
||||||
|
* x 2019/12/11 v 1.0 创建此文件
|
||||||
|
*/
|
||||||
|
public enum ResponseCode {
|
||||||
|
|
||||||
|
SUCCESS(0,"SUCCESS"),
|
||||||
|
ERROR(1,"ERROR"),
|
||||||
|
|
||||||
|
// 请求参数校验
|
||||||
|
ILLEGAL_ARGUMENT(2,"请求参数格式错误"),
|
||||||
|
EMPTY_ARGUMENT(1,"请求参数为空");
|
||||||
|
|
||||||
|
private final int code;
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
ResponseCode(int code, String desc){
|
||||||
|
this.code = code;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.yuyou.openapi.openapi.model.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (C), 2012 - 2018, qyx
|
||||||
|
* FileName: ABMessageDTO
|
||||||
|
* Author: x
|
||||||
|
* Date: 2020/8/5 2:12 PM
|
||||||
|
* Description: 用于AB业务层的字段类型
|
||||||
|
* History:
|
||||||
|
* <author> <time> <version> <desc>
|
||||||
|
* x 2020/8/5 v1.0 创建此文件
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ABMessageDTO {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.yuyou.openapi.openapi.model.vo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (C), 2012 - 2018, qyx
|
||||||
|
* FileName: ABClientBaseVO
|
||||||
|
* Author: x
|
||||||
|
* Date: 2020/8/4 7:02 PM
|
||||||
|
* Description: 抽象的数据实体模板格式
|
||||||
|
* History:
|
||||||
|
* <author> <time> <version> <desc>
|
||||||
|
* x 2020/8/4 v1.0 创建此文件
|
||||||
|
*/
|
||||||
|
public class ABClientBaseVO {
|
||||||
|
|
||||||
|
/* *//**
|
||||||
|
* 数据实体对应标签字段
|
||||||
|
*//*
|
||||||
|
private Tag tag;
|
||||||
|
|
||||||
|
*//**
|
||||||
|
* 对应Tag格式的数据实体
|
||||||
|
*//*
|
||||||
|
private Datas data;
|
||||||
|
|
||||||
|
abstract class Tag{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class Datas{
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package com.yuyou.openapi.openapi.model.vo;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (C), 2012 - 2018, qyx
|
||||||
|
* FileName: ABClientInterMessageVO
|
||||||
|
* Author: x
|
||||||
|
* Date: 2020/8/5 2:00 PM
|
||||||
|
* Description: AB分级标签调用接口映射实体
|
||||||
|
* History:
|
||||||
|
* <author> <time> <version> <desc>
|
||||||
|
* x 2020/8/5 v1.0 创建此文件
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class ABClientInterMessageVO implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* poneNum 这个字段是用Base64进行加密
|
||||||
|
*/
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务名称 这个字段是用Base64进行加密
|
||||||
|
*/
|
||||||
|
private String actName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 呼叫开始时间 时间戳
|
||||||
|
*/
|
||||||
|
private Long startTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标签分级 1:A,2:B....依次类推
|
||||||
|
*/
|
||||||
|
private Integer clientType;
|
||||||
|
}
|
@ -0,0 +1,79 @@
|
|||||||
|
package com.yuyou.openapi.openapi.model.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (C), 2012 - 2018, qyx
|
||||||
|
* FileName: ABClientMessageVO
|
||||||
|
* Author: x
|
||||||
|
* Date: 2020/8/4 6:59 PM
|
||||||
|
* Description: ABClient接口对应接口表现层映射
|
||||||
|
* History:
|
||||||
|
* <author> <time> <version> <desc>
|
||||||
|
* x 2020/8/4 v1.0 创建此文件
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class ABClientZMMessageVO extends ABClientBaseVO implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据实体对应标签字段
|
||||||
|
*/
|
||||||
|
private Tag tag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对应Tag格式的数据实体
|
||||||
|
*/
|
||||||
|
private Datas data;
|
||||||
|
|
||||||
|
|
||||||
|
class Tag{
|
||||||
|
/**
|
||||||
|
* 学生姓名-key名称
|
||||||
|
*/
|
||||||
|
private String tag_key_name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系方式-key名称
|
||||||
|
*/
|
||||||
|
private String tag_key_mobile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库当前所在年级-key名称
|
||||||
|
*/
|
||||||
|
private String tag_key_grade;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程科目-key名称
|
||||||
|
*/
|
||||||
|
private String tag_key_course;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class Datas{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 学生姓名
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系方式
|
||||||
|
*/
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库当前所在年级
|
||||||
|
*/
|
||||||
|
private String grade;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程科目
|
||||||
|
*/
|
||||||
|
private String course;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.yuyou.openapi.openapi.service;
|
||||||
|
|
||||||
|
import com.yuyou.openapi.openapi.model.dto.ABMessageDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (C), 2012 - 2018, qyx
|
||||||
|
* FileName: ABClientService
|
||||||
|
* Author: x
|
||||||
|
* Date: 2020/8/4 7:20 PM
|
||||||
|
* Description: ABClient 调用处理服务调用接口
|
||||||
|
* History:
|
||||||
|
* <author> <time> <version> <desc>
|
||||||
|
* x 2020/8/4 v1.0 创建此文件
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface ABClientService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录接口推送信息对数据进行入库,并异步进行发送给下游
|
||||||
|
*/
|
||||||
|
void recordAndSendABClientMsg(ABMessageDTO dto);
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.yuyou.openapi.openapi.service.impl;
|
||||||
|
|
||||||
|
import com.yuyou.openapi.openapi.model.dto.ABMessageDTO;
|
||||||
|
import com.yuyou.openapi.openapi.service.ABClientService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (C), 2012 - 2018, qyx
|
||||||
|
* FileName: ABClientServiceImpl
|
||||||
|
* Author: x
|
||||||
|
* Date: 2020/8/4 7:20 PM
|
||||||
|
* Description: TODO
|
||||||
|
* History:
|
||||||
|
* <author> <time> <version> <desc>
|
||||||
|
* x 2020/8/4 v1.0 创建此文件
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ABClientServiceImpl implements ABClientService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void recordAndSendABClientMsg(ABMessageDTO dto) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
server:
|
||||||
|
port: 8090
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
spring:
|
||||||
|
# 序列化忽略null的k-v配置
|
||||||
|
jackson:
|
||||||
|
default-property-inclusion: non_null
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.yuyou.openapi.openapi;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
class OpenapiApplicationTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue