嘉宝宝

master
Guo YuKun 2024-03-27 11:02:26 +08:00
parent c35cec22ca
commit 598247f1c6
11 changed files with 44 additions and 36 deletions

View File

@ -8,6 +8,7 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@ -42,5 +43,5 @@ public class House {
private Date createTime; //创建时间
private Date updateTime; //最近更新时间
private Integer isDelete; //逻辑删除字段
private Long dictionaryTypeId;
}

View File

@ -19,4 +19,5 @@ public class HouseImages {
private Long id; //id
private Long houseId; //房型id
private String imageAddr; //图片地址
}

View File

@ -8,7 +8,6 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import java.util.stream.Collectors;

View File

@ -1,11 +1,13 @@
package com.bwie.common.remote.house;
import com.bwie.common.domain.House;
import com.bwie.common.domain.request.HouseEsRequest;
import com.bwie.common.remote.house.factory.RemoteHouseFactory;
import com.bwie.common.result.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import java.util.List;
@ -17,4 +19,7 @@ import java.util.List;
public interface RemoteHouseService {
@GetMapping("/list")
public Result<List<HouseEsRequest>> getHouseEsList();
@PostMapping("/shouall")
public Result<List<House>> shouall();
}

View File

@ -1,5 +1,6 @@
package com.bwie.common.remote.house.factory;
import com.bwie.common.domain.House;
import com.bwie.common.domain.request.HouseEsRequest;
import com.bwie.common.remote.house.RemoteHouseService;
@ -21,6 +22,12 @@ public class RemoteHouseFactory implements FallbackFactory<RemoteHouseService> {
log.error("远程调用失败:[{}]",cause.getMessage(),cause);
return Result.error(cause.getMessage());
}
@Override
public Result<List<House>> shouall(){
log.error("远程调用失败:[{}]",cause.getMessage(),cause);
return Result.error(cause.getMessage());
}
};
}
}

View File

@ -0,0 +1,18 @@
package com.bwie.es;
import com.bwie.common.handler.GlobalExceptionHandle;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Import;
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@EnableFeignClients("com.bwie.**")
@EnableDiscoveryClient
public class EsApplication {
public static void main(String[] args) {
SpringApplication.run(EsApplication.class);
}
}

View File

@ -7,6 +7,7 @@ import com.bwie.common.result.Result;
import com.bwie.es.service.EsService;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Component;
@ -14,6 +15,7 @@ import java.util.List;
@Component
@Log4j2
public class SyncHouseData {
private final RemoteHouseService remoteHouseService;

View File

@ -1,29 +0,0 @@
package com.bwie.home.controller;
import com.bwie.common.domain.House;
import com.bwie.common.result.Result;
import com.bwie.home.service.HomeListService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
public class HomeListController {
private final HomeListService homeListService;
public HomeListController(HomeListService homeService) {
this.homeListService = homeService;
}
@PostMapping("/shouall")
public Result<List<House>> shouall(){
return homeListService.shouall();
}
}

View File

@ -1,7 +1,9 @@
package com.bwie.home.controller;
import com.bwie.common.domain.House;
import com.bwie.common.domain.request.HouseEsRequest;
import com.bwie.common.result.Result;
import com.bwie.home.service.HomeListService;
import com.bwie.home.service.HouseService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -16,8 +18,10 @@ public class HouseController {
private final HouseService houseService;
public HouseController(HouseService houseService) {
private final HomeListService homeListService;
public HouseController(HouseService houseService, HomeListService homeListService) {
this.houseService = houseService;
this.homeListService = homeListService;
}
@GetMapping("/list")
@ -28,5 +32,8 @@ public class HouseController {
}
@PostMapping("/shouall")
public Result<List<House>> shouall(){
return homeListService.shouall();
}
}

View File

@ -8,18 +8,15 @@
<artifactId>house_project</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>bwie-modules</artifactId>
<packaging>pom</packaging>
<modules>
<module>bwie-system</module>
<module>bwie-group</module>
</modules>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>