diff --git a/fangjia-job/fangjia-job-common/src/main/java/com/fangjia/job/common/base/FangjiaConstant.java b/fangjia-job/fangjia-job-common/src/main/java/com/fangjia/job/common/base/FangjiaConstant.java new file mode 100644 index 0000000..a453a64 --- /dev/null +++ b/fangjia-job/fangjia-job-common/src/main/java/com/fangjia/job/common/base/FangjiaConstant.java @@ -0,0 +1,22 @@ +package com.fangjia.job.common.base; + +public class FangjiaConstant { + + /* + * CitySendLog的推送类型 0.置顶咨询推送,1.小区推送 2.涨幅排行推送 3.跌幅排行推送 4.潜力排行推送 + */ + public static final byte NEWS_SEND_TYPE = 0; + + public static final byte HOUSING_ESTATE_SEND_TYPE = 1; + + public static final byte INCREASE_SEND_TYPE = 2; + + public static final byte DECLINES_SEND_TYPE = 3; + + public static final byte POTENTIAL_SEND_TYPE = 4; + + public static String FANGJIA_API_TOKEN = "F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB"; + + public static final int SUCCESS_RESPONSE_CODE = 200; + +} diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/dto/CityNewPriceDto.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/dto/CityNewPriceDto.java new file mode 100644 index 0000000..447a5f3 --- /dev/null +++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/dto/CityNewPriceDto.java @@ -0,0 +1,75 @@ +package com.fangjia.job.youfang.dto; + +import java.util.List; + +public class CityNewPriceDto { + + /** + * 上涨数量 + */ + private Integer upCount; + /** + * 下跌量 + */ + private Integer downCount; + /** + * 平均上涨幅度 + */ + private Double avgUp; + /** + * 平均下跌幅度 + */ + private Double avgDown; + + private List rets; + + private List regionRets; + + /** + * 城市年涨跌幅 + */ + private Double yoy; + + public Integer getUpCount() { + return upCount; + } + public void setUpCount(Integer upCount) { + this.upCount = upCount; + } + public Integer getDownCount() { + return downCount; + } + public void setDownCount(Integer downCount) { + this.downCount = downCount; + } + public Double getAvgUp() { + return avgUp; + } + public void setAvgUp(Double avgUp) { + this.avgUp = avgUp; + } + public Double getAvgDown() { + return avgDown; + } + public void setAvgDown(Double avgDown) { + this.avgDown = avgDown; + } + public List getRets() { + return rets; + } + public void setRets(List rets) { + this.rets = rets; + } + public List getRegionRets() { + return regionRets; + } + public void setRegionRets(List regionRets) { + this.regionRets = regionRets; + } + public Double getYoy() { + return yoy; + } + public void setYoy(Double yoy) { + this.yoy = yoy; + } +} diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/dto/CityNewPriceResultDto.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/dto/CityNewPriceResultDto.java new file mode 100644 index 0000000..3fba313 --- /dev/null +++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/dto/CityNewPriceResultDto.java @@ -0,0 +1,18 @@ +package com.fangjia.job.youfang.dto; + +import com.fangjia.job.common.base.ReponseData; + +public class CityNewPriceResultDto extends ReponseData { + + private CityNewPriceDto result; + + public CityNewPriceDto getResult() { + return result; + } + + public void setResult(CityNewPriceDto result) { + this.result = result; + } + + +} diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/dto/CityStatInfoDto.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/dto/CityStatInfoDto.java new file mode 100644 index 0000000..7dc5b20 --- /dev/null +++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/dto/CityStatInfoDto.java @@ -0,0 +1,133 @@ +package com.fangjia.job.youfang.dto; + +public class CityStatInfoDto { + + private String id; + private String city; + private Integer statDate; + private Integer avgPrice; + private Integer index; + private Double markup; + private Double rentRate; + private Double yoyMarkup; + // 全国涨幅排名 + private int rangeLevel; + // 下跌概率(用潜力指数计算,大于50的是上涨概率,小于50的用100-指数=下跌概率) + private Integer downChance; + // 是否关注该城市(定位城市数据页面使用) + private boolean follow; + + public boolean isFollow() { + return follow; + } + + public void setFollow(boolean follow) { + this.follow = follow; + } + + public Integer getDownChance() { + if (index == null) { + index = 0; + } + if (index != null && index > 50) { + this.downChance = index; + } else { + this.downChance = 100 - index; + } + return downChance; + } + + public void setDownChance(Integer downChance) { + this.downChance = downChance; + } + + public int getRangeLevel() { + return rangeLevel; + } + + public void setRangeLevel(int rangeLevel) { + this.rangeLevel = rangeLevel; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public Integer getStatDate() { + return statDate; + } + + public void setStatDate(Integer statDate) { + this.statDate = statDate; + } + + public Integer getAvgPrice() { + if (avgPrice == null) { + return 0; + } + return avgPrice; + } + + public void setAvgPrice(Integer avgPrice) { + this.avgPrice = avgPrice; + } + + public Integer getIndex() { + if (index == null) { + return 0; + } + return index; + } + + public void setIndex(Integer index) { + this.index = index; + } + + public Double getMarkup() { + if (markup == null) { + return 0D; + } + return markup; + } + + public void setMarkup(Double markup) { + this.markup = markup; + } + + public Double getRentRate() { + return rentRate; + } + + public void setRentRate(Double rentRate) { + this.rentRate = rentRate; + } + + public Double getYoyMarkup() { + return yoyMarkup; + } + + public void setYoyMarkup(Double yoyMarkup) { + this.yoyMarkup = yoyMarkup; + } + + // 为实现深copy + @Override + public CityStatInfoDto clone() throws CloneNotSupportedException { + CityStatInfoDto dto = null; + dto = (CityStatInfoDto) super.clone(); + return dto; + } + +} diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/dto/RegionSellStatDto.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/dto/RegionSellStatDto.java new file mode 100644 index 0000000..a8938aa --- /dev/null +++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/dto/RegionSellStatDto.java @@ -0,0 +1,64 @@ +package com.fangjia.job.youfang.dto; + +import java.util.Date; + +public class RegionSellStatDto { + private String id; + private String city; + private String region; + private Integer avgPrice; + private Integer date; + private Date updateDate; + private Double mom; + private Double yoy; + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public String getCity() { + return city; + } + public void setCity(String city) { + this.city = city; + } + public String getRegion() { + return region; + } + public void setRegion(String region) { + this.region = region; + } + public Integer getAvgPrice() { + return avgPrice; + } + public void setAvgPrice(Integer avgPrice) { + this.avgPrice = avgPrice; + } + public Integer getDate() { + return date; + } + public void setDate(Integer date) { + this.date = date; + } + public Date getUpdateDate() { + return updateDate; + } + public void setUpdateDate(Date updateDate) { + this.updateDate = updateDate; + } + public Double getMom() { + return mom; + } + public void setMom(Double mom) { + this.mom = mom; + } + public Double getYoy() { + return yoy; + } + public void setYoy(Double yoy) { + this.yoy = yoy; + } + + +} diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/job/CityRankingSendJob.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/job/CityRankingSendJob.java index 0ba027b..11ccc7d 100644 --- a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/job/CityRankingSendJob.java +++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/job/CityRankingSendJob.java @@ -1,34 +1,186 @@ package com.fangjia.job.youfang.job; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; - +import org.springframework.beans.factory.annotation.Value; import com.dangdang.ddframe.job.api.ShardingContext; import com.dangdang.ddframe.job.api.simple.SimpleJob; +import com.fangjia.job.common.base.FangjiaConstant; +import com.fangjia.job.common.util.RestApiCallUtils; +import com.fangjia.job.youfang.document.CitySendLog; +import com.fangjia.job.youfang.dto.CityNewPriceDto; +import com.fangjia.job.youfang.dto.CityNewPriceResultDto; +import com.fangjia.job.youfang.po.CityCollect; +import com.fangjia.job.youfang.remote.FshApiRemoteService; import com.fangjia.job.youfang.service.CityCollectService; import com.fangjia.job.youfang.service.CitySendLogService; -import com.fangjia.job.youfang.service.PushMessageService; -import com.fangjia.job.youfang.service.PushRecordMessageService; +import com.fangjia.job.youfang.dto.CityStatInfoDto; public class CityRankingSendJob implements SimpleJob { - + private static final Logger LOG = LoggerFactory.getLogger(TopNewsSendJob.class); - + @Autowired private CityCollectService cityCollectService; - + @Autowired private CitySendLogService citySendLogService; - + + @Value("${open.url}") + private String openApiUrl; + + private static final int NUM = 10;// 排名前10 @Override public void execute(ShardingContext context) { - LOG.info("城市排名推送开始,context:"+context); - //1.查询 - //2.对比 - //3.发送 - //4.记录 + LOG.info("城市排名推送开始,context:" + context); + // 1.查询 + // 查询全部城市 + FshApiRemoteService fshApiRemoteService = RestApiCallUtils.getRestClient(FshApiRemoteService.class, openApiUrl); + CityNewPriceResultDto resultDto = fshApiRemoteService.getAllCitys(FangjiaConstant.FANGJIA_API_TOKEN); + List topTenList = new ArrayList(); + List bottomTenList = new ArrayList(); + List potentialTenList = new ArrayList(); + // 排序,整理出涨幅,跌幅,潜力的前10 + if (null != resultDto && resultDto.getCode() == FangjiaConstant.SUCCESS_RESPONSE_CODE) { + CityNewPriceDto dto = resultDto.getResult(); + if (null != dto && null != dto.getRets()) { + List rets = dto.getRets(); + // 涨幅排序 + List upList = rets.stream() + .sorted((u1, u2) -> u2.getMarkup().compareTo(u1.getMarkup())).collect(Collectors.toList()); + List copyList = new ArrayList(); + Iterator upIter = upList.iterator(); + try { + // 涨幅排序深复制 + while (upIter.hasNext()) { + copyList.add(upIter.next().clone()); + } + // 涨幅前10 + topTenList = copyList.subList(0, NUM); + // 跌幅前10 + bottomTenList = copyList.subList(copyList.size() - NUM, copyList.size()); + Collections.reverse(bottomTenList);// 涨幅后10名倒序 + // 潜力排序 + List potentialList = rets.stream() + .sorted((u1, u2) -> u2.getIndex().compareTo(u1.getIndex())).collect(Collectors.toList()); + potentialTenList = potentialList.subList(0, NUM); + } catch (CloneNotSupportedException e) { + // 深复制失败 + LOG.error("深复制失败", e); + // 涨幅前10 + topTenList = upList.subList(0, NUM); + // 跌幅前10 + bottomTenList = upList.subList(copyList.size() - NUM, copyList.size()); + Collections.reverse(bottomTenList);// 涨幅后10名倒序 + // 深复制失败,再次访问,用新list做潜力排序 + CityNewPriceResultDto resultDto2 = fshApiRemoteService + .getAllCitys(FangjiaConstant.FANGJIA_API_TOKEN); + CityNewPriceDto dto2 = resultDto2.getResult(); + List rets2 = dto2.getRets(); + // 潜力排序 + List potentialList = rets2.stream() + .sorted((u1, u2) -> u2.getIndex().compareTo(u1.getIndex())).collect(Collectors.toList()); + potentialTenList = potentialList.subList(0, NUM); + } + } + } + // 查询用户 + List cityList = cityCollectService.findAll(); + // 用于性能节省的变量 + String cityName = ""; + Integer topRankings = null; + Integer bottomRankings = null; + Integer potentialRankings = null; + // 2.对比 + for (CityCollect city : cityList) { + // cityList已排序好,如果cityName不变,则使用上个排名 + if (cityName.equals(city.getCity())) { + try { + baseSend(city, topRankings, FangjiaConstant.INCREASE_SEND_TYPE); + sendRankings(city, bottomRankings, FangjiaConstant.INCREASE_SEND_TYPE); + sendRankings(city, potentialRankings, FangjiaConstant.POTENTIAL_SEND_TYPE); + } catch (Exception e) { + LOG.error("推送失败!", e); + } + } else { + // 如果cityName改变,则查询替换cityName和排名 + cityName = city.getCity(); + try { + topRankings = sendRankings(city, topTenList, FangjiaConstant.INCREASE_SEND_TYPE); + bottomRankings = sendRankings(city, bottomTenList, FangjiaConstant.DECLINES_SEND_TYPE); + potentialRankings = sendRankings(city, potentialTenList, FangjiaConstant.POTENTIAL_SEND_TYPE); + } catch (Exception e) { + LOG.error("推送失败!", e); + } + } + } + } + + /** + * 首次遍历,并返回排名,没有则返回null + * + * @param city + * @param list + * @param sendType + * @return + */ + private Integer sendRankings(CityCollect city, List list, byte sendType) { + List sendList = citySendLogService.find(city.getUid(), null, sendType); + if ((null == sendList || sendList.isEmpty()) && !list.isEmpty()) { + for (int i = 0; i <= list.size(); i++) { + if (city.getCity().equals(list.get(i).getCity())) { + int rankings = i + 1;// 排名 + baseSend(city, rankings, sendType); + return rankings; + } + } + } + return null; + } + + /** + * 再次遍历,直接使用上次的排名 + * + * @param city + * @param rankings + * @param sendType + */ + private void sendRankings(CityCollect city, Integer rankings, byte sendType) { + List sendList = citySendLogService.find(city.getUid(), null, sendType); + if ((null == sendList || sendList.isEmpty()) && null != rankings) { + baseSend(city, rankings, sendType); + } + } + + /** + * 发送并保存 + * + * @param city + * @param rankings + * @param sendType + */ + private void baseSend(CityCollect city, Integer rankings, byte sendType) { + String title = null; + if (FangjiaConstant.INCREASE_SEND_TYPE == sendType) { + title = "全国城市涨幅排名第" + rankings + "位"; + } else if (FangjiaConstant.DECLINES_SEND_TYPE == sendType) { + title = "全国城市跌幅排名第" + rankings + "位"; + + } else { + title = "全国城市潜力排名第" + rankings + "位"; + } + LOG.info("全国城市涨幅(跌幅、潜力)排名推送开始,uid:" + city.getUid() + ",city:" + city.getCity()); + // 发送 + // TODO + // 记录 + citySendLogService.save(city.getCity(), city.getUid(), 0L, sendType); } } diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/job/HousingEstateNewsSendJob.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/job/HousingEstateNewsSendJob.java index c126c8d..897b92c 100644 --- a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/job/HousingEstateNewsSendJob.java +++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/job/HousingEstateNewsSendJob.java @@ -1,16 +1,20 @@ package com.fangjia.job.youfang.job; +import java.util.List; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import com.dangdang.ddframe.job.api.ShardingContext; import com.dangdang.ddframe.job.api.simple.SimpleJob; +import com.fangjia.job.common.base.FangjiaConstant; +import com.fangjia.job.youfang.document.CitySendLog; +import com.fangjia.job.youfang.po.CityCollect; +import com.fangjia.job.youfang.po.News; import com.fangjia.job.youfang.service.CityCollectService; import com.fangjia.job.youfang.service.CitySendLogService; import com.fangjia.job.youfang.service.NewsService; -import com.fangjia.job.youfang.service.PushMessageService; -import com.fangjia.job.youfang.service.PushRecordMessageService; public class HousingEstateNewsSendJob implements SimpleJob { @@ -28,10 +32,48 @@ public class HousingEstateNewsSendJob implements SimpleJob { @Override public void execute(ShardingContext context) { LOG.info("城市小区推送开始,context:"+context); - //1.查询 - //2.对比 - //3.发送 - //4.记录 + // 1.查询 + List cityList = cityCollectService.findAll(); + String cityName = ""; + List newsList = null; + // 2.对比 + for (CityCollect city : cityList) { + // cityList已排序好,如果cityName不变,则使用上个newsList + if (cityName.equals(city.getCity())) { + try { + sendNews(city, newsList); + } catch (Exception e) { + LOG.error("推送失败!", e); + } + } else { + // 如果cityName改变,则查询替换cityName和newsList + cityName = city.getCity(); + newsList = newsService.findHousingEstate(cityName); + try { + sendNews(city, newsList); + } catch (Exception e) { + LOG.error("推送失败!", e); + } + } + } + } + + private void sendNews(CityCollect city, List newsList) { + if (null != newsList && !newsList.isEmpty()) { + for (News n : newsList) { + List sendList = citySendLogService.find(city.getUid(), n.getId(), + FangjiaConstant.HOUSING_ESTATE_SEND_TYPE); + // 未推送过的推送 + if (null == sendList || sendList.isEmpty()) { + LOG.info("小区推送开始。。。uid:" + city.getUid() + ",newsId:" + n.getId()); + // 3.发送 + // TODO + // 4.记录 + citySendLogService.save(city.getCity(), city.getUid(), n.getId(), FangjiaConstant.HOUSING_ESTATE_SEND_TYPE); + } + } + } + } } diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/job/TopNewsSendJob.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/job/TopNewsSendJob.java index 43bea83..896574b 100644 --- a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/job/TopNewsSendJob.java +++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/job/TopNewsSendJob.java @@ -1,37 +1,77 @@ package com.fangjia.job.youfang.job; +import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; - import com.dangdang.ddframe.job.api.ShardingContext; import com.dangdang.ddframe.job.api.simple.SimpleJob; +import com.fangjia.job.common.base.FangjiaConstant; +import com.fangjia.job.youfang.document.CitySendLog; +import com.fangjia.job.youfang.po.CityCollect; +import com.fangjia.job.youfang.po.News; import com.fangjia.job.youfang.service.CityCollectService; import com.fangjia.job.youfang.service.CitySendLogService; import com.fangjia.job.youfang.service.NewsService; -import com.fangjia.job.youfang.service.PushMessageService; -import com.fangjia.job.youfang.service.PushRecordMessageService; public class TopNewsSendJob implements SimpleJob { - + private static final Logger LOG = LoggerFactory.getLogger(TopNewsSendJob.class); - + @Autowired private CityCollectService cityCollectService; - + @Autowired private CitySendLogService citySendLogService; - + @Autowired private NewsService newsService; @Override public void execute(ShardingContext context) { - LOG.info("城市置顶咨询推送开始,context:"+context); - //1.查询 - //2.对比 - //3.发送 - //4.记录 + LOG.info("城市置顶咨询推送开始,context:" + context); + // 1.查询 + List cityList = cityCollectService.findAll(); + String cityName = ""; + List newsList = null; + // 2.对比 + for (CityCollect city : cityList) { + // cityList已排序好,如果cityName不变,则使用上个newsList + if (cityName.equals(city.getCity())) { + try { + sendNews(city, newsList); + } catch (Exception e) { + LOG.error("推送失败!", e); + } + } else { + // 如果cityName改变,则查询替换cityName和newsList + cityName = city.getCity(); + newsList = newsService.findTopNews(cityName); + try { + sendNews(city, newsList); + } catch (Exception e) { + LOG.error("推送失败!", e); + } + } + } + } + + private void sendNews(CityCollect city, List newsList) { + if (null != newsList && !newsList.isEmpty()) { + for (News n : newsList) { + List sendList = citySendLogService.find(city.getUid(), n.getId(), + FangjiaConstant.NEWS_SEND_TYPE); + // 未推送过的推送 + if (null == sendList || sendList.isEmpty()) { + LOG.info("新闻推送开始。。。uid:" + city.getUid() + ",newsId:" + n.getId()); + // 3.发送 + // TODO + // 4.记录 + citySendLogService.save(city.getCity(), city.getUid(), n.getId(), FangjiaConstant.NEWS_SEND_TYPE); + } + } + } + } } diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/remote/FshApiRemoteService.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/remote/FshApiRemoteService.java index 358e687..83e00b1 100644 --- a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/remote/FshApiRemoteService.java +++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/remote/FshApiRemoteService.java @@ -6,6 +6,7 @@ import com.fangjia.job.common.base.Response; import com.fangjia.job.youfang.document.DistrictEvaluateSingleDto; import com.fangjia.job.youfang.document.DistrictInfoDto; import com.fangjia.job.youfang.document.DistrictSearchSingleDto; +import com.fangjia.job.youfang.dto.CityNewPriceResultDto; import com.fangjia.job.youfang.dto.DistrictDetailDto; import feign.Param; @@ -14,66 +15,77 @@ import feign.RequestLine; /** * API调用接口定义 + * * @author yinjihuan */ public interface FshApiRemoteService { - + /** * 发送月涨幅计算通知 + * * @param token * @return */ @RequestLine("GET /rest/houses/rose/month?token={token}") - public Response sendHouseRoseMonthNotice(@Param("token")String token); - + public Response sendHouseRoseMonthNotice(@Param("token") String token); + /** * 发送租金提醒计算通知 + * * @param token * @return */ @RequestLine("GET /rest/houses/rent/notice?token={token}") - public Response sendHouseRentNotice(@Param("token")String token); - + public Response sendHouseRentNotice(@Param("token") String token); + /** * 定时估价操作,并算出周涨跌幅通知 + * * @param token * @return */ @RequestLine("GET /rest/houses/eval?token={token}") - public Response evalAllHousePrice(@Param("token")String token); - + public Response evalAllHousePrice(@Param("token") String token); + @RequestLine("GET /fsh/getAgencyInfo") - public Map getAgencyInfo(@QueryMap Map queryMap); - + public Map getAgencyInfo(@QueryMap Map queryMap); + /** * 获取小区综合信息district_new_price + * * @param queryMap * @return */ @RequestLine("GET /fsh/getDistrictNewPriceInfo") public DistrictEvaluateSingleDto getDistrictNewPriceInfo(@QueryMap Map queryMap); - + /** * 小区详情 */ @RequestLine("GET /fsh/detail") public DistrictInfoDto detail(@QueryMap Map queryMap); - - //小区估价接口 + + // 小区估价接口 @RequestLine("GET /fsh/evaluate") public DistrictSearchSingleDto evaluate(@QueryMap Map queryMap); - + /** * 刷新小区详情页面缓存数据 + * * @param queryMap * @return */ @RequestLine("GET /district/details") public String refreshDistrictDetailPageData(@QueryMap Map queryMap); - + /** * 小区信息汇总 */ @RequestLine("GET /fsh/districtDetail") public DistrictDetailDto districtDetail(@QueryMap Map queryMap); + + // 城市列表 + @RequestLine("GET /quotations/cityList?token={token}") + public CityNewPriceResultDto getAllCitys(@Param("token") String token); + } diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/CitySendLogService.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/CitySendLogService.java index bc88256..acf0683 100644 --- a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/CitySendLogService.java +++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/CitySendLogService.java @@ -6,7 +6,7 @@ import com.fangjia.job.youfang.document.CitySendLog; public interface CitySendLogService { - void save(CitySendLog log); + void save(String city, Long uid, Long nId, byte sendType); List find(long uid, Long newsId, Byte sendType); } diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/CitySendLogServiceImpl.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/CitySendLogServiceImpl.java index 7d00b6c..ebd1c94 100644 --- a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/CitySendLogServiceImpl.java +++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/CitySendLogServiceImpl.java @@ -1,4 +1,5 @@ package com.fangjia.job.youfang.service; + import java.util.Calendar; import java.util.Date; import java.util.List; @@ -18,7 +19,13 @@ public class CitySendLogServiceImpl implements CitySendLogService { private MongoTemplate mongoTemplate; @Override - public void save(CitySendLog log) { + public void save(String city, Long uid, Long nId, byte sendType) { + CitySendLog log = new CitySendLog(); + log.setCity(city); + log.setNewsId(nId); + log.setSendTime(new Date()); + log.setSendType(sendType); + log.setUid(uid); mongoTemplate.save(log); }