集成ES 20250116
This commit is contained in:
@@ -1,10 +1,7 @@
|
|||||||
package com.sqx.modules.es.controller;
|
package com.sqx.modules.es.controller;
|
||||||
|
|
||||||
import cn.hutool.json.JSONUtil;
|
|
||||||
import com.sqx.common.utils.Result;
|
import com.sqx.common.utils.Result;
|
||||||
import com.sqx.modules.es.dao.EsPayDetailDao;
|
|
||||||
import com.sqx.modules.es.service.EsCoreService;
|
import com.sqx.modules.es.service.EsCoreService;
|
||||||
import com.sqx.modules.pay.entity.PayDetails;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -14,7 +11,6 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import springfox.documentation.annotations.ApiIgnore;
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,19 +26,10 @@ public class EsCoreController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private EsCoreService esCoreService;
|
private EsCoreService esCoreService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private EsPayDetailDao esPayDetailsDao;
|
|
||||||
|
|
||||||
@ApiOperation("同步")
|
@ApiOperation("同步")
|
||||||
@PostMapping("/sync")
|
@PostMapping("/sync")
|
||||||
public Result sync(@ApiIgnore @RequestParam Map<String, Object> params) {
|
public Result sync(@ApiIgnore @RequestParam Map<String, Object> params) {
|
||||||
PayDetails payDetails = esPayDetailsDao.selectByOrderId("1000001851456083");
|
esCoreService.sync();
|
||||||
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();
|
return Result.success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.sqx.modules.es.service;
|
package com.sqx.modules.es.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import org.dromara.easyes.core.kernel.BaseEsMapper;
|
import org.dromara.easyes.core.kernel.BaseEsMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -8,4 +9,6 @@ import org.dromara.easyes.core.kernel.BaseEsMapper;
|
|||||||
*/
|
*/
|
||||||
public interface IEsService<T> {
|
public interface IEsService<T> {
|
||||||
BaseEsMapper<T> getBaseEsMapper();
|
BaseEsMapper<T> getBaseEsMapper();
|
||||||
|
|
||||||
|
IService<T> getOriginalService();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,20 +4,14 @@ import com.sqx.modules.es.mapper.EsOrdersMapper;
|
|||||||
import com.sqx.modules.es.service.EsOrdersService;
|
import com.sqx.modules.es.service.EsOrdersService;
|
||||||
import com.sqx.modules.orders.entity.Orders;
|
import com.sqx.modules.orders.entity.Orders;
|
||||||
import com.sqx.modules.orders.service.OrdersService;
|
import com.sqx.modules.orders.service.OrdersService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author tankaikai
|
* @author tankaikai
|
||||||
* @since 2025-01-16 9:51
|
* @since 2025-01-16 9:51
|
||||||
*/
|
*/
|
||||||
public class EsOrdersServiceImpl extends EsServiceImpl<EsOrdersMapper, Orders> implements EsOrdersService {
|
@Service
|
||||||
|
public class EsOrdersServiceImpl extends EsServiceImpl<EsOrdersMapper, OrdersService, Orders> implements EsOrdersService {
|
||||||
|
|
||||||
@Resource
|
|
||||||
private OrdersService ordersService;
|
|
||||||
|
|
||||||
public OrdersService getOriginalService() {
|
|
||||||
return ordersService;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,25 @@
|
|||||||
package com.sqx.modules.es.service.impl;
|
package com.sqx.modules.es.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.sqx.modules.es.service.IEsService;
|
import com.sqx.modules.es.service.IEsService;
|
||||||
import org.apache.ibatis.logging.Log;
|
import org.apache.ibatis.logging.Log;
|
||||||
import org.apache.ibatis.logging.LogFactory;
|
import org.apache.ibatis.logging.LogFactory;
|
||||||
import org.dromara.easyes.core.kernel.BaseEsMapper;
|
import org.dromara.easyes.core.kernel.BaseEsMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author tankaikai
|
* @author tankaikai
|
||||||
* @since 2025-01-16 9:45
|
* @since 2025-01-16 9:45
|
||||||
*/
|
*/
|
||||||
public class EsServiceImpl<M extends BaseEsMapper<T>, T> implements IEsService<T> {
|
public class EsServiceImpl<M extends BaseEsMapper<T>, S extends IService<T>,T> implements IEsService<T> {
|
||||||
protected Log log = LogFactory.getLog(this.getClass());
|
protected Log log = LogFactory.getLog(this.getClass());
|
||||||
@Resource
|
|
||||||
|
@Autowired
|
||||||
protected M baseEsMapper;
|
protected M baseEsMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
protected S originalService;
|
||||||
|
|
||||||
public EsServiceImpl() {
|
public EsServiceImpl() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,4 +27,8 @@ public class EsServiceImpl<M extends BaseEsMapper<T>, T> implements IEsService<T
|
|||||||
return this.baseEsMapper;
|
return this.baseEsMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public S getOriginalService() {
|
||||||
|
return this.originalService;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user