郭梦洋3.30更新
parent
279b86360c
commit
546eec90ee
|
@ -0,0 +1,40 @@
|
|||
package com.bwie.common.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 咨询表
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("advice")
|
||||
public class Advice {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long adviceId; //咨讯
|
||||
private String adviceTitle; //咨讯标题
|
||||
private String adviceConment; //咨讯内容
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date adviceTime; //咨讯上传时间
|
||||
private String adviceCome; //咨讯来源
|
||||
private Integer adviceStatus; //咨讯状态
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date craeteTime;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
private Integer isDelete;
|
||||
}
|
|
@ -8,6 +8,9 @@ import lombok.Builder;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 房源审核表
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package com.bwie.common.domain.request;
|
||||
|
||||
import com.bwie.common.domain.Advice;
|
||||
import com.bwie.common.domain.House;
|
||||
import com.bwie.common.domain.User;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class VoIndexList {
|
||||
|
||||
private List<House> newHouse;
|
||||
|
||||
private List<String> houseImage;
|
||||
|
||||
private List<Advice> adviceList;
|
||||
|
||||
private List<House> oldHouse;
|
||||
|
||||
private List<User> userInfo;
|
||||
|
||||
}
|
|
@ -3,4 +3,5 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
|||
com.bwie.common.handler.GlobalExceptionHandle,\
|
||||
com.bwie.common.config.RedisConfig,\
|
||||
com.bwie.common.redis.RedisCache,\
|
||||
com.bwie.common.remote.factory.RemoteHouseFactory
|
||||
com.bwie.common.remote.factory.RemoteHouseFactory,\
|
||||
com.bwie.common.remote.factory.RemoteLoginFactory
|
||||
|
|
|
@ -53,6 +53,13 @@
|
|||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>1.4.1</version>
|
||||
</dependency>
|
||||
<!-- xxl-job依赖 -->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-job-core</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</dependency>
|
||||
<!--爬虫jsoup-->
|
||||
<dependency>
|
||||
<groupId>org.jsoup</groupId>
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.bwie.home.controller;
|
|||
|
||||
import com.bwie.common.domain.House;
|
||||
import com.bwie.common.domain.request.HouseEsRequest;
|
||||
import com.bwie.common.domain.request.VoIndexList;
|
||||
import com.bwie.common.result.Result;
|
||||
import com.bwie.home.job.Reptile;
|
||||
import com.bwie.home.service.HomeListService;
|
||||
|
@ -43,4 +44,11 @@ public class HouseController {
|
|||
reptile.reptile(page);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping("/index")
|
||||
public Result<VoIndexList> getIndexList(){
|
||||
return Result.success(
|
||||
houseService.getIndexList()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,6 @@ public class ReptileJob {
|
|||
reptile.reptile(bkUrl);
|
||||
redisCache.redisTemplate.opsForList().rightPush(url, bkUrl);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package com.bwie.home.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bwie.common.domain.Advice;
|
||||
|
||||
public interface AdviceMapper extends BaseMapper<Advice> {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.bwie.home.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bwie.common.domain.User;
|
||||
|
||||
public interface UserMapper extends BaseMapper<User> {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.bwie.home.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bwie.common.domain.Advice;
|
||||
|
||||
public interface AdviceService extends IService<Advice> {
|
||||
}
|
|
@ -3,6 +3,7 @@ package com.bwie.home.service;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bwie.common.domain.House;
|
||||
import com.bwie.common.domain.request.HouseEsRequest;
|
||||
import com.bwie.common.domain.request.VoIndexList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -14,4 +15,10 @@ public interface HouseService extends IService<House> {
|
|||
* @return
|
||||
*/
|
||||
List<HouseEsRequest> getHouseEsList();
|
||||
|
||||
/**
|
||||
* 获取首页信息
|
||||
* @return
|
||||
*/
|
||||
VoIndexList getIndexList();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package com.bwie.home.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bwie.common.domain.User;
|
||||
|
||||
public interface UserService extends IService<User> {
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.bwie.home.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bwie.common.domain.Advice;
|
||||
import com.bwie.home.mapper.AdviceMapper;
|
||||
import com.bwie.home.service.AdviceService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class AdviceServiceImpl extends ServiceImpl<AdviceMapper, Advice>
|
||||
implements AdviceService {
|
||||
|
||||
}
|
|
@ -2,20 +2,19 @@ package com.bwie.home.service.impl;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bwie.common.domain.DictionaryType;
|
||||
import com.bwie.common.domain.House;
|
||||
import com.bwie.common.domain.HouseImages;
|
||||
import com.bwie.common.domain.HouseType;
|
||||
import com.bwie.common.domain.*;
|
||||
import com.bwie.common.domain.request.HouseEsRequest;
|
||||
import com.bwie.common.domain.request.VoIndexList;
|
||||
import com.bwie.home.mapper.HouseMapper;
|
||||
import com.bwie.home.service.DictionaryTypeService;
|
||||
import com.bwie.home.service.HouseImagesService;
|
||||
import com.bwie.home.service.HouseService;
|
||||
import com.bwie.home.service.HouseTypeService;
|
||||
import com.bwie.home.service.*;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
|
@ -25,13 +24,22 @@ public class HouseServiceImpl extends ServiceImpl<HouseMapper, House>
|
|||
private final HouseTypeService houseTypeService;
|
||||
private final DictionaryTypeService dictionaryTypeService;
|
||||
private final HouseImagesService houseImagesService;
|
||||
private final UserService userService;
|
||||
private final AdviceService adviceService;
|
||||
private final Executor executor;
|
||||
|
||||
|
||||
public HouseServiceImpl(HouseTypeService houseTypeService,
|
||||
DictionaryTypeService dictionaryTypeService,
|
||||
HouseImagesService houseImagesService) {
|
||||
HouseImagesService houseImagesService,
|
||||
UserService userService,
|
||||
AdviceService adviceService, Executor executor) {
|
||||
this.houseTypeService = houseTypeService;
|
||||
this.dictionaryTypeService = dictionaryTypeService;
|
||||
this.houseImagesService = houseImagesService;
|
||||
this.userService = userService;
|
||||
this.adviceService = adviceService;
|
||||
this.executor = executor;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,4 +64,63 @@ public class HouseServiceImpl extends ServiceImpl<HouseMapper, House>
|
|||
|
||||
return esRequestList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoIndexList getIndexList() {
|
||||
|
||||
CountDownLatch countDownLatch = new CountDownLatch(5);
|
||||
VoIndexList voIndexList = new VoIndexList();
|
||||
|
||||
//横幅信息
|
||||
CompletableFuture<List<HouseImages>> f1 = CompletableFuture.supplyAsync(() -> {
|
||||
List<HouseImages> list = houseImagesService.list(new LambdaQueryWrapper<HouseImages>().eq(HouseImages::getHouseId, 0));
|
||||
countDownLatch.countDown();
|
||||
return list;
|
||||
}, executor);
|
||||
|
||||
// 经纪人信息
|
||||
CompletableFuture<List<User>> f2 = CompletableFuture.supplyAsync(() -> {
|
||||
List<User> list = userService.list();
|
||||
countDownLatch.countDown();
|
||||
return list;
|
||||
}, executor);
|
||||
|
||||
//咨询
|
||||
CompletableFuture<List<Advice>> f3 = CompletableFuture.supplyAsync(() -> {
|
||||
List<Advice> list = adviceService.list();
|
||||
countDownLatch.countDown();
|
||||
return list;
|
||||
}, executor);
|
||||
|
||||
//新房
|
||||
CompletableFuture<List<House>> f4 = CompletableFuture.supplyAsync(() -> {
|
||||
List<House> list = this.list(new LambdaQueryWrapper<House>().last("LIMIT" + 5));
|
||||
countDownLatch.countDown();
|
||||
return list;
|
||||
}, executor);
|
||||
|
||||
//二手房
|
||||
CompletableFuture<List<House>> f5 = CompletableFuture.supplyAsync(() -> {
|
||||
List<House> list = this.list(new LambdaQueryWrapper<House>().last("LIMIT" + 5));
|
||||
countDownLatch.countDown();
|
||||
return list;
|
||||
}, executor);
|
||||
|
||||
try {
|
||||
countDownLatch.await();
|
||||
List<HouseImages> houseImages = f1.get();
|
||||
List<String> imageList = houseImages.stream().map(HouseImages::getImageAddr).collect(Collectors.toList());
|
||||
voIndexList.setHouseImage(imageList);//横幅信息
|
||||
voIndexList.setUserInfo(f2.get());
|
||||
voIndexList.setAdviceList(f3.get());
|
||||
// voIndexList.setNewHouse(f4.get());
|
||||
// voIndexList.setOldHouse(f5.get());
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
return voIndexList;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package com.bwie.home.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bwie.common.domain.User;
|
||||
import com.bwie.home.mapper.UserMapper;
|
||||
import com.bwie.home.service.UserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class UserServiceImpl extends ServiceImpl<UserMapper, User>
|
||||
implements UserService {
|
||||
}
|
|
@ -15,10 +15,14 @@
|
|||
<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>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch</groupId>
|
||||
|
|
Loading…
Reference in New Issue