集成ES
This commit is contained in:
@@ -41,6 +41,7 @@ public class ShiroConfig {
|
|||||||
shiroFilter.setFilters(filters);
|
shiroFilter.setFilters(filters);
|
||||||
|
|
||||||
Map<String, String> filterMap = new LinkedHashMap<>();
|
Map<String, String> filterMap = new LinkedHashMap<>();
|
||||||
|
filterMap.put("/es/**", "anon");
|
||||||
filterMap.put("/uniCallBack/**", "anon");
|
filterMap.put("/uniCallBack/**", "anon");
|
||||||
filterMap.put("/course/synCourse", "anon");
|
filterMap.put("/course/synCourse", "anon");
|
||||||
filterMap.put("/webjars/**", "anon");
|
filterMap.put("/webjars/**", "anon");
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ public class CourseCollect implements Serializable {
|
|||||||
* 收藏id
|
* 收藏id
|
||||||
*/
|
*/
|
||||||
@TableId(type = IdType.ID_WORKER)
|
@TableId(type = IdType.ID_WORKER)
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
|
||||||
@IndexId(type= org.dromara.easyes.annotation.rely.IdType.CUSTOMIZE)
|
@IndexId(type= org.dromara.easyes.annotation.rely.IdType.CUSTOMIZE)
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long courseCollectId;
|
private Long courseCollectId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.*;
|
|||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.dromara.easyes.annotation.IndexId;
|
||||||
|
import org.dromara.easyes.annotation.IndexName;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@@ -14,6 +16,7 @@ import java.io.Serializable;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("course_user")
|
@TableName("course_user")
|
||||||
|
@IndexName("course_user")
|
||||||
public class CourseUser implements Serializable {
|
public class CourseUser implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -23,6 +26,7 @@ public class CourseUser implements Serializable {
|
|||||||
* 我的短剧id
|
* 我的短剧id
|
||||||
*/
|
*/
|
||||||
@TableId(type = IdType.ID_WORKER)
|
@TableId(type = IdType.ID_WORKER)
|
||||||
|
@IndexId(type= org.dromara.easyes.annotation.rely.IdType.CUSTOMIZE)
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long courseUserId;
|
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.annotation.JsonSerialize;
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.dromara.easyes.annotation.IndexId;
|
||||||
|
import org.dromara.easyes.annotation.IndexName;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
@@ -16,9 +18,11 @@ import java.math.BigDecimal;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("disc_spinning_record")
|
@TableName("disc_spinning_record")
|
||||||
|
@IndexName("disc_spinning_record")
|
||||||
public class DiscSpinningRecord extends Model<DiscSpinningRecord> {
|
public class DiscSpinningRecord extends Model<DiscSpinningRecord> {
|
||||||
//主键
|
//主键
|
||||||
@TableId(type = IdType.ID_WORKER)
|
@TableId(type = IdType.ID_WORKER)
|
||||||
|
@IndexId(type= org.dromara.easyes.annotation.rely.IdType.CUSTOMIZE)
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.sqx.modules.es.controller;
|
||||||
|
|
||||||
|
import com.sqx.common.utils.Result;
|
||||||
|
import com.sqx.modules.es.service.EsCoreService;
|
||||||
|
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 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;
|
||||||
|
|
||||||
|
@ApiOperation("同步")
|
||||||
|
@PostMapping("/sync")
|
||||||
|
public Result sync(@ApiIgnore @RequestParam Map<String, Object> params) {
|
||||||
|
esCoreService.sync();
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
package com.sqx.modules.es.controller;
|
|
||||||
|
|
||||||
import com.sqx.common.utils.Result;
|
|
||||||
import com.sqx.modules.es.service.EsOrdersService;
|
|
||||||
import com.sqx.modules.orders.entity.Orders;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import springfox.documentation.annotations.ApiIgnore;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author tankaikai
|
|
||||||
* @since 2025-01-02 20:33
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@RestController
|
|
||||||
@RequestMapping(value = "/es/orders")
|
|
||||||
public class EsOrdersController {
|
|
||||||
@Autowired
|
|
||||||
private EsOrdersService esOrdersService;
|
|
||||||
|
|
||||||
@ApiOperation("分页")
|
|
||||||
@GetMapping("/page")
|
|
||||||
public Result page(@ApiIgnore @RequestParam Map<String, Object> params) {
|
|
||||||
return Result.success().put("page", null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("列表")
|
|
||||||
@GetMapping("/list")
|
|
||||||
public Result list(@ApiIgnore @RequestParam Map<String, Object> params) {
|
|
||||||
List<Orders> data = esOrdersService.list(params);
|
|
||||||
return Result.success().put("data", data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("列表")
|
|
||||||
@GetMapping("/{id}")
|
|
||||||
public Result info(@PathVariable Long id) {
|
|
||||||
Orders data = esOrdersService.info(id);
|
|
||||||
return Result.success().put("data", data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("保存")
|
|
||||||
@PostMapping("/save")
|
|
||||||
public Result save() {
|
|
||||||
esOrdersService.save();
|
|
||||||
return Result.success();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
11
src/main/java/com/sqx/modules/es/mapper/EsCashOutMapper.java
Normal file
11
src/main/java/com/sqx/modules/es/mapper/EsCashOutMapper.java
Normal file
@@ -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.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.pay.entity.PayDetails;
|
||||||
|
import org.dromara.easyes.core.kernel.BaseEsMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author tankaikai
|
||||||
|
* @since 2025-01-06 9:40
|
||||||
|
*/
|
||||||
|
public interface EsPayDetailsMapper extends BaseEsMapper<PayDetails> {
|
||||||
|
}
|
||||||
10
src/main/java/com/sqx/modules/es/service/EsCoreService.java
Normal file
10
src/main/java/com/sqx/modules/es/service/EsCoreService.java
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package com.sqx.modules.es.service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author tankaikai
|
||||||
|
* @since 2025-01-02 20:27
|
||||||
|
*/
|
||||||
|
public interface EsCoreService {
|
||||||
|
|
||||||
|
void sync();
|
||||||
|
}
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package com.sqx.modules.es.service;
|
|
||||||
|
|
||||||
import com.sqx.modules.orders.entity.Orders;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author tankaikai
|
|
||||||
* @since 2025-01-02 20:27
|
|
||||||
*/
|
|
||||||
public interface EsOrdersService {
|
|
||||||
|
|
||||||
List<Orders> page(Map<String, Object> params);
|
|
||||||
|
|
||||||
List<Orders> list(Map<String, Object> params);
|
|
||||||
|
|
||||||
Orders info(Long id);
|
|
||||||
|
|
||||||
void save();
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,179 @@
|
|||||||
|
package com.sqx.modules.es.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Dict;
|
||||||
|
import cn.hutool.core.util.PageUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
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 lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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 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;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sync() {
|
||||||
|
syncOrders();
|
||||||
|
//syncCashOut();
|
||||||
|
//syncCourseCollect();
|
||||||
|
//syncCourseUser();
|
||||||
|
//syncDiscSpinningRecord();
|
||||||
|
//syncPayDetails();
|
||||||
|
//syncUserMoneyDetails();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Dict> buildPageList(int total) {
|
||||||
|
int size = 300;
|
||||||
|
int totalPage = PageUtil.totalPage(total, size);
|
||||||
|
List<Dict> pageList = new ArrayList<>();
|
||||||
|
for (int page = 1; page <= totalPage; page++) {
|
||||||
|
Dict dict = new Dict();
|
||||||
|
dict.set("page", (page - 1) * size);
|
||||||
|
dict.set("size", size);
|
||||||
|
pageList.add(dict);
|
||||||
|
}
|
||||||
|
return pageList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void syncOrders() {
|
||||||
|
Integer total = ordersDao.selectCount(Wrappers.<Orders>lambdaQuery().orderByAsc(Orders::getOrdersId));
|
||||||
|
List<Dict> pageList = buildPageList(total);
|
||||||
|
pageList.parallelStream().forEach(param -> {
|
||||||
|
Integer p = param.getInt("page");
|
||||||
|
Integer s = param.getInt("size");
|
||||||
|
List<Orders> list = ordersDao.selectList(Wrappers.<Orders>lambdaQuery().orderByAsc(Orders::getOrdersId).last(StrUtil.format("limit {},{}", p, s)));
|
||||||
|
esOrdersMapper.insertBatch(list);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void syncCashOut() {
|
||||||
|
LambdaQueryWrapper<CashOut> queryWrapper = Wrappers.<CashOut>lambdaQuery().orderByAsc(CashOut::getId);
|
||||||
|
Integer total = cashOutDao.selectCount(queryWrapper);
|
||||||
|
List<Dict> pageList = buildPageList(total);
|
||||||
|
pageList.parallelStream().forEach(param -> {
|
||||||
|
Integer p = param.getInt("page");
|
||||||
|
Integer s = param.getInt("size");
|
||||||
|
List<CashOut> list = cashOutDao.selectList(queryWrapper.last(StrUtil.format("limit {},{}", p, s)));
|
||||||
|
esCashOutMapper.insertBatch(list);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void syncCourseCollect() {
|
||||||
|
LambdaQueryWrapper<CourseCollect> queryWrapper = Wrappers.<CourseCollect>lambdaQuery().orderByAsc(CourseCollect::getCourseId);
|
||||||
|
Integer total = courseCollectDao.selectCount(queryWrapper);
|
||||||
|
List<Dict> pageList = buildPageList(total);
|
||||||
|
pageList.parallelStream().forEach(param -> {
|
||||||
|
Integer p = param.getInt("page");
|
||||||
|
Integer s = param.getInt("size");
|
||||||
|
List<CourseCollect> list = courseCollectDao.selectList(queryWrapper.last(StrUtil.format("limit {},{}", p, s)));
|
||||||
|
esCourseCollectMapper.insertBatch(list);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void syncCourseUser() {
|
||||||
|
LambdaQueryWrapper<CourseUser> queryWrapper = Wrappers.<CourseUser>lambdaQuery().orderByAsc(CourseUser::getCourseUserId);
|
||||||
|
Integer total = courseUserDao.selectCount(queryWrapper);
|
||||||
|
List<Dict> pageList = buildPageList(total);
|
||||||
|
pageList.parallelStream().forEach(param -> {
|
||||||
|
Integer p = param.getInt("page");
|
||||||
|
Integer s = param.getInt("size");
|
||||||
|
List<CourseUser> list = courseUserDao.selectList(queryWrapper.last(StrUtil.format("limit {},{}", p, s)));
|
||||||
|
esCourseUserMapper.insertBatch(list);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void syncDiscSpinningRecord() {
|
||||||
|
LambdaQueryWrapper<DiscSpinningRecord> queryWrapper = Wrappers.<DiscSpinningRecord>lambdaQuery().orderByAsc(DiscSpinningRecord::getId);
|
||||||
|
Integer total = discSpinningRecordDao.selectCount(queryWrapper);
|
||||||
|
List<Dict> pageList = buildPageList(total);
|
||||||
|
pageList.parallelStream().forEach(param -> {
|
||||||
|
Integer p = param.getInt("page");
|
||||||
|
Integer s = param.getInt("size");
|
||||||
|
List<DiscSpinningRecord> list = discSpinningRecordDao.selectList(queryWrapper.last(StrUtil.format("limit {},{}", p, s)));
|
||||||
|
esDiscSpinningRecordMapper.insertBatch(list);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void syncPayDetails() {
|
||||||
|
LambdaQueryWrapper<PayDetails> queryWrapper = Wrappers.<PayDetails>lambdaQuery().orderByAsc(PayDetails::getId);
|
||||||
|
Integer total = payDetailsDao.selectCount(queryWrapper);
|
||||||
|
List<Dict> pageList = buildPageList(total);
|
||||||
|
pageList.parallelStream().forEach(param -> {
|
||||||
|
Integer p = param.getInt("page");
|
||||||
|
Integer s = param.getInt("size");
|
||||||
|
List<PayDetails> list = payDetailsDao.selectList(queryWrapper.last(StrUtil.format("limit {},{}", p, s)));
|
||||||
|
esPayDetailsMapper.insertBatch(list);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void syncUserMoneyDetails() {
|
||||||
|
LambdaQueryWrapper<UserMoneyDetails> queryWrapper = Wrappers.<UserMoneyDetails>lambdaQuery().orderByAsc(UserMoneyDetails::getId);
|
||||||
|
Integer total = userMoneyDetailsDao.selectCount(queryWrapper);
|
||||||
|
List<Dict> pageList = buildPageList(total);
|
||||||
|
pageList.parallelStream().forEach(param -> {
|
||||||
|
Integer p = param.getInt("page");
|
||||||
|
Integer s = param.getInt("size");
|
||||||
|
List<UserMoneyDetails> list = userMoneyDetailsDao.selectList(queryWrapper.last(StrUtil.format("limit {},{}", p, s)));
|
||||||
|
esUserMoneyDetailsMapper.insertBatch(list);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
package com.sqx.modules.es.service.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.lang.Dict;
|
|
||||||
import cn.hutool.core.util.PageUtil;
|
|
||||||
import com.sqx.modules.app.dao.UserMoneyDetailsDao;
|
|
||||||
import com.sqx.modules.app.entity.UserMoneyDetails;
|
|
||||||
import com.sqx.modules.es.mapper.EsOrdersMapper;
|
|
||||||
import com.sqx.modules.es.mapper.EsUserMoneyDetailsMapper;
|
|
||||||
import com.sqx.modules.es.service.EsOrdersService;
|
|
||||||
import com.sqx.modules.orders.dao.OrdersDao;
|
|
||||||
import com.sqx.modules.orders.entity.Orders;
|
|
||||||
import org.dromara.easyes.core.conditions.select.LambdaEsQueryWrapper;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author tankaikai
|
|
||||||
* @since 2025-01-02 20:27
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class EsOrderServiceImpl implements EsOrdersService {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private OrdersDao ordersDao;
|
|
||||||
@Resource
|
|
||||||
private UserMoneyDetailsDao userMoneyDetailsDao;
|
|
||||||
@Resource
|
|
||||||
private EsOrdersMapper esOrdersMapper;
|
|
||||||
@Resource
|
|
||||||
private EsUserMoneyDetailsMapper esUserMoneyDetailsMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Orders> page(Map<String, Object> params) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Orders> list(Map<String, Object> params) {
|
|
||||||
LambdaEsQueryWrapper<Orders> wrapper = new LambdaEsQueryWrapper<>();
|
|
||||||
wrapper.in(Orders::getCourseId, 1206L, 1208L)
|
|
||||||
.and(i -> i.eq(Orders::getOrdersId, 2307).eq(Orders::getOrdersNo, "1000001141962852"))
|
|
||||||
.or()
|
|
||||||
.and(i -> i.eq(Orders::getOrdersId, 2355).eq(Orders::getOrdersNo, "1000001702936915"));
|
|
||||||
return esOrdersMapper.selectList(wrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Orders info(Long id) {
|
|
||||||
Orders orders = esOrdersMapper.selectById(id);
|
|
||||||
return orders;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void save() {
|
|
||||||
UserMoneyDetails details = userMoneyDetailsDao.selectById(2554L);
|
|
||||||
esUserMoneyDetailsMapper.insert(details);
|
|
||||||
Integer total = ordersDao.esCount();
|
|
||||||
//int size = 300;
|
|
||||||
int size = 1;
|
|
||||||
int totalPage = PageUtil.totalPage(total, size);
|
|
||||||
List<Dict> pageList = new ArrayList<>();
|
|
||||||
for (int page = 1; page <= totalPage; page++) {
|
|
||||||
Dict dict = new Dict();
|
|
||||||
dict.set("page", (page-1)*size);
|
|
||||||
dict.set("size", size);
|
|
||||||
pageList.add(dict);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
pageList.parallelStream().forEach(param -> {
|
|
||||||
Integer p = param.getInt("page");
|
|
||||||
Integer s = param.getInt("size");
|
|
||||||
List<Orders> list = ordersDao.esPage(p, s);
|
|
||||||
esOrdersMapper.insertBatch(list);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -45,9 +45,5 @@ public interface OrdersDao extends BaseMapper<Orders> {
|
|||||||
|
|
||||||
Integer countOrderNum(Long userId, String time);
|
Integer countOrderNum(Long userId, String time);
|
||||||
|
|
||||||
Integer esCount();
|
|
||||||
|
|
||||||
List<Orders> esPage(@Param("page") Integer page, @Param("size") Integer size);
|
|
||||||
|
|
||||||
BigDecimal sumPayByCourseId(Long courseId);
|
BigDecimal sumPayByCourseId(Long courseId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.dromara.easyes.annotation.IndexId;
|
||||||
|
import org.dromara.easyes.annotation.IndexName;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -18,6 +20,7 @@ import java.math.BigDecimal;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("cash_out")
|
@TableName("cash_out")
|
||||||
|
@IndexName("cash_out")
|
||||||
public class CashOut implements Serializable {
|
public class CashOut implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -26,6 +29,7 @@ public class CashOut implements Serializable {
|
|||||||
* 申请提现id
|
* 申请提现id
|
||||||
*/
|
*/
|
||||||
@TableId(type = IdType.ID_WORKER)
|
@TableId(type = IdType.ID_WORKER)
|
||||||
|
@IndexId(type= org.dromara.easyes.annotation.rely.IdType.CUSTOMIZE)
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
@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.annotation.JsonSerialize;
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.dromara.easyes.annotation.IndexId;
|
||||||
|
import org.dromara.easyes.annotation.IndexName;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -17,6 +19,7 @@ import java.math.BigDecimal;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("pay_details")
|
@TableName("pay_details")
|
||||||
|
@IndexName("pay_details")
|
||||||
public class PayDetails implements Serializable {
|
public class PayDetails implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -25,6 +28,7 @@ public class PayDetails implements Serializable {
|
|||||||
* 充值记录id
|
* 充值记录id
|
||||||
*/
|
*/
|
||||||
@TableId(type = IdType.ID_WORKER)
|
@TableId(type = IdType.ID_WORKER)
|
||||||
|
@IndexId(type= org.dromara.easyes.annotation.rely.IdType.CUSTOMIZE)
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.extension.activerecord.Model;
|
|||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.dromara.easyes.annotation.IndexId;
|
||||||
|
import org.dromara.easyes.annotation.IndexName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务领取记录(TaskCenterRecord)表实体类
|
* 任务领取记录(TaskCenterRecord)表实体类
|
||||||
@@ -16,10 +18,12 @@ import lombok.Data;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("task_center_record")
|
@TableName("task_center_record")
|
||||||
|
@IndexName("task_center_record")
|
||||||
@ApiModel(value = "任务领取记录 实体类")
|
@ApiModel(value = "任务领取记录 实体类")
|
||||||
public class TaskCenterRecord extends Model<TaskCenterRecord> {
|
public class TaskCenterRecord extends Model<TaskCenterRecord> {
|
||||||
|
|
||||||
@TableId(type = IdType.ID_WORKER)
|
@TableId(type = IdType.ID_WORKER)
|
||||||
|
@IndexId(type= org.dromara.easyes.annotation.rely.IdType.CUSTOMIZE)
|
||||||
@ApiModelProperty(value = "id",hidden = true)
|
@ApiModelProperty(value = "id",hidden = true)
|
||||||
private Long id;
|
private Long id;
|
||||||
@ApiModelProperty(value = "用户id",hidden = true)
|
@ApiModelProperty(value = "用户id",hidden = true)
|
||||||
|
|||||||
@@ -331,13 +331,4 @@
|
|||||||
and course_id = #{courseId}
|
and course_id = #{courseId}
|
||||||
group by course_id
|
group by course_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<select id="esCount" resultType="int">
|
|
||||||
select count(1) from orders
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="esPage" resultType="com.sqx.modules.orders.entity.Orders">
|
|
||||||
select * from orders order by orders_id asc limit ${page},${size}
|
|
||||||
</select>
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user