集成ES 20250116
This commit is contained in:
parent
944f841aaa
commit
16841d6a8c
164
pom.xml
164
pom.xml
|
|
@ -1,6 +1,6 @@
|
|||
<?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">
|
||||
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.sqx</groupId>
|
||||
<artifactId>duanju</artifactId>
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
<mssql.version>4.0</mssql.version>
|
||||
<oracle.version>11.2.0.3</oracle.version>
|
||||
<druid.version>1.1.13</druid.version>
|
||||
<!-- <quartz.version>2.3.0</quartz.version>-->
|
||||
<!-- <quartz.version>2.3.0</quartz.version>-->
|
||||
<commons.lang.version>2.6</commons.lang.version>
|
||||
<commons.fileupload.version>1.2.2</commons.fileupload.version>
|
||||
<commons.io.version>2.5</commons.io.version>
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
<qiniu.version>7.2.23</qiniu.version>
|
||||
<aliyun.oss.version>3.4.0</aliyun.oss.version>
|
||||
<qcloud.cos.version>4.4</qcloud.cos.version>
|
||||
<!-- <swagger.version>2.7.0</swagger.version>-->
|
||||
<!-- <swagger.version>2.7.0</swagger.version>-->
|
||||
<swagger.version>2.9.2</swagger.version>
|
||||
<joda.time.version>2.9.9</joda.time.version>
|
||||
<gson.version>2.8.5</gson.version>
|
||||
|
|
@ -90,17 +90,17 @@
|
|||
<artifactId>guava</artifactId>
|
||||
<version>19.0</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.amazonaws</groupId>-->
|
||||
<!-- <artifactId>aws-java-sdk</artifactId>-->
|
||||
<!-- <version>1.11.274</version>-->
|
||||
<!-- <exclusions>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <artifactId>aws-java-sdk-simpleworkflow</artifactId>-->
|
||||
<!-- <groupId>com.amazonaws</groupId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- </exclusions>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.amazonaws</groupId>-->
|
||||
<!-- <artifactId>aws-java-sdk</artifactId>-->
|
||||
<!-- <version>1.11.274</version>-->
|
||||
<!-- <exclusions>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <artifactId>aws-java-sdk-simpleworkflow</artifactId>-->
|
||||
<!-- <groupId>com.amazonaws</groupId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- </exclusions>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>cn.afterturn</groupId>
|
||||
<artifactId>easypoi-spring-boot-starter</artifactId>
|
||||
|
|
@ -155,11 +155,11 @@
|
|||
<version>5.5.0</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.alibaba/druid -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.alibaba</groupId>-->
|
||||
<!-- <artifactId>druid</artifactId>-->
|
||||
<!-- <version>1.1.10</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.alibaba</groupId>-->
|
||||
<!-- <artifactId>druid</artifactId>-->
|
||||
<!-- <version>1.1.10</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- 苹果工具类 -->
|
||||
<dependency>
|
||||
<groupId>com.auth0</groupId>
|
||||
|
|
@ -245,6 +245,16 @@
|
|||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.elasticsearch.client</groupId>
|
||||
<artifactId>elasticsearch-rest-high-level-client</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.elasticsearch</groupId>
|
||||
<artifactId>elasticsearch</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
@ -264,9 +274,9 @@
|
|||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>org.springframework.boot</groupId>-->
|
||||
<!--<artifactId>spring-boot-devtools</artifactId>-->
|
||||
<!--<optional>true</optional>-->
|
||||
<!--<groupId>org.springframework.boot</groupId>-->
|
||||
<!--<artifactId>spring-boot-devtools</artifactId>-->
|
||||
<!--<optional>true</optional>-->
|
||||
<!--</dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
|
|
@ -280,23 +290,23 @@
|
|||
</exclusions>
|
||||
</dependency>
|
||||
<!--动态数据库切换-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.baomidou</groupId>-->
|
||||
<!-- <artifactId>dynamic-datasource-spring-boot-starter</artifactId>-->
|
||||
<!-- <version>4.1.3</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.baomidou</groupId>-->
|
||||
<!-- <artifactId>dynamic-datasource-spring-boot-starter</artifactId>-->
|
||||
<!-- <version>4.1.3</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>${mysql.version}</version>
|
||||
</dependency>
|
||||
<!--oracle驱动-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.oracle</groupId>-->
|
||||
<!-- <artifactId>ojdbc6</artifactId>-->
|
||||
<!-- <version>${oracle.version}</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!--oracle驱动-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.oracle</groupId>-->
|
||||
<!-- <artifactId>ojdbc6</artifactId>-->
|
||||
<!-- <version>${oracle.version}</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- 用于定义sharding-jdbc 分片规则 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.shardingsphere</groupId>
|
||||
|
|
@ -314,33 +324,33 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<!--mssql驱动-->
|
||||
<!--mssql驱动-->
|
||||
<dependency>
|
||||
<groupId>com.microsoft.sqlserver</groupId>
|
||||
<artifactId>sqljdbc4</artifactId>
|
||||
<version>${mssql.version}</version>
|
||||
</dependency>
|
||||
<!--postgresql驱动-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.postgresql</groupId>-->
|
||||
<!-- <artifactId>postgresql</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<!--postgresql驱动-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.postgresql</groupId>-->
|
||||
<!-- <artifactId>postgresql</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.quartz-scheduler</groupId>-->
|
||||
<!-- <artifactId>quartz</artifactId>-->
|
||||
<!-- <version>${quartz.version}</version>-->
|
||||
<!-- <exclusions>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <groupId>com.mchange</groupId>-->
|
||||
<!-- <artifactId>c3p0</artifactId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- </exclusions>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.quartz-scheduler</groupId>-->
|
||||
<!-- <artifactId>quartz</artifactId>-->
|
||||
<!-- <version>${quartz.version}</version>-->
|
||||
<!-- <exclusions>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <groupId>com.mchange</groupId>-->
|
||||
<!-- <artifactId>c3p0</artifactId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- </exclusions>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
|
|
@ -462,11 +472,11 @@
|
|||
<artifactId>xstream</artifactId>
|
||||
<version>1.4.18</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<artifactId>weixin-java-pay</artifactId>
|
||||
<version>3.6.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<artifactId>weixin-java-pay</artifactId>
|
||||
<version>3.6.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
|
|
@ -492,16 +502,26 @@
|
|||
<artifactId>restful-sdk</artifactId>
|
||||
<version>1.0.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>com.baidu.aip</groupId>-->
|
||||
<!-- <artifactId>java-sdk</artifactId>-->
|
||||
<!-- <version>4.11.3</version>-->
|
||||
<!--</dependency>-->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.client</groupId>
|
||||
<artifactId>elasticsearch-rest-high-level-client</artifactId>
|
||||
<version>7.14.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch</groupId>
|
||||
<artifactId>elasticsearch</artifactId>
|
||||
<version>7.14.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.easy-es</groupId>
|
||||
<artifactId>easy-es-boot-starter</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
@ -553,12 +573,12 @@
|
|||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<version>0.4.14</version>
|
||||
<!--<executions>-->
|
||||
<!--<execution>-->
|
||||
<!--<phase>package</phase>-->
|
||||
<!--<goals>-->
|
||||
<!--<goal>build</goal>-->
|
||||
<!--</goals>-->
|
||||
<!--</execution>-->
|
||||
<!--<execution>-->
|
||||
<!--<phase>package</phase>-->
|
||||
<!--<goals>-->
|
||||
<!--<goal>build</goal>-->
|
||||
<!--</goals>-->
|
||||
<!--</execution>-->
|
||||
<!--</executions>-->
|
||||
<configuration>
|
||||
<imageName>sqx/fast</imageName>
|
||||
|
|
@ -606,4 +626,4 @@
|
|||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
|
@ -41,6 +41,7 @@ public class ShiroConfig {
|
|||
shiroFilter.setFilters(filters);
|
||||
|
||||
Map<String, String> filterMap = new LinkedHashMap<>();
|
||||
filterMap.put("/es/**", "anon");
|
||||
filterMap.put("/uniCallBack/**", "anon");
|
||||
filterMap.put("/course/synCourse", "anon");
|
||||
filterMap.put("/app/**", "anon");
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ import io.swagger.annotations.ApiModel;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import org.dromara.easyes.annotation.IndexId;
|
||||
import org.dromara.easyes.annotation.IndexName;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -18,6 +20,7 @@ import java.math.BigDecimal;
|
|||
@Data
|
||||
@AllArgsConstructor
|
||||
@TableName("user_money_details")
|
||||
@IndexName(value = "user_money_details", keepGlobalPrefix = true)
|
||||
@ApiModel("钱包详情")
|
||||
public class UserMoneyDetails implements Serializable {
|
||||
/**
|
||||
|
|
@ -26,6 +29,7 @@ public class UserMoneyDetails implements Serializable {
|
|||
@ApiModelProperty("钱包详情id")
|
||||
@TableId(type = IdType.ID_WORKER)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@IndexId(type = org.dromara.easyes.annotation.rely.IdType.CUSTOMIZE)
|
||||
private Long id;
|
||||
/**
|
||||
* 用户id
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.easyes.annotation.IndexId;
|
||||
import org.dromara.easyes.annotation.IndexName;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
|
@ -16,6 +18,7 @@ import java.io.Serializable;
|
|||
@Data
|
||||
@Accessors(chain = true)
|
||||
@TableName("course_collect")
|
||||
@IndexName(value = "course_collect", keepGlobalPrefix = true)
|
||||
public class CourseCollect implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
@ -25,6 +28,7 @@ public class CourseCollect implements Serializable {
|
|||
* 收藏id
|
||||
*/
|
||||
@TableId(type = IdType.ID_WORKER)
|
||||
@IndexId(type= org.dromara.easyes.annotation.rely.IdType.CUSTOMIZE)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long courseCollectId;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.*;
|
|||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import org.dromara.easyes.annotation.IndexId;
|
||||
import org.dromara.easyes.annotation.IndexName;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
|
@ -14,6 +16,7 @@ import java.io.Serializable;
|
|||
*/
|
||||
@Data
|
||||
@TableName("course_user")
|
||||
@IndexName(value = "course_user", keepGlobalPrefix = true)
|
||||
public class CourseUser implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
@ -23,6 +26,7 @@ public class CourseUser implements Serializable {
|
|||
* 我的短剧id
|
||||
*/
|
||||
@TableId(type = IdType.ID_WORKER)
|
||||
@IndexId(type= org.dromara.easyes.annotation.rely.IdType.CUSTOMIZE)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long courseUserId;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.activerecord.Model;
|
|||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import org.dromara.easyes.annotation.IndexId;
|
||||
import org.dromara.easyes.annotation.IndexName;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
|
@ -16,9 +18,11 @@ import java.math.BigDecimal;
|
|||
*/
|
||||
@Data
|
||||
@TableName("disc_spinning_record")
|
||||
@IndexName(value = "disc_spinning_record", keepGlobalPrefix = true)
|
||||
public class DiscSpinningRecord extends Model<DiscSpinningRecord> {
|
||||
//主键
|
||||
@TableId(type = IdType.ID_WORKER)
|
||||
@IndexId(type= org.dromara.easyes.annotation.rely.IdType.CUSTOMIZE)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
package com.sqx.modules.es.controller;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.es.dao.EsPayDetailDao;
|
||||
import com.sqx.modules.es.service.EsCoreService;
|
||||
import com.sqx.modules.pay.entity.PayDetails;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 全量同步相关表数据到es
|
||||
*
|
||||
* @author tankaikai
|
||||
* @since 2025-01-02 20:33
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping(value = "/es/core")
|
||||
public class EsCoreController {
|
||||
@Autowired
|
||||
private EsCoreService esCoreService;
|
||||
|
||||
@Resource
|
||||
private EsPayDetailDao esPayDetailsDao;
|
||||
|
||||
@ApiOperation("同步")
|
||||
@PostMapping("/sync")
|
||||
public Result sync(@ApiIgnore @RequestParam Map<String, Object> params) {
|
||||
PayDetails payDetails = esPayDetailsDao.selectByOrderId("1000001851456083");
|
||||
System.out.println(JSONUtil.toJsonPrettyStr(payDetails));
|
||||
PayDetails payDetails1 = esPayDetailsDao.getBaseEsMapper().selectById(3306L);
|
||||
System.out.println(JSONUtil.toJsonPrettyStr(payDetails1));
|
||||
PayDetails payDetails2 = esPayDetailsDao.getOriginalDao().selectById(3306L);
|
||||
System.out.println(JSONUtil.toJsonPrettyStr(payDetails2));
|
||||
//esCoreService.sync();
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package com.sqx.modules.es.dao;
|
||||
|
||||
import com.sqx.modules.es.mapper.EsPayDetailsMapper;
|
||||
import com.sqx.modules.pay.dao.PayDetailsDao;
|
||||
import com.sqx.modules.pay.entity.PayDetails;
|
||||
import org.dromara.easyes.core.conditions.select.LambdaEsQueryWrapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author tankaikai
|
||||
* @since 2025-01-15 18:29
|
||||
*/
|
||||
@Component
|
||||
public class EsPayDetailDao {
|
||||
|
||||
@Resource
|
||||
private EsPayDetailsMapper baseEsMapper;
|
||||
|
||||
@Resource
|
||||
private PayDetailsDao originalDao;
|
||||
|
||||
public EsPayDetailsMapper getBaseEsMapper() {
|
||||
return this.baseEsMapper;
|
||||
}
|
||||
|
||||
public PayDetailsDao getOriginalDao() {
|
||||
return this.originalDao;
|
||||
}
|
||||
|
||||
public PayDetails selectByRemark(String remark) {
|
||||
return baseEsMapper.selectOne(new LambdaEsQueryWrapper<PayDetails>().eq(PayDetails::getRemark, remark));
|
||||
}
|
||||
|
||||
|
||||
public PayDetails selectByOrderId(String orderId) {
|
||||
return baseEsMapper.selectOne(new LambdaEsQueryWrapper<PayDetails>().eq(PayDetails::getOrderId, orderId));
|
||||
}
|
||||
|
||||
|
||||
public PayDetails selectOneByLimit(String orderId) {
|
||||
return baseEsMapper.selectOne(new LambdaEsQueryWrapper<PayDetails>().eq(PayDetails::getOrderId, orderId).orderByDesc(PayDetails::getId).limit(1));
|
||||
}
|
||||
|
||||
|
||||
public PayDetails selectByTradeNo(String tradeNo) {
|
||||
return baseEsMapper.selectOne(new LambdaEsQueryWrapper<PayDetails>().eq(PayDetails::getTradeNo, tradeNo));
|
||||
}
|
||||
|
||||
|
||||
public int selectPayCount(Long userId) {
|
||||
Long count = baseEsMapper.selectCount(new LambdaEsQueryWrapper<PayDetails>().eq(PayDetails::getState, 1).eq(PayDetails::getUserId, userId));
|
||||
return count == null ? 0 : count.intValue();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
** Dao层实现MyBatis中ES可以实现的查询方法
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.sqx.modules.es.mapper;
|
||||
|
||||
import com.sqx.modules.pay.entity.CashOut;
|
||||
import org.dromara.easyes.core.kernel.BaseEsMapper;
|
||||
|
||||
/**
|
||||
* @author tankaikai
|
||||
* @since 2025-01-06 9:40
|
||||
*/
|
||||
public interface EsCashOutMapper extends BaseEsMapper<CashOut> {
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.sqx.modules.es.mapper;
|
||||
|
||||
import com.sqx.modules.course.entity.CourseCollect;
|
||||
import org.dromara.easyes.core.kernel.BaseEsMapper;
|
||||
|
||||
/**
|
||||
* @author tankaikai
|
||||
* @since 2025-01-06 9:40
|
||||
*/
|
||||
public interface EsCourseCollectMapper extends BaseEsMapper<CourseCollect> {
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.sqx.modules.es.mapper;
|
||||
|
||||
import com.sqx.modules.course.entity.CourseUser;
|
||||
import org.dromara.easyes.core.kernel.BaseEsMapper;
|
||||
|
||||
/**
|
||||
* @author tankaikai
|
||||
* @since 2025-01-06 9:40
|
||||
*/
|
||||
public interface EsCourseUserMapper extends BaseEsMapper<CourseUser> {
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.sqx.modules.es.mapper;
|
||||
|
||||
import com.sqx.modules.discSpinning.entity.DiscSpinningRecord;
|
||||
import org.dromara.easyes.core.kernel.BaseEsMapper;
|
||||
|
||||
/**
|
||||
* @author tankaikai
|
||||
* @since 2025-01-06 9:40
|
||||
*/
|
||||
public interface EsDiscSpinningRecordMapper extends BaseEsMapper<DiscSpinningRecord> {
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.sqx.modules.es.mapper;
|
||||
|
||||
import com.sqx.modules.orders.entity.Orders;
|
||||
import org.dromara.easyes.core.kernel.BaseEsMapper;
|
||||
|
||||
/**
|
||||
* @author tankaikai
|
||||
* @since 2025-01-02 20:24
|
||||
*/
|
||||
public interface EsOrdersMapper extends BaseEsMapper<Orders> {
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.sqx.modules.es.mapper;
|
||||
|
||||
import com.sqx.modules.pay.entity.PayDetails;
|
||||
import org.dromara.easyes.core.kernel.BaseEsMapper;
|
||||
|
||||
/**
|
||||
* @author tankaikai
|
||||
* @since 2025-01-06 9:40
|
||||
*/
|
||||
public interface EsPayDetailsMapper extends BaseEsMapper<PayDetails> {
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.sqx.modules.es.mapper;
|
||||
|
||||
import com.sqx.modules.taskCenter.entity.TaskCenterRecord;
|
||||
import org.dromara.easyes.core.kernel.BaseEsMapper;
|
||||
|
||||
/**
|
||||
* @author tankaikai
|
||||
* @since 2025-01-08 16:31
|
||||
*/
|
||||
public interface EsTaskCenterRecordMapper extends BaseEsMapper<TaskCenterRecord> {
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.sqx.modules.es.mapper;
|
||||
|
||||
import com.sqx.modules.app.entity.UserMoneyDetails;
|
||||
import org.dromara.easyes.core.kernel.BaseEsMapper;
|
||||
|
||||
/**
|
||||
* @author tankaikai
|
||||
* @since 2025-01-02 20:24
|
||||
*/
|
||||
public interface EsUserMoneyDetailsMapper extends BaseEsMapper<UserMoneyDetails> {
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
ES包下分层解释
|
||||
** Mapper层:Easy-ES对ElasticSearch的底层实现,类似与MyBatisPlus对Mapper的加持,使其拥有更方便快捷的增删改查实现
|
||||
** Dao层:实现MyBatisPlus中自行扩展的查询方法,改用ES库查询,方便替换原始的Dao层方便;
|
||||
- 如:"Private OrdersDao ordersDao;"替换为"Private EsOrdersDao esOrdersDao;"
|
||||
- 可通过esOrdersDao.getBaseEsMapper()拥有es mapper层的能力
|
||||
- 可通过esOrdersDao.getOriginalDao()拥有原始Dao层(MybatisPlus Mapper/Dao)的能力
|
||||
** Service层:实现MyBatisPlus中简单、稍复杂的查询统计逻辑,改用ES库查询,方便替换原始的Service层;
|
||||
如:"Private OrdersService ordersService;";替换为"Private EsOrdersService esOrdersService;";
|
||||
- 可通过esOrdersService.getBaseEsMapper()拥有es mapper层的能力
|
||||
- 可通过esOrdersDao.getOriginalService()拥有原始Service层(MybatisPlus Service)的能力
|
||||
** Controller层:目前主要实现的数据初始化同步功能,后期如果有其他ES相关的接口,可以写到这里面;
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.sqx.modules.es.service;
|
||||
|
||||
/**
|
||||
* @author tankaikai
|
||||
* @since 2025-01-02 20:27
|
||||
*/
|
||||
public interface EsCoreService {
|
||||
|
||||
void sync();
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.sqx.modules.es.service;
|
||||
|
||||
import com.sqx.modules.orders.entity.Orders;
|
||||
|
||||
/**
|
||||
* @author tankaikai
|
||||
* @since 2025-01-16 9:50
|
||||
*/
|
||||
public interface EsOrdersService extends IEsService<Orders> {
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.sqx.modules.es.service;
|
||||
|
||||
/**
|
||||
* @author tankaikai
|
||||
* @since 2025-01-16 9:45
|
||||
*/
|
||||
public interface IEsService<T> {
|
||||
}
|
||||
|
|
@ -0,0 +1,207 @@
|
|||
package com.sqx.modules.es.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.sqx.modules.app.dao.UserMoneyDetailsDao;
|
||||
import com.sqx.modules.app.entity.UserMoneyDetails;
|
||||
import com.sqx.modules.course.dao.CourseCollectDao;
|
||||
import com.sqx.modules.course.dao.CourseUserDao;
|
||||
import com.sqx.modules.course.entity.CourseCollect;
|
||||
import com.sqx.modules.course.entity.CourseUser;
|
||||
import com.sqx.modules.discSpinning.dao.DiscSpinningRecordDao;
|
||||
import com.sqx.modules.discSpinning.entity.DiscSpinningRecord;
|
||||
import com.sqx.modules.es.mapper.*;
|
||||
import com.sqx.modules.es.service.EsCoreService;
|
||||
import com.sqx.modules.orders.dao.OrdersDao;
|
||||
import com.sqx.modules.orders.entity.Orders;
|
||||
import com.sqx.modules.pay.dao.CashOutDao;
|
||||
import com.sqx.modules.pay.dao.PayDetailsDao;
|
||||
import com.sqx.modules.pay.entity.CashOut;
|
||||
import com.sqx.modules.pay.entity.PayDetails;
|
||||
import com.sqx.modules.taskCenter.dao.TaskCenterRecordDao;
|
||||
import com.sqx.modules.taskCenter.entity.TaskCenterRecord;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* @author tankaikai
|
||||
* @since 2025-01-02 20:27
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class EsCoreServiceImpl implements EsCoreService {
|
||||
|
||||
@Resource
|
||||
private OrdersDao ordersDao;
|
||||
@Resource
|
||||
private CashOutDao cashOutDao;
|
||||
@Resource
|
||||
private CourseCollectDao courseCollectDao;
|
||||
@Resource
|
||||
private CourseUserDao courseUserDao;
|
||||
@Resource
|
||||
private DiscSpinningRecordDao discSpinningRecordDao;
|
||||
@Resource
|
||||
private PayDetailsDao payDetailsDao;
|
||||
@Resource
|
||||
private UserMoneyDetailsDao userMoneyDetailsDao;
|
||||
@Resource
|
||||
private TaskCenterRecordDao taskCenterRecordDao;
|
||||
|
||||
@Resource
|
||||
private EsOrdersMapper esOrdersMapper;
|
||||
|
||||
@Resource
|
||||
private EsCashOutMapper esCashOutMapper;
|
||||
|
||||
@Resource
|
||||
private EsCourseCollectMapper esCourseCollectMapper;
|
||||
|
||||
@Resource
|
||||
private EsCourseUserMapper esCourseUserMapper;
|
||||
@Resource
|
||||
private EsDiscSpinningRecordMapper esDiscSpinningRecordMapper;
|
||||
@Resource
|
||||
private EsPayDetailsMapper esPayDetailsMapper;
|
||||
|
||||
@Resource
|
||||
private EsUserMoneyDetailsMapper esUserMoneyDetailsMapper;
|
||||
@Resource
|
||||
private EsTaskCenterRecordMapper esTaskCenterRecordMapper;
|
||||
|
||||
@Override
|
||||
public void sync() {
|
||||
List<String> list = new ArrayList<>();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
list.add(i + "");
|
||||
}
|
||||
CompletableFuture<Void> future1 = CompletableFuture.runAsync(() -> {
|
||||
// 执行方法1的代码
|
||||
System.out.println("方法1正在执行...");
|
||||
syncUserMoneyDetails(list);
|
||||
});
|
||||
CompletableFuture<Void> future2 = CompletableFuture.runAsync(() -> {
|
||||
// 执行方法2的代码
|
||||
System.out.println("方法2正在执行...");
|
||||
syncOrders(list);
|
||||
});
|
||||
CompletableFuture<Void> future3 = CompletableFuture.runAsync(() -> {
|
||||
// 执行方法3的代码
|
||||
System.out.println("方法3正在执行...");
|
||||
syncPayDetails(list);
|
||||
});
|
||||
CompletableFuture<Void> future4 = CompletableFuture.runAsync(() -> {
|
||||
// 执行方法4的代码
|
||||
System.out.println("方法4正在执行...");
|
||||
syncDiscSpinningRecord(list);
|
||||
});
|
||||
CompletableFuture<Void> future5 = CompletableFuture.runAsync(() -> {
|
||||
// 执行方法6的代码
|
||||
System.out.println("方法5正在执行...");
|
||||
syncCashOut(list);
|
||||
});
|
||||
CompletableFuture<Void> future6 = CompletableFuture.runAsync(() -> {
|
||||
// 执行方法6的代码
|
||||
System.out.println("方法6正在执行...");
|
||||
syncCourseCollect(list);
|
||||
});
|
||||
CompletableFuture<Void> future7 = CompletableFuture.runAsync(() -> {
|
||||
// 执行方法7的代码
|
||||
System.out.println("方法7正在执行...");
|
||||
syncCourseUser(list);
|
||||
});
|
||||
CompletableFuture<Void> future8 = CompletableFuture.runAsync(() -> {
|
||||
// 执行方法8的代码
|
||||
System.out.println("方法8正在执行...");
|
||||
syncTaskCenterRecord(list);
|
||||
});
|
||||
// 等待多个任务完成
|
||||
CompletableFuture.allOf(future1, future2, future3, future4, future5, future6, future7, future8).join();
|
||||
System.out.println("所有方法已并行执行完毕。");
|
||||
/*
|
||||
syncUserMoneyDetails(list);
|
||||
syncOrders(list);
|
||||
syncCourseCollect(list);
|
||||
syncPayDetails(list);
|
||||
syncDiscSpinningRecord(list);
|
||||
syncCashOut(list);
|
||||
syncCourseUser(list);
|
||||
syncTaskCenterRecord(list);
|
||||
|
||||
System.out.println("所有方法已并行执行完毕。");
|
||||
*/
|
||||
}
|
||||
|
||||
private void syncOrders(List<String> list) {
|
||||
list.parallelStream().forEach(i -> {
|
||||
System.out.println("同步订单数据:" + i);
|
||||
List<Orders> batchList = ordersDao.selectList(Wrappers.<Orders>lambdaQuery().likeLeft(Orders::getOrdersId, i));
|
||||
esOrdersMapper.insertBatch(batchList);
|
||||
});
|
||||
}
|
||||
|
||||
private void syncCashOut(List<String> list) {
|
||||
list.parallelStream().forEach(i -> {
|
||||
System.out.println("同步提现数据:" + i);
|
||||
List<CashOut> batchList = cashOutDao.selectList(Wrappers.<CashOut>lambdaQuery().likeLeft(CashOut::getId, i));
|
||||
if (CollUtil.isNotEmpty(batchList)) {
|
||||
esCashOutMapper.insertBatch(batchList);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void syncCourseCollect(List<String> list) {
|
||||
list.parallelStream().forEach(i -> {
|
||||
System.out.println("同步短剧收藏数据:" + i);
|
||||
List<CourseCollect> batchList = courseCollectDao.selectList(Wrappers.<CourseCollect>lambdaQuery().likeLeft(CourseCollect::getCourseCollectId, i));
|
||||
esCourseCollectMapper.insertBatch(batchList);
|
||||
});
|
||||
}
|
||||
|
||||
private void syncCourseUser(List<String> list) {
|
||||
list.parallelStream().forEach(i -> {
|
||||
System.out.println("同步短剧用户数据:" + i);
|
||||
List<CourseUser> batchList = courseUserDao.selectList(Wrappers.<CourseUser>lambdaQuery().likeLeft(CourseUser::getCourseUserId, i));
|
||||
esCourseUserMapper.insertBatch(batchList);
|
||||
});
|
||||
}
|
||||
|
||||
private void syncTaskCenterRecord(List<String> list) {
|
||||
list.parallelStream().forEach(i -> {
|
||||
System.out.println("同步任务中心数据:" + i);
|
||||
List<TaskCenterRecord> batchList = taskCenterRecordDao.selectList(Wrappers.<TaskCenterRecord>lambdaQuery().likeLeft(TaskCenterRecord::getId, i));
|
||||
esTaskCenterRecordMapper.insertBatch(batchList);
|
||||
});
|
||||
}
|
||||
|
||||
private void syncDiscSpinningRecord(List<String> list) {
|
||||
list.parallelStream().forEach(i -> {
|
||||
System.out.println("同步抽奖记录数据:" + i);
|
||||
List<DiscSpinningRecord> batchList = discSpinningRecordDao.selectList(Wrappers.<DiscSpinningRecord>lambdaQuery().likeLeft(DiscSpinningRecord::getId, i));
|
||||
esDiscSpinningRecordMapper.insertBatch(batchList);
|
||||
});
|
||||
}
|
||||
|
||||
private void syncPayDetails(List<String> list) {
|
||||
list.parallelStream().forEach(i -> {
|
||||
System.out.println("同步支付详情数据:" + i);
|
||||
List<PayDetails> batchList = payDetailsDao.selectList(Wrappers.<PayDetails>lambdaQuery().likeLeft(PayDetails::getId, i));
|
||||
esPayDetailsMapper.insertBatch(batchList);
|
||||
});
|
||||
}
|
||||
|
||||
private void syncUserMoneyDetails(List<String> list) {
|
||||
list.parallelStream().forEach(i -> {
|
||||
System.out.println("同步用户资金明细数据:" + i);
|
||||
List<UserMoneyDetails> batchList = userMoneyDetailsDao.selectList(Wrappers.<UserMoneyDetails>lambdaQuery().likeLeft(UserMoneyDetails::getId, i));
|
||||
esUserMoneyDetailsMapper.insertBatch(batchList);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.sqx.modules.es.service.impl;
|
||||
|
||||
import com.sqx.modules.es.mapper.EsOrdersMapper;
|
||||
import com.sqx.modules.es.service.EsOrdersService;
|
||||
import com.sqx.modules.orders.entity.Orders;
|
||||
import com.sqx.modules.orders.service.OrdersService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author tankaikai
|
||||
* @since 2025-01-16 9:51
|
||||
*/
|
||||
public class EsOrdersServiceImpl extends EsServiceImpl<EsOrdersMapper, Orders> implements EsOrdersService {
|
||||
|
||||
@Resource
|
||||
private OrdersService ordersService;
|
||||
|
||||
public OrdersService getOriginalService() {
|
||||
return ordersService;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.sqx.modules.es.service.impl;
|
||||
|
||||
import com.sqx.modules.es.service.IEsService;
|
||||
import org.apache.ibatis.logging.Log;
|
||||
import org.apache.ibatis.logging.LogFactory;
|
||||
import org.dromara.easyes.core.kernel.BaseEsMapper;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author tankaikai
|
||||
* @since 2025-01-16 9:45
|
||||
*/
|
||||
public class EsServiceImpl<M extends BaseEsMapper<T>, T> implements IEsService<T> {
|
||||
protected Log log = LogFactory.getLog(this.getClass());
|
||||
@Resource
|
||||
protected M baseEsMapper;
|
||||
|
||||
public EsServiceImpl() {
|
||||
}
|
||||
|
||||
public M getBaseEsMapper() {
|
||||
return this.baseEsMapper;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -5,6 +5,8 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.sqx.modules.course.entity.Course;
|
||||
import lombok.Data;
|
||||
import org.dromara.easyes.annotation.IndexId;
|
||||
import org.dromara.easyes.annotation.IndexName;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -16,6 +18,7 @@ import java.math.BigDecimal;
|
|||
*/
|
||||
@Data
|
||||
@TableName("orders")
|
||||
@IndexName(value = "orders",keepGlobalPrefix = true)
|
||||
public class Orders implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
@ -25,6 +28,7 @@ public class Orders implements Serializable {
|
|||
*/
|
||||
@TableId(type = IdType.ID_WORKER)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@IndexId(type= org.dromara.easyes.annotation.rely.IdType.CUSTOMIZE)
|
||||
private Long ordersId;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import org.dromara.easyes.annotation.IndexId;
|
||||
import org.dromara.easyes.annotation.IndexName;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -19,6 +21,7 @@ import java.math.BigDecimal;
|
|||
*/
|
||||
@Data
|
||||
@TableName("cash_out")
|
||||
@IndexName(value = "cash_out", keepGlobalPrefix = true)
|
||||
public class CashOut implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
@ -27,8 +30,9 @@ public class CashOut implements Serializable {
|
|||
* 申请提现id
|
||||
*/
|
||||
@TableId(type = IdType.ID_WORKER)
|
||||
@IndexId(type = org.dromara.easyes.annotation.rely.IdType.CUSTOMIZE)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private long id;
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 申请时间
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import org.dromara.easyes.annotation.IndexId;
|
||||
import org.dromara.easyes.annotation.IndexName;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -17,6 +19,7 @@ import java.math.BigDecimal;
|
|||
*/
|
||||
@Data
|
||||
@TableName("pay_details")
|
||||
@IndexName(value = "pay_details", keepGlobalPrefix = true)
|
||||
public class PayDetails implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
@ -25,6 +28,7 @@ public class PayDetails implements Serializable {
|
|||
* 充值记录id
|
||||
*/
|
||||
@TableId(type = IdType.ID_WORKER)
|
||||
@IndexId(type = org.dromara.easyes.annotation.rely.IdType.CUSTOMIZE)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
|||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.dromara.easyes.annotation.IndexId;
|
||||
import org.dromara.easyes.annotation.IndexName;
|
||||
|
||||
/**
|
||||
* 任务领取记录(TaskCenterRecord)表实体类
|
||||
|
|
@ -18,9 +20,11 @@ import lombok.Data;
|
|||
*/
|
||||
@Data
|
||||
@TableName("task_center_record")
|
||||
@IndexName(value = "task_center_record", keepGlobalPrefix = true)
|
||||
@ApiModel(value = "任务领取记录 实体类")
|
||||
public class TaskCenterRecord extends Model<TaskCenterRecord> {
|
||||
@TableId(type = IdType.ID_WORKER)
|
||||
@IndexId(type= org.dromara.easyes.annotation.rely.IdType.CUSTOMIZE)
|
||||
@ApiModelProperty(value = "id",hidden = true)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@ spring:
|
|||
|
||||
mvc:
|
||||
throw-exception-if-no-handler-found: true
|
||||
# pathmatch:
|
||||
# matching-strategy: ant_path_matcher
|
||||
# pathmatch:
|
||||
# matching-strategy: ant_path_matcher
|
||||
shardingsphere:
|
||||
#广播表
|
||||
# broadcast-tables:
|
||||
# - course
|
||||
# broadcast-tables:
|
||||
# - course
|
||||
# 短剧集表 通过course_id 分
|
||||
course-details:
|
||||
- course_details
|
||||
|
|
@ -159,3 +159,21 @@ sqx:
|
|||
header: token
|
||||
uni:
|
||||
adSecret: 122e4ff1edc66dcf8761f7f7ffc81e0f8773cbfafb58aed29c72fbd092c77315
|
||||
|
||||
easy-es:
|
||||
banner: false
|
||||
address: 47.122.74.162:9200
|
||||
username: elastic #es用户名,若无则删去此行配置
|
||||
password: rer8cpBAvEWs #es密码,若无则删去此行配置
|
||||
keep-alive-millis: 30000 # 心跳策略时间 单位:ms
|
||||
connect-timeout: 15000 # 连接超时时间 单位:ms
|
||||
socket-timeout: 600000 # 通信超时时间 单位:ms
|
||||
request-timeout: 15000 # 请求超时时间 单位:ms
|
||||
connection-request-timeout: 15000 # 连接请求超时时间 单位:ms
|
||||
global-config:
|
||||
process-index-mode: manual #索引处理模式,smoothly:平滑模式, not_smoothly:非平滑模式, manual:手动模式,,默认开启此模式
|
||||
print-dsl: true
|
||||
async-process-index-blocking: true # 异步处理索引是否阻塞主线程 默认阻塞 数据量过大时调整为非阻塞异步进行 项目启动更快
|
||||
db-config:
|
||||
map-underscore-to-camel-case: true # 是否开启下划线转驼峰 默认为false
|
||||
index-prefix: ${spring.profiles.active}_ # 索引前缀,可用于区分环境 默认为空 用法和MP的tablePrefix一样的作用和用法
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloading for this project.
|
||||
Refer to https://manuals.jrebel.com/jrebel/standalone/config.html for more information.
|
||||
-->
|
||||
<application generated-by="intellij" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_3.xsd">
|
||||
|
||||
<id>duanju</id>
|
||||
|
||||
<classpath>
|
||||
<dir name="E:/IdeaProjects/video_server_debug/target/classes">
|
||||
</dir>
|
||||
</classpath>
|
||||
|
||||
</application>
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package com.sqx.es;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author tankaikai
|
||||
* @since 2025-01-08 13:33
|
||||
*/
|
||||
public class SyncDataToEsScriptGenTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
build("dev");
|
||||
}
|
||||
|
||||
private static void build(String env) {
|
||||
String absolutePath = FileUtil.getAbsolutePath("", SyncDataToEsScriptGenTest.class);
|
||||
String basePath = FileUtil.getParent(absolutePath, 5) + "/src/test/java/com/sqx/es";
|
||||
String configPath = basePath + "/" + env + "-config-data.json";
|
||||
String config = FileUtil.readUtf8String(configPath);
|
||||
System.out.println(config);
|
||||
String outPath = basePath + "/" + "out";
|
||||
FileUtil.del(outPath);
|
||||
FileUtil.mkdir(outPath);
|
||||
String templatePath = basePath + "/" + "template.yml";
|
||||
String template = FileUtil.readUtf8String(templatePath);
|
||||
JSONObject data = JSONUtil.parseObj(config);
|
||||
|
||||
JSONArray dbList = data.getJSONArray("dbList");
|
||||
JSONArray tableList = data.getJSONArray("tableList");
|
||||
Set<String> dbSet = dbList.stream().map(obj -> Convert.toStr(obj)).collect(Collectors.toSet());
|
||||
for (String dbName : dbSet) {
|
||||
for (int i = 0; i < tableList.size(); i++) {
|
||||
Map<String, String> params = new HashMap();
|
||||
params.put("env", data.getStr("env"));
|
||||
params.put("dbName", dbName);
|
||||
JSONObject table = tableList.getJSONObject(i);
|
||||
String tableName = table.getStr("tableName");
|
||||
params.put("tableName", tableName);
|
||||
params.put("mappingSql", table.getStr("mappingSql"));
|
||||
String content = StrUtil.format(template, params);
|
||||
String fileName = tableName + "@" + env + "." + dbName + ".yml";
|
||||
FileUtil.writeUtf8String(content, new File(outPath + "/" + fileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"env": "dev",
|
||||
"dbList": [
|
||||
"duanju-0",
|
||||
"duanju-1",
|
||||
"duanju-2",
|
||||
"duanju-3",
|
||||
"duanju-4"
|
||||
],
|
||||
"tableList": [
|
||||
{
|
||||
"tableName": "user_money_details",
|
||||
"mappingSql": "select a.id as _id, a.user_id, a.sys_user_id, a.by_user_id, a.title, a.classify, a.type, a.state, a.money, a.content, a.money_type, a.create_time, a.source_id from user_money_details a"
|
||||
},
|
||||
{
|
||||
"tableName": "orders",
|
||||
"mappingSql": "select a.orders_id as _id, a.orders_no, a.trade_no, a.user_id, a.course_id, a.pay_money, a.pay_way, a.status, a.create_time, a.refund_content, a.orders_type, a.vip_name_type, a.course_details_id, a.course_details_ids, a.qd_money, a.sys_user_id, a.one_money, a.one_user_id, a.two_money, a.two_user_id, a.pay_time, a.pay_diamond, a.diamond from orders a"
|
||||
},
|
||||
{
|
||||
"tableName": "course_collect",
|
||||
"mappingSql": "select a.course_collect_id as _id, a.course_id, a.user_id, a.create_time, a.course_details_id, a.classify, a.update_time from course_collect a"
|
||||
},
|
||||
{
|
||||
"tableName": "pay_details",
|
||||
"mappingSql": "select a.id as _id, a.classify, a.trade_no, a.money, a.user_id, a.state, a.create_time, a.pay_time, a.type, a.remark, a.order_id, a.product_id, a.pay_diamond, a.diamond, a.third_order_no from pay_details a"
|
||||
},
|
||||
{
|
||||
"tableName": "disc_spinning_record",
|
||||
"mappingSql": "select a.id as _id, a.user_id, a.source_id, a.img_url, a.name, a.type, a.number, a.target, a.target_id, a.draw_day, a.create_time, a.source from disc_spinning_record a"
|
||||
},
|
||||
{
|
||||
"tableName": "cash_out",
|
||||
"mappingSql": "select a.id as _id, a.create_at, a.is_out, a.money, a.out_at, a.relation_id, a.user_id, a.zhifubao, a.zhifubao_name, a.order_number, a.state, a.refund, a.rate, a.sys_user_id, a.user_type, a.withdraw_type from cash_out a"
|
||||
},
|
||||
{
|
||||
"tableName": "course_user",
|
||||
"mappingSql": "select a.course_user_id as _id, a.course_id, a.order_id, a.user_id, a.create_time, a.update_time, a.course_details_id, a.classify from course_user a"
|
||||
},
|
||||
{
|
||||
"tableName": "task_center_record",
|
||||
"mappingSql": "select a.id as _id, a.user_id, a.task_id, a.source_id, a.name, a.type, a.target_id, a.number, a.create_time, a.update_time from task_center_record a"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-0
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_cash_out
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.id as _id, a.create_at, a.is_out, a.money, a.out_at, a.relation_id, a.user_id, a.zhifubao, a.zhifubao_name, a.order_number, a.state, a.refund, a.rate, a.sys_user_id, a.user_type, a.withdraw_type from cash_out a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-1
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_cash_out
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.id as _id, a.create_at, a.is_out, a.money, a.out_at, a.relation_id, a.user_id, a.zhifubao, a.zhifubao_name, a.order_number, a.state, a.refund, a.rate, a.sys_user_id, a.user_type, a.withdraw_type from cash_out a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-2
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_cash_out
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.id as _id, a.create_at, a.is_out, a.money, a.out_at, a.relation_id, a.user_id, a.zhifubao, a.zhifubao_name, a.order_number, a.state, a.refund, a.rate, a.sys_user_id, a.user_type, a.withdraw_type from cash_out a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-3
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_cash_out
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.id as _id, a.create_at, a.is_out, a.money, a.out_at, a.relation_id, a.user_id, a.zhifubao, a.zhifubao_name, a.order_number, a.state, a.refund, a.rate, a.sys_user_id, a.user_type, a.withdraw_type from cash_out a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-4
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_cash_out
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.id as _id, a.create_at, a.is_out, a.money, a.out_at, a.relation_id, a.user_id, a.zhifubao, a.zhifubao_name, a.order_number, a.state, a.refund, a.rate, a.sys_user_id, a.user_type, a.withdraw_type from cash_out a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-0
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_course_collect
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.course_collect_id as _id, a.course_id, a.user_id, a.create_time, a.course_details_id, a.classify, a.update_time from course_collect a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-1
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_course_collect
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.course_collect_id as _id, a.course_id, a.user_id, a.create_time, a.course_details_id, a.classify, a.update_time from course_collect a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-2
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_course_collect
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.course_collect_id as _id, a.course_id, a.user_id, a.create_time, a.course_details_id, a.classify, a.update_time from course_collect a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-3
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_course_collect
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.course_collect_id as _id, a.course_id, a.user_id, a.create_time, a.course_details_id, a.classify, a.update_time from course_collect a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-4
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_course_collect
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.course_collect_id as _id, a.course_id, a.user_id, a.create_time, a.course_details_id, a.classify, a.update_time from course_collect a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-0
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_course_user
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.course_user_id as _id, a.course_id, a.order_id, a.user_id, a.create_time, a.update_time, a.course_details_id, a.classify from course_user a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-1
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_course_user
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.course_user_id as _id, a.course_id, a.order_id, a.user_id, a.create_time, a.update_time, a.course_details_id, a.classify from course_user a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-2
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_course_user
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.course_user_id as _id, a.course_id, a.order_id, a.user_id, a.create_time, a.update_time, a.course_details_id, a.classify from course_user a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-3
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_course_user
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.course_user_id as _id, a.course_id, a.order_id, a.user_id, a.create_time, a.update_time, a.course_details_id, a.classify from course_user a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-4
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_course_user
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.course_user_id as _id, a.course_id, a.order_id, a.user_id, a.create_time, a.update_time, a.course_details_id, a.classify from course_user a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-0
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_disc_spinning_record
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.id as _id, a.user_id, a.source_id, a.img_url, a.name, a.type, a.number, a.target, a.target_id, a.draw_day, a.create_time, a.source from disc_spinning_record a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-1
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_disc_spinning_record
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.id as _id, a.user_id, a.source_id, a.img_url, a.name, a.type, a.number, a.target, a.target_id, a.draw_day, a.create_time, a.source from disc_spinning_record a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-2
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_disc_spinning_record
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.id as _id, a.user_id, a.source_id, a.img_url, a.name, a.type, a.number, a.target, a.target_id, a.draw_day, a.create_time, a.source from disc_spinning_record a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-3
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_disc_spinning_record
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.id as _id, a.user_id, a.source_id, a.img_url, a.name, a.type, a.number, a.target, a.target_id, a.draw_day, a.create_time, a.source from disc_spinning_record a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-4
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_disc_spinning_record
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.id as _id, a.user_id, a.source_id, a.img_url, a.name, a.type, a.number, a.target, a.target_id, a.draw_day, a.create_time, a.source from disc_spinning_record a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-0
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_orders
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.orders_id as _id, a.orders_no, a.trade_no, a.user_id, a.course_id, a.pay_money, a.pay_way, a.status, a.create_time, a.refund_content, a.orders_type, a.vip_name_type, a.course_details_id, a.course_details_ids, a.qd_money, a.sys_user_id, a.one_money, a.one_user_id, a.two_money, a.two_user_id, a.pay_time, a.pay_diamond, a.diamond from orders a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-1
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_orders
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.orders_id as _id, a.orders_no, a.trade_no, a.user_id, a.course_id, a.pay_money, a.pay_way, a.status, a.create_time, a.refund_content, a.orders_type, a.vip_name_type, a.course_details_id, a.course_details_ids, a.qd_money, a.sys_user_id, a.one_money, a.one_user_id, a.two_money, a.two_user_id, a.pay_time, a.pay_diamond, a.diamond from orders a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-2
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_orders
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.orders_id as _id, a.orders_no, a.trade_no, a.user_id, a.course_id, a.pay_money, a.pay_way, a.status, a.create_time, a.refund_content, a.orders_type, a.vip_name_type, a.course_details_id, a.course_details_ids, a.qd_money, a.sys_user_id, a.one_money, a.one_user_id, a.two_money, a.two_user_id, a.pay_time, a.pay_diamond, a.diamond from orders a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-3
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_orders
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.orders_id as _id, a.orders_no, a.trade_no, a.user_id, a.course_id, a.pay_money, a.pay_way, a.status, a.create_time, a.refund_content, a.orders_type, a.vip_name_type, a.course_details_id, a.course_details_ids, a.qd_money, a.sys_user_id, a.one_money, a.one_user_id, a.two_money, a.two_user_id, a.pay_time, a.pay_diamond, a.diamond from orders a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-4
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_orders
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.orders_id as _id, a.orders_no, a.trade_no, a.user_id, a.course_id, a.pay_money, a.pay_way, a.status, a.create_time, a.refund_content, a.orders_type, a.vip_name_type, a.course_details_id, a.course_details_ids, a.qd_money, a.sys_user_id, a.one_money, a.one_user_id, a.two_money, a.two_user_id, a.pay_time, a.pay_diamond, a.diamond from orders a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-0
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_pay_details
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.id as _id, a.classify, a.trade_no, a.money, a.user_id, a.state, a.create_time, a.pay_time, a.type, a.remark, a.order_id, a.product_id, a.pay_diamond, a.diamond, a.third_order_no from pay_details a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-1
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_pay_details
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.id as _id, a.classify, a.trade_no, a.money, a.user_id, a.state, a.create_time, a.pay_time, a.type, a.remark, a.order_id, a.product_id, a.pay_diamond, a.diamond, a.third_order_no from pay_details a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-2
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_pay_details
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.id as _id, a.classify, a.trade_no, a.money, a.user_id, a.state, a.create_time, a.pay_time, a.type, a.remark, a.order_id, a.product_id, a.pay_diamond, a.diamond, a.third_order_no from pay_details a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-3
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_pay_details
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.id as _id, a.classify, a.trade_no, a.money, a.user_id, a.state, a.create_time, a.pay_time, a.type, a.remark, a.order_id, a.product_id, a.pay_diamond, a.diamond, a.third_order_no from pay_details a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-4
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_pay_details
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.id as _id, a.classify, a.trade_no, a.money, a.user_id, a.state, a.create_time, a.pay_time, a.type, a.remark, a.order_id, a.product_id, a.pay_diamond, a.diamond, a.third_order_no from pay_details a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-0
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_task_center_record
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.id as _id, a.user_id, a.task_id, a.source_id, a.name, a.type, a.target_id, a.number, a.create_time, a.update_time from task_center_record a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-1
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_task_center_record
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.id as _id, a.user_id, a.task_id, a.source_id, a.name, a.type, a.target_id, a.number, a.create_time, a.update_time from task_center_record a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-2
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_task_center_record
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.id as _id, a.user_id, a.task_id, a.source_id, a.name, a.type, a.target_id, a.number, a.create_time, a.update_time from task_center_record a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-3
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_task_center_record
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.id as _id, a.user_id, a.task_id, a.source_id, a.name, a.type, a.target_id, a.number, a.create_time, a.update_time from task_center_record a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-4
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_task_center_record
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.id as _id, a.user_id, a.task_id, a.source_id, a.name, a.type, a.target_id, a.number, a.create_time, a.update_time from task_center_record a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-0
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_user_money_details
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.id as _id, a.user_id, a.sys_user_id, a.by_user_id, a.title, a.classify, a.type, a.state, a.money, a.content, a.money_type, a.create_time, a.source_id from user_money_details a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-1
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_user_money_details
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.id as _id, a.user_id, a.sys_user_id, a.by_user_id, a.title, a.classify, a.type, a.state, a.money, a.content, a.money_type, a.create_time, a.source_id from user_money_details a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-2
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_user_money_details
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.id as _id, a.user_id, a.sys_user_id, a.by_user_id, a.title, a.classify, a.type, a.state, a.money, a.content, a.money_type, a.create_time, a.source_id from user_money_details a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-3
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_user_money_details
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.id as _id, a.user_id, a.sys_user_id, a.by_user_id, a.title, a.classify, a.type, a.state, a.money, a.content, a.money_type, a.create_time, a.source_id from user_money_details a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: dev_duanju-4
|
||||
outerAdapterKey: esKey1
|
||||
destination: dev_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_user_money_details
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "select a.id as _id, a.user_id, a.sys_user_id, a.by_user_id, a.title, a.classify, a.type, a.state, a.money, a.content, a.money_type, a.create_time, a.source_id from user_money_details a"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"env": "prod",
|
||||
"dbList": [
|
||||
"duanju-0",
|
||||
"duanju-1",
|
||||
"duanju-2",
|
||||
"duanju-3",
|
||||
"duanju-4"
|
||||
],
|
||||
"tableList": [
|
||||
{
|
||||
"tableName": "user_money_details",
|
||||
"mappingSql": "select a.id as _id, a.user_id, a.sys_user_id, a.by_user_id, a.title, a.classify, a.type, a.state, a.money, a.content, a.money_type, a.create_time, a.source_id from user_money_details a"
|
||||
},
|
||||
{
|
||||
"tableName": "orders",
|
||||
"mappingSql": "select a.orders_id as _id, a.orders_no, a.trade_no, a.user_id, a.course_id, a.pay_money, a.pay_way, a.status, a.create_time, a.refund_content, a.orders_type, a.vip_name_type, a.course_details_id, a.course_details_ids, a.qd_money, a.sys_user_id, a.one_money, a.one_user_id, a.two_money, a.two_user_id, a.pay_time, a.pay_diamond, a.diamond from orders a"
|
||||
},
|
||||
{
|
||||
"tableName": "course_collect",
|
||||
"mappingSql": "select a.course_collect_id as _id, a.course_id, a.user_id, a.create_time, a.course_details_id, a.classify, a.update_time from course_collect a"
|
||||
},
|
||||
{
|
||||
"tableName": "pay_details",
|
||||
"mappingSql": "select a.id as _id, a.classify, a.trade_no, a.money, a.user_id, a.state, a.create_time, a.pay_time, a.type, a.remark, a.order_id, a.product_id, a.pay_diamond, a.diamond, a.third_order_no from pay_details a"
|
||||
},
|
||||
{
|
||||
"tableName": "disc_spinning_record",
|
||||
"mappingSql": "select a.id as _id, a.user_id, a.source_id, a.img_url, a.name, a.type, a.number, a.target, a.target_id, a.draw_day, a.create_time, a.source from disc_spinning_record a"
|
||||
},
|
||||
{
|
||||
"tableName": "cash_out",
|
||||
"mappingSql": "select a.id as _id, a.create_at, a.is_out, a.money, a.out_at, a.relation_id, a.user_id, a.zhifubao, a.zhifubao_name, a.order_number, a.state, a.refund, a.rate, a.sys_user_id, a.user_type, a.withdraw_type from cash_out a"
|
||||
},
|
||||
{
|
||||
"tableName": "course_user",
|
||||
"mappingSql": "select a.course_user_id as _id, a.course_id, a.order_id, a.user_id, a.create_time, a.update_time, a.course_details_id, a.classify from course_user a"
|
||||
},
|
||||
{
|
||||
"tableName": "task_center_record",
|
||||
"mappingSql": "select a.id as _id, a.user_id, a.task_id, a.source_id, a.name, a.type, a.target_id, a.number, a.create_time, a.update_time from task_center_record a"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
dataSourceKey: {env}_{dbName}
|
||||
outerAdapterKey: esKey1
|
||||
destination: {env}_sync_data_to_es
|
||||
groupId: g1
|
||||
esMapping:
|
||||
_index: dev_{tableName}
|
||||
# _type: doc
|
||||
_id: _id
|
||||
upsert: true
|
||||
# pk: "orders_id"
|
||||
sql: "{mappingSql}"
|
||||
# objFields:
|
||||
# _labels: array:;
|
||||
# _obj: object
|
||||
# etlCondition: "where 1=1"
|
||||
commitBatch: 3000
|
||||
Loading…
Reference in New Issue