Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
612d69e691 | ||
|
|
0cc4b691de | ||
|
|
9da25f822c | ||
|
|
11e4d4f3f9 | ||
|
|
825b010843 | ||
|
|
989935c9a0 | ||
|
|
70b628b446 | ||
|
|
1d293a063c | ||
|
|
a85c2fcbc8 | ||
|
|
5e5d80b148 | ||
|
|
79ef9425bd | ||
|
|
921d64e0bf | ||
|
|
d3bf57b0ea | ||
|
|
19527f62b7 | ||
|
|
96e66bb8a0 | ||
|
|
23ba4f41e4 | ||
|
|
57e1415de3 | ||
|
|
690cc8ac34 | ||
|
|
bc4036adae | ||
|
|
9a698124ac | ||
|
|
2888581b7e | ||
|
|
79e980eabe | ||
|
|
b824bfde4c | ||
|
|
570f3f9ad2 | ||
|
|
12449a6354 | ||
|
|
342a027afb | ||
|
|
38c11416db | ||
|
|
b225ed592e | ||
|
|
721d53e369 | ||
|
|
48517f8953 | ||
|
|
fb2997aa2b | ||
|
|
db4fffcda2 | ||
|
|
6312fb6070 | ||
|
|
2a33bdcfaf | ||
|
|
46b554f4c0 | ||
|
|
1046a86a03 | ||
|
|
636a5522ae | ||
|
|
bf19ecdea6 | ||
|
|
4ca021bf2a | ||
|
|
1b1f2392d7 | ||
|
|
875a14f2b7 | ||
|
|
dbaab0484b | ||
|
|
d1a4b55f5d | ||
|
|
bc0e40193c |
+189
@@ -0,0 +1,189 @@
|
||||
import {
|
||||
default as Record
|
||||
} from "./record.js"; // record, pack
|
||||
import request from './request.js'
|
||||
const {
|
||||
record,
|
||||
pack,
|
||||
unpack,
|
||||
Replayer
|
||||
} = Record;
|
||||
|
||||
window.TracePlugin = {
|
||||
endOrNot: true,
|
||||
uniqueNo: null,
|
||||
traceId: null,
|
||||
appKey: null,
|
||||
productCode: null,
|
||||
productName: null,
|
||||
module: null,
|
||||
content: null,
|
||||
events: [],
|
||||
replayer: null,
|
||||
/**
|
||||
* 开始录制函数
|
||||
* uniqueNo 订单唯一标识,非必传
|
||||
* extra 订单额外参数,非必传
|
||||
*/
|
||||
start: function(uniqueNo = null, extra = {}) {
|
||||
window.TracePlugin.traceId = null;
|
||||
window.TracePlugin.endOrNot = false;
|
||||
if (window.stopFn) {
|
||||
window.stopFn();
|
||||
window.stopFn = null;
|
||||
}
|
||||
window.stopFn = record({
|
||||
emit(event) {
|
||||
window.TracePlugin.appKey = extra.appKey;
|
||||
window.TracePlugin.productCode = extra.productCode;
|
||||
window.TracePlugin.productName = extra.productName;
|
||||
window.TracePlugin.module = extra.module;
|
||||
window.TracePlugin.content = extra.content;
|
||||
window.TracePlugin.uniqueNo = uniqueNo;
|
||||
if (!window.TracePlugin.endOrNot) {
|
||||
window.TracePlugin.events.push(event);
|
||||
if (window.TracePlugin.events.length === 100) {
|
||||
window.TracePlugin.stop(uniqueNo);
|
||||
window.TracePlugin.endOrNot = false;
|
||||
window.TracePlugin.events = [];
|
||||
}
|
||||
}
|
||||
},
|
||||
packFn: pack,
|
||||
sampling: {
|
||||
// 定义不录制的鼠标交互事件类型,可以细粒度的开启或关闭对应交互录制
|
||||
mouseInteraction: {
|
||||
MouseUp: false,
|
||||
MouseDown: false,
|
||||
Click: true,
|
||||
ContextMenu: false,
|
||||
DblClick: false,
|
||||
Focus: true,
|
||||
Blur: true,
|
||||
TouchStart: true,
|
||||
TouchEnd: true,
|
||||
},
|
||||
mousemove: false,
|
||||
scroll: 150, // 每 150ms 最多触发一次
|
||||
// 设置输入事件的录制时机
|
||||
input: "last", // 连续输入时,只录制最终值
|
||||
},
|
||||
recordCanvas: true, //支持录制canvas
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 暂停录制函数
|
||||
* uniqueNo 订单唯一标识,必传
|
||||
* callback 录制成功后回调函数,非必传
|
||||
* fail 录制失败后回调函数,非必传
|
||||
*/
|
||||
stop: async function(uniqueNo, callback, fail) {
|
||||
// 压缩、入库、重置事件库、唯一标识
|
||||
window.TracePlugin.uniqueNo = uniqueNo;
|
||||
// 事件数超过100则分割
|
||||
let len = Math.ceil(window.TracePlugin.events.length / 100)
|
||||
let save = async (events) => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: '/track/save',
|
||||
method: 'post',
|
||||
data: {
|
||||
traceId: window.TracePlugin.traceId,
|
||||
last: false,
|
||||
orderId: uniqueNo,
|
||||
appKey: window.TracePlugin.appKey,
|
||||
productCode: window.TracePlugin.productCode,
|
||||
productName: window.TracePlugin.productName,
|
||||
module: window.TracePlugin.module,
|
||||
content: window.TracePlugin.content,
|
||||
events: events
|
||||
}
|
||||
})
|
||||
const {
|
||||
code,
|
||||
data
|
||||
} = res
|
||||
if (code === 200 && data) {
|
||||
const {
|
||||
traceId
|
||||
} = data
|
||||
window.TracePlugin.traceId = traceId;
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
fail && fail(window.TracePlugin.traceId)
|
||||
}
|
||||
}
|
||||
let timer = null;
|
||||
for (let i = 0; i < len; i++) {
|
||||
let events = window.TracePlugin.events.slice(i * 100, i === len - 1 ? window.TracePlugin.events
|
||||
.length : 100)
|
||||
timer && window.clearTimeout(timer);
|
||||
timer = setTimeout(async function() {
|
||||
await save(events);
|
||||
}, 200);
|
||||
}
|
||||
window.TracePlugin.events = [];
|
||||
callback && callback(window.TracePlugin.traceId);
|
||||
window.TracePlugin.endOrNot = true;
|
||||
return JSON.stringify(window.TracePlugin.events);
|
||||
},
|
||||
/**
|
||||
* 结束录制函数
|
||||
* uniqueNo 订单唯一标识,必传
|
||||
* callback 录制成功后回调函数,非必传
|
||||
* fail 录制失败后回调函数,非必传
|
||||
*/
|
||||
end: async function(uniqueNo, callback, fail) {
|
||||
if (window.stopFn) {
|
||||
window.stopFn();
|
||||
window.stopFn = null;
|
||||
}
|
||||
// 压缩、入库、重置事件库、唯一标识
|
||||
window.TracePlugin.uniqueNo = uniqueNo
|
||||
// 事件数超过100则分割
|
||||
let len = Math.ceil(window.TracePlugin.events.length / 100)
|
||||
let save = async (events) => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: '/track/save',
|
||||
method: 'post',
|
||||
data: {
|
||||
traceId: window.TracePlugin.traceId,
|
||||
last: true,
|
||||
orderId: uniqueNo,
|
||||
appKey: window.TracePlugin.appKey,
|
||||
productCode: window.TracePlugin.productCode,
|
||||
productName: window.TracePlugin.productName,
|
||||
module: window.TracePlugin.module,
|
||||
content: window.TracePlugin.content,
|
||||
events: events
|
||||
}
|
||||
})
|
||||
const {
|
||||
code
|
||||
} = res
|
||||
if (code === 200) {
|
||||
window.TracePlugin.traceId = null;
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
fail && fail(window.TracePlugin.traceId)
|
||||
}
|
||||
}
|
||||
let timer = null;
|
||||
for (let i = 0; i < len; i++) {
|
||||
let events = window.TracePlugin.events.slice(i * 100, i === len - 1 ? window.TracePlugin.events
|
||||
.length -
|
||||
i * 100 : 100)
|
||||
timer && window.clearTimeout(timer);
|
||||
timer = setTimeout(async function() {
|
||||
await save(events);
|
||||
}, 200);
|
||||
}
|
||||
window.TracePlugin.events = [];
|
||||
callback && callback(window.TracePlugin.traceId)
|
||||
window.TracePlugin.endOrNot = true;
|
||||
return JSON.stringify(window.TracePlugin.events);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
||||
@@ -0,0 +1,100 @@
|
||||
<?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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.wabestway.recall</groupId>
|
||||
<artifactId>afis-recall-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.wabestway.common</groupId>
|
||||
<artifactId>afis-web-common</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
<version>2.2.3.RELEASE</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.8.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
<version>1.5.22</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!--lombok插件 -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.6</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-openfeign-core</artifactId>
|
||||
<version>2.2.3.RELEASE</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>release</id>
|
||||
<name>Nexus Release Repository</name>
|
||||
<url>http://dev.wabestway.com/nexus/repository/maven-releases/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<!-- 需与server id一致 -->
|
||||
<id>snapshot</id>
|
||||
<name>Nexus Snapshot Repository</name>
|
||||
<url>http://dev.wabestway.com/nexus/repository/maven-snapshots/</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>none</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.wabestway.recall.api.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TraceRecord {
|
||||
/**
|
||||
* 业务订单ID
|
||||
*/
|
||||
private String orderId;
|
||||
/**
|
||||
* 产品编码
|
||||
*/
|
||||
private String supplierProductCode;
|
||||
/**
|
||||
* 产品名称
|
||||
*/
|
||||
private String supplierProductName;
|
||||
/**
|
||||
* 保单号
|
||||
*/
|
||||
private String policyNo;
|
||||
/**
|
||||
* 投保人名称
|
||||
*/
|
||||
private String holderName;
|
||||
/**
|
||||
* 投保人手机号
|
||||
*/
|
||||
private String holderPhone;
|
||||
/**
|
||||
* 保险公司名称
|
||||
*/
|
||||
private String supplierName;
|
||||
/**
|
||||
* 保单起始日期
|
||||
*/
|
||||
private String startDate;
|
||||
/**
|
||||
* 保单结束日期
|
||||
*/
|
||||
private String endDate;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.wabestway.recall.api.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TraceUpDTO {
|
||||
private String batchId;
|
||||
private Long batchTime;
|
||||
List<TraceRecord> records;
|
||||
}
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.wabestway.recall.api.fallback;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.wabestway.commons.http.ResObj;
|
||||
import com.wabestway.recall.api.dto.TraceUpDTO;
|
||||
import com.wabestway.recall.api.feign.TraceFeignClient;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class TraceFeignClientFallback implements TraceFeignClient {
|
||||
|
||||
@Override
|
||||
public ResObj batchTraceUp(TraceUpDTO traceUpDTO) {
|
||||
log.error("回溯业务数据更新:{}", JSON.toJSONString(traceUpDTO));
|
||||
return ResObj.fail("服务不可用");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.wabestway.recall.api.feign;
|
||||
|
||||
import com.wabestway.commons.http.ResObj;
|
||||
import com.wabestway.recall.api.dto.TraceUpDTO;
|
||||
import com.wabestway.recall.api.fallback.TraceFeignClientFallback;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
@FeignClient(value = "afis-recall", fallback = TraceFeignClientFallback.class)
|
||||
public interface TraceFeignClient {
|
||||
@RequestMapping(method = RequestMethod.POST, value ="/api/traceUp")
|
||||
ResObj batchTraceUp(@RequestBody TraceUpDTO traceUpDTO);
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.wabestway.recall</groupId>
|
||||
<artifactId>afis-recall</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>afis-recall-service</artifactId>
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.wabestway.recall.trace.dao;
|
||||
|
||||
import com.wabestway.recall.trace.entity.RecallApiEntity;
|
||||
import com.wabestway.recall.trace.dto.RecallApiDTO;
|
||||
import com.wabestway.recall.trace.vo.RecallApiVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-15 09:59:12
|
||||
*/
|
||||
@Mapper
|
||||
public interface RecallApiDao extends BaseMapper<RecallApiEntity> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param recallApiDTO
|
||||
* @return
|
||||
*/
|
||||
IPage<RecallApiVO> queryRecallApiByCondition(Page<RecallApiDTO> page, @Param("recallApiDTO")RecallApiDTO recallApiDTO);
|
||||
|
||||
/**
|
||||
* 条件查询,不分页
|
||||
* @param recallApiDTO
|
||||
* @return
|
||||
*/
|
||||
List<RecallApiVO> queryRecallApiListNoPage(@Param("recallApiDTO")RecallApiDTO recallApiDTO);
|
||||
|
||||
/**
|
||||
* 根据id更新
|
||||
* @param recallApi 对象
|
||||
* @return
|
||||
*/
|
||||
void updateRecallApiById(@Param("recallApi")RecallApiEntity recallApi);
|
||||
|
||||
/**
|
||||
* 根据id查询详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
RecallApiVO queryRecallApiById(@Param("id") String id);
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package com.wabestway.recall.trace.dao;
|
||||
|
||||
import com.wabestway.recall.trace.entity.RecallProductEntity;
|
||||
import com.wabestway.recall.trace.dto.RecallProductDTO;
|
||||
import com.wabestway.recall.trace.vo.RecallProductVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-15 09:59:12
|
||||
*/
|
||||
@Mapper
|
||||
public interface RecallProductDao extends BaseMapper<RecallProductEntity> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param recallProductDTO
|
||||
* @return
|
||||
*/
|
||||
IPage<RecallProductVO> queryRecallProductByCondition(Page<RecallProductDTO> page, @Param("recallProductDTO")RecallProductDTO recallProductDTO);
|
||||
|
||||
/**
|
||||
* 条件查询,不分页
|
||||
* @param recallProductDTO
|
||||
* @return
|
||||
*/
|
||||
List<RecallProductVO> queryRecallProductListNoPage(@Param("recallProductDTO")RecallProductDTO recallProductDTO);
|
||||
|
||||
/**
|
||||
* 根据id更新
|
||||
* @param recallProduct 对象
|
||||
* @return
|
||||
*/
|
||||
void updateRecallProductById(@Param("recallProduct")RecallProductEntity recallProduct);
|
||||
|
||||
/**
|
||||
* 根据id查询详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
RecallProductVO queryRecallProductById(@Param("id") String id);
|
||||
}
|
||||
@@ -48,4 +48,6 @@ public interface RecallRecordDao extends BaseMapper<RecallRecordEntity> {
|
||||
* @return
|
||||
*/
|
||||
RecallRecordVO queryRecallRecordById(@Param("id") String id);
|
||||
|
||||
List<RecallRecordVO> queryTraceRecords(@Param("traceId") String traceId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.wabestway.recall.trace.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import com.wabestway.commons.http.PageDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-15 09:59:12
|
||||
*/
|
||||
@Data
|
||||
@ApiModel
|
||||
public class RecallApiDTO extends PageDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** */
|
||||
@ApiModelProperty(value = "")
|
||||
private String id;
|
||||
/** 可回溯调用appKey */
|
||||
@ApiModelProperty(value = "可回溯调用appKey")
|
||||
private String appKey;
|
||||
/** 调用方名称 */
|
||||
@ApiModelProperty(value = "调用方名称")
|
||||
private String name;
|
||||
/** 备注 */
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -22,6 +22,8 @@ public class RecallOrderDTO extends PageDTO implements Serializable {
|
||||
/** 主键 */
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
@ApiModelProperty(value = "租户ID")
|
||||
private String tenantId;
|
||||
/** 产品编码 */
|
||||
@ApiModelProperty(value = "产品编码")
|
||||
private String productCode;
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package com.wabestway.recall.trace.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import com.wabestway.commons.http.PageDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-15 09:59:12
|
||||
*/
|
||||
@Data
|
||||
@ApiModel
|
||||
public class RecallProductDTO extends PageDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** */
|
||||
@ApiModelProperty(value = "")
|
||||
private String id;
|
||||
/** 产品编码 */
|
||||
@ApiModelProperty(value = "产品编码")
|
||||
private String productCode;
|
||||
/** 产品名称 */
|
||||
@ApiModelProperty(value = "产品名称")
|
||||
private String productName;
|
||||
/** 保险公司编码 */
|
||||
@ApiModelProperty(value = "保险公司编码")
|
||||
private String supplierCode;
|
||||
/** 保险公司名称 */
|
||||
@ApiModelProperty(value = "保险公司名称")
|
||||
private String supplierName;
|
||||
/** 是否归档 0-否1-是 */
|
||||
@ApiModelProperty(value = "是否归档 0-否1-是 ")
|
||||
private String archived;
|
||||
/** 是否记录轨迹 0-否1-是 */
|
||||
@ApiModelProperty(value = "是否记录轨迹 0-否1-是 ")
|
||||
private String tracked;
|
||||
|
||||
}
|
||||
+4
-2
@@ -1,6 +1,8 @@
|
||||
package com.wabestway.recall.trace.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
import com.wabestway.commons.http.PageDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
@@ -8,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
@@ -36,7 +38,7 @@ public class RecallRecordDTO extends PageDTO implements Serializable {
|
||||
private String content;
|
||||
/** 记录事件 */
|
||||
@ApiModelProperty(value = "记录事件")
|
||||
private Blob events;
|
||||
private List<String> events;
|
||||
/** 回溯记录跟踪ID */
|
||||
@ApiModelProperty(value = "回溯记录跟踪ID")
|
||||
private String traceId;
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.wabestway.recall.trace.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-06 17:37:03
|
||||
*/
|
||||
@Data
|
||||
@ApiModel
|
||||
public class TraceDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
/**
|
||||
* 产品编码
|
||||
*/
|
||||
@ApiModelProperty(value = "产品编码")
|
||||
private String productCode;
|
||||
/**
|
||||
* 产品名称
|
||||
*/
|
||||
@ApiModelProperty(value = "产品名称")
|
||||
private String productName;
|
||||
/**
|
||||
* 模块
|
||||
*/
|
||||
@ApiModelProperty(value = "模块")
|
||||
private String module;
|
||||
/**
|
||||
* 页面说明
|
||||
*/
|
||||
@ApiModelProperty(value = "页面说明")
|
||||
private String content;
|
||||
/**
|
||||
* 记录事件
|
||||
*/
|
||||
@ApiModelProperty(value = "记录事件")
|
||||
private List<String> events;
|
||||
/**
|
||||
* 回溯记录跟踪ID
|
||||
*/
|
||||
@ApiModelProperty(value = "回溯记录跟踪ID")
|
||||
private String traceId;
|
||||
/**
|
||||
* 回溯订单Id
|
||||
*/
|
||||
@ApiModelProperty(value = "回溯订单Id")
|
||||
private String orderId;
|
||||
/**
|
||||
* 是否最后提交
|
||||
*/
|
||||
@ApiModelProperty(value = "是否最后提交")
|
||||
private boolean last;
|
||||
/**
|
||||
* 调用接口appKey
|
||||
*/
|
||||
@ApiModelProperty(value = "调用接口appKey")
|
||||
private String appKey;
|
||||
|
||||
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.wabestway.recall.trace.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-15 09:59:12
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "recall_api")
|
||||
public class RecallApiEntity {
|
||||
/** */
|
||||
@TableId
|
||||
private String id;
|
||||
/** 可回溯调用appKey */
|
||||
private String appKey;
|
||||
/** 调用方名称 */
|
||||
private String name;
|
||||
/** 租户Id */
|
||||
private String tenantId;
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
/** 创建人 */
|
||||
private String createBy;
|
||||
/** 创建时间 */
|
||||
private Long createTime;
|
||||
/** 更新人 */
|
||||
private String updateBy;
|
||||
/** 更新时间 */
|
||||
private Long updateTime;
|
||||
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package com.wabestway.recall.trace.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-15 09:59:12
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "recall_product")
|
||||
public class RecallProductEntity {
|
||||
/** */
|
||||
@TableId
|
||||
private String id;
|
||||
/** 产品编码 */
|
||||
private String productCode;
|
||||
/** 产品名称 */
|
||||
private String productName;
|
||||
/** 保险公司编码 */
|
||||
private String supplierCode;
|
||||
/** 保险公司名称 */
|
||||
private String supplierName;
|
||||
/** 是否归档 0-否1-是 */
|
||||
private String archived;
|
||||
/** 是否记录轨迹 0-否1-是 */
|
||||
private String tracked;
|
||||
/** 租户Id */
|
||||
private String tenantId;
|
||||
/** 创建人 */
|
||||
private String createBy;
|
||||
/** 创建时间 */
|
||||
private Long createTime;
|
||||
/** 更新人 */
|
||||
private String updateBy;
|
||||
/** 更新时间 */
|
||||
private Long updateTime;
|
||||
|
||||
}
|
||||
+6
-1
@@ -1,10 +1,14 @@
|
||||
package com.wabestway.recall.trace.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import com.wabestway.recall.trace.handler.ListTypeHandler;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
@@ -27,7 +31,8 @@ public class RecallRecordEntity {
|
||||
/** 页面说明 */
|
||||
private String content;
|
||||
/** 记录事件 */
|
||||
private Blob events;
|
||||
@TableField(typeHandler = ListTypeHandler.class)
|
||||
private List<String> events;
|
||||
/** 回溯记录跟踪ID */
|
||||
private String traceId;
|
||||
/** 创建人 */
|
||||
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
package com.wabestway.recall.trace.handler;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.apache.ibatis.type.MappedJdbcTypes;
|
||||
import org.apache.ibatis.type.MappedTypes;
|
||||
import org.apache.ibatis.type.TypeHandler;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@MappedTypes(value = {List.class})
|
||||
@MappedJdbcTypes(value = {JdbcType.BLOB})
|
||||
public class ListTypeHandler implements TypeHandler<List<String>> {
|
||||
private ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
@Override
|
||||
public void setParameter(PreparedStatement ps, int i, List<String> strings, JdbcType jdbcType) throws SQLException {
|
||||
String jsonStr = null;
|
||||
try {
|
||||
jsonStr = objectMapper.writeValueAsString(strings);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
ps.setString(i, jsonStr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getResult(ResultSet rs, String s) throws SQLException {
|
||||
String str = rs.getString(s);
|
||||
List<String> newList = new ArrayList<>();
|
||||
try {
|
||||
newList = objectMapper.readValue(str, new TypeReference<List<String>>() {
|
||||
});
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return newList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getResult(ResultSet rs, int i) throws SQLException {
|
||||
String str = rs.getString(i);
|
||||
List<String> newList = new ArrayList<>();
|
||||
try {
|
||||
newList = objectMapper.readValue(str, new TypeReference<List<String>>() {
|
||||
});
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return newList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getResult(CallableStatement cs, int i) throws SQLException {
|
||||
String str = cs.getString(i);
|
||||
List<String> newList = new ArrayList<>();
|
||||
try {
|
||||
newList = objectMapper.readValue(str, new TypeReference<List<String>>() {
|
||||
});
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return newList;
|
||||
}
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package com.wabestway.recall.trace.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.wabestway.recall.trace.entity.RecallApiEntity;
|
||||
import com.wabestway.recall.trace.dto.RecallApiDTO;
|
||||
import com.wabestway.recall.trace.vo.RecallApiVO;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-15 09:59:12
|
||||
*/
|
||||
public interface RecallApiService extends IService<RecallApiEntity> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param recallApiDTO
|
||||
* @return
|
||||
*/
|
||||
IPage<RecallApiVO> queryRecallApiByCondition(long page, long size, RecallApiDTO recallApiDTO);
|
||||
|
||||
/**
|
||||
* 条件查询,不分页
|
||||
* @param recallApiDTO
|
||||
* @return
|
||||
*/
|
||||
List<RecallApiVO> queryRecallApiListNoPage(RecallApiDTO recallApiDTO);
|
||||
|
||||
/**
|
||||
* 根据id更新
|
||||
* @param recallApi 对象
|
||||
* @return
|
||||
*/
|
||||
void updateRecallApiById(RecallApiEntity recallApi);
|
||||
|
||||
/**
|
||||
* 根据id查询详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
RecallApiVO queryRecallApiById(String id);
|
||||
|
||||
/**
|
||||
* 查询调用app归属租户
|
||||
* @param appKey
|
||||
* @return
|
||||
*/
|
||||
String queryApiTenant(String appKey);
|
||||
}
|
||||
|
||||
+14
-8
@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.wabestway.recall.trace.entity.RecallOrderEntity;
|
||||
import com.wabestway.recall.trace.dto.RecallOrderDTO;
|
||||
import com.wabestway.recall.trace.vo.RecallOrderVO;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -24,13 +23,6 @@ public interface RecallOrderService extends IService<RecallOrderEntity> {
|
||||
*/
|
||||
IPage<RecallOrderVO> queryRecallOrderByCondition(long page, long size, RecallOrderDTO recallOrderDTO);
|
||||
|
||||
/**
|
||||
* 条件查询,不分页
|
||||
* @param recallOrderDTO
|
||||
* @return
|
||||
*/
|
||||
List<RecallOrderVO> queryRecallOrderListNoPage(RecallOrderDTO recallOrderDTO);
|
||||
|
||||
/**
|
||||
* 根据id更新
|
||||
* @param recallOrder 对象
|
||||
@@ -44,5 +36,19 @@ public interface RecallOrderService extends IService<RecallOrderEntity> {
|
||||
* @return
|
||||
*/
|
||||
RecallOrderVO queryRecallOrderById(String id);
|
||||
|
||||
/**
|
||||
* 根据业务订单Id 查询回溯订单
|
||||
* @param orderId
|
||||
* @return
|
||||
*/
|
||||
RecallOrderEntity queryRecallOrderByOrderId(String orderId);
|
||||
|
||||
/**
|
||||
* 根据回溯轨迹ID 查询回溯订单
|
||||
* @param traceId
|
||||
* @return
|
||||
*/
|
||||
RecallOrderEntity queryRecallOrderByTraceId(String traceId);
|
||||
}
|
||||
|
||||
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package com.wabestway.recall.trace.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.wabestway.recall.trace.entity.RecallProductEntity;
|
||||
import com.wabestway.recall.trace.dto.RecallProductDTO;
|
||||
import com.wabestway.recall.trace.vo.RecallProductVO;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-15 09:59:12
|
||||
*/
|
||||
public interface RecallProductService extends IService<RecallProductEntity> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param recallProductDTO
|
||||
* @return
|
||||
*/
|
||||
IPage<RecallProductVO> queryRecallProductByCondition(long page, long size, RecallProductDTO recallProductDTO);
|
||||
|
||||
/**
|
||||
* 条件查询,不分页
|
||||
* @param recallProductDTO
|
||||
* @return
|
||||
*/
|
||||
List<RecallProductVO> queryRecallProductListNoPage(RecallProductDTO recallProductDTO);
|
||||
|
||||
/**
|
||||
* 根据id更新
|
||||
* @param recallProduct 对象
|
||||
* @return
|
||||
*/
|
||||
void updateRecallProductById(RecallProductEntity recallProduct);
|
||||
|
||||
/**
|
||||
* 根据id查询详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
RecallProductVO queryRecallProductById(String id);
|
||||
}
|
||||
|
||||
+7
@@ -44,5 +44,12 @@ public interface RecallRecordService extends IService<RecallRecordEntity> {
|
||||
* @return
|
||||
*/
|
||||
RecallRecordVO queryRecallRecordById(String id);
|
||||
|
||||
/**
|
||||
* 根据traceId 查询列表
|
||||
* @param traceId
|
||||
* @return
|
||||
*/
|
||||
List<RecallRecordVO> queryTraceRecords(String traceId);
|
||||
}
|
||||
|
||||
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
package com.wabestway.recall.trace.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.wabestway.recall.trace.dao.RecallApiDao;
|
||||
import com.wabestway.recall.trace.entity.RecallApiEntity;
|
||||
import com.wabestway.recall.trace.dto.RecallApiDTO;
|
||||
import com.wabestway.recall.trace.vo.RecallApiVO;
|
||||
import com.wabestway.recall.trace.service.RecallApiService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-15 09:59:12
|
||||
*/
|
||||
@Service
|
||||
public class RecallApiServiceImpl extends ServiceImpl<RecallApiDao, RecallApiEntity> implements RecallApiService {
|
||||
|
||||
@Override
|
||||
public IPage<RecallApiVO> queryRecallApiByCondition(long page, long size, RecallApiDTO recallApiDTO) {
|
||||
Page<RecallApiDTO> paramReq = new Page<>(page, size);
|
||||
paramReq.addOrder(new OrderItem().setColumn("create_time").setAsc(false));//创建时间降序排序
|
||||
IPage<RecallApiVO> iPage = baseMapper.queryRecallApiByCondition(paramReq, recallApiDTO);
|
||||
return iPage;
|
||||
}
|
||||
|
||||
public List<RecallApiVO> queryRecallApiListNoPage(RecallApiDTO recallApiDTO) {
|
||||
return baseMapper.queryRecallApiListNoPage(recallApiDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRecallApiById(RecallApiEntity recallApi) {
|
||||
baseMapper.updateRecallApiById(recallApi);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecallApiVO queryRecallApiById(String id) {
|
||||
return baseMapper.queryRecallApiById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String queryApiTenant(String appKey) {
|
||||
LambdaQueryWrapper<RecallApiEntity> query = Wrappers.lambdaQuery();
|
||||
query.eq(RecallApiEntity::getAppKey, appKey);
|
||||
query.last("limit 1");
|
||||
RecallApiEntity recallApi = baseMapper.selectOne(query);
|
||||
if (recallApi != null) {
|
||||
return recallApi.getTenantId();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+20
-8
@@ -1,7 +1,9 @@
|
||||
package com.wabestway.recall.trace.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -10,11 +12,8 @@ import com.wabestway.recall.trace.entity.RecallOrderEntity;
|
||||
import com.wabestway.recall.trace.dto.RecallOrderDTO;
|
||||
import com.wabestway.recall.trace.vo.RecallOrderVO;
|
||||
import com.wabestway.recall.trace.service.RecallOrderService;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-06 17:37:03
|
||||
@@ -24,15 +23,12 @@ public class RecallOrderServiceImpl extends ServiceImpl<RecallOrderDao, RecallOr
|
||||
|
||||
@Override
|
||||
public IPage<RecallOrderVO> queryRecallOrderByCondition(long page, long size, RecallOrderDTO recallOrderDTO) {
|
||||
Page<RecallOrderDTO> paramReq = new Page<>(page,size);
|
||||
Page<RecallOrderDTO> paramReq = new Page<>(page, size);
|
||||
paramReq.addOrder(new OrderItem().setColumn("create_time").setAsc(false));//创建时间降序排序
|
||||
IPage<RecallOrderVO> iPage = baseMapper.queryRecallOrderByCondition(paramReq, recallOrderDTO);
|
||||
return iPage;
|
||||
}
|
||||
|
||||
public List<RecallOrderVO> queryRecallOrderListNoPage(RecallOrderDTO recallOrderDTO) {
|
||||
return baseMapper.queryRecallOrderListNoPage(recallOrderDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRecallOrderById(RecallOrderEntity recallOrder) {
|
||||
@@ -40,7 +36,23 @@ public class RecallOrderServiceImpl extends ServiceImpl<RecallOrderDao, RecallOr
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecallOrderVO queryRecallOrderById(String id ) {
|
||||
public RecallOrderVO queryRecallOrderById(String id) {
|
||||
return baseMapper.queryRecallOrderById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecallOrderEntity queryRecallOrderByOrderId(String orderId) {
|
||||
LambdaQueryWrapper<RecallOrderEntity> orderQuery = Wrappers.lambdaQuery();
|
||||
orderQuery.eq(RecallOrderEntity::getOrderId, orderId);
|
||||
orderQuery.last("limit 1");
|
||||
return baseMapper.selectOne(orderQuery);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecallOrderEntity queryRecallOrderByTraceId(String traceId) {
|
||||
LambdaQueryWrapper<RecallOrderEntity> orderQuery = Wrappers.lambdaQuery();
|
||||
orderQuery.eq(RecallOrderEntity::getTraceId, traceId);
|
||||
orderQuery.last("limit 1");
|
||||
return baseMapper.selectOne(orderQuery);
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package com.wabestway.recall.trace.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 org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.wabestway.recall.trace.dao.RecallProductDao;
|
||||
import com.wabestway.recall.trace.entity.RecallProductEntity;
|
||||
import com.wabestway.recall.trace.dto.RecallProductDTO;
|
||||
import com.wabestway.recall.trace.vo.RecallProductVO;
|
||||
import com.wabestway.recall.trace.service.RecallProductService;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-15 09:59:12
|
||||
*/
|
||||
@Service
|
||||
public class RecallProductServiceImpl extends ServiceImpl<RecallProductDao, RecallProductEntity> implements RecallProductService {
|
||||
|
||||
@Override
|
||||
public IPage<RecallProductVO> queryRecallProductByCondition(long page, long size, RecallProductDTO recallProductDTO) {
|
||||
Page<RecallProductDTO> paramReq = new Page<>(page,size);
|
||||
paramReq.addOrder(new OrderItem().setColumn("create_time").setAsc(false));//创建时间降序排序
|
||||
IPage<RecallProductVO> iPage = baseMapper.queryRecallProductByCondition(paramReq, recallProductDTO);
|
||||
return iPage;
|
||||
}
|
||||
|
||||
public List<RecallProductVO> queryRecallProductListNoPage(RecallProductDTO recallProductDTO) {
|
||||
return baseMapper.queryRecallProductListNoPage(recallProductDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRecallProductById(RecallProductEntity recallProduct) {
|
||||
baseMapper.updateRecallProductById(recallProduct);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecallProductVO queryRecallProductById(String id ) {
|
||||
return baseMapper.queryRecallProductById(id);
|
||||
}
|
||||
}
|
||||
+5
@@ -43,4 +43,9 @@ public class RecallRecordServiceImpl extends ServiceImpl<RecallRecordDao, Recall
|
||||
public RecallRecordVO queryRecallRecordById(String id ) {
|
||||
return baseMapper.queryRecallRecordById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RecallRecordVO> queryTraceRecords(String traceId) {
|
||||
return baseMapper.queryTraceRecords(traceId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.wabestway.recall.trace.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-15 09:59:12
|
||||
*/
|
||||
@Data
|
||||
@ApiModel
|
||||
public class RecallApiVO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** */
|
||||
@ApiModelProperty(value = "")
|
||||
private String id;
|
||||
/** 可回溯调用appKey */
|
||||
@ApiModelProperty(value = "可回溯调用appKey")
|
||||
private String appKey;
|
||||
/** 调用方名称 */
|
||||
@ApiModelProperty(value = "调用方名称")
|
||||
private String name;
|
||||
/** 备注 */
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
/** 创建人 */
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
/** 创建时间 */
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Long createTime;
|
||||
/** 更新人 */
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
/** 更新时间 */
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Long updateTime;
|
||||
|
||||
}
|
||||
+94
-47
@@ -1,13 +1,13 @@
|
||||
package com.wabestway.recall.trace.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-06 17:37:03
|
||||
@@ -15,73 +15,120 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
@Data
|
||||
@ApiModel
|
||||
public class RecallOrderVO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
/** 产品编码 */
|
||||
private String id;
|
||||
/**
|
||||
* 产品编码
|
||||
*/
|
||||
@ApiModelProperty(value = "产品编码")
|
||||
private String productCode;
|
||||
/** 产品名称 */
|
||||
private String productCode;
|
||||
/**
|
||||
* 产品名称
|
||||
*/
|
||||
@ApiModelProperty(value = "产品名称")
|
||||
private String productName;
|
||||
/** 保单号 */
|
||||
private String productName;
|
||||
/**
|
||||
* 保单号
|
||||
*/
|
||||
@ApiModelProperty(value = "保单号")
|
||||
private String policyNo;
|
||||
/** 投保人名称 */
|
||||
private String policyNo;
|
||||
/**
|
||||
* 投保人名称
|
||||
*/
|
||||
@ApiModelProperty(value = "投保人名称")
|
||||
private String holderName;
|
||||
/** 投保人手机号 */
|
||||
private String holderName;
|
||||
/**
|
||||
* 投保人手机号
|
||||
*/
|
||||
@ApiModelProperty(value = "投保人手机号")
|
||||
private String holderPhone;
|
||||
/** 保险公司名称 */
|
||||
private String holderPhone;
|
||||
/**
|
||||
* 保险公司名称
|
||||
*/
|
||||
@ApiModelProperty(value = "保险公司名称")
|
||||
private String supplierName;
|
||||
/** 是否记录完整0-否1-是 */
|
||||
private String supplierName;
|
||||
/**
|
||||
* 是否记录完整0-否1-是
|
||||
*/
|
||||
@ApiModelProperty(value = "是否记录完整0-否1-是")
|
||||
private String complete;
|
||||
/** 是否已归档 0-否1-是 */
|
||||
private String complete;
|
||||
/**
|
||||
* 是否已归档 0-否1-是
|
||||
*/
|
||||
@ApiModelProperty(value = "是否已归档 0-否1-是 ")
|
||||
private String archived;
|
||||
/** 完成日期 */
|
||||
private String archived;
|
||||
/**
|
||||
* 完成日期
|
||||
*/
|
||||
@ApiModelProperty(value = "完成日期")
|
||||
private Long completeDate;
|
||||
/** 归档日期 */
|
||||
private Long completeDate;
|
||||
/**
|
||||
* 归档日期
|
||||
*/
|
||||
@ApiModelProperty(value = "归档日期")
|
||||
private Long archivedDate;
|
||||
/** 保单起始日期 */
|
||||
private Long archivedDate;
|
||||
/**
|
||||
* 保单起始日期
|
||||
*/
|
||||
@ApiModelProperty(value = "保单起始日期")
|
||||
private String startDate;
|
||||
/** 保单结束日期 */
|
||||
private String startDate;
|
||||
/**
|
||||
* 保单结束日期
|
||||
*/
|
||||
@ApiModelProperty(value = "保单结束日期")
|
||||
private String endDate;
|
||||
/** 生成视频文件ID */
|
||||
private String endDate;
|
||||
/**
|
||||
* 生成视频文件ID
|
||||
*/
|
||||
@ApiModelProperty(value = "生成视频文件ID")
|
||||
private String fileId;
|
||||
/** 生成视频文件地址 */
|
||||
private String fileId;
|
||||
/**
|
||||
* 生成视频文件地址
|
||||
*/
|
||||
@ApiModelProperty(value = "生成视频文件地址")
|
||||
private String fileUrl;
|
||||
/** 业务订单ID */
|
||||
private String fileUrl;
|
||||
/**
|
||||
* 业务订单ID
|
||||
*/
|
||||
@ApiModelProperty(value = "业务订单ID")
|
||||
private String orderId;
|
||||
/** 回溯记录跟踪ID */
|
||||
private String orderId;
|
||||
/**
|
||||
* 回溯记录跟踪ID
|
||||
*/
|
||||
@ApiModelProperty(value = "回溯记录跟踪ID")
|
||||
private String traceId;
|
||||
/** 可回溯记录appKey */
|
||||
private String traceId;
|
||||
/**
|
||||
* 可回溯记录appKey
|
||||
*/
|
||||
@ApiModelProperty(value = "可回溯记录appKey")
|
||||
private String appKey;
|
||||
/** 创建人 */
|
||||
private String appKey;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
/** 创建时间 */
|
||||
private String createBy;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Long createTime;
|
||||
/** 更新人 */
|
||||
@JsonProperty(value = "createAt")
|
||||
private Long createTime;
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
/** 更新时间 */
|
||||
private String updateBy;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Long updateTime;
|
||||
private Long updateTime;
|
||||
|
||||
private List<String> events;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.wabestway.recall.trace.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-15 09:59:12
|
||||
*/
|
||||
@Data
|
||||
@ApiModel
|
||||
public class RecallProductVO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** */
|
||||
@ApiModelProperty(value = "")
|
||||
private String id;
|
||||
/** 产品编码 */
|
||||
@ApiModelProperty(value = "产品编码")
|
||||
private String productCode;
|
||||
/** 产品名称 */
|
||||
@ApiModelProperty(value = "产品名称")
|
||||
private String productName;
|
||||
/** 保险公司编码 */
|
||||
@ApiModelProperty(value = "保险公司编码")
|
||||
private String supplierCode;
|
||||
/** 保险公司名称 */
|
||||
@ApiModelProperty(value = "保险公司名称")
|
||||
private String supplierName;
|
||||
/** 是否归档 0-否1-是 */
|
||||
@ApiModelProperty(value = "是否归档 0-否1-是 ")
|
||||
private String archived;
|
||||
/** 是否记录轨迹 0-否1-是 */
|
||||
@ApiModelProperty(value = "是否记录轨迹 0-否1-是 ")
|
||||
private String tracked;
|
||||
/** 创建人 */
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
/** 创建时间 */
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Long createTime;
|
||||
/** 更新人 */
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
/** 更新时间 */
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Long updateTime;
|
||||
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.wabestway.recall.trace.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -34,7 +36,7 @@ public class RecallRecordVO implements Serializable {
|
||||
private String content;
|
||||
/** 记录事件 */
|
||||
@ApiModelProperty(value = "记录事件")
|
||||
private Blob events;
|
||||
private List<String> events;
|
||||
/** 回溯记录跟踪ID */
|
||||
@ApiModelProperty(value = "回溯记录跟踪ID")
|
||||
private String traceId;
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
<?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.wabestway.recall.trace.dao.RecallApiDao">
|
||||
|
||||
<sql id="queryRecallApiSql">
|
||||
t.id id,
|
||||
t.app_key appKey,
|
||||
t.name name,
|
||||
t.tenant_id tenantId,
|
||||
t.remark remark,
|
||||
t.create_by createBy,
|
||||
t.create_time createTime,
|
||||
t.update_by updateBy,
|
||||
t.update_time updateTime
|
||||
</sql>
|
||||
|
||||
<select id="queryRecallApiByCondition"
|
||||
parameterType="com.wabestway.recall.trace.dto.RecallApiDTO"
|
||||
resultType="com.wabestway.recall.trace.vo.RecallApiVO">
|
||||
select
|
||||
<include refid="queryRecallApiSql"/>
|
||||
from
|
||||
recall_api t
|
||||
where 1 = 1
|
||||
|
||||
<if test="recallApiDTO.id != null and recallApiDTO.id != '' ">
|
||||
and t.id = #{recallApiDTO.id}
|
||||
</if>
|
||||
<if test="recallApiDTO.appKey != null and recallApiDTO.appKey != '' ">
|
||||
and t.app_key = #{recallApiDTO.appKey}
|
||||
</if>
|
||||
<if test="recallApiDTO.name != null and recallApiDTO.name != '' ">
|
||||
and t.name = #{recallApiDTO.name}
|
||||
</if>
|
||||
<if test="recallApiDTO.remark != null and recallApiDTO.remark != '' ">
|
||||
and t.remark = #{recallApiDTO.remark}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="queryRecallApiListNoPage"
|
||||
parameterType="com.wabestway.recall.trace.dto.RecallApiDTO"
|
||||
resultType="com.wabestway.recall.trace.vo.RecallApiVO">
|
||||
select
|
||||
<include refid="queryRecallApiSql"/>
|
||||
from recall_api t
|
||||
where 1 = 1
|
||||
|
||||
<if test="recallApiDTO.id != null and recallApiDTO.id != '' ">
|
||||
and t.id = #{recallApiDTO.id}
|
||||
</if>
|
||||
<if test="recallApiDTO.appKey != null and recallApiDTO.appKey != '' ">
|
||||
and t.app_key = #{recallApiDTO.appKey}
|
||||
</if>
|
||||
<if test="recallApiDTO.name != null and recallApiDTO.name != '' ">
|
||||
and t.name = #{recallApiDTO.name}
|
||||
</if>
|
||||
<if test="recallApiDTO.remark != null and recallApiDTO.remark != '' ">
|
||||
and t.remark = #{recallApiDTO.remark}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="queryRecallApiById" resultType="com.wabestway.recall.trace.vo.RecallApiVO">
|
||||
select
|
||||
<include refid="queryRecallApiSql"/>
|
||||
from recall_api t
|
||||
where t.id= #{id}
|
||||
</select>
|
||||
|
||||
<update id="updateRecallApiById" parameterType="com.wabestway.recall.trace.entity.RecallApiEntity">
|
||||
update recall_api t
|
||||
|
||||
<set>
|
||||
<if test="recallApi.id != null and recallApi.id != '' ">
|
||||
t.id = #{recallApi.id},
|
||||
</if>
|
||||
<if test="recallApi.appKey != null and recallApi.appKey != '' ">
|
||||
t.app_key = #{recallApi.appKey},
|
||||
</if>
|
||||
<if test="recallApi.name != null and recallApi.name != '' ">
|
||||
t.name = #{recallApi.name},
|
||||
</if>
|
||||
<if test="recallApi.remark != null and recallApi.remark != '' ">
|
||||
t.remark = #{recallApi.remark},
|
||||
</if>
|
||||
<if test="recallApi.updateBy != null and recallApi.updateBy != '' ">
|
||||
t.update_by = #{recallApi.updateBy},
|
||||
</if>
|
||||
<if test="recallApi.updateTime != null ">
|
||||
t.update_time = #{recallApi.updateTime},
|
||||
</if>
|
||||
</set>
|
||||
where t.id= #{recallApi.id}
|
||||
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -41,6 +41,9 @@
|
||||
<if test="recallOrderDTO.id != null and recallOrderDTO.id != '' ">
|
||||
and t.id = #{recallOrderDTO.id}
|
||||
</if>
|
||||
<if test="recallOrderDTO.tenantId != null and recallOrderDTO.tenantId != '' ">
|
||||
and t.tenant_id = #{recallOrderDTO.tenantId}
|
||||
</if>
|
||||
<if test="recallOrderDTO.productCode != null and recallOrderDTO.productCode != '' ">
|
||||
and t.product_code = #{recallOrderDTO.productCode}
|
||||
</if>
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
<?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.wabestway.recall.trace.dao.RecallProductDao">
|
||||
|
||||
<sql id="queryRecallProductSql">
|
||||
t.id id,
|
||||
t.product_code productCode,
|
||||
t.product_name productName,
|
||||
t.supplier_code supplierCode,
|
||||
t.supplier_name supplierName,
|
||||
t.archived archived,
|
||||
t.tracked tracked,
|
||||
t.tenant_id tenantId,
|
||||
t.create_by createBy,
|
||||
t.create_time createTime,
|
||||
t.update_by updateBy,
|
||||
t.update_time updateTime
|
||||
</sql>
|
||||
|
||||
<select id="queryRecallProductByCondition"
|
||||
parameterType="com.wabestway.recall.trace.dto.RecallProductDTO"
|
||||
resultType="com.wabestway.recall.trace.vo.RecallProductVO">
|
||||
select
|
||||
<include refid="queryRecallProductSql"/>
|
||||
from
|
||||
recall_product t
|
||||
where 1 = 1
|
||||
|
||||
<if test="recallProductDTO.id != null and recallProductDTO.id != '' ">
|
||||
and t.id = #{recallProductDTO.id}
|
||||
</if>
|
||||
<if test="recallProductDTO.productCode != null and recallProductDTO.productCode != '' ">
|
||||
and t.product_code = #{recallProductDTO.productCode}
|
||||
</if>
|
||||
<if test="recallProductDTO.productName != null and recallProductDTO.productName != '' ">
|
||||
and t.product_name = #{recallProductDTO.productName}
|
||||
</if>
|
||||
<if test="recallProductDTO.supplierCode != null and recallProductDTO.supplierCode != '' ">
|
||||
and t.supplier_code = #{recallProductDTO.supplierCode}
|
||||
</if>
|
||||
<if test="recallProductDTO.supplierName != null and recallProductDTO.supplierName != '' ">
|
||||
and t.supplier_name = #{recallProductDTO.supplierName}
|
||||
</if>
|
||||
<if test="recallProductDTO.archived != null and recallProductDTO.archived != '' ">
|
||||
and t.archived = #{recallProductDTO.archived}
|
||||
</if>
|
||||
<if test="recallProductDTO.tracked != null and recallProductDTO.tracked != '' ">
|
||||
and t.tracked = #{recallProductDTO.tracked}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="queryRecallProductListNoPage"
|
||||
parameterType="com.wabestway.recall.trace.dto.RecallProductDTO"
|
||||
resultType="com.wabestway.recall.trace.vo.RecallProductVO">
|
||||
select
|
||||
<include refid="queryRecallProductSql"/>
|
||||
from recall_product t
|
||||
where 1 = 1
|
||||
|
||||
<if test="recallProductDTO.id != null and recallProductDTO.id != '' ">
|
||||
and t.id = #{recallProductDTO.id}
|
||||
</if>
|
||||
<if test="recallProductDTO.productCode != null and recallProductDTO.productCode != '' ">
|
||||
and t.product_code = #{recallProductDTO.productCode}
|
||||
</if>
|
||||
<if test="recallProductDTO.productName != null and recallProductDTO.productName != '' ">
|
||||
and t.product_name = #{recallProductDTO.productName}
|
||||
</if>
|
||||
<if test="recallProductDTO.supplierCode != null and recallProductDTO.supplierCode != '' ">
|
||||
and t.supplier_code = #{recallProductDTO.supplierCode}
|
||||
</if>
|
||||
<if test="recallProductDTO.supplierName != null and recallProductDTO.supplierName != '' ">
|
||||
and t.supplier_name = #{recallProductDTO.supplierName}
|
||||
</if>
|
||||
<if test="recallProductDTO.archived != null and recallProductDTO.archived != '' ">
|
||||
and t.archived = #{recallProductDTO.archived}
|
||||
</if>
|
||||
<if test="recallProductDTO.tracked != null and recallProductDTO.tracked != '' ">
|
||||
and t.tracked = #{recallProductDTO.tracked}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="queryRecallProductById" resultType="com.wabestway.recall.trace.vo.RecallProductVO">
|
||||
select
|
||||
<include refid="queryRecallProductSql"/>
|
||||
from recall_product t
|
||||
where t.id= #{id}
|
||||
</select>
|
||||
|
||||
<update id="updateRecallProductById" parameterType="com.wabestway.recall.trace.entity.RecallProductEntity">
|
||||
update recall_product t
|
||||
|
||||
<set>
|
||||
<if test="recallProduct.id != null and recallProduct.id != '' ">
|
||||
t.id = #{recallProduct.id},
|
||||
</if>
|
||||
<if test="recallProduct.productCode != null and recallProduct.productCode != '' ">
|
||||
t.product_code = #{recallProduct.productCode},
|
||||
</if>
|
||||
<if test="recallProduct.productName != null and recallProduct.productName != '' ">
|
||||
t.product_name = #{recallProduct.productName},
|
||||
</if>
|
||||
<if test="recallProduct.supplierCode != null and recallProduct.supplierCode != '' ">
|
||||
t.supplier_code = #{recallProduct.supplierCode},
|
||||
</if>
|
||||
<if test="recallProduct.supplierName != null and recallProduct.supplierName != '' ">
|
||||
t.supplier_name = #{recallProduct.supplierName},
|
||||
</if>
|
||||
<if test="recallProduct.archived != null and recallProduct.archived != '' ">
|
||||
t.archived = #{recallProduct.archived},
|
||||
</if>
|
||||
<if test="recallProduct.tracked != null and recallProduct.tracked != '' ">
|
||||
t.tracked = #{recallProduct.tracked},
|
||||
</if>
|
||||
<if test="recallProduct.updateBy != null and recallProduct.updateBy != '' ">
|
||||
t.update_by = #{recallProduct.updateBy},
|
||||
</if>
|
||||
<if test="recallProduct.updateTime != null ">
|
||||
t.update_time = #{recallProduct.updateTime},
|
||||
</if>
|
||||
</set>
|
||||
where t.id= #{recallProduct.id}
|
||||
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -2,7 +2,10 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.wabestway.recall.trace.dao.RecallRecordDao">
|
||||
|
||||
<resultMap id="queryOrderRecordMap" type="com.wabestway.recall.trace.vo.RecallRecordVO">
|
||||
<result column="events" property="events"
|
||||
typeHandler="com.wabestway.recall.trace.handler.ListTypeHandler"></result>
|
||||
</resultMap>
|
||||
<sql id="queryRecallRecordSql">
|
||||
t.id id,
|
||||
t.product_code productCode,
|
||||
@@ -18,11 +21,11 @@
|
||||
<select id="queryRecallRecordByCondition"
|
||||
parameterType="com.wabestway.recall.trace.dto.RecallRecordDTO"
|
||||
resultType="com.wabestway.recall.trace.vo.RecallRecordVO">
|
||||
select
|
||||
select
|
||||
<include refid="queryRecallRecordSql"/>
|
||||
from
|
||||
from
|
||||
recall_record t
|
||||
where 1 = 1
|
||||
where 1 = 1
|
||||
|
||||
<if test="recallRecordDTO.id != null and recallRecordDTO.id != '' ">
|
||||
and t.id = #{recallRecordDTO.id}
|
||||
@@ -50,10 +53,10 @@
|
||||
<select id="queryRecallRecordListNoPage"
|
||||
parameterType="com.wabestway.recall.trace.dto.RecallRecordDTO"
|
||||
resultType="com.wabestway.recall.trace.vo.RecallRecordVO">
|
||||
select
|
||||
select
|
||||
<include refid="queryRecallRecordSql"/>
|
||||
from recall_record t
|
||||
where 1 = 1
|
||||
from recall_record t
|
||||
where 1 = 1
|
||||
|
||||
<if test="recallRecordDTO.id != null and recallRecordDTO.id != '' ">
|
||||
and t.id = #{recallRecordDTO.id}
|
||||
@@ -79,10 +82,10 @@
|
||||
</select>
|
||||
|
||||
<select id="queryRecallRecordById" resultType="com.wabestway.recall.trace.vo.RecallRecordVO">
|
||||
select
|
||||
select
|
||||
<include refid="queryRecallRecordSql"/>
|
||||
from recall_record t
|
||||
where t.id= #{id}
|
||||
from recall_record t
|
||||
where t.id= #{id}
|
||||
</select>
|
||||
|
||||
<update id="updateRecallRecordById" parameterType="com.wabestway.recall.trace.entity.RecallRecordEntity">
|
||||
@@ -114,4 +117,13 @@
|
||||
where t.id= #{recallRecord.id}
|
||||
|
||||
</update>
|
||||
|
||||
<select id="queryTraceRecords" resultMap="queryOrderRecordMap">
|
||||
select
|
||||
<include refid="queryRecallRecordSql"/>
|
||||
from recall_record t
|
||||
where t.trace_id = #{traceId}
|
||||
order by t.create_time asc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
+55
-8
@@ -6,17 +6,62 @@
|
||||
<parent>
|
||||
<groupId>com.wabestway.recall</groupId>
|
||||
<artifactId>afis-recall</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>afis-recall-web</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<spring-cloud.version>Hoxton.SR9</spring-cloud.version>
|
||||
<spring-cloud-alibaba.version>2.2.3.RELEASE</spring-cloud-alibaba.version>
|
||||
<spring-cloud-alibaba.version>2.2.1.RELEASE</spring-cloud-alibaba.version>
|
||||
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<mybatisplus.version>3.3.2</mybatisplus.version>
|
||||
<alibaba.boot.druid>1.1.22</alibaba.boot.druid>
|
||||
</properties>
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-job-core</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.wabestway.recall</groupId>
|
||||
<artifactId>afis-recall-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.wabestway.recall</groupId>
|
||||
<artifactId>afis-recall-service</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>${mybatisplus.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-generator</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>${alibaba.boot.druid}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
@@ -26,6 +71,12 @@
|
||||
<artifactId>afis-engine-api</artifactId>
|
||||
<version>2.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.wabestway.auth</groupId>
|
||||
<artifactId>afis-auth-api</artifactId>
|
||||
<version>1.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
@@ -40,11 +91,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-mongodb-reactive</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.wabestway.recall.config;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* Created by king on 2021/5/9.
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnClass(value = {PaginationInterceptor.class})
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
|
||||
@Bean
|
||||
public PaginationInterceptor paginationInterceptor() {
|
||||
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
|
||||
return paginationInterceptor;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.wabestway.recall.feign;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.wabestway.commons.http.ResObj;
|
||||
import com.wabestway.recall.api.dto.TraceUpDTO;
|
||||
import com.wabestway.recall.api.feign.TraceFeignClient;
|
||||
import com.wabestway.recall.trace.entity.RecallOrderEntity;
|
||||
import com.wabestway.recall.trace.service.RecallOrderService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@Slf4j
|
||||
public class TraceFeignClientImpl implements TraceFeignClient {
|
||||
@Autowired
|
||||
private RecallOrderService recallOrderService;
|
||||
|
||||
@Override
|
||||
public ResObj batchTraceUp(TraceUpDTO traceUpDTO) {
|
||||
log.info("同步请求数据:{}", JSON.toJSONString(traceUpDTO));
|
||||
if (traceUpDTO != null && traceUpDTO.getRecords() != null) {
|
||||
traceUpDTO.getRecords().forEach(order -> {
|
||||
RecallOrderEntity recallOrderEntity = recallOrderService.queryRecallOrderByOrderId(order.getOrderId());
|
||||
if (recallOrderEntity != null) {
|
||||
recallOrderEntity.setPolicyNo(order.getPolicyNo());
|
||||
recallOrderEntity.setHolderName(order.getHolderName());
|
||||
recallOrderEntity.setHolderPhone(order.getHolderPhone());
|
||||
recallOrderEntity.setStartDate(order.getStartDate());
|
||||
recallOrderEntity.setEndDate(order.getEndDate());
|
||||
recallOrderEntity.setSupplierName(order.getSupplierName());
|
||||
recallOrderEntity.setUpdateTime(System.currentTimeMillis());
|
||||
recallOrderService.updateRecallOrderById(recallOrderEntity);
|
||||
}
|
||||
});
|
||||
}
|
||||
return ResObj.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.wabestway.recall.jobtask;
|
||||
|
||||
import com.wabestway.recall.trace.service.RecallOrderApiService;
|
||||
import com.xxl.job.core.biz.model.ReturnT;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class GenVideoJobHandler {
|
||||
@Autowired
|
||||
private RecallOrderApiService recallOrderApiService;
|
||||
|
||||
@XxlJob("VideoGenJobHandler")
|
||||
public ReturnT<String> genRecallVideo() {
|
||||
log.info("[定时器:回溯视频]-开始执行");
|
||||
recallOrderApiService.traceVideo();
|
||||
log.info("[定时器:回溯视频]-执行完成");
|
||||
return ReturnT.SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.wabestway.recall.jobtask;
|
||||
|
||||
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class XXLJobConfig {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(XXLJobConfig.class);
|
||||
|
||||
@Value("${xxl.job.admin.addresses}")
|
||||
private String adminAddresses;
|
||||
|
||||
@Value("${xxl.job.accessToken}")
|
||||
private String accessToken;
|
||||
|
||||
@Value("${xxl.job.executor.appname}")
|
||||
private String appname;
|
||||
|
||||
@Value("${xxl.job.executor.port:-1}")
|
||||
private int port;
|
||||
|
||||
@Value("${xxl.job.executor.logpath}")
|
||||
private String logPath;
|
||||
|
||||
@Value("${xxl.job.executor.logretentiondays}")
|
||||
private int logRetentionDays;
|
||||
|
||||
@Bean
|
||||
public XxlJobSpringExecutor xxlJobExecutor() {
|
||||
logger.info(">>>>>>>>>>> xxl-job config init.");
|
||||
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
|
||||
xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
|
||||
xxlJobSpringExecutor.setAppname(appname);
|
||||
xxlJobSpringExecutor.setPort(port);
|
||||
xxlJobSpringExecutor.setAccessToken(accessToken);
|
||||
xxlJobSpringExecutor.setLogPath(logPath);
|
||||
xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
|
||||
|
||||
return xxlJobSpringExecutor;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package com.wabestway.recall.model;
|
||||
|
||||
import lombok.Data;
|
||||
import org.bson.codecs.pojo.annotations.BsonIgnore;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.index.Indexed;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Document(collection = "orders")
|
||||
public class Order {
|
||||
@Id
|
||||
private String id;
|
||||
private String appKey;
|
||||
private String tenantId;
|
||||
private String productCode;
|
||||
private String productName;
|
||||
@BsonIgnore
|
||||
private List<String> events;
|
||||
@Indexed(unique = true)
|
||||
private String traceId;
|
||||
@Indexed(unique = true)
|
||||
private String orderId;
|
||||
private String complete;
|
||||
private String archived;
|
||||
private String fileId;
|
||||
private String fileUrl;
|
||||
private long createAt;
|
||||
@BsonIgnore
|
||||
private int page;
|
||||
@BsonIgnore
|
||||
private int pageSize;
|
||||
|
||||
private String startDate;
|
||||
private String endDate;
|
||||
private String policyNo;
|
||||
private String holderName;
|
||||
private String holderPhone;
|
||||
private String supplierName;
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.wabestway.recall.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class OrderList {
|
||||
private int page;
|
||||
private int pageSize;
|
||||
private long total;
|
||||
private List<Order> list;
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.wabestway.recall.model;
|
||||
|
||||
import lombok.Data;
|
||||
import org.bson.codecs.pojo.annotations.BsonIgnore;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.index.Indexed;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Document(collection = "records")
|
||||
public class Record {
|
||||
@Id
|
||||
private String id;
|
||||
private List<String> events;
|
||||
private String traceId;
|
||||
@BsonIgnore
|
||||
private String orderId;
|
||||
private boolean last;
|
||||
private String productCode;
|
||||
private String productName;
|
||||
private long createAt;
|
||||
@BsonIgnore
|
||||
private String appKey;
|
||||
private String module;
|
||||
private String content;
|
||||
}
|
||||
@@ -1,173 +0,0 @@
|
||||
package com.wabestway.recall.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class ResObj<T> {
|
||||
private static final String SUCCESS = "success";
|
||||
|
||||
private static final String FAILURE = "failure";
|
||||
|
||||
private static final Integer SUCCESS_CODE = 200;
|
||||
|
||||
private static final Integer FAILURE_CODE = 400;
|
||||
|
||||
private Integer code;
|
||||
|
||||
private String message;
|
||||
|
||||
private String _trackId;
|
||||
|
||||
private T data;
|
||||
|
||||
private Map extr;
|
||||
|
||||
private long timestamp;
|
||||
|
||||
private Integer _status;
|
||||
|
||||
private ResObj(Integer code, T data) {
|
||||
this.code = code;
|
||||
this.data = data;
|
||||
this.timestamp = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
private ResObj(Integer code, String message, T data) {
|
||||
this.code = code;
|
||||
this.data = data;
|
||||
this.message = message;
|
||||
this.timestamp = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
private ResObj(T data) {
|
||||
this.data = data;
|
||||
this.timestamp = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
private ResObj(Integer code) {
|
||||
this.code = code;
|
||||
this.timestamp = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public boolean isOk() {
|
||||
return SUCCESS_CODE.equals(this.code);
|
||||
}
|
||||
|
||||
public T data() {
|
||||
return (T) this.data;
|
||||
}
|
||||
|
||||
public Object get(String key) {
|
||||
if (this.data != null && key != null) {
|
||||
return ((Map) this.data).get(key);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ResObj() {
|
||||
this.timestamp = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public static ResObj ok() {
|
||||
ResObj o = new ResObj(SUCCESS_CODE);
|
||||
return o;
|
||||
}
|
||||
|
||||
public static ResObj ok(Object data) {
|
||||
ResObj o = new ResObj(SUCCESS_CODE, data);
|
||||
return o;
|
||||
}
|
||||
|
||||
public static ResObj fail(String msg) {
|
||||
ResObj o = new ResObj(FAILURE_CODE, msg, null);
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
public static ResObj fail() {
|
||||
ResObj o = new ResObj(FAILURE_CODE);
|
||||
return o;
|
||||
}
|
||||
|
||||
public static ResObj result(Integer code, Object data) {
|
||||
ResObj o = new ResObj(code, data);
|
||||
return o;
|
||||
}
|
||||
|
||||
public static ResObj result(Integer code, String message, Object data) {
|
||||
ResObj o = new ResObj(code, message, data);
|
||||
return o;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public T getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public ResObj<T> setData(T data) {
|
||||
this.data = data;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Long getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public ResObj setTimestamp(Long timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Map getExtr() {
|
||||
return extr;
|
||||
}
|
||||
|
||||
|
||||
public Integer get_status() {
|
||||
return _status;
|
||||
}
|
||||
|
||||
public void set_status(Integer _status) {
|
||||
this._status = _status;
|
||||
}
|
||||
|
||||
public String get_trackId() {
|
||||
return _trackId;
|
||||
}
|
||||
|
||||
public void set_trackId(String _trackId) {
|
||||
this._trackId = _trackId;
|
||||
}
|
||||
|
||||
public ResObj trackId(String _trackId) {
|
||||
this._trackId = _trackId;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (message == null) {
|
||||
return "ResObj(" + code + ")";
|
||||
}
|
||||
return "ResObj(" + code + "){" + message + "}";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.wabestway.recall.repository;
|
||||
|
||||
import com.wabestway.recall.model.Order;
|
||||
import org.springframework.data.domain.*;
|
||||
import org.springframework.data.mongodb.repository.ReactiveMongoRepository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
public interface OrderRepository extends ReactiveMongoRepository<Order, String> {
|
||||
Mono<Order> findByOrderId(String orderId);
|
||||
|
||||
Mono<Order> findByTraceId(String traceId);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.wabestway.recall.repository;
|
||||
|
||||
|
||||
import com.wabestway.recall.model.Record;
|
||||
import org.springframework.data.mongodb.repository.ReactiveMongoRepository;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
|
||||
public interface RecordRepository extends ReactiveMongoRepository<Record, String> {
|
||||
Flux<Record> findAllByTraceIdOrderByCreateAtAsc(String traceId);
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
package com.wabestway.recall.trace.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.wabestway.recall.trace.dto.RecallApiDTO;
|
||||
import com.wabestway.recall.trace.vo.RecallApiVO;
|
||||
import com.wabestway.recall.trace.service.RecallApiApiService;
|
||||
import com.wabestway.commons.http.Paging;
|
||||
import com.wabestway.commons.http.ResObj;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-15 09:59:12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/trace/recallApi")
|
||||
@Api(tags = {"-接口"}, description = "-接口")
|
||||
public class RecallApiController {
|
||||
@Autowired
|
||||
private RecallApiApiService recallApiApiService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
@ApiOperation(value = "分页列表查询", notes = "条件分页查询列表", httpMethod = "POST")
|
||||
public ResObj<Paging<RecallApiVO>> list(@RequestBody RecallApiDTO paramRequest) {
|
||||
return recallApiApiService.list(paramRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@GetMapping("/info/{id}")
|
||||
@ApiOperation(value = "根据id查详情", notes = "根据id查详情", httpMethod = "GET")
|
||||
public ResObj<RecallApiVO> info(@PathVariable("id") String id) {
|
||||
return recallApiApiService.getRecallApi(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
@ApiOperation(value = "保存", notes = "保存", httpMethod = "POST")
|
||||
public ResObj saveRecallApi(@RequestBody RecallApiDTO paramRequest) {
|
||||
return recallApiApiService.saveRecallApi(paramRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
@ApiOperation(value = "修改", notes = "修改", httpMethod = "POST")
|
||||
public ResObj updateRecallApi(@RequestBody RecallApiDTO paramRequest) {
|
||||
return recallApiApiService.updateRecallApi(paramRequest);
|
||||
}
|
||||
}
|
||||
+26
-28
@@ -1,6 +1,7 @@
|
||||
package com.wabestway.recall.trace.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.wabestway.recall.util.HeaderDataUtil;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -10,20 +11,20 @@ import com.wabestway.recall.trace.service.RecallOrderApiService;
|
||||
import com.wabestway.commons.http.Paging;
|
||||
import com.wabestway.commons.http.ResObj;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-06 17:37:03
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/trace/recallOrder")
|
||||
@RequestMapping("/order")
|
||||
@Api(tags = {"-接口"}, description = "-接口")
|
||||
public class RecallOrderController {
|
||||
@Autowired
|
||||
private RecallOrderApiService recallOrderApiService;
|
||||
private final RecallOrderApiService recallOrderApiService;
|
||||
|
||||
public RecallOrderController(RecallOrderApiService recallOrderApiService) {
|
||||
this.recallOrderApiService = recallOrderApiService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表
|
||||
@@ -31,39 +32,36 @@ public class RecallOrderController {
|
||||
@PostMapping("/list")
|
||||
@ApiOperation(value = "分页列表查询", notes = "条件分页查询列表", httpMethod = "POST")
|
||||
public ResObj<Paging<RecallOrderVO>> list(@RequestBody RecallOrderDTO paramRequest) {
|
||||
paramRequest.setTenantId(null);
|
||||
return recallOrderApiService.list(paramRequest);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/tenant/list")
|
||||
@ApiOperation(value = "租户分页列表查询", notes = "条件分页查询列表", httpMethod = "POST")
|
||||
public ResObj<Paging<RecallOrderVO>> tenantList(@RequestBody RecallOrderDTO paramRequest) {
|
||||
paramRequest.setTenantId(HeaderDataUtil.getTenantId());
|
||||
return recallOrderApiService.list(paramRequest);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@GetMapping("/info/{id}")
|
||||
@PostMapping("/info/{id}")
|
||||
@ApiOperation(value = "根据id查详情", notes = "根据id查详情", httpMethod = "GET")
|
||||
public ResObj<RecallOrderVO> info(@PathVariable("id") String id) {
|
||||
return recallOrderApiService.getRecallOrder(id);
|
||||
return recallOrderApiService.getRecallOrderByOrderId(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
* 生成回溯MP4文件
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
@ApiOperation(value = "保存", notes = "保存", httpMethod = "POST")
|
||||
public ResObj saveRecallOrder(@RequestBody RecallOrderDTO paramRequest) {
|
||||
return recallOrderApiService.saveRecallOrder(paramRequest);
|
||||
@GetMapping("/ffmpeg")
|
||||
public ResObj createMp4() {
|
||||
return recallOrderApiService.traceVideo();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
@ApiOperation(value = "修改", notes = "修改", httpMethod = "POST")
|
||||
public ResObj updateRecallOrder(@RequestBody RecallOrderDTO paramRequest) {
|
||||
return recallOrderApiService.updateRecallOrder(paramRequest);
|
||||
}
|
||||
|
||||
@PostMapping("/changeStatus")
|
||||
@ApiOperation(value = "启禁用更新", notes = "启禁用更新", httpMethod = "POST")
|
||||
public ResObj changeStatus(@RequestBody RecallOrderDTO paramRequest) {
|
||||
return recallOrderApiService.changeStatus(paramRequest.getId(), paramRequest.getStatus());
|
||||
}
|
||||
}
|
||||
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
package com.wabestway.recall.trace.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.wabestway.recall.trace.dto.RecallProductDTO;
|
||||
import com.wabestway.recall.trace.vo.RecallProductVO;
|
||||
import com.wabestway.recall.trace.service.RecallProductApiService;
|
||||
import com.wabestway.commons.http.Paging;
|
||||
import com.wabestway.commons.http.ResObj;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-15 09:59:12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/trace/recallProduct")
|
||||
@Api(tags = {"-接口"}, description = "-接口")
|
||||
public class RecallProductController {
|
||||
@Autowired
|
||||
private RecallProductApiService recallProductApiService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
@ApiOperation(value = "分页列表查询", notes = "条件分页查询列表", httpMethod = "POST")
|
||||
public ResObj<Paging<RecallProductVO>> list(@RequestBody RecallProductDTO paramRequest) {
|
||||
return recallProductApiService.list(paramRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@GetMapping("/info/{id}")
|
||||
@ApiOperation(value = "根据id查详情", notes = "根据id查详情", httpMethod = "GET")
|
||||
public ResObj<RecallProductVO> info(@PathVariable("id") String id) {
|
||||
return recallProductApiService.getRecallProduct(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
@ApiOperation(value = "保存", notes = "保存", httpMethod = "POST")
|
||||
public ResObj saveRecallProduct(@RequestBody RecallProductDTO paramRequest) {
|
||||
return recallProductApiService.saveRecallProduct(paramRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
@ApiOperation(value = "修改", notes = "修改", httpMethod = "POST")
|
||||
public ResObj updateRecallProduct(@RequestBody RecallProductDTO paramRequest) {
|
||||
return recallProductApiService.updateRecallProduct(paramRequest);
|
||||
}
|
||||
|
||||
}
|
||||
+4
-39
@@ -1,69 +1,34 @@
|
||||
package com.wabestway.recall.trace.controller;
|
||||
|
||||
import com.wabestway.recall.trace.dto.TraceDTO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.wabestway.recall.trace.dto.RecallRecordDTO;
|
||||
import com.wabestway.recall.trace.vo.RecallRecordVO;
|
||||
import com.wabestway.recall.trace.service.RecallRecordApiService;
|
||||
import com.wabestway.commons.http.Paging;
|
||||
import com.wabestway.commons.http.ResObj;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-06 17:37:03
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/trace/recallRecord")
|
||||
@RequestMapping("/track")
|
||||
@Api(tags = {"-接口"}, description = "-接口")
|
||||
public class RecallRecordController {
|
||||
@Autowired
|
||||
private RecallRecordApiService recallRecordApiService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
@ApiOperation(value = "分页列表查询", notes = "条件分页查询列表", httpMethod = "POST")
|
||||
public ResObj<Paging<RecallRecordVO>> list(@RequestBody RecallRecordDTO paramRequest) {
|
||||
return recallRecordApiService.list(paramRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@GetMapping("/info/{id}")
|
||||
@ApiOperation(value = "根据id查详情", notes = "根据id查详情", httpMethod = "GET")
|
||||
public ResObj<RecallRecordVO> info(@PathVariable("id") String id) {
|
||||
return recallRecordApiService.getRecallRecord(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
@ApiOperation(value = "保存", notes = "保存", httpMethod = "POST")
|
||||
public ResObj saveRecallRecord(@RequestBody RecallRecordDTO paramRequest) {
|
||||
return recallRecordApiService.saveRecallRecord(paramRequest);
|
||||
public ResObj saveRecallRecord(@RequestBody TraceDTO record) {
|
||||
return recallRecordApiService.save(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
@ApiOperation(value = "修改", notes = "修改", httpMethod = "POST")
|
||||
public ResObj updateRecallRecord(@RequestBody RecallRecordDTO paramRequest) {
|
||||
return recallRecordApiService.updateRecallRecord(paramRequest);
|
||||
}
|
||||
|
||||
@PostMapping("/changeStatus")
|
||||
@ApiOperation(value = "启禁用更新", notes = "启禁用更新", httpMethod = "POST")
|
||||
public ResObj changeStatus(@RequestBody RecallRecordDTO paramRequest) {
|
||||
return recallRecordApiService.changeStatus(paramRequest.getId(), paramRequest.getStatus());
|
||||
}
|
||||
}
|
||||
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package com.wabestway.recall.trace.service;
|
||||
|
||||
|
||||
import com.wabestway.recall.trace.dto.RecallApiDTO;
|
||||
import com.wabestway.recall.trace.vo.RecallApiVO;
|
||||
import com.wabestway.commons.http.Paging;
|
||||
import com.wabestway.commons.http.ResObj;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-15 09:59:12
|
||||
*/
|
||||
public interface RecallApiApiService {
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param paramReq
|
||||
* @return
|
||||
*/
|
||||
ResObj<Paging<RecallApiVO>> list(RecallApiDTO paramReq);
|
||||
|
||||
/**
|
||||
* 查询详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ResObj<RecallApiVO> getRecallApi(String id);
|
||||
|
||||
/**
|
||||
* 保存
|
||||
* @param paramReq
|
||||
* @return
|
||||
*/
|
||||
ResObj saveRecallApi(RecallApiDTO paramReq);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param paramReq
|
||||
* @return
|
||||
*/
|
||||
ResObj updateRecallApi(RecallApiDTO paramReq);
|
||||
|
||||
}
|
||||
+5
-27
@@ -1,6 +1,5 @@
|
||||
package com.wabestway.recall.trace.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.wabestway.recall.trace.dto.RecallOrderDTO;
|
||||
import com.wabestway.recall.trace.vo.RecallOrderVO;
|
||||
import com.wabestway.commons.http.Paging;
|
||||
@@ -8,8 +7,6 @@ import com.wabestway.commons.http.ResObj;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-06 17:37:03
|
||||
@@ -18,37 +15,18 @@ public interface RecallOrderApiService {
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param paramReq
|
||||
* @return
|
||||
*/
|
||||
ResObj<Paging<RecallOrderVO>> list(RecallOrderDTO paramReq);
|
||||
|
||||
/**
|
||||
* 查询详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ResObj<RecallOrderVO> getRecallOrder(String id);
|
||||
ResObj<RecallOrderVO> getRecallOrderByOrderId(String orderId);
|
||||
|
||||
/**
|
||||
* 保存
|
||||
* @param paramReq
|
||||
* 根据回溯文件生成MP4视频
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ResObj saveRecallOrder(RecallOrderDTO paramReq);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param paramReq
|
||||
* @return
|
||||
*/
|
||||
ResObj updateRecallOrder(RecallOrderDTO paramReq);
|
||||
|
||||
/**
|
||||
* 启禁用
|
||||
* @param id
|
||||
* @param status
|
||||
* @return
|
||||
*/
|
||||
ResObj changeStatus(String id, String status);
|
||||
ResObj traceVideo();
|
||||
}
|
||||
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package com.wabestway.recall.trace.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.wabestway.recall.trace.dto.RecallProductDTO;
|
||||
import com.wabestway.recall.trace.vo.RecallProductVO;
|
||||
import com.wabestway.commons.http.Paging;
|
||||
import com.wabestway.commons.http.ResObj;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-15 09:59:12
|
||||
*/
|
||||
public interface RecallProductApiService {
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param paramReq
|
||||
* @return
|
||||
*/
|
||||
ResObj<Paging<RecallProductVO>> list(RecallProductDTO paramReq);
|
||||
|
||||
/**
|
||||
* 查询详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ResObj<RecallProductVO> getRecallProduct(String id);
|
||||
|
||||
/**
|
||||
* 保存
|
||||
* @param paramReq
|
||||
* @return
|
||||
*/
|
||||
ResObj saveRecallProduct(RecallProductDTO paramReq);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param paramReq
|
||||
* @return
|
||||
*/
|
||||
ResObj updateRecallProduct(RecallProductDTO paramReq);
|
||||
}
|
||||
+6
-37
@@ -1,15 +1,11 @@
|
||||
package com.wabestway.recall.trace.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.wabestway.recall.trace.dto.RecallRecordDTO;
|
||||
import com.wabestway.recall.trace.vo.RecallRecordVO;
|
||||
import com.wabestway.commons.http.Paging;
|
||||
|
||||
import com.wabestway.recall.trace.dto.TraceDTO;
|
||||
import com.wabestway.commons.http.ResObj;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-06 17:37:03
|
||||
@@ -17,38 +13,11 @@ import com.wabestway.commons.http.ResObj;
|
||||
public interface RecallRecordApiService {
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param paramReq
|
||||
* 回溯数据记录
|
||||
*
|
||||
* @param record
|
||||
* @return
|
||||
*/
|
||||
ResObj<Paging<RecallRecordVO>> list(RecallRecordDTO paramReq);
|
||||
ResObj save(TraceDTO record);
|
||||
|
||||
/**
|
||||
* 查询详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ResObj<RecallRecordVO> getRecallRecord(String id);
|
||||
|
||||
/**
|
||||
* 保存
|
||||
* @param paramReq
|
||||
* @return
|
||||
*/
|
||||
ResObj saveRecallRecord(RecallRecordDTO paramReq);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param paramReq
|
||||
* @return
|
||||
*/
|
||||
ResObj updateRecallRecord(RecallRecordDTO paramReq);
|
||||
|
||||
/**
|
||||
* 启禁用
|
||||
* @param id
|
||||
* @param status
|
||||
* @return
|
||||
*/
|
||||
ResObj changeStatus(String id, String status);
|
||||
}
|
||||
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
package com.wabestway.recall.trace.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.wabestway.commons.http.Paging;
|
||||
import com.wabestway.commons.http.ResObj;
|
||||
import com.wabestway.recall.util.HeaderDataUtil;
|
||||
import com.wabestway.recall.util.ShortAppKeyGenerator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import com.wabestway.ins.utils.UUIDUtil;
|
||||
import com.wabestway.recall.trace.entity.RecallApiEntity;
|
||||
import com.wabestway.recall.trace.dto.RecallApiDTO;
|
||||
import com.wabestway.recall.trace.vo.RecallApiVO;
|
||||
import com.wabestway.recall.trace.service.RecallApiApiService;
|
||||
import com.wabestway.recall.trace.service.RecallApiService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-15 09:59:12
|
||||
*/
|
||||
@Service
|
||||
public class RecallApiApiServiceImpl implements RecallApiApiService {
|
||||
@Autowired
|
||||
private RecallApiService recallApiService;
|
||||
|
||||
@Override
|
||||
public ResObj<Paging<RecallApiVO>> list(RecallApiDTO paramReq) {
|
||||
IPage<RecallApiVO> resultPage = recallApiService.queryRecallApiByCondition(paramReq.getPage(), paramReq.getPageSize(), paramReq);
|
||||
|
||||
Paging<RecallApiVO> paging = new Paging(resultPage.getRecords(), paramReq.getPage(), resultPage.getSize(), resultPage.getTotal());
|
||||
return ResObj.ok(paging);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResObj<RecallApiVO> getRecallApi(String id) {
|
||||
RecallApiVO recallApiVO = recallApiService.queryRecallApiById(id);
|
||||
|
||||
return ResObj.ok(recallApiVO);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public ResObj saveRecallApi(RecallApiDTO paramReq) {
|
||||
RecallApiEntity recallApi = new RecallApiEntity();
|
||||
BeanUtils.copyProperties(paramReq, recallApi);
|
||||
|
||||
recallApi.setId(UUIDUtil.generate());//赋值id
|
||||
recallApi.setAppKey(ShortAppKeyGenerator.generate());
|
||||
recallApi.setTenantId(HeaderDataUtil.getTenantId());
|
||||
recallApi.setCreateBy(HeaderDataUtil.getUserId());//创建人
|
||||
recallApi.setCreateTime(System.currentTimeMillis());//创建时间
|
||||
recallApi.setUpdateBy(HeaderDataUtil.getUserId());//更新人
|
||||
recallApi.setUpdateTime(System.currentTimeMillis());//更新时间
|
||||
|
||||
recallApiService.save(recallApi);
|
||||
return ResObj.ok();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public ResObj updateRecallApi(RecallApiDTO paramReq) {
|
||||
RecallApiEntity recallApi = new RecallApiEntity();
|
||||
paramReq.setAppKey(null);
|
||||
BeanUtils.copyProperties(paramReq, recallApi);
|
||||
recallApi.setUpdateBy(HeaderDataUtil.getUserId());//更新人
|
||||
recallApi.setUpdateTime(System.currentTimeMillis());//更新时间
|
||||
recallApiService.updateById(recallApi);
|
||||
return ResObj.ok();
|
||||
}
|
||||
|
||||
}
|
||||
+149
-44
@@ -1,31 +1,49 @@
|
||||
package com.wabestway.recall.trace.service.impl;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.wabestway.commons.http.Paging;
|
||||
import com.wabestway.commons.http.ResObj;
|
||||
import com.wabestway.commons.enums.DataValidEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import com.wabestway.ins.utils.UUIDUtil;
|
||||
import com.wabestway.engine.api.dfs.UploadFileDTO;
|
||||
import com.wabestway.engine.api.dfs.UploadRespVO;
|
||||
import com.wabestway.engine.api.feign.DfsStorageFeignClient;
|
||||
import com.wabestway.recall.trace.entity.RecallOrderEntity;
|
||||
import com.wabestway.recall.trace.service.RecallOrderService;
|
||||
import com.wabestway.recall.trace.service.RecallRecordService;
|
||||
import com.wabestway.recall.trace.vo.RecallRecordVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.wabestway.recall.trace.dto.RecallOrderDTO;
|
||||
import com.wabestway.recall.trace.vo.RecallOrderVO;
|
||||
import com.wabestway.recall.trace.service.RecallOrderApiService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.wabestway.recall.trace.util.HeaderDataUtil;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-06 17:37:03
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class RecallOrderApiServiceImpl implements RecallOrderApiService {
|
||||
@Autowired
|
||||
private RecallOrderService recallOrderService;
|
||||
@Autowired
|
||||
private DfsStorageFeignClient storageFeignClient;
|
||||
@Autowired
|
||||
private RecallRecordService recallRecordService;
|
||||
|
||||
@Override
|
||||
public ResObj<Paging<RecallOrderVO>> list(RecallOrderDTO paramReq) {
|
||||
@@ -35,51 +53,138 @@ public class RecallOrderApiServiceImpl implements RecallOrderApiService {
|
||||
return ResObj.ok(paging);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResObj<RecallOrderVO> getRecallOrder(String id) {
|
||||
RecallOrderVO recallOrderVO = recallOrderService.queryRecallOrderById(id);
|
||||
|
||||
@Override
|
||||
public ResObj<RecallOrderVO> getRecallOrderByOrderId(String orderId) {
|
||||
RecallOrderVO recallOrderVO = new RecallOrderVO();
|
||||
RecallOrderEntity recallOrderEntity = recallOrderService.queryRecallOrderByOrderId(orderId);
|
||||
if (recallOrderEntity != null) {
|
||||
BeanUtils.copyProperties(recallOrderEntity, recallOrderVO);
|
||||
|
||||
List<RecallRecordVO> recordList = recallRecordService.queryTraceRecords(recallOrderEntity.getTraceId());
|
||||
log.info(JSON.toJSONString(recordList));
|
||||
List<String> events = recordList.stream()
|
||||
.flatMap(entity -> entity.getEvents().stream())
|
||||
.collect(Collectors.toList());
|
||||
recallOrderVO.setEvents(events);
|
||||
}
|
||||
return ResObj.ok(recallOrderVO);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public ResObj saveRecallOrder(RecallOrderDTO paramReq) {
|
||||
RecallOrderEntity recallOrder = new RecallOrderEntity();
|
||||
BeanUtils.copyProperties(paramReq, recallOrder);
|
||||
public ResObj traceVideo() {
|
||||
LambdaQueryWrapper<RecallOrderEntity> orderQuery = Wrappers.lambdaQuery();
|
||||
orderQuery.eq(RecallOrderEntity::getComplete, "1");
|
||||
orderQuery.isNull(RecallOrderEntity::getFileId);
|
||||
orderQuery.orderByDesc(RecallOrderEntity::getCompleteDate);
|
||||
//orderQuery.last("limit 1");
|
||||
List<RecallOrderEntity> orderList = recallOrderService.getBaseMapper().selectList(orderQuery);
|
||||
orderList.forEach(order -> {
|
||||
|
||||
recallOrder.setId(UUIDUtil.generate());//赋值id
|
||||
recallOrder.setStatus(DataValidEnum.VALID.getCode());
|
||||
recallOrder.setCreateBy(HeaderDataUtil.getUserId());//创建人
|
||||
recallOrder.setCreateTime(System.currentTimeMillis());//创建时间
|
||||
recallOrder.setUpdateBy(HeaderDataUtil.getUserId());//更新人
|
||||
recallOrder.setUpdateTime(System.currentTimeMillis());//更新时间
|
||||
|
||||
recallOrderService.save(recallOrder);
|
||||
List<RecallRecordVO> recordList = recallRecordService.queryTraceRecords(order.getTraceId());
|
||||
List<String> events = recordList.stream()
|
||||
.flatMap(entity -> entity.getEvents().stream())
|
||||
.collect(Collectors.toList());
|
||||
JSONArray array = JSONArray.parseArray(JSON.toJSONString(events));
|
||||
try {
|
||||
createVideo(order, array.toJSONString());
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
});
|
||||
return ResObj.ok();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public ResObj updateRecallOrder(RecallOrderDTO paramReq) {
|
||||
RecallOrderEntity recallOrder = new RecallOrderEntity();
|
||||
BeanUtils.copyProperties(paramReq, recallOrder);
|
||||
recallOrder.setUpdateBy(HeaderDataUtil.getUserId());//更新人
|
||||
recallOrder.setUpdateTime(System.currentTimeMillis());//更新时间
|
||||
recallOrderService.updateById(recallOrder);
|
||||
return ResObj.ok();
|
||||
void createVideo(RecallOrderEntity fo, String jsonData) throws IOException {
|
||||
|
||||
// 创建临时目录
|
||||
Path tempDir = null;
|
||||
try {
|
||||
tempDir = Files.createTempDirectory("ts");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("Created temporary directory: " + tempDir);
|
||||
|
||||
try {
|
||||
File tempFile = new File(tempDir.toFile(), "traces.json");
|
||||
FileWriter fw = new FileWriter(tempFile);
|
||||
BufferedWriter bw = new BufferedWriter(fw);
|
||||
bw.write(jsonData);
|
||||
bw.flush();
|
||||
bw.close();
|
||||
fw.close();
|
||||
/*String[] command = {"ts-node", " /opt/rrvideo/src/cli.ts --input traces.json"};
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(command);
|
||||
processBuilder.directory(tempDir.toFile());
|
||||
// 在临时目录下执行命令
|
||||
Process p1 = processBuilder.start();
|
||||
|
||||
Thread processThread = new Thread(() -> {
|
||||
try {
|
||||
// 读取命令输出
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(p1.getInputStream()));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
System.out.println(line);
|
||||
}
|
||||
reader.close();
|
||||
// 等待命令执行完成
|
||||
int exitCode = p1.waitFor();
|
||||
|
||||
System.out.println("Command exited with code " + exitCode);
|
||||
} catch (InterruptedException | IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
processThread.start();*/
|
||||
try {
|
||||
String[] cmd = {"rrvideo", "--input", "traces.json"};
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(cmd);
|
||||
processBuilder.directory(tempDir.toFile());
|
||||
System.out.printf(processBuilder.command().toString());
|
||||
Process process = processBuilder.start();
|
||||
|
||||
// 捕获输出
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
System.out.println(line);
|
||||
}
|
||||
|
||||
// 等待进程结束
|
||||
int exitCode = process.waitFor();
|
||||
System.out.println("Command exited with code " + exitCode);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
File file = new File(tempDir.toFile(), "video.mp4");
|
||||
if (file.exists()) {
|
||||
log.info(String.valueOf(file.length()));
|
||||
//byte[] fileBytes = Files.readAllBytes(file.toPath());
|
||||
byte[] fileBytes = FileUtil.readBytes(file);
|
||||
String titles = fo.getOrderId() + ".mp4";
|
||||
UploadFileDTO uploadFileDTO = new UploadFileDTO(fileBytes, "RECALL", titles);
|
||||
|
||||
ResObj<UploadRespVO> uploadResObj = storageFeignClient.uploadBytes(uploadFileDTO);
|
||||
log.info(JSON.toJSONString(uploadResObj));
|
||||
if (uploadResObj.isOk()) {
|
||||
fo.setFileId(uploadResObj.getData().getFileId());
|
||||
fo.setFileUrl(uploadResObj.getData().getFileUrl());
|
||||
fo.setUpdateTime(System.currentTimeMillis());
|
||||
recallOrderService.updateRecallOrderById(fo);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
} finally {
|
||||
// 删除临时目录
|
||||
Files.walk(tempDir)
|
||||
.sorted(Comparator.reverseOrder())
|
||||
.map(Path::toFile)
|
||||
.forEach(File::delete);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public ResObj changeStatus(String id, String status) {
|
||||
RecallOrderEntity recallOrder = new RecallOrderEntity();
|
||||
recallOrder.setId(id);
|
||||
recallOrder.setStatus(status);
|
||||
recallOrder.setUpdateBy(HeaderDataUtil.getUserId());
|
||||
recallOrder.setUpdateTime(System.currentTimeMillis());
|
||||
recallOrderService.updateRecallOrderById(recallOrder);
|
||||
|
||||
return ResObj.ok();
|
||||
}
|
||||
}
|
||||
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
package com.wabestway.recall.trace.service.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.wabestway.commons.http.Paging;
|
||||
import com.wabestway.commons.http.ResObj;
|
||||
import com.wabestway.commons.enums.DataValidEnum;
|
||||
import com.wabestway.recall.util.HeaderDataUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import com.wabestway.ins.utils.UUIDUtil;
|
||||
import com.wabestway.recall.trace.entity.RecallProductEntity;
|
||||
import com.wabestway.recall.trace.dto.RecallProductDTO;
|
||||
import com.wabestway.recall.trace.vo.RecallProductVO;
|
||||
import com.wabestway.recall.trace.service.RecallProductApiService;
|
||||
import com.wabestway.recall.trace.service.RecallProductService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
/**
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-15 09:59:12
|
||||
*/
|
||||
@Service
|
||||
public class RecallProductApiServiceImpl implements RecallProductApiService {
|
||||
@Autowired
|
||||
private RecallProductService recallProductService;
|
||||
|
||||
@Override
|
||||
public ResObj<Paging<RecallProductVO>> list(RecallProductDTO paramReq) {
|
||||
IPage<RecallProductVO> resultPage = recallProductService.queryRecallProductByCondition(paramReq.getPage(), paramReq.getPageSize(), paramReq);
|
||||
|
||||
Paging<RecallProductVO> paging = new Paging(resultPage.getRecords(), paramReq.getPage(), resultPage.getSize(), resultPage.getTotal());
|
||||
return ResObj.ok(paging);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResObj<RecallProductVO> getRecallProduct(String id) {
|
||||
RecallProductVO recallProductVO = recallProductService.queryRecallProductById(id);
|
||||
|
||||
return ResObj.ok(recallProductVO);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public ResObj saveRecallProduct(RecallProductDTO paramReq) {
|
||||
RecallProductEntity recallProduct = new RecallProductEntity();
|
||||
BeanUtils.copyProperties(paramReq, recallProduct);
|
||||
|
||||
recallProduct.setId(UUIDUtil.generate());//赋值id
|
||||
recallProduct.setCreateBy(HeaderDataUtil.getUserId());//创建人
|
||||
recallProduct.setCreateTime(System.currentTimeMillis());//创建时间
|
||||
recallProduct.setUpdateBy(HeaderDataUtil.getUserId());//更新人
|
||||
recallProduct.setUpdateTime(System.currentTimeMillis());//更新时间
|
||||
|
||||
recallProductService.save(recallProduct);
|
||||
return ResObj.ok();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public ResObj updateRecallProduct(RecallProductDTO paramReq) {
|
||||
RecallProductEntity recallProduct = new RecallProductEntity();
|
||||
BeanUtils.copyProperties(paramReq, recallProduct);
|
||||
recallProduct.setUpdateBy(HeaderDataUtil.getUserId());//更新人
|
||||
recallProduct.setUpdateTime(System.currentTimeMillis());//更新时间
|
||||
recallProductService.updateById(recallProduct);
|
||||
return ResObj.ok();
|
||||
}
|
||||
|
||||
}
|
||||
+65
-60
@@ -1,85 +1,90 @@
|
||||
package com.wabestway.recall.trace.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.wabestway.commons.http.Paging;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.wabestway.commons.http.ResObj;
|
||||
import com.wabestway.commons.enums.DataValidEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import com.wabestway.ins.utils.UUIDUtil;
|
||||
import com.wabestway.recall.trace.dto.TraceDTO;
|
||||
import com.wabestway.recall.trace.entity.RecallOrderEntity;
|
||||
import com.wabestway.recall.trace.entity.RecallRecordEntity;
|
||||
import com.wabestway.recall.trace.dto.RecallRecordDTO;
|
||||
import com.wabestway.recall.trace.vo.RecallRecordVO;
|
||||
import com.wabestway.recall.trace.service.RecallApiService;
|
||||
import com.wabestway.recall.trace.service.RecallOrderService;
|
||||
import com.wabestway.recall.trace.service.RecallRecordService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.wabestway.recall.trace.service.RecallRecordApiService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.wabestway.recall.trace.util.HeaderDataUtil;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author wangH
|
||||
* @company 北京华焱坤泰科技有限公司
|
||||
* @Time 2023-05-06 17:37:03
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class RecallRecordApiServiceImpl implements RecallRecordApiService {
|
||||
@Autowired
|
||||
private RecallRecordService recallRecordService;
|
||||
@Autowired
|
||||
private RecallOrderService recallOrderService;
|
||||
@Autowired
|
||||
private RecallApiService recallApiService;
|
||||
|
||||
@Override
|
||||
public ResObj<Paging<RecallRecordVO>> list(RecallRecordDTO paramReq) {
|
||||
IPage<RecallRecordVO> resultPage = recallRecordService.queryRecallRecordByCondition(paramReq.getPage(), paramReq.getPageSize(), paramReq);
|
||||
public ResObj save(TraceDTO record) {
|
||||
Objects.requireNonNull(record);
|
||||
|
||||
Paging<RecallRecordVO> paging = new Paging(resultPage.getRecords(), paramReq.getPage(), resultPage.getSize(), resultPage.getTotal());
|
||||
return ResObj.ok(paging);
|
||||
}
|
||||
String traceId = StringUtils.isBlank(record.getTraceId()) ? UUID.randomUUID().toString().replace("-", "") : record.getTraceId();
|
||||
|
||||
@Override
|
||||
public ResObj<RecallRecordVO> getRecallRecord(String id) {
|
||||
RecallRecordVO recallRecordVO = recallRecordService.queryRecallRecordById(id);
|
||||
|
||||
return ResObj.ok(recallRecordVO);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public ResObj saveRecallRecord(RecallRecordDTO paramReq) {
|
||||
boolean isLastEvent = record.isLast();
|
||||
RecallOrderEntity order = Optional.ofNullable(Optional.ofNullable(record.getOrderId())
|
||||
.map(recallOrderService::queryRecallOrderByOrderId)
|
||||
.orElse(null))
|
||||
.orElseGet(() -> Optional.ofNullable(recallOrderService.queryRecallOrderByTraceId(traceId)).orElseGet(() -> {
|
||||
RecallOrderEntity newOrder = new RecallOrderEntity();
|
||||
newOrder.setId(UUID.randomUUID().toString().replace("-", ""));
|
||||
Optional.ofNullable(record.getOrderId())
|
||||
.ifPresent(newOrder::setOrderId);
|
||||
newOrder.setTraceId(traceId);
|
||||
newOrder.setProductCode(record.getProductCode());
|
||||
newOrder.setProductName(record.getProductName());
|
||||
newOrder.setCreateTime(System.currentTimeMillis());
|
||||
newOrder.setUpdateTime(System.currentTimeMillis());
|
||||
newOrder.setAppKey(record.getAppKey());
|
||||
newOrder.setArchived("0");
|
||||
newOrder.setComplete(isLastEvent ? "1" : "0");
|
||||
String tenantId = recallApiService.queryApiTenant(record.getAppKey());
|
||||
Optional.ofNullable(tenantId)
|
||||
.ifPresent(newOrder::setTenantId);
|
||||
if (isLastEvent) {
|
||||
newOrder.setCompleteDate(System.currentTimeMillis());
|
||||
}
|
||||
recallOrderService.save(newOrder);
|
||||
return newOrder;
|
||||
}));
|
||||
if (isLastEvent && !"1".equals(order.getComplete())) {
|
||||
order.setComplete("1");
|
||||
Optional.ofNullable(record.getOrderId())
|
||||
.ifPresent(order::setOrderId);
|
||||
order.setCompleteDate(System.currentTimeMillis());
|
||||
order.setUpdateTime(System.currentTimeMillis());
|
||||
recallOrderService.updateRecallOrderById(order);
|
||||
}
|
||||
record.setTraceId(traceId);
|
||||
RecallRecordEntity recallRecord = new RecallRecordEntity();
|
||||
BeanUtils.copyProperties(paramReq, recallRecord);
|
||||
|
||||
recallRecord.setId(UUIDUtil.generate());//赋值id
|
||||
recallRecord.setStatus(DataValidEnum.VALID.getCode());
|
||||
recallRecord.setCreateBy(HeaderDataUtil.getUserId());//创建人
|
||||
recallRecord.setCreateTime(System.currentTimeMillis());//创建时间
|
||||
recallRecord.setUpdateBy(HeaderDataUtil.getUserId());//更新人
|
||||
recallRecord.setUpdateTime(System.currentTimeMillis());//更新时间
|
||||
|
||||
BeanUtils.copyProperties(record, recallRecord);
|
||||
recallRecord.setId(UUID.randomUUID().toString().replace("-", ""));
|
||||
recallRecord.setCreateTime(System.currentTimeMillis());
|
||||
recallRecordService.save(recallRecord);
|
||||
return ResObj.ok();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public ResObj updateRecallRecord(RecallRecordDTO paramReq) {
|
||||
RecallRecordEntity recallRecord = new RecallRecordEntity();
|
||||
BeanUtils.copyProperties(paramReq, recallRecord);
|
||||
recallRecord.setUpdateBy(HeaderDataUtil.getUserId());//更新人
|
||||
recallRecord.setUpdateTime(System.currentTimeMillis());//更新时间
|
||||
recallRecordService.updateById(recallRecord);
|
||||
return ResObj.ok();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public ResObj changeStatus(String id, String status) {
|
||||
RecallRecordEntity recallRecord = new RecallRecordEntity();
|
||||
recallRecord.setId(id);
|
||||
recallRecord.setStatus(status);
|
||||
recallRecord.setUpdateBy(HeaderDataUtil.getUserId());
|
||||
recallRecord.setUpdateTime(System.currentTimeMillis());
|
||||
recallRecordService.updateRecallRecordById(recallRecord);
|
||||
|
||||
return ResObj.ok();
|
||||
record.setEvents(null);
|
||||
log.info("保存数据:{}", JSON.toJSONString(record));
|
||||
return ResObj.ok(record);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.wabestway.recall.util;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.wabestway.auth.api.user.ReqOrgInfo;
|
||||
import com.wabestway.auth.api.user.ReqTenantInfo;
|
||||
import com.wabestway.auth.api.user.ReqUser;
|
||||
import com.wabestway.auth.api.user.TokenObj;
|
||||
import com.wabestway.commons.exception.AlertException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.net.URLDecoder;
|
||||
|
||||
public class HeaderDataUtil {
|
||||
private static Logger logger = LoggerFactory.getLogger(HeaderDataUtil.class);
|
||||
|
||||
public HeaderDataUtil() {
|
||||
}
|
||||
|
||||
public static ReqUser getUserData() {
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
|
||||
.getRequest();
|
||||
ReqUser reqUser = null;
|
||||
try {
|
||||
String header = request.getHeader(TokenObj._USER);
|
||||
if (header != null) {
|
||||
String str = URLDecoder.decode(header, "UTF-8");
|
||||
logger.info("用户信息:{}", str);
|
||||
reqUser = new Gson().fromJson(str, ReqUser.class);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("用户信息转化异常", e);
|
||||
throw new AlertException("未获取到header用户信息!");
|
||||
}
|
||||
|
||||
return reqUser;
|
||||
}
|
||||
|
||||
public static ReqOrgInfo getOrgInfoData() {
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
|
||||
.getRequest();
|
||||
ReqOrgInfo orgInfo = null;
|
||||
try {
|
||||
String header = request.getHeader(TokenObj._ORG);
|
||||
if (header != null) {
|
||||
String str = URLDecoder.decode(header, "UTF-8");
|
||||
logger.info("机构信息:{}", str);
|
||||
orgInfo = new Gson().fromJson(str, ReqOrgInfo.class);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("机构信息转化异常", e);
|
||||
throw new AlertException("未获取到header机构信息!");
|
||||
}
|
||||
|
||||
return orgInfo;
|
||||
}
|
||||
|
||||
public static ReqTenantInfo getTenantData() {
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
|
||||
.getRequest();
|
||||
ReqTenantInfo tenant = null;
|
||||
try {
|
||||
String header = request.getHeader(TokenObj._TENANT);
|
||||
if (header != null) {
|
||||
String str = URLDecoder.decode(header, "UTF-8");
|
||||
logger.info("机构信息:{}", str);
|
||||
tenant = new Gson().fromJson(str, ReqTenantInfo.class);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("租户信息转化异常", e);
|
||||
}
|
||||
|
||||
return tenant;
|
||||
}
|
||||
|
||||
public static String getUserId() {
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
|
||||
.getRequest();
|
||||
String userId = null;
|
||||
try {
|
||||
String header = request.getHeader(TokenObj._USERID);
|
||||
if (header != null) {
|
||||
userId = URLDecoder.decode(header, "UTF-8");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("用户ID信息转化异常", e);
|
||||
}
|
||||
|
||||
return userId;
|
||||
}
|
||||
|
||||
public static String getTenantId() {
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
|
||||
.getRequest();
|
||||
String tenantId = null;
|
||||
|
||||
try {
|
||||
String header = request.getHeader(TokenObj._TENANTID);
|
||||
if (header != null) {
|
||||
tenantId = URLDecoder.decode(header, "UTF-8");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("租户id信息转化异常", e);
|
||||
}
|
||||
|
||||
return tenantId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.wabestway.recall.util;
|
||||
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ShortAppKeyGenerator {
|
||||
private static final char[] BASE62_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".toCharArray();
|
||||
|
||||
public static String generate() {
|
||||
String input = System.currentTimeMillis() + "";
|
||||
MessageDigest md = null;
|
||||
try {
|
||||
md = MessageDigest.getInstance("MD5");
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
byte[] bytes = md.digest(input.getBytes());
|
||||
return toBase62(bytes);
|
||||
}
|
||||
|
||||
private static String toBase62(byte[] bytes) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
long num = toLong(bytes);
|
||||
while (num > 0) {
|
||||
int remainder = (int) (num % 62);
|
||||
sb.append(BASE62_CHARS[remainder]);
|
||||
num /= 62;
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static long toLong(byte[] bytes) {
|
||||
long result = 0;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
result <<= 8;
|
||||
result |= ((long) (bytes[i] & 0xFF));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String appKey = generate();
|
||||
System.out.println(appKey); // 输出:pT8bnL3ZTYqdBlUo
|
||||
}
|
||||
}
|
||||
@@ -1,196 +0,0 @@
|
||||
package com.wabestway.recall.web;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.wabestway.commons.http.ResObj;
|
||||
import com.wabestway.engine.api.dfs.UploadFileDTO;
|
||||
import com.wabestway.engine.api.dfs.UploadRespVO;
|
||||
import com.wabestway.engine.api.feign.DfsStorageFeignClient;
|
||||
import com.wabestway.recall.model.Order;
|
||||
import com.wabestway.recall.model.OrderList;
|
||||
import com.wabestway.recall.model.Record;
|
||||
import com.wabestway.recall.repository.OrderRepository;
|
||||
import com.wabestway.recall.repository.RecordRepository;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.domain.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/order")
|
||||
public class OrderController {
|
||||
private final RecordRepository recordRepository;
|
||||
private final OrderRepository orderRepository;
|
||||
|
||||
private final DfsStorageFeignClient storageFeignClient;
|
||||
|
||||
public OrderController(RecordRepository recordRepository, OrderRepository orderRepository, DfsStorageFeignClient storageFeignClient) {
|
||||
this.recordRepository = recordRepository;
|
||||
this.orderRepository = orderRepository;
|
||||
this.storageFeignClient = storageFeignClient;
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public Flux<Order> getAllOrders() {
|
||||
return orderRepository.findAll();
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
public Mono<ResObj> list(@RequestBody Order order) {
|
||||
OrderList resList = new OrderList();
|
||||
List<Order> list = new ArrayList<>();
|
||||
Sort s = Sort.by("createAt").descending();
|
||||
PageRequest pageRequest = PageRequest.of(order.getPage() - 1, order.getPageSize(), s);
|
||||
ExampleMatcher matcher = ExampleMatcher.matching()
|
||||
.withIgnoreNullValues().withIgnorePaths("createAt", "last", "page", "pageSize");
|
||||
Example<Order> ep = Example.of(order, matcher);
|
||||
Flux<Order> flux = orderRepository.findAll(ep, s);
|
||||
flux.skip(pageRequest.getOffset()).limitRequest(pageRequest.getPageSize()).subscribe(list::add);
|
||||
resList.setList(list);
|
||||
return flux.count().flatMap(count -> {
|
||||
resList.setTotal(count);
|
||||
return Mono.just(ResObj.ok(resList));
|
||||
});
|
||||
}
|
||||
|
||||
@PostMapping("/recallUp")
|
||||
public Mono<ResObj> recallUp(@RequestBody Order order) {
|
||||
Mono<Order> queryOrder = orderRepository.findByOrderId(order.getOrderId());
|
||||
return queryOrder.flatMap(ss -> {
|
||||
ss.setStartDate(order.getStartDate());
|
||||
ss.setEndDate(order.getEndDate());
|
||||
ss.setHolderName(order.getHolderName());
|
||||
ss.setHolderPhone(order.getHolderPhone());
|
||||
ss.setSupplierName(order.getSupplierName());
|
||||
orderRepository.save(ss).subscribe();
|
||||
return Mono.just(ResObj.ok());
|
||||
}).defaultIfEmpty(ResObj.fail("订单不存在"));
|
||||
}
|
||||
|
||||
@PostMapping("/info/{orderId}")
|
||||
public Mono<ResObj> findByOrderId(@PathVariable String orderId) {
|
||||
Mono<Order> forder = orderRepository.findByOrderId(orderId);
|
||||
return forder.flatMap(fo -> {
|
||||
Flux<Record> rs = recordRepository.findAllByTraceIdOrderByCreateAtAsc(fo.getTraceId());
|
||||
Mono<List<List<String>>> es = rs.map(rr -> rr.getEvents()).collectList();
|
||||
Mono<List<String>> events = es.flatMapIterable(lists -> lists).flatMapIterable(list -> list).collectList();
|
||||
return events.flatMap(e -> {
|
||||
fo.setEvents(e);
|
||||
return Mono.just(ResObj.ok(fo));
|
||||
});
|
||||
}).defaultIfEmpty(ResObj.fail("订单不存在"));
|
||||
}
|
||||
|
||||
@GetMapping("/ffmpeg")
|
||||
public Mono<ResObj> createMp4() {
|
||||
Order order = new Order();
|
||||
order.setComplete("1");
|
||||
ExampleMatcher matcher = ExampleMatcher.matching()
|
||||
.withIgnoreNullValues().withIgnorePaths("createAt", "last", "page", "pageSize");
|
||||
Example<Order> ep = Example.of(order, matcher);
|
||||
Sort s = Sort.by("createAt");
|
||||
Flux<Order> flux = orderRepository.findAll(ep, s);
|
||||
flux.filter(fo -> fo.getFileId() == null).subscribe(fo -> {
|
||||
Mono<List<List<String>>> es = recordRepository.findAllByTraceIdOrderByCreateAtAsc(fo.getTraceId()).map(rr -> rr.getEvents()).collectList();
|
||||
Mono<List<String>> events = es.flatMapIterable(lists -> lists).flatMapIterable(list -> list).collectList();
|
||||
events.subscribe(e -> {
|
||||
JSONArray array = JSONArray.parseArray(JSON.toJSONString(e));
|
||||
try {
|
||||
createVideo(fo, array.toJSONString());
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
});
|
||||
});
|
||||
return Mono.just(ResObj.ok());
|
||||
}
|
||||
|
||||
void createVideo(Order fo, String jsonData) throws IOException {
|
||||
|
||||
// 创建临时目录
|
||||
Path tempDir = null;
|
||||
try {
|
||||
tempDir = Files.createTempDirectory("ts");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("Created temporary directory: " + tempDir);
|
||||
|
||||
try {
|
||||
File tempFile = new File(tempDir.toFile(), "traces.json");
|
||||
FileWriter fw = new FileWriter(tempFile);
|
||||
BufferedWriter bw = new BufferedWriter(fw);
|
||||
bw.write(jsonData);
|
||||
bw.flush();
|
||||
bw.close();
|
||||
fw.close();
|
||||
String[] command = {"ts-node", "/opt/trace-transform/src/index.ts"};
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(command);
|
||||
processBuilder.directory(tempDir.toFile());
|
||||
// 在临时目录下执行命令
|
||||
Process process = processBuilder.start();
|
||||
|
||||
Thread processThread = new Thread(() -> {
|
||||
try {
|
||||
// 读取命令输出
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
System.out.println(line);
|
||||
}
|
||||
reader.close();
|
||||
// 等待命令执行完成
|
||||
int exitCode = process.waitFor();
|
||||
|
||||
System.out.println("Command exited with code " + exitCode);
|
||||
} catch (InterruptedException | IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
processThread.start();
|
||||
|
||||
// Continue with other tasks here...
|
||||
|
||||
try {
|
||||
processThread.join();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
File file = new File(tempDir.toFile(), "video.mp4");
|
||||
if (file.exists()) {
|
||||
log.info(String.valueOf(file.length()));
|
||||
//byte[] fileBytes = Files.readAllBytes(file.toPath());
|
||||
byte[] fileBytes = FileUtil.readBytes(file);
|
||||
String titles = fo.getOrderId() + ".mp4";
|
||||
UploadFileDTO uploadFileDTO = new UploadFileDTO(fileBytes, "RECALL", titles);
|
||||
|
||||
ResObj<UploadRespVO> uploadResObj = storageFeignClient.uploadBytes(uploadFileDTO);
|
||||
log.info(JSON.toJSONString(uploadResObj));
|
||||
if (uploadResObj.isOk()) {
|
||||
fo.setFileId(uploadResObj.getData().getFileId());
|
||||
fo.setFileUrl(uploadResObj.getData().getFileUrl());
|
||||
orderRepository.save(fo).subscribe();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
} finally {
|
||||
// 删除临时目录
|
||||
// Files.walk(tempDir)
|
||||
// .sorted(Comparator.reverseOrder())
|
||||
// .map(Path::toFile)
|
||||
// .forEach(File::delete);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
package com.wabestway.recall.web;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.wabestway.recall.model.Order;
|
||||
import com.wabestway.recall.model.Record;
|
||||
import com.wabestway.recall.model.ResObj;
|
||||
import com.wabestway.recall.repository.OrderRepository;
|
||||
import com.wabestway.recall.repository.RecordRepository;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/track")
|
||||
public class RecallController {
|
||||
private final RecordRepository recordRepository;
|
||||
private final OrderRepository orderRepository;
|
||||
|
||||
public RecallController(RecordRepository recordRepository, OrderRepository orderRepository) {
|
||||
this.recordRepository = recordRepository;
|
||||
this.orderRepository = orderRepository;
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public Flux<Record> getAllUsers() {
|
||||
return recordRepository.findAll();
|
||||
}
|
||||
|
||||
@PostMapping("/save")
|
||||
public Mono<ResObj> save(@RequestBody Record record) {
|
||||
if (record.getOrderId() != null && !record.getOrderId().isEmpty()) {
|
||||
Mono<Order> order = orderRepository.findByOrderId(record.getOrderId());
|
||||
order.hasElement().subscribe(exit -> {
|
||||
if (!exit) {
|
||||
if (record.getTraceId() != null && !record.getTraceId().isEmpty()) {
|
||||
Mono<Order> tcOrder = orderRepository.findByTraceId(record.getTraceId());
|
||||
tcOrder.filter(to -> to.getId() != null).flatMap(to -> {
|
||||
to.setOrderId(record.getOrderId());
|
||||
if (record.isLast()) {
|
||||
to.setComplete("1");
|
||||
}
|
||||
return orderRepository.save(to);
|
||||
}).subscribe();
|
||||
} else {
|
||||
record.setTraceId(UUID.randomUUID().toString().replace("-", ""));
|
||||
Order forder = new Order();
|
||||
forder.setOrderId(record.getOrderId());
|
||||
forder.setTraceId(record.getTraceId());
|
||||
forder.setProductCode(record.getProductCode());
|
||||
forder.setProductName(record.getProductName());
|
||||
forder.setCreateAt(System.currentTimeMillis());
|
||||
forder.setAppKey(record.getAppKey());
|
||||
forder.setArchived("0");
|
||||
forder.setComplete("0");
|
||||
// forder.setHolderName("王五");
|
||||
// forder.setHolderPhone("18515064530");
|
||||
// forder.setSupplierName("阳光保险");
|
||||
// forder.setStartDate("2023-01-01");
|
||||
// forder.setEndDate("2035-01-01");
|
||||
if (record.isLast()) {
|
||||
forder.setComplete("1");
|
||||
}
|
||||
orderRepository.save(forder).subscribe();
|
||||
}
|
||||
} else {
|
||||
order.subscribe(to -> {
|
||||
if (record.isLast()) {
|
||||
to.setComplete("1");
|
||||
orderRepository.save(to).subscribe();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (record.getTraceId() == null || record.getTraceId().isEmpty()) {
|
||||
record.setTraceId(UUID.randomUUID().toString().replace("-", ""));
|
||||
Order order = new Order();
|
||||
order.setTraceId(record.getTraceId());
|
||||
order.setProductCode(record.getProductCode());
|
||||
order.setProductName(record.getProductName());
|
||||
order.setCreateAt(System.currentTimeMillis());
|
||||
order.setAppKey(record.getAppKey());
|
||||
order.setArchived("0");
|
||||
order.setComplete("0");
|
||||
// order.setHolderName("王五");
|
||||
// order.setHolderPhone("18515064530");
|
||||
// order.setSupplierName("阳光保险");
|
||||
// order.setStartDate("2023-01-01");
|
||||
// order.setEndDate("2035-01-01");
|
||||
if (record.isLast()) {
|
||||
order.setComplete("1");
|
||||
}
|
||||
orderRepository.save(order).subscribe();
|
||||
}
|
||||
}
|
||||
record.setCreateAt(System.currentTimeMillis());
|
||||
log.info("保存数据:{}", JSON.toJSONString(record));
|
||||
return recordRepository.save(record).flatMap(ss -> {
|
||||
ss.setEvents(null);
|
||||
return Mono.just(ResObj.ok(ss));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
# nacos
|
||||
@@ -0,0 +1,2 @@
|
||||
server:
|
||||
port: 9235
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
#spring:
|
||||
# jackson:
|
||||
# date-format: yyyy-MM-dd HH:mm:ss
|
||||
# time-zone: GMT+8
|
||||
|
||||
mybatis-plus:
|
||||
#MyBaits 别名包扫描路径,通过该属性可以给包中的类注册别名
|
||||
configuration:
|
||||
# 打印控制台
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
spring:
|
||||
freemarker:
|
||||
settings:
|
||||
classic_compatible: true
|
||||
@@ -0,0 +1,17 @@
|
||||
spring:
|
||||
profiles: dev
|
||||
application:
|
||||
name: afis-recall
|
||||
cloud:
|
||||
nacos:
|
||||
config:
|
||||
file-extension: yaml
|
||||
server-addr: 192.168.0.141:8848
|
||||
namespace: ns-car-dev
|
||||
discovery:
|
||||
#Nacos服务注册中心地址
|
||||
server-addr: 192.168.0.141:8848
|
||||
namespace: ns-car-dev
|
||||
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
@@ -0,0 +1,51 @@
|
||||
spring:
|
||||
profiles: native
|
||||
application:
|
||||
name: afis-recall
|
||||
cloud:
|
||||
nacos:
|
||||
config:
|
||||
file-extension: yaml
|
||||
server-addr: 49.7.225.107:8848
|
||||
namespace: native-test
|
||||
discovery:
|
||||
#Nacos服务注册中心地址
|
||||
server-addr: 49.7.225.107:8848
|
||||
namespace: native-test
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
url: jdbc:mysql://203.189.0.250:13049/afis-agency?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
username: yxb-dev
|
||||
password: yxbDev!902
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
platform: mysql
|
||||
druid:
|
||||
initial-size: 2
|
||||
max-active: 100
|
||||
time-between-eviction-runs-millis: 60000
|
||||
min-evictable-idle-time-millis: 300000
|
||||
validation-query: SELECT 1 FROM DUAL
|
||||
test-while-idle: true
|
||||
test-on-borrow: false
|
||||
test-on-return: false
|
||||
pool-prepared-statements: true
|
||||
max-pool-prepared-statement-per-connection-size: 5
|
||||
filter:
|
||||
stat:
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 2000
|
||||
enabled: true
|
||||
config:
|
||||
enabled: true
|
||||
wall:
|
||||
enabled: true
|
||||
encoding:
|
||||
enabled: true
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
url-pattern: /druid/*
|
||||
login-username: admin
|
||||
login-password: admin
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
spring:
|
||||
profiles: prod
|
||||
application:
|
||||
name: afis-recall
|
||||
cloud:
|
||||
nacos:
|
||||
config:
|
||||
file-extension: yaml
|
||||
server-addr: 192.168.208.47:18848,192.168.208.48:18848
|
||||
namespace: yxb-prod
|
||||
discovery:
|
||||
#Nacos服务注册中心地址
|
||||
server-addr: 192.168.208.47:18848,192.168.208.48:18848
|
||||
namespace: yxb-prod
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
@@ -0,0 +1,16 @@
|
||||
spring:
|
||||
profiles: uat
|
||||
application:
|
||||
name: afis-recall
|
||||
cloud:
|
||||
nacos:
|
||||
config:
|
||||
file-extension: yaml
|
||||
server-addr: 192.168.1.128:9010
|
||||
namespace: ns-car-uat
|
||||
discovery:
|
||||
#Nacos服务注册中心地址
|
||||
server-addr: 192.168.1.128:9010
|
||||
namespace: ns-car-uat
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
@@ -0,0 +1,3 @@
|
||||
spring:
|
||||
profiles:
|
||||
active: native
|
||||
@@ -0,0 +1,135 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration debug="false">
|
||||
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
|
||||
<springProperty scope="context" name="LOG_HOME" source="application.log.home" defaultValue="/home/log"/>
|
||||
<springProperty scope="context" name="SERVICE_NAME" source="spring.application.name"/>
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{trace_id}] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/${SERVICE_NAME}/${SERVICE_NAME}.log.%d{yyyy-MM-dd}.log</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<MaxHistory>181</MaxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} ${PID} %X{trace_id} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
</encoder>
|
||||
<!--日志文件最大的大小-->
|
||||
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
|
||||
<MaxFileSize>10MB</MaxFileSize>
|
||||
</triggeringPolicy>
|
||||
</appender>
|
||||
|
||||
<!-- 2.2 level为 INFO 日志,时间滚动输出 -->
|
||||
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<!-- 正在记录的日志文档的路径及文档名 -->
|
||||
<file>${LOG_HOME}/${SERVICE_NAME}/${SERVICE_NAME}.log</file>
|
||||
<!--日志文档输出格式-->
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} ${PID} %X{trace_id} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 每天日志归档路径以及格式 -->
|
||||
<fileNamePattern>${LOG_HOME}/${SERVICE_NAME}/${SERVICE_NAME}-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
<!--日志文档保留天数-->
|
||||
<maxHistory>181</maxHistory>
|
||||
</rollingPolicy>
|
||||
<!-- 此日志文档只记录info级别的 -->
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>info</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 2.3 level为 WARN 日志,时间滚动输出 -->
|
||||
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<!-- 正在记录的日志文档的路径及文档名 -->
|
||||
<file>${LOG_HOME}/${SERVICE_NAME}/${SERVICE_NAME}-warn.log</file>
|
||||
<!--日志文档输出格式-->
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} ${PID} %X{trace_id} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
|
||||
</encoder>
|
||||
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_HOME}/${SERVICE_NAME}/${SERVICE_NAME}-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
<!--日志文档保留天数-->
|
||||
<maxHistory>181</maxHistory>
|
||||
</rollingPolicy>
|
||||
<!-- 此日志文档只记录warn级别的 -->
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>warn</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 2.4 level为 ERROR 日志,时间滚动输出 -->
|
||||
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<!-- 正在记录的日志文档的路径及文档名 -->
|
||||
<file>${LOG_HOME}/${SERVICE_NAME}/${SERVICE_NAME}-error.log</file>
|
||||
<!--日志文档输出格式-->
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} ${PID} %X{trace_id} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
|
||||
</encoder>
|
||||
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_HOME}/${SERVICE_NAME}/${SERVICE_NAME}-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
<!--日志文档保留天数-->
|
||||
<maxHistory>181</maxHistory>
|
||||
</rollingPolicy>
|
||||
<!-- 此日志文档只记录ERROR级别的 -->
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>ERROR</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
|
||||
<property name="email_subject" value="【Error】: %logger - %msg"/>
|
||||
|
||||
<logger name="com.wabestway" additivity="false">
|
||||
<level value="debug"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
<appender-ref ref="STDOUT"/>
|
||||
</logger>
|
||||
|
||||
<logger name="com.alibaba" additivity="false">
|
||||
<level value="ERROR"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
<appender-ref ref="STDOUT"/>
|
||||
</logger>
|
||||
|
||||
<!-- 在程序的开发测试阶段,可以调整level的级别,常用级别优先级为: -->
|
||||
<!-- TRACE < DEBUG < INFO < WARN < ERROR -->
|
||||
<!-- 日志输出级别 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="INFO_FILE"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
<appender-ref ref="WARN_FILE"/>
|
||||
<appender-ref ref="ERROR_FILE"/>
|
||||
</root>
|
||||
</configuration>
|
||||
@@ -12,8 +12,6 @@
|
||||
<module>afis-recall-web</module>
|
||||
<module>afis-recall-service</module>
|
||||
</modules>
|
||||
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
@@ -27,7 +25,6 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
|
||||
Reference in New Issue
Block a user