master
parent
8cbbe2bce6
commit
594df81b1b
|
@ -10,6 +10,7 @@
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-ask/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-ask/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-background/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-background/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-background/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-background/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-esask/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-group/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-group/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-group/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-group/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-home/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-home/src/main/java" charset="UTF-8" />
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<elasticsearch.version>7.17.0</elasticsearch.version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- bootstrap 启动器 -->
|
<!-- bootstrap 启动器 -->
|
||||||
|
@ -53,6 +54,11 @@
|
||||||
<artifactId>jjwt</artifactId>
|
<artifactId>jjwt</artifactId>
|
||||||
<version>0.9.1</version>
|
<version>0.9.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- ES-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.elasticsearch.client</groupId>
|
||||||
|
<artifactId>elasticsearch-rest-high-level-client</artifactId>
|
||||||
|
</dependency>
|
||||||
<!-- Alibaba Fastjson -->
|
<!-- Alibaba Fastjson -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.bwie.common.handler;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.bwie.common.result.Result;
|
import com.bwie.common.result.Result;
|
||||||
|
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.validation.ObjectError;
|
import org.springframework.validation.ObjectError;
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.bwie.gateway.config;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.extern.log4j.Log4j2;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.bwie.gateway.utils;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.bwie.common.result.Result;
|
import com.bwie.common.result.Result;
|
||||||
import com.bwie.common.utils.StringUtils;
|
import com.bwie.common.utils.StringUtils;
|
||||||
import lombok.extern.log4j.Log4j2;
|
|
||||||
import org.springframework.core.io.buffer.DataBuffer;
|
import org.springframework.core.io.buffer.DataBuffer;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<elasticsearch.version>7.17.0</elasticsearch.version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- 系统公共 依赖 -->
|
<!-- 系统公共 依赖 -->
|
||||||
|
@ -23,12 +24,20 @@
|
||||||
<groupId>com.bwie</groupId>
|
<groupId>com.bwie</groupId>
|
||||||
<artifactId>bwie-common</artifactId>
|
<artifactId>bwie-common</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>xin.altitude.cms.common</groupId>
|
||||||
|
<artifactId>ucode-cms-common</artifactId>
|
||||||
|
<version>1.3.4</version>
|
||||||
|
</dependency>
|
||||||
<!-- SpringBoot Web-->
|
<!-- SpringBoot Web-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.elasticsearch.client</groupId>
|
||||||
|
<artifactId>elasticsearch-rest-high-level-client</artifactId>
|
||||||
|
</dependency>
|
||||||
<!-- Druid -->
|
<!-- Druid -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
|
|
|
@ -4,8 +4,11 @@ import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableDiscoveryClient
|
@EnableDiscoveryClient
|
||||||
|
@EnableScheduling
|
||||||
@MapperScan("com.bwie.ask.mapper")
|
@MapperScan("com.bwie.ask.mapper")
|
||||||
public class AskApp {
|
public class AskApp {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
package com.bwie.ask.controller;
|
package com.bwie.ask.controller;
|
||||||
|
|
||||||
import com.bwie.ask.seriver.AskBuyService;
|
import com.bwie.ask.seriver.AskBuyService;
|
||||||
import com.bwie.common.domain.AskBuy;
|
import com.bwie.common.domain.AskBuy;
|
||||||
import com.bwie.common.result.Result;
|
import com.bwie.common.result.Result;
|
||||||
|
@ -7,30 +6,23 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 求购controller层
|
* 求购controller层
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/buy")
|
@RequestMapping("/buy")
|
||||||
public class AskBuyController {
|
public class AskBuyController {
|
||||||
|
|
||||||
private final AskBuyService askBuyService;
|
private final AskBuyService askBuyService;
|
||||||
|
|
||||||
public AskBuyController(AskBuyService askBuyService) {
|
public AskBuyController(AskBuyService askBuyService) {
|
||||||
this.askBuyService = askBuyService;
|
this.askBuyService = askBuyService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/shouAll")
|
@PostMapping("/shouAll")
|
||||||
public Result<List<AskBuy>> shouAll(){
|
public Result<List<AskBuy>> shouAll(){
|
||||||
return askBuyService.shouAll();
|
return askBuyService.shouAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/addAskBuy")
|
@PostMapping("/addAskBuy")
|
||||||
public Result addAskBuy(@RequestBody AskBuy askBuy){
|
public Result addAskBuy(@RequestBody AskBuy askBuy){
|
||||||
return askBuyService.addAskBuy(askBuy);
|
return askBuyService.addAskBuy(askBuy);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
package com.bwie.ask.controller;
|
|
||||||
|
|
||||||
import com.bwie.ask.seriver.EsAskBuyService;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Es求购表
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/esBuy")
|
|
||||||
public class EsAskBuyController {
|
|
||||||
|
|
||||||
private final EsAskBuyService esAskBuyService;
|
|
||||||
|
|
||||||
public EsAskBuyController(EsAskBuyService esAskBuyService) {
|
|
||||||
this.esAskBuyService = esAskBuyService;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
package com.bwie.ask.controller;
|
|
||||||
|
|
||||||
import com.bwie.ask.seriver.EsAskRentService;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Es求租表
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/esRent")
|
|
||||||
public class EsAskRentController {
|
|
||||||
|
|
||||||
private final EsAskRentService esAskRentService;
|
|
||||||
|
|
||||||
public EsAskRentController(EsAskRentService esAskRentService) {
|
|
||||||
this.esAskRentService = esAskRentService;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
package com.bwie.ask.seriver;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.bwie.common.domain.AskBuy;
|
|
||||||
import com.bwie.common.domain.AskRent;
|
|
||||||
|
|
||||||
public interface EsAskBuyService extends IService<AskBuy> {
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
package com.bwie.ask.seriver;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.bwie.common.domain.AskBuy;
|
|
||||||
import com.bwie.common.domain.AskRent;
|
|
||||||
|
|
||||||
public interface EsAskRentService extends IService<AskRent> {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -5,6 +5,7 @@ import com.bwie.ask.mapper.AskBuyMapper;
|
||||||
import com.bwie.ask.seriver.AskBuyService;
|
import com.bwie.ask.seriver.AskBuyService;
|
||||||
import com.bwie.common.domain.AskBuy;
|
import com.bwie.common.domain.AskBuy;
|
||||||
import com.bwie.common.result.Result;
|
import com.bwie.common.result.Result;
|
||||||
|
import org.hibernate.validator.internal.util.stereotypes.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -34,6 +35,21 @@ public class AskBuyServiceImpl extends ServiceImpl<AskBuyMapper, AskBuy> impleme
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public Result addAskBuy(AskBuy askBuy){
|
public Result addAskBuy(AskBuy askBuy){
|
||||||
|
if(askBuy.getAskBuyAddress()==null || askBuy.getAskBuyAddress().equals("")){
|
||||||
|
return Result.error("具体位置不能为空!!!!");
|
||||||
|
}
|
||||||
|
if(askBuy.getAskBuyTitle()==null || askBuy.getAskBuyTitle().equals("")){
|
||||||
|
return Result.error("标签不能为空!!!!");
|
||||||
|
}
|
||||||
|
if(askBuy.getAskBuyPrice()==null || askBuy.getAskBuyPrice().equals("")){
|
||||||
|
return Result.error("期望价格 不允许为空!!!!");
|
||||||
|
}
|
||||||
|
if(askBuy.getDictionaryTypeId()==null){
|
||||||
|
return Result.error("求购类型不允许为空!!!!");
|
||||||
|
}
|
||||||
|
if(askBuy.getAddrId()==null){
|
||||||
|
return Result.error("具体的省市县不允许为空!!!!");
|
||||||
|
}
|
||||||
Integer i = askBuyMapper.addAskBuy(askBuy);
|
Integer i = askBuyMapper.addAskBuy(askBuy);
|
||||||
return Result.success(i>0?200:500,i>0?"发表成功!!!!":"发表失败!!!!");
|
return Result.success(i>0?200:500,i>0?"发表成功!!!!":"发表失败!!!!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,24 @@ public class AskRentServiceImpl extends ServiceImpl<AskRentMapper, AskRent> impl
|
||||||
return Result.success(askRentList);
|
return Result.success(askRentList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result addAskRent(AskRent askRent){
|
public Result addAskRent(AskRent askRent){
|
||||||
|
if(askRent.getAskRentAddress()==null || askRent.getAskRentAddress().equals("")){
|
||||||
|
return Result.error("具体位置不能为空!!!!");
|
||||||
|
}
|
||||||
|
if(askRent.getAskRentTitle()==null || askRent.getAskRentTitle().equals("")){
|
||||||
|
return Result.error("标签不能为空!!!!");
|
||||||
|
}
|
||||||
|
if(askRent.getAskRentPrice()==null || askRent.getAskRentPrice().equals("")){
|
||||||
|
return Result.error("期望价格 不允许为空!!!!");
|
||||||
|
}
|
||||||
|
if(askRent.getDictionaryTypeId()==null){
|
||||||
|
return Result.error("求购类型不允许为空!!!!");
|
||||||
|
}
|
||||||
|
if(askRent.getAddrId()==null){
|
||||||
|
return Result.error("具体的省市县不允许为空!!!!");
|
||||||
|
}
|
||||||
Integer i = askRentMapper.addAskRent(askRent);
|
Integer i = askRentMapper.addAskRent(askRent);
|
||||||
return Result.success(i>0?200:500,i>0?"发表成功!!!!":"发表失败!!!!");
|
return Result.success(i>0?200:500,i>0?"发表成功!!!!":"发表失败!!!!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
package com.bwie.ask.seriver.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.bwie.ask.mapper.EsAskBuyMapper;
|
|
||||||
import com.bwie.ask.seriver.EsAskBuyService;
|
|
||||||
import com.bwie.common.domain.AskBuy;
|
|
||||||
import com.bwie.common.redis.RedisCache;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
/**
|
|
||||||
* Es求购表
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class EsAskBuyServiceImpl extends ServiceImpl<EsAskBuyMapper, AskBuy> implements EsAskBuyService {
|
|
||||||
|
|
||||||
private final RedisCache redisCache;
|
|
||||||
private final EsAskBuyMapper esAskBuyMapper;
|
|
||||||
|
|
||||||
public EsAskBuyServiceImpl(RedisCache redisCache, EsAskBuyMapper esAskBuyMapper) {
|
|
||||||
this.redisCache = redisCache;
|
|
||||||
this.esAskBuyMapper = esAskBuyMapper;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
package com.bwie.ask.seriver.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.bwie.ask.mapper.EsAskRentMapper;
|
|
||||||
import com.bwie.ask.seriver.EsAskRentService;
|
|
||||||
import com.bwie.common.domain.AskRent;
|
|
||||||
import com.bwie.common.redis.RedisCache;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
/**
|
|
||||||
* Es求租表
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class EsAskRentServiceImpl extends ServiceImpl<EsAskRentMapper, AskRent> implements EsAskRentService {
|
|
||||||
|
|
||||||
|
|
||||||
private final RedisCache redisCache;
|
|
||||||
|
|
||||||
private final EsAskRentService esAskRentService;
|
|
||||||
|
|
||||||
public EsAskRentServiceImpl(RedisCache redisCache, EsAskRentService esAskRentService) {
|
|
||||||
this.redisCache = redisCache;
|
|
||||||
this.esAskRentService = esAskRentService;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
<insert id="addAskBuy">
|
<insert id="addAskBuy">
|
||||||
INSERT INTO `xm_house`.`askbuy` (`askbuy_address`, `askbuy_title`, `dictionary_type_id`, `addr_id`, `user_id`, `askbuy_price`, `is_delete`, `create_time`, `update_time`)
|
INSERT INTO `xm_house`.`askbuy` (`askbuy_address`, `askbuy_title`, `dictionary_type_id`, `addr_id`, `user_id`, `askbuy_price`, `is_delete`, `create_time`, `update_time`)
|
||||||
VALUES (#{askBuyAddress},#{askbuy},#{dictionaryTypeId},#{addrId},#{userId},#{askBuyPrice},#{isDelete},#{createTime},#{updateTime});
|
VALUES (#{askBuyAddress},#{askBuyTitle},#{dictionaryTypeId},#{addrId},#{userId},#{askBuyPrice},#{isDelete},#{createTime},#{updateTime});
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<select id="shouAll" resultType="com.bwie.common.domain.AskBuy">
|
<select id="shouAll" resultType="com.bwie.common.domain.AskBuy">
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.bwie.ask.mapper.AskRentMapper">
|
<mapper namespace="com.bwie.ask.mapper.AskRentMapper">
|
||||||
<insert id="addAskRent">
|
<insert id="addAskRent">
|
||||||
INSERT INTO `xm_house`.`askrent` (`askrent_address`, `askrent_title`, `dictionary_type_id`, `addr_id`, `user_id`, `askrent_price`, `is_delete`,
|
INSERT INTO `xm_house`.`askrent` (`askrent_address`, `askrent_title`, `dictionary_type_id`, `addr_id`, `user_id`, `askrent_price`, `is_delete`, `create_time`, `update_time`) VALUES
|
||||||
`craete_time`, `update_time`)
|
(#{askRentAddress},#{askRentTitle},#{dictionaryTypeId},#{addrId},#{userId},#{askRentPrice},#{isDelete},#{createTime},#{updateTime});
|
||||||
VALUES (#{askRentAddress},#{askRentTitle},#{dictionaryTypeId},#{addrId},#{userId},#{askRentPrice},#{isDelete},#{createTime},#{updateTime});
|
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<select id="shouList" resultType="com.bwie.common.domain.AskRent">
|
<select id="shouList" resultType="com.bwie.common.domain.AskRent">
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.bwie</groupId>
|
||||||
|
<artifactId>house_project</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<relativePath>../../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>bwie-esask</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<elasticsearch.version>7.17.0</elasticsearch.version>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<!-- 系统公共 依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.bwie</groupId>
|
||||||
|
<artifactId>bwie-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>xin.altitude.cms.common</groupId>
|
||||||
|
<artifactId>ucode-cms-common</artifactId>
|
||||||
|
<version>1.3.4</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- SpringBoot Web-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.elasticsearch.client</groupId>
|
||||||
|
<artifactId>elasticsearch-rest-high-level-client</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- Druid -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
|
<version>1.2.8</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- Mysql Connector -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- Mybatis 依赖配置 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
|
<version>2.2.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Pagehelper -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
|
<version>1.4.1</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- test -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.elasticsearch</groupId>
|
||||||
|
<artifactId>elasticsearch-x-content</artifactId>
|
||||||
|
<version>7.17.12</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.bwie.esask;
|
||||||
|
|
||||||
|
import com.bwie.common.redis.RedisCache;
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||||
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableDiscoveryClient
|
||||||
|
@EnableFeignClients
|
||||||
|
@EnableScheduling
|
||||||
|
@MapperScan("com.bwie.esask.mapper")
|
||||||
|
@Import(value = {RedisCache.class})
|
||||||
|
public class EsAskApp {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(EsAskApp.class);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.bwie.esask.config;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.apache.http.HttpHost;
|
||||||
|
import org.elasticsearch.client.RestClient;
|
||||||
|
import org.elasticsearch.client.RestHighLevelClient;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@ConfigurationProperties(prefix = "es")
|
||||||
|
@Data
|
||||||
|
public class InitEsRes {
|
||||||
|
private String host;
|
||||||
|
private int port;
|
||||||
|
private String scheme;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public RestHighLevelClient restHighLevelClient(){
|
||||||
|
return new RestHighLevelClient(
|
||||||
|
RestClient.builder(new HttpHost(host,port,scheme))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.bwie.esask.controller;
|
||||||
|
|
||||||
|
import com.bwie.esask.seriver.EsAskBuyService;
|
||||||
|
import com.bwie.common.domain.AskBuy;
|
||||||
|
import com.bwie.common.domain.request.AskBuyRequest;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Es求购表
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/esBuy")
|
||||||
|
public class EsAskBuyController {
|
||||||
|
|
||||||
|
private final EsAskBuyService esAskBuyService;
|
||||||
|
|
||||||
|
public EsAskBuyController(EsAskBuyService esAskBuyService) {
|
||||||
|
this.esAskBuyService = esAskBuyService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/shouList")
|
||||||
|
public void shouList(@RequestBody List<AskBuy> list){
|
||||||
|
esAskBuyService.shouList(list);
|
||||||
|
}
|
||||||
|
@PostMapping("/shouBuyList")
|
||||||
|
public Result shouBuyList(@RequestBody AskBuyRequest askBuyRequest){
|
||||||
|
return esAskBuyService.shouBuyList(askBuyRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.bwie.esask.controller;
|
||||||
|
|
||||||
|
import com.bwie.esask.seriver.EsAskRentService;
|
||||||
|
import com.bwie.common.domain.AskRent;
|
||||||
|
import com.bwie.common.domain.request.AskRentRequest;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Es求租表
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/esRent")
|
||||||
|
public class EsAskRentController {
|
||||||
|
|
||||||
|
private final EsAskRentService esAskRentService;
|
||||||
|
|
||||||
|
public EsAskRentController(EsAskRentService esAskRentService) {
|
||||||
|
this.esAskRentService = esAskRentService;
|
||||||
|
}
|
||||||
|
@PostMapping("/shouListt")
|
||||||
|
public void shouListt(@RequestBody List<AskRent> list){
|
||||||
|
esAskRentService.shouListt(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/shouRentList")
|
||||||
|
public Result shouRentList(@RequestBody AskRentRequest askRentRequest){
|
||||||
|
return esAskRentService.shouRentList(askRentRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.bwie.esask.feign;
|
||||||
|
|
||||||
|
import com.bwie.common.domain.AskBuy;
|
||||||
|
import com.bwie.common.domain.AskRent;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@FeignClient("bwie-ask")
|
||||||
|
public interface AskBuyRentFeign {
|
||||||
|
|
||||||
|
@PostMapping("/buy/shouAll")
|
||||||
|
public Result<List<AskBuy>> shouAll();
|
||||||
|
|
||||||
|
@PostMapping("/rent/shouList")
|
||||||
|
public Result<List<AskRent>> shouList();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,12 +1,13 @@
|
||||||
package com.bwie.ask.mapper;
|
package com.bwie.esask.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.bwie.common.domain.AskBuy;
|
import com.bwie.common.domain.AskBuy;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Es求购同步表
|
* Es求购同步表
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface EsAskBuyMapper extends BaseMapper<AskBuy> {
|
public interface EsAskBuyMapper extends BaseMapper<AskBuy> {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.bwie.ask.mapper;
|
package com.bwie.esask.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.bwie.common.domain.AskBuy;
|
import com.bwie.common.domain.AskBuy;
|
||||||
|
@ -15,6 +15,4 @@ import java.util.List;
|
||||||
public interface EsAskRentMapper extends BaseMapper<AskRent> {
|
public interface EsAskRentMapper extends BaseMapper<AskRent> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.bwie.esask.seriver;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.bwie.common.domain.AskBuy;
|
||||||
|
import com.bwie.common.domain.AskRent;
|
||||||
|
import com.bwie.common.domain.request.AskBuyRequest;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface EsAskBuyService extends IService<AskBuy> {
|
||||||
|
|
||||||
|
public void shouList(List<AskBuy> list);
|
||||||
|
|
||||||
|
public Result shouBuyList(AskBuyRequest askBuyRequest);
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.bwie.esask.seriver;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.bwie.common.domain.AskBuy;
|
||||||
|
import com.bwie.common.domain.AskRent;
|
||||||
|
import com.bwie.common.domain.request.AskRentRequest;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface EsAskRentService extends IService<AskRent> {
|
||||||
|
|
||||||
|
public void shouListt(List<AskRent> list);
|
||||||
|
|
||||||
|
public Result shouRentList(AskRentRequest askRentRequest);
|
||||||
|
}
|
|
@ -0,0 +1,90 @@
|
||||||
|
package com.bwie.esask.seriver.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.bwie.esask.feign.AskBuyRentFeign;
|
||||||
|
import com.bwie.esask.mapper.EsAskBuyMapper;
|
||||||
|
import com.bwie.esask.seriver.EsAskBuyService;
|
||||||
|
import com.bwie.common.domain.AskBuy;
|
||||||
|
import com.bwie.common.domain.request.AskBuyRequest;
|
||||||
|
import com.bwie.common.redis.RedisCache;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import org.elasticsearch.action.bulk.BulkRequest;
|
||||||
|
import org.elasticsearch.action.index.IndexRequest;
|
||||||
|
import org.elasticsearch.action.search.SearchRequest;
|
||||||
|
import org.elasticsearch.action.search.SearchResponse;
|
||||||
|
import org.elasticsearch.client.RequestOptions;
|
||||||
|
import org.elasticsearch.client.RestHighLevelClient;
|
||||||
|
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||||
|
import org.elasticsearch.index.query.QueryBuilders;
|
||||||
|
import org.elasticsearch.search.SearchHit;
|
||||||
|
import org.elasticsearch.search.SearchHits;
|
||||||
|
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||||
|
import org.elasticsearch.xcontent.XContentType;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Es求购表
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class EsAskBuyServiceImpl extends ServiceImpl<EsAskBuyMapper, AskBuy> implements EsAskBuyService {
|
||||||
|
|
||||||
|
private final RedisCache redisCache;
|
||||||
|
|
||||||
|
|
||||||
|
private final RestHighLevelClient client;
|
||||||
|
|
||||||
|
private final AskBuyRentFeign askBuyRentFeign;
|
||||||
|
|
||||||
|
public EsAskBuyServiceImpl(RedisCache redisCache,RestHighLevelClient client, AskBuyRentFeign askBuyRentFeign) {
|
||||||
|
this.redisCache = redisCache;
|
||||||
|
this.client = client;
|
||||||
|
this.askBuyRentFeign = askBuyRentFeign;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void shouList(List<AskBuy> list){
|
||||||
|
try {
|
||||||
|
BulkRequest bulkRequest = new BulkRequest();
|
||||||
|
list.forEach(askBuy -> {
|
||||||
|
bulkRequest.add(
|
||||||
|
new IndexRequest("askbuy")
|
||||||
|
.id(JSON.toJSONString(askBuy.getAskBuyId()))
|
||||||
|
.source(JSON.toJSONString(askBuy),XContentType.JSON)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
client.bulk(bulkRequest, RequestOptions.DEFAULT);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Result shouBuyList(AskBuyRequest askBuyRequest){
|
||||||
|
ArrayList<AskBuy> arrayList = new ArrayList<>();
|
||||||
|
SearchRequest searchRequest = new SearchRequest("askbuy");
|
||||||
|
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
|
||||||
|
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
|
||||||
|
sourceBuilder.query(boolQueryBuilder);
|
||||||
|
searchRequest.source(sourceBuilder);
|
||||||
|
try {
|
||||||
|
SearchResponse search = client.search(searchRequest, RequestOptions.DEFAULT);
|
||||||
|
SearchHits hits = search.getHits();
|
||||||
|
if(hits!=null){
|
||||||
|
for (SearchHit hit : hits.getHits()) {
|
||||||
|
String sourceAsString = hit.getSourceAsString();
|
||||||
|
AskBuy askBuy = JSON.parseObject(sourceAsString, AskBuy.class);
|
||||||
|
arrayList.add(askBuy);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return Result.success(arrayList);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,90 @@
|
||||||
|
package com.bwie.esask.seriver.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.bwie.esask.mapper.EsAskRentMapper;
|
||||||
|
import com.bwie.esask.seriver.EsAskRentService;
|
||||||
|
import com.bwie.common.domain.AskRent;
|
||||||
|
import com.bwie.common.domain.request.AskRentRequest;
|
||||||
|
import com.bwie.common.redis.RedisCache;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import org.elasticsearch.action.bulk.BulkRequest;
|
||||||
|
import org.elasticsearch.action.index.IndexRequest;
|
||||||
|
import org.elasticsearch.action.search.SearchRequest;
|
||||||
|
import org.elasticsearch.action.search.SearchResponse;
|
||||||
|
import org.elasticsearch.client.RequestOptions;
|
||||||
|
import org.elasticsearch.client.RestHighLevelClient;
|
||||||
|
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||||
|
import org.elasticsearch.index.query.QueryBuilders;
|
||||||
|
import org.elasticsearch.search.SearchHit;
|
||||||
|
import org.elasticsearch.search.SearchHits;
|
||||||
|
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||||
|
import org.elasticsearch.xcontent.XContentType;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Es求租表
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class EsAskRentServiceImpl extends ServiceImpl<EsAskRentMapper, AskRent> implements EsAskRentService {
|
||||||
|
|
||||||
|
|
||||||
|
private final RedisCache redisCache;
|
||||||
|
|
||||||
|
|
||||||
|
private final RestHighLevelClient client;
|
||||||
|
|
||||||
|
public EsAskRentServiceImpl(RedisCache redisCache, RestHighLevelClient client) {
|
||||||
|
this.redisCache = redisCache;
|
||||||
|
this.client = client;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void shouListt(List<AskRent> list) {
|
||||||
|
try {
|
||||||
|
BulkRequest bulkRequest = new BulkRequest();
|
||||||
|
list.forEach(askRent -> {
|
||||||
|
bulkRequest.add(
|
||||||
|
new IndexRequest("askrent")
|
||||||
|
.id(JSON.toJSONString(askRent.getAskRentId()))
|
||||||
|
.source(JSON.toJSONString(askRent),XContentType.JSON)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
client.bulk(bulkRequest,RequestOptions.DEFAULT);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//求购的链表
|
||||||
|
@Override
|
||||||
|
public Result shouRentList(AskRentRequest askRentRequest){
|
||||||
|
ArrayList<AskRent> arrayList = new ArrayList<>();
|
||||||
|
SearchRequest searchRequest = new SearchRequest("askrent");
|
||||||
|
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
|
||||||
|
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
|
||||||
|
sourceBuilder.query(boolQueryBuilder);
|
||||||
|
searchRequest.source(sourceBuilder);
|
||||||
|
try {
|
||||||
|
SearchResponse search = client.search(searchRequest, RequestOptions.DEFAULT);
|
||||||
|
SearchHits hits = search.getHits();
|
||||||
|
if(hits!=null){
|
||||||
|
for (SearchHit hit : hits.getHits()) {
|
||||||
|
String sourceAsString = hit.getSourceAsString();
|
||||||
|
AskRent askRent = JSON.parseObject(sourceAsString, AskRent.class);
|
||||||
|
arrayList.add(askRent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return Result.success(arrayList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.bwie.esask.sync;
|
||||||
|
|
||||||
|
import com.bwie.common.domain.AskRent;
|
||||||
|
import com.bwie.esask.feign.AskBuyRentFeign;
|
||||||
|
import com.bwie.esask.seriver.EsAskBuyService;
|
||||||
|
import com.bwie.common.domain.AskBuy;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import com.bwie.esask.seriver.EsAskRentService;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
/**
|
||||||
|
* 同步求购表
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class AskBuySync {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 求购表
|
||||||
|
*/
|
||||||
|
private final AskBuyRentFeign askBuyRentFeign;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 求租表
|
||||||
|
*/
|
||||||
|
private final EsAskRentService esAskRentService;
|
||||||
|
private final EsAskBuyService esAskBuyService;
|
||||||
|
public AskBuySync(AskBuyRentFeign askBuyRentFeign, EsAskRentService askRentService, EsAskBuyService esAskBuyService) {
|
||||||
|
this.askBuyRentFeign = askBuyRentFeign;
|
||||||
|
this.esAskRentService = askRentService;
|
||||||
|
this.esAskBuyService = esAskBuyService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Scheduled(cron = "0/5 * * * * ?")
|
||||||
|
public void buySync(){
|
||||||
|
Result<List<AskBuy>> listResult = askBuyRentFeign.shouAll();
|
||||||
|
List<AskBuy> data = listResult.getData();
|
||||||
|
if(data!=null){
|
||||||
|
esAskBuyService.shouList(data);
|
||||||
|
}
|
||||||
|
System.out.println("定时器求购正常启动!!!!!!");
|
||||||
|
|
||||||
|
Result<List<AskRent>> listResulta = askBuyRentFeign.shouList();
|
||||||
|
List<AskRent> dataa = listResulta.getData();
|
||||||
|
if(dataa!=null) {
|
||||||
|
esAskRentService.shouListt(dataa);
|
||||||
|
}
|
||||||
|
System.out.println("定时器求租正常启动!!!!!!");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
es:
|
||||||
|
host: 124.221.177.197
|
||||||
|
port: 9200
|
||||||
|
scheme: http
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 9004
|
||||||
|
# Spring
|
||||||
|
spring:
|
||||||
|
main:
|
||||||
|
allow-circular-references: true
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
jackson:
|
||||||
|
date-format: yyyy-MM-dd HH:mm:ss
|
||||||
|
time-zone: GMT+8
|
||||||
|
application:
|
||||||
|
# 应用名称
|
||||||
|
name: bwie-es
|
||||||
|
profiles:
|
||||||
|
# 环境配置
|
||||||
|
active: dev
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: 124.221.177.197:8848
|
||||||
|
config:
|
||||||
|
# 配置中心地址
|
||||||
|
server-addr: 124.221.177.197:8848
|
||||||
|
# 配置文件格式
|
||||||
|
file-extension: yml
|
||||||
|
# 共享配置
|
||||||
|
shared-configs:
|
||||||
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.bwie.ask.mapper.EsAskBuyMapper">
|
<mapper namespace="com.bwie.esask.mapper.EsAskBuyMapper">
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.bwie.ask.mapper.EsAskRentMapper">
|
<mapper namespace="com.bwie.esask.mapper.EsAskRentMapper">
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
1
pom.xml
1
pom.xml
|
@ -16,6 +16,7 @@
|
||||||
<module>bwie-modules/bwie-background</module>
|
<module>bwie-modules/bwie-background</module>
|
||||||
<module>bwie-modules/bwie-ask</module>
|
<module>bwie-modules/bwie-ask</module>
|
||||||
<module>bwie-modules/bwie-home</module>
|
<module>bwie-modules/bwie-home</module>
|
||||||
|
<module>bwie-modules/bwie-esask</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|
Loading…
Reference in New Issue