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..c5f8ab6
--- /dev/null
+++ b/fangjia-job/fangjia-job-common/src/main/java/com/fangjia/job/common/base/FangjiaConstant.java
@@ -0,0 +1,28 @@
+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 final int SUCCESS_RESPONSE_CODE = 200;
+
+ public static final int SEND_THREAD_NUM = 100;
+
+ public static final int OPEN_APP_TYPE = 0;
+
+ public static final int URL_SEND_TYPE = 2;
+
+ public static final int SEND_ERROR_LIMIT = 3; //失败尝试的上限
+
+}
diff --git a/fangjia-job/fangjia-job-common/src/main/java/com/fangjia/job/common/util/DateUtilCustom.java b/fangjia-job/fangjia-job-common/src/main/java/com/fangjia/job/common/util/DateUtilCustom.java
index 34f5d34..7f9372d 100644
--- a/fangjia-job/fangjia-job-common/src/main/java/com/fangjia/job/common/util/DateUtilCustom.java
+++ b/fangjia-job/fangjia-job-common/src/main/java/com/fangjia/job/common/util/DateUtilCustom.java
@@ -1,5 +1,6 @@
package com.fangjia.job.common.util;
+import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
@@ -128,6 +129,31 @@ public class DateUtilCustom {
return map;
}
+ /**
+ * 计算两个日期之间相差的天数
+ * @param smdate 较小的时间
+ * @param bdate 较大的时间
+ * @return 相差天数
+ * @throws ParseException
+ */
+ public static int between(Date smdate,Date bdate) {
+ try {
+ SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
+ smdate=sdf.parse(sdf.format(smdate));
+ bdate=sdf.parse(sdf.format(bdate));
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(smdate);
+ long time1 = cal.getTimeInMillis();
+ cal.setTime(bdate);
+ long time2 = cal.getTimeInMillis();
+ long between_days=(time2-time1)/(1000*3600*24);
+
+ return Integer.parseInt(String.valueOf(between_days));
+ } catch (Exception e) {
+ return -1;
+ }
+ }
+
public static void main(String[] args) {
System.err.println(JsonUtils.toJson(getLatelyDate(3)));
}
diff --git a/fangjia-job/fangjia-job-youfang/pom.xml b/fangjia-job/fangjia-job-youfang/pom.xml
index e58901d..d25c2c9 100644
--- a/fangjia-job/fangjia-job-youfang/pom.xml
+++ b/fangjia-job/fangjia-job-youfang/pom.xml
@@ -71,6 +71,11 @@
com.cxytiandi
cxytiandi-jdbc
+
+
+ org.projectlombok
+ lombok
+
diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/document/CitySendLog.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/document/CitySendLog.java
new file mode 100644
index 0000000..b80eb07
--- /dev/null
+++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/document/CitySendLog.java
@@ -0,0 +1,35 @@
+package com.fangjia.job.youfang.document;
+
+import java.util.Date;
+
+import lombok.Data;
+
+/**
+ * 城市相关推送记录
+ *
+ * @author user
+ *
+ */
+@Data
+public class CitySendLog {
+
+ private String city;
+
+ private long uid;
+
+ private Long newsId;
+
+ private Date sendTime;
+
+ /*
+ * 0.置顶咨询推送,1.小区推送 2.涨幅排行推送 3.跌幅排行推送 4.潜力排行推送
+ */
+ private byte sendType;
+
+ // 推送次数
+ private int sendNum;
+
+ // 推送状态
+ private Boolean sendStatus;
+
+}
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..8bb886e
--- /dev/null
+++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/dto/CityStatInfoDto.java
@@ -0,0 +1,152 @@
+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 CityStatInfoDto() {
+
+ }
+
+ public CityStatInfoDto(String id, String city, Integer statDate, Integer avgPrice, Integer index, Double markup,
+ Double rentRate, Double yoyMarkup, int rangeLevel, Integer downChance, boolean follow) {
+ super();
+ this.id = id;
+ this.city = city;
+ this.statDate = statDate;
+ this.avgPrice = avgPrice;
+ this.index = index;
+ this.markup = markup;
+ this.rentRate = rentRate;
+ this.yoyMarkup = yoyMarkup;
+ this.rangeLevel = rangeLevel;
+ this.downChance = downChance;
+ this.follow = 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 {
+ return new CityStatInfoDto(this.id, this.city, this.statDate, this.avgPrice, this.index, this.markup,
+ this.rentRate, this.yoyMarkup, this.rangeLevel, this.downChance, this.follow);
+ }
+
+}
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
new file mode 100644
index 0000000..c67a670
--- /dev/null
+++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/job/CityRankingSendJob.java
@@ -0,0 +1,251 @@
+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.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+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.po.EnterpriseProductUser;
+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.EnterpriseProductUserService;
+import com.fangjia.job.youfang.service.PushMessageService;
+import com.fangjia.job.youfang.dto.CityStatInfoDto;
+import com.fangjia.job.youfang.param.PushMessageParam;
+
+public class CityRankingSendJob implements SimpleJob {
+
+ private static final Logger LOG = LoggerFactory.getLogger(TopNewsSendJob.class);
+
+ @Autowired
+ private CityCollectService cityCollectService;
+
+ @Autowired
+ private CitySendLogService citySendLogService;
+
+ @Autowired
+ private EnterpriseProductUserService enterpriseProductUserService;
+
+ @Autowired
+ private PushMessageService pushMessageService;
+
+ @Value("${open.url}")
+ private String openApiUrl;
+
+ @Value("${FANGJIA_API_TOKEN}")
+ private String token;
+
+ private static final int NUM = 10;// 排名前10
+
+ private static final ExecutorService THREAD_POOL = Executors.newFixedThreadPool(FangjiaConstant.SEND_THREAD_NUM);
+
+ @Override
+ public void execute(ShardingContext context) {
+ LOG.info("城市排名推送开始,context:" + context);
+ // 1.查询
+ // 查询全部城市
+ FshApiRemoteService fshApiRemoteService = RestApiCallUtils.getRestClient(FshApiRemoteService.class, openApiUrl);
+ CityNewPriceResultDto resultDto = fshApiRemoteService.getAllCitys(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(upList.size() - NUM, upList.size());
+ Collections.reverse(bottomTenList);// 涨幅后10名倒序
+ // 深复制失败,再次访问,用新list做潜力排序
+ CityNewPriceResultDto resultDto2 = fshApiRemoteService.getAllCitys(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())) {
+ THREAD_POOL.execute(new MyThread(city, topRankings, bottomRankings, potentialRankings));
+ } 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, null);
+ return rankings;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * 再次遍历(包含检查),直接使用上次的排名
+ *
+ * @param city
+ * @param rankings
+ * @param sendType
+ */
+ private void sendAndInspect(CityCollect city, Integer rankings, byte sendType) {
+ if (null != rankings) {
+ List sendList = citySendLogService.find(city.getUid(), null, sendType);
+ if (null == sendList || sendList.isEmpty()) {
+ baseSend(city, rankings, sendType, null);// 首次
+ } else if (!sendList.get(0).getSendStatus()
+ && sendList.get(0).getSendNum() < FangjiaConstant.SEND_ERROR_LIMIT) {
+ baseSend(city, rankings, sendType, sendList.get(0));
+ }
+ }
+ }
+
+ /**
+ * 发送并保存
+ *
+ * @param city
+ * @param rankings
+ * @param sendType
+ */
+ private void baseSend(CityCollect city, Integer rankings, byte sendType, CitySendLog log) {
+ String title = null;
+ if (FangjiaConstant.INCREASE_SEND_TYPE == sendType) {
+ title = city.getCity() + ",全国城市涨幅排名第" + rankings + "位";
+ } else if (FangjiaConstant.DECLINES_SEND_TYPE == sendType) {
+ title = city.getCity() + ",全国城市跌幅排名第" + rankings + "位";
+
+ } else {
+ title = city.getCity() + ",全国城市潜力排名第" + rankings + "位";
+ }
+ LOG.info("全国城市涨幅(跌幅、潜力)排名推送开始,uid:" + city.getUid() + ",city:" + city.getCity());
+ // 发送
+ EnterpriseProductUser user = enterpriseProductUserService.getById(city.getUid(),
+ new String[] { "push_client_id" });
+ LOG.info(title);
+ PushMessageParam param = new PushMessageParam();
+ param.setTitle("排行榜提醒");
+ param.setContent(title);
+ param.setOperation(FangjiaConstant.URL_SEND_TYPE);
+ param.setOperationPage("/views/house/cityDetail.html?city=" + city.getCity());
+ boolean result = false;
+ int sendNum = 1;
+ if (null != user) {
+ param.setPushClientId(user.getPushClientId());
+ result = pushMessageService.pushByReturn(param);
+ } else {
+ LOG.info("PushClientId查询不到,uid:" + city.getUid());
+ sendNum = FangjiaConstant.SEND_ERROR_LIMIT;
+ }
+ // 记录
+ if (null == log) {
+ citySendLogService.save(city.getCity(), city.getUid(), 0L, sendType, result, sendNum);
+ } else {
+ log.setSendStatus(result);
+ log.setSendNum(log.getSendNum() + 1);
+ citySendLogService.update(log);
+ }
+ }
+
+ class MyThread extends Thread {
+
+ private Integer topRankings;
+ private Integer bottomRankings;
+ private Integer potentialRankings;
+
+ private CityCollect city;
+
+ public MyThread(CityCollect city, Integer topRankings, Integer bottomRankings, Integer potentialRankings) {
+ this.topRankings = topRankings;
+ this.bottomRankings = bottomRankings;
+ this.potentialRankings = potentialRankings;
+ this.city = city;
+ }
+
+ @Override
+ public void run() {
+ try {
+ sendAndInspect(city, topRankings, FangjiaConstant.INCREASE_SEND_TYPE);
+ sendAndInspect(city, bottomRankings, FangjiaConstant.INCREASE_SEND_TYPE);
+ sendAndInspect(city, potentialRankings, FangjiaConstant.POTENTIAL_SEND_TYPE);
+ } catch (Exception e) {
+ LOG.error("推送失败!", e);
+ }
+ }
+ }
+
+}
diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/job/HouseRentNoticeJob.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/job/HouseRentNoticeJob.java
index 7c382c8..89be3a3 100644
--- a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/job/HouseRentNoticeJob.java
+++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/job/HouseRentNoticeJob.java
@@ -1,19 +1,31 @@
package com.fangjia.job.youfang.job;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
+
+import com.cxytiandi.jdbc.util.DateUtils;
+import com.cxytiandi.jdbc.util.PageBean;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
-import com.fangjia.job.common.base.Response;
-import com.fangjia.job.common.util.DingDingMessageUtil;
-import com.fangjia.job.common.util.JsonUtils;
-import com.fangjia.job.common.util.RestApiCallUtils;
-import com.fangjia.job.youfang.remote.FshApiRemoteService;
+import com.fangjia.job.common.core.FangjiaThreadPoolExecutor;
+import com.fangjia.job.common.util.DateUtilCustom;
+import com.fangjia.job.youfang.param.PushMessageParam;
+import com.fangjia.job.youfang.po.EnterpriseProductUser;
+import com.fangjia.job.youfang.po.HouseInfo;
+import com.fangjia.job.youfang.service.EnterpriseProductUserService;
+import com.fangjia.job.youfang.service.HouseInfoService;
+import com.fangjia.job.youfang.service.PushMessageService;
/**
* 房产租金提醒任务
- * 每天触发一次,逻辑在服务端
+ * 每天触发一次
* @author yinjihuan
*/
public class HouseRentNoticeJob implements SimpleJob {
@@ -23,10 +35,19 @@ public class HouseRentNoticeJob implements SimpleJob {
@Value("${fsh.url}")
private String fshApiUrl;
+ @Autowired
+ private HouseInfoService houseInfoService;
+
+ @Autowired
+ private EnterpriseProductUserService enterpriseProductUserService;
+
+ @Autowired
+ private PushMessageService pushMessageService;
+
@Override
public void execute(ShardingContext shardingContext) {
logger.info("开始执行HouseRentNoticeJob");
- FshApiRemoteService fshApiRemoteService = RestApiCallUtils.getRestClient(FshApiRemoteService.class, fshApiUrl);
+ /*FshApiRemoteService fshApiRemoteService = RestApiCallUtils.getRestClient(FshApiRemoteService.class, fshApiUrl);
for (int i = 0; i < 300; i++) {
try {
Response response = fshApiRemoteService.sendHouseRentNotice("goojia123456");
@@ -43,8 +64,145 @@ public class HouseRentNoticeJob implements SimpleJob {
Thread.sleep(1000 * 60);
} catch (InterruptedException e) {
}
+ }*/
+
+ long total = houseInfoService.queryHouseAllCount(1L);
+ logger.info("total:" + total);
+ int pages = PageBean.calcPages(total, 1000);
+ logger.info("pages:" + pages);
+ for (int i = 1; i <= pages; i++) {
+ logger.info("开始执行页数:" + i);
+ List houses = houseInfoService.queryHousesByPage(i, 1000,
+ new String[] { "id", "live_status", "lease_start_date", "lease_end_date", "uid", "rent_cycle", "rent_cycle_unit", "last_rent_date" });
+ final CountDownLatch latch = new CountDownLatch(houses.size());
+ for (HouseInfo house : houses) {
+ final HouseInfo h = house;
+ FangjiaThreadPoolExecutor.execute(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ int days = DateUtilCustom.between(new Date(), h.getLeaseEndDate());
+ if("出租".equals(h.getLiveStatus()) && days >= 0) {
+ rentPush(h);
+ rentEndPush(h);
+ }
+ } catch (Exception e) {
+ logger.error("定时推送收租通知异常:"+h.getId(), e);
+ } finally {
+ latch.countDown();
+ }
+ }
+
+ });
+
+ }
+
+ try {
+ latch.await();
+ } catch (InterruptedException e) {
+ logger.error("推送收租通知等待异常", e);
+ }
}
logger.info("HouseRentNoticeJob执行结束");
}
+ // 收租提醒,提前7天通知
+ private void rentPush(HouseInfo houseInfo) {
+ int unitMonth = houseInfo.getRentCycle() * 1;
+ if("季".equals(houseInfo.getRentCycleUnit())){
+ unitMonth = houseInfo.getRentCycle() * 3;
+ }else if("年".equals(houseInfo.getRentCycleUnit())){
+ unitMonth = houseInfo.getRentCycle() * 12;
+ }
+ //共多少月
+ if (houseInfo.getLeaseEndDate() == null || houseInfo.getLeaseStartDate() == null) {
+ return;
+ }
+ int months = (houseInfo.getLeaseEndDate().getYear() - houseInfo.getLeaseStartDate().getYear())*12 + (houseInfo.getLeaseEndDate().getMonth() - houseInfo.getLeaseStartDate().getMonth());
+ if(houseInfo.getLeaseEndDate().getDate()- houseInfo.getLeaseStartDate().getDate()>0){
+ months = months + 1;
+ }
+ //共多少期
+ int sumCycle = (int) Math.ceil(months*1.0/unitMonth);
+
+ Date date = new Date();
+ int months2 = (date.getYear() - houseInfo.getLeaseStartDate().getYear())*12 + (date.getMonth() - houseInfo.getLeaseStartDate().getMonth());
+
+ int count = (int) Math.floor(months2*1.0/unitMonth);
+ int stage = 0;
+ //第几期
+ if(count + 2<=sumCycle){
+ stage = count+2;//默认开始为一期,再加1是下一期
+ }else{
+ stage = sumCycle;//默认开始为一期,再加1是下一期
+ }
+ Date nextDay = null;
+ if(count + 1=1 && date.getTime()<=lastNextDay.getTime()){
+ stage = stage-1;
+ nextDay = lastNextDay;
+ }
+ }else{
+ nextDay = org.apache.commons.lang3.time.DateUtils.addMonths(houseInfo.getLeaseStartDate(), (sumCycle-1)*unitMonth);
+ nextDay.setDate(houseInfo.getLastRentDate().getDate());
+
+ Date lastNextDay = org.apache.commons.lang3.time.DateUtils.addMonths(nextDay, -1*unitMonth);
+ date = org.apache.commons.lang3.time.DateUtils.truncate(date, Calendar.DAY_OF_MONTH);
+ if(stage>=1 && date.getTime() cityList = cityCollectService.findAll();
+ String cityName = "";
+ List newsList = null;
+ // 2.对比
+ for (CityCollect city : cityList) {
+ // cityList已排序好,如果cityName不变,则使用上个newsList
+ if (cityName.equals(city.getCity())) {
+ THREAD_POOL.execute(new MyThread(city, newsList));
+ } else {
+ // 如果cityName改变,则查询替换cityName和newsList
+ cityName = city.getCity();
+ newsList = newsService.findHousingEstate(cityName);
+ THREAD_POOL.execute(new MyThread(city, newsList));
+ }
+ }
+ }
+
+ 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() || (!sendList.get(0).getSendStatus()
+ && sendList.get(0).getSendNum() < FangjiaConstant.SEND_ERROR_LIMIT)) {
+ LOG.info("小区推送开始。。。uid:" + city.getUid() + ",newsId:" + n.getId());
+ // 3.发送
+ EnterpriseProductUser user = enterpriseProductUserService.getById(city.getUid(),
+ new String[] { "push_client_id" });
+ String pushMsg = n.getIntroduction();
+ LOG.info(pushMsg);
+ PushMessageParam param = new PushMessageParam();
+ param.setTitle(n.getTitle());
+ param.setContent(pushMsg);
+ param.setOperation(FangjiaConstant.URL_SEND_TYPE);
+ param.setOperationPage("/views/district/detail.html?city=" + n.getRecommendDistrictCity()
+ + "®ion=" + n.getRecommendDistrictRegion() + "&name=" + n.getRecommendDistrictName());
+
+ boolean result = false;
+ int sendNum = 1;
+ if (null != user) {
+ param.setPushClientId(user.getPushClientId());
+ result = pushMessageService.pushByReturn(param);
+ } else {
+ LOG.info("PushClientId查询不到,uid:" + city.getUid());
+ sendNum = FangjiaConstant.SEND_ERROR_LIMIT;// 不可推送的,次数直接置为3次,避免再次推送
+ }
+ // 4.记录
+ if (null == sendList || sendList.isEmpty()) {
+ citySendLogService.save(city.getCity(), city.getUid(), n.getId(),
+ FangjiaConstant.HOUSING_ESTATE_SEND_TYPE, result, sendNum);
+ } else {
+ CitySendLog log = sendList.get(0);
+ log.setSendStatus(result);
+ log.setSendNum(log.getSendNum() + 1);
+ citySendLogService.update(log);
+ }
+ }
+ }
+ }
+ }
+
+ class MyThread extends Thread {
+ private List news;
+ private CityCollect city;
+
+ public MyThread(CityCollect city, List news) {
+ this.news = news;
+ this.city = city;
+ }
+
+ @Override
+ public void run() {
+ try {
+ sendNews(city, news);
+ } catch (Exception e) {
+ LOG.error("推送失败!", e);
+ }
+ }
+ }
+
+}
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
new file mode 100644
index 0000000..025a8aa
--- /dev/null
+++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/job/TopNewsSendJob.java
@@ -0,0 +1,156 @@
+package com.fangjia.job.youfang.job;
+
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+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.common.util.JsonUtils;
+import com.fangjia.job.youfang.document.CitySendLog;
+import com.fangjia.job.youfang.param.PushMessageParam;
+import com.fangjia.job.youfang.po.CityCollect;
+import com.fangjia.job.youfang.po.EnterpriseProductUser;
+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.EnterpriseProductUserService;
+import com.fangjia.job.youfang.service.NewsService;
+import com.fangjia.job.youfang.service.PushMessageService;
+
+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;
+
+ @Autowired
+ private EnterpriseProductUserService enterpriseProductUserService;
+
+ @Autowired
+ private PushMessageService pushMessageService;
+
+ private static final ExecutorService THREAD_POOL = Executors.newFixedThreadPool(FangjiaConstant.SEND_THREAD_NUM);
+
+ @Override
+ public void execute(ShardingContext context) {
+ 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())) {
+ THREAD_POOL.execute(new MyThread(city, newsList));
+
+ } else {
+ // 如果cityName改变,则查询替换cityName和newsList
+ cityName = city.getCity();
+ newsList = newsService.findTopNews(cityName);
+ THREAD_POOL.execute(new MyThread(city, newsList));
+ }
+ }
+ }
+
+ 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()
+ || (!sendList.get(0).getSendStatus()&&sendList.get(0).getSendNum() < FangjiaConstant.SEND_ERROR_LIMIT)) {
+ LOG.info("新闻推送开始。。。uid:" + city.getUid() + ",newsId:" + n.getId());
+ // 3.发送
+ EnterpriseProductUser user = enterpriseProductUserService.getById(city.getUid(),
+ new String[] { "push_client_id" });
+ String pushMsg = n.getIntroduction();
+ PushMessageParam param = new PushMessageParam();
+ param.setTitle(n.getTitle());
+ param.setContent(pushMsg);
+ param.setOperation(FangjiaConstant.URL_SEND_TYPE);
+ switch (n.getType()) {
+ case "专题":
+ param.setOperationPage("/views/news/newsDetail.html?newsId=" + n.getId());
+ break;
+ case "新闻":
+ param.setOperationPage("/views/news/newsDetail.html?newsId=" + n.getId());
+ param.setUserId(city.getUid());
+ break;
+ case "推荐城市":
+ param.setOperationPage("/views/house/cityDetail.html?city=" + n.getCity());
+ break;
+ case "投票":
+ param.setOperation(FangjiaConstant.OPEN_APP_TYPE);
+ break;
+ case "活动":
+ param.setOperation(FangjiaConstant.OPEN_APP_TYPE);
+ break;
+ case "推荐小区":
+ param.setOperationPage(
+ "/views/district/detail.html?city=" + n.getRecommendDistrictCity() + "®ion="
+ + n.getRecommendDistrictRegion() + "&name=" + n.getRecommendDistrictName());
+ break;
+ default:
+ param.setOperationPage("/views/news/newsDetail.html?newsId=" + n.getId());
+ }
+ boolean result = false;
+ int sendNum = 1;
+ if (null != user) {
+ param.setPushClientId(user.getPushClientId());
+ LOG.info("param:" + JsonUtils.toJson(param));
+ result = pushMessageService.pushByReturn(param);
+ } else {
+ LOG.info("PushClientId查询不到,uid:" + city.getUid());
+ sendNum = FangjiaConstant.SEND_ERROR_LIMIT;// 不可推送的,次数直接置为3次,避免再次推送
+ }
+ // 4.记录
+ if (null == sendList || sendList.isEmpty()) {
+ citySendLogService.save(city.getCity(), city.getUid(), n.getId(),
+ FangjiaConstant.NEWS_SEND_TYPE, result, sendNum);
+ } else {
+ CitySendLog log = sendList.get(0);
+ log.setSendStatus(result);
+ log.setSendNum(log.getSendNum() + 1);
+ citySendLogService.update(log);
+ }
+ }
+ }
+ }
+
+ }
+
+ class MyThread extends Thread {
+ private List news;
+ private CityCollect city;
+
+ public MyThread(CityCollect city, List news) {
+ this.news = news;
+ this.city = city;
+ }
+
+ @Override
+ public void run() {
+ try {
+ sendNews(city, news);
+ } catch (Exception e) {
+ LOG.error("推送失败!", e);
+ }
+ }
+ }
+
+}
diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/job/UserAssetsLevelJob.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/job/UserAssetsLevelJob.java
index 1999f65..0b8cfeb 100644
--- a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/job/UserAssetsLevelJob.java
+++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/job/UserAssetsLevelJob.java
@@ -90,7 +90,7 @@ public class UserAssetsLevelJob implements SimpleJob {
}
level.setName(name);
Long totalMoney = houseInfoService.queryUserManagerHouseTotalPrice(1L, user.getId()+"");
- level.setAssets(DataUtil.getDoubleRound(2, totalMoney / 10000D));
+ level.setAssets(DataUtil.getDoubleRound(0, totalMoney / 10000D));
mongoTemplate.save(level);
}
}
diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/param/PushMessageParam.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/param/PushMessageParam.java
new file mode 100644
index 0000000..54c9576
--- /dev/null
+++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/param/PushMessageParam.java
@@ -0,0 +1,71 @@
+package com.fangjia.job.youfang.param;
+
+public class PushMessageParam {
+
+ // 标题
+ private String title;
+
+ // 内容
+ private String content;
+
+ // 通知操作(0:打开应用,1:打开指定页面,2:打开url)
+ private int operation;
+
+ // 当通知操作为打开具体页面时这个值就是页面的值,当为打开url时这个值就是url的值
+ private String operationPage;
+
+ // 推送ID
+ private String pushClientId;
+
+ // 推送给哪个用户
+ private Long userId;
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ public int getOperation() {
+ return operation;
+ }
+
+ public void setOperation(int operation) {
+ this.operation = operation;
+ }
+
+ public String getOperationPage() {
+ return operationPage;
+ }
+
+ public void setOperationPage(String operationPage) {
+ this.operationPage = operationPage;
+ }
+
+ public String getPushClientId() {
+ return pushClientId;
+ }
+
+ public void setPushClientId(String pushClientId) {
+ this.pushClientId = pushClientId;
+ }
+
+ public Long getUserId() {
+ return userId;
+ }
+
+ public void setUserId(Long userId) {
+ this.userId = userId;
+ }
+
+}
diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/po/CityCollect.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/po/CityCollect.java
new file mode 100644
index 0000000..41289bb
--- /dev/null
+++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/po/CityCollect.java
@@ -0,0 +1,29 @@
+package com.fangjia.job.youfang.po;
+
+import java.io.Serializable;
+
+import com.cxytiandi.jdbc.annotation.AutoId;
+import com.cxytiandi.jdbc.annotation.Field;
+import com.cxytiandi.jdbc.annotation.TableName;
+
+import lombok.Data;
+
+@Data
+@TableName(value = "city_collect", author = "yinjihuan", desc = "城市收藏表")
+public class CityCollect implements Serializable {
+
+ private static final long serialVersionUID = 5064195667364691855L;
+
+ @AutoId
+ @Field(value = "id", desc = "ID")
+ private Long id;
+
+ @Field(value = "city", desc = "城市")
+ private String city;
+
+ @Field(value = "add_time", desc = "保存时间")
+ private Data addTime;
+
+ @Field(value = "uid", desc = "用户ID")
+ private Long uid;
+}
diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/po/News.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/po/News.java
index bd11c35..79b98ed 100644
--- a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/po/News.java
+++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/po/News.java
@@ -50,8 +50,8 @@ public class News implements Serializable {
@Field(value = "content", desc = "内容")
private String content;
- @Field(value = "publish_status", desc = "是否已发布(0:未发布,1已发布)")
- private int publishStatus;
+ // @Field(value = "publish_status", desc = "是否已发布(0:未发布,1已发布)")
+ // private int publishStatus;
@Field(value = "top_status", desc = "是否置顶(0否 1是)")
private int topStatus;
@@ -62,6 +62,9 @@ public class News implements Serializable {
@Field(value = "visit_count", desc = "浏览量")
private int visitCount;
+ @Field(value = "thumbs_up_count", desc = "点赞量")
+ private int thumbsUpCount;
+
@Field(value = "vote_favor_count", desc = "投票赞成数量")
private int voteFavorCount;
@@ -71,6 +74,42 @@ public class News implements Serializable {
@Field(value = "user_id", desc = "创建用户ID")
private Long userId;
+ @Field(value = "m_date", desc = "修改时间")
+ private Date mDate;
+
+ @Field(value = "tags", desc = "标签,多个下划线分割")
+ private String tags;
+
+ @Field(value = "vote_favor_text", desc = "投票赞成显示文字(投票类专有)")
+ private String voteFavorText;
+
+ @Field(value = "vote_no_favor_text", desc = "投票不赞成显示文字(投票类专有)")
+ private String voteNoFavorText;
+
+ @Field(value = "recommend_city", desc = "推荐城市,城市推荐才有此值")
+ private String recommendCity;
+
+ @Field(value = "recommend_city_tags", desc = "推荐城市的标签,下划线分割,城市推荐才有此值")
+ private String recommendCityTags;
+
+ @Field(value = "recommend_district_city", desc = "小区推荐咨询的城市")
+ private String recommendDistrictCity;
+
+ @Field(value = "recommend_district_region", desc = "小区推荐咨询的区域")
+ private String recommendDistrictRegion;
+
+ @Field(value = "recommend_district_name", desc = "小区推荐咨询的小区名")
+ private String recommendDistrictName;
+
+ @Field(value = "recommend_district_tags", desc = "小区推荐咨询的小区标签,下划线分割")
+ private String recommendDistrictTags;
+
+ @Field(value = "small_cover_img", desc = "封面缩略图")
+ private String smallCoverImg;
+
+ @Field(value = "init_visit_count", desc = "初始化浏览量")
+ private Integer initVisitCount;
+
public Long getId() {
return id;
}
@@ -175,13 +214,13 @@ public class News implements Serializable {
this.content = content;
}
- public int getPublishStatus() {
- return publishStatus;
- }
-
- public void setPublishStatus(int publishStatus) {
- this.publishStatus = publishStatus;
- }
+ // public int getPublishStatus() {
+ // return publishStatus;
+ // }
+ //
+ // public void setPublishStatus(int publishStatus) {
+ // this.publishStatus = publishStatus;
+ // }
public int getTopStatus() {
return topStatus;
@@ -230,4 +269,109 @@ public class News implements Serializable {
public void setUserId(Long userId) {
this.userId = userId;
}
+
+ public int getThumbsUpCount() {
+ return thumbsUpCount;
+ }
+
+ public void setThumbsUpCount(int thumbsUpCount) {
+ this.thumbsUpCount = thumbsUpCount;
+ }
+
+ public Date getMDate() {
+ return mDate;
+ }
+
+ public void setMDate(Date mDate) {
+ this.mDate = mDate;
+ }
+
+ public String getTags() {
+ return tags;
+ }
+
+ public void setTags(String tags) {
+ this.tags = tags;
+ }
+
+ public String getVoteFavorText() {
+ return voteFavorText;
+ }
+
+ public void setVoteFavorText(String voteFavorText) {
+ this.voteFavorText = voteFavorText;
+ }
+
+ public String getVoteNoFavorText() {
+ return voteNoFavorText;
+ }
+
+ public void setVoteNoFavorText(String voteNoFavorText) {
+ this.voteNoFavorText = voteNoFavorText;
+ }
+
+ public String getRecommendCity() {
+ return recommendCity;
+ }
+
+ public void setRecommendCity(String recommendCity) {
+ this.recommendCity = recommendCity;
+ }
+
+ public String getRecommendCityTags() {
+ return recommendCityTags;
+ }
+
+ public void setRecommendCityTags(String recommendCityTags) {
+ this.recommendCityTags = recommendCityTags;
+ }
+
+ public String getRecommendDistrictCity() {
+ return recommendDistrictCity;
+ }
+
+ public void setRecommendDistrictCity(String recommendDistrictCity) {
+ this.recommendDistrictCity = recommendDistrictCity;
+ }
+
+ public String getRecommendDistrictRegion() {
+ return recommendDistrictRegion;
+ }
+
+ public void setRecommendDistrictRegion(String recommendDistrictRegion) {
+ this.recommendDistrictRegion = recommendDistrictRegion;
+ }
+
+ public String getRecommendDistrictName() {
+ return recommendDistrictName;
+ }
+
+ public void setRecommendDistrictName(String recommendDistrictName) {
+ this.recommendDistrictName = recommendDistrictName;
+ }
+
+ public String getRecommendDistrictTags() {
+ return recommendDistrictTags;
+ }
+
+ public void setRecommendDistrictTags(String recommendDistrictTags) {
+ this.recommendDistrictTags = recommendDistrictTags;
+ }
+
+ public String getSmallCoverImg() {
+ return smallCoverImg;
+ }
+
+ public void setSmallCoverImg(String smallCoverImg) {
+ this.smallCoverImg = smallCoverImg;
+ }
+
+ public Integer getInitVisitCount() {
+ return initVisitCount;
+ }
+
+ public void setInitVisitCount(Integer initVisitCount) {
+ this.initVisitCount = initVisitCount;
+ }
+
}
\ No newline at end of file
diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/po/PushMessage.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/po/PushMessage.java
new file mode 100644
index 0000000..f93388e
--- /dev/null
+++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/po/PushMessage.java
@@ -0,0 +1,60 @@
+package com.fangjia.job.youfang.po;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import com.cxytiandi.jdbc.annotation.AutoId;
+import com.cxytiandi.jdbc.annotation.Field;
+import com.cxytiandi.jdbc.annotation.TableName;
+
+import lombok.Data;
+
+@Data
+@TableName(value = "push_message", author = "yinjihuan", desc = "推送消息表")
+public class PushMessage implements Serializable {
+
+ private static final long serialVersionUID = -1101101524583976384L;
+
+ @AutoId
+ @Field(value = "id", desc = "ID")
+ private Long id;
+
+ @Field(value = "title", desc = "标题")
+ private String title;
+
+ @Field(value = "content", desc = "内容")
+ private String content;
+
+ @Field(value = "add_time", desc = "添加时间")
+ private Date addTime;
+
+ @Field(value = "save_status", desc = "用户消息列表是否留存(0不存,1存)")
+ private Integer saveStatus;
+
+ @Field(value = "operation", desc = "通知操作(0:打开应用,1:打开指定页面,2:打开url)")
+ private Integer operation;
+
+ @Field(value = "operation_page", desc = "当通知操作为打开具体页面时这个值就是页面的值,当为打开url时这个值就是url的值")
+ private String operationPage;
+
+ @Field(value = "user_range", desc = "通知用户范围(0:全部用户,1:部分用户)")
+ private Integer userRange;
+
+ @Field(value = "user_range_city", desc = "通知用户范围对应的城市")
+ private String userRangeCity;
+
+ @Field(value = "push_time", desc = "推送时间")
+ private Date pushTime;
+
+ @Field(value = "push_status", desc = "是否已推送(0未推送,1已推送)")
+ private Integer pushStatus;
+
+ @Field(value = "user_range_province", desc = "通知用户所在省份")
+ private String userRangeProvince;
+
+ @Field(value = "uid", desc = "创建用户ID")
+ private Long uid;
+
+ @Field(value = "user_range_city_code", desc = "个推城市码")
+ private String userRangeCityCode;
+}
diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/po/PushRecordMessage.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/po/PushRecordMessage.java
new file mode 100644
index 0000000..056f0b3
--- /dev/null
+++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/po/PushRecordMessage.java
@@ -0,0 +1,33 @@
+package com.fangjia.job.youfang.po;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import com.cxytiandi.jdbc.annotation.AutoId;
+import com.cxytiandi.jdbc.annotation.Field;
+import com.cxytiandi.jdbc.annotation.TableName;
+
+import lombok.Data;
+
+@Data
+@TableName(value = "push_record_message", author = "yinjihuan", desc = "推送消息记录表")
+public class PushRecordMessage implements Serializable {
+
+ private static final long serialVersionUID = 6736005034016737661L;
+
+ @AutoId
+ @Field(value = "id", desc = "ID")
+ private Long id;
+
+ @Field(value = "uid", desc = "用户ID")
+ private Long uid;
+
+ @Field(value = "mid", desc = "消息ID")
+ private Long mid;
+
+ @Field(value = "add_time", desc = "添加时间")
+ private Date addTime;
+
+ @Field(value = "read_status", desc = "是否已读 (0未读,1已读)")
+ private Integer readStatus;
+}
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..bc37a37 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,84 @@ 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);
+
+ /**
+ * 消息推送接口
+ * @param queryMap
+ * @return
+ */
+ @RequestLine("POST /rest/message/push")
+ public Response pushMessage(@QueryMap Map queryMap);
}
diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/CityCollectService.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/CityCollectService.java
new file mode 100644
index 0000000..cbf1931
--- /dev/null
+++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/CityCollectService.java
@@ -0,0 +1,11 @@
+package com.fangjia.job.youfang.service;
+
+import java.util.List;
+
+import com.fangjia.job.youfang.po.CityCollect;
+
+public interface CityCollectService {
+
+ List findAll();
+
+}
diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/CityCollectServiceImpl.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/CityCollectServiceImpl.java
new file mode 100644
index 0000000..069576d
--- /dev/null
+++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/CityCollectServiceImpl.java
@@ -0,0 +1,23 @@
+package com.fangjia.job.youfang.service;
+
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+
+import com.cxytiandi.jdbc.EntityService;
+import com.cxytiandi.jdbc.Orders;
+import com.cxytiandi.jdbc.Orders.OrderyType;
+import com.fangjia.job.youfang.po.CityCollect;
+
+@Service
+public class CityCollectServiceImpl extends EntityService implements CityCollectService {
+
+ private static final String ORDER_PARAM = "city";
+
+ @Override
+ public List findAll() {
+ return super.list(new Orders[] { new Orders(ORDER_PARAM, OrderyType.ASC) });
+// return super.list(new String[] {"uid"},new Object[] {"190075963655061504"},new Orders[] { new Orders(ORDER_PARAM, OrderyType.ASC) });
+ }
+
+}
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
new file mode 100644
index 0000000..ba06c37
--- /dev/null
+++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/CitySendLogService.java
@@ -0,0 +1,14 @@
+package com.fangjia.job.youfang.service;
+
+import java.util.List;
+
+import com.fangjia.job.youfang.document.CitySendLog;
+
+public interface CitySendLogService {
+
+ CitySendLog save(String city, Long uid, Long nId, byte sendType, Boolean sendStatus, int sendNum);
+
+ List find(long uid, Long newsId, Byte sendType);
+
+ void update(CitySendLog log);
+}
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
new file mode 100644
index 0000000..d7ef36c
--- /dev/null
+++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/CitySendLogServiceImpl.java
@@ -0,0 +1,75 @@
+package com.fangjia.job.youfang.service;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
+import org.springframework.data.mongodb.core.query.Update;
+import org.springframework.stereotype.Service;
+
+import com.fangjia.job.youfang.document.CitySendLog;
+
+@Service
+public class CitySendLogServiceImpl implements CitySendLogService {
+
+ @Autowired
+ private MongoTemplate mongoTemplate;
+
+ @Override
+ public CitySendLog save(String city, Long uid, Long nId, byte sendType, Boolean sendStatus, int sendNum) {
+ CitySendLog log = new CitySendLog();
+ log.setCity(city);
+ log.setNewsId(nId);
+ log.setSendTime(new Date());
+ log.setSendType(sendType);
+ log.setUid(uid);
+ log.setSendStatus(sendStatus);
+ log.setSendNum(sendNum);
+ mongoTemplate.save(log);
+ return log;
+ }
+
+ @Override
+ public List find(long uid, Long newsId, Byte sendType) {
+ if (null != newsId) {// 咨询推送
+ Query query = Query.query(Criteria.where("uid").is(uid).and("newsId").is(newsId));
+ return mongoTemplate.find(query, CitySendLog.class);
+ } else { // 排名推送,查当前一个月内的记录
+ Query query = Query.query(
+ Criteria.where("uid").is(uid).and("sendTime").gt(getMonthAgo()).and("sendType").is(sendType));
+ return mongoTemplate.find(query, CitySendLog.class);
+ }
+ }
+
+ /**
+ * 取一个月前的时间
+ *
+ * @return
+ */
+ private Date getMonthAgo() {
+ Calendar c = Calendar.getInstance();
+ c.setTime(new Date());
+ c.add(Calendar.MONTH, -1);
+ return c.getTime();
+ }
+
+ @Override
+ public void update(CitySendLog log) {
+ if (null != log.getNewsId()) {
+ mongoTemplate.updateFirst(
+ Query.query(Criteria.where("uid").is(log.getUid()).and("newsId").is(log.getNewsId())),
+ Update.update("sendNum", log.getSendNum()).set("sendStatus", log.getSendStatus()),
+ CitySendLog.class);
+ } else {
+ mongoTemplate.updateFirst(
+ Query.query(Criteria.where("uid").is(log.getUid()).and("sendTime").is(log.getSendTime())
+ .and("sendType").is(log.getSendType())),
+ Update.update("sendNum", log.getSendNum()).set("sendStatus", log.getSendStatus()),
+ CitySendLog.class);
+ }
+ }
+}
diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/EnterpriseProductUserService.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/EnterpriseProductUserService.java
index 3c56e85..f7ba8a0 100644
--- a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/EnterpriseProductUserService.java
+++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/EnterpriseProductUserService.java
@@ -44,4 +44,6 @@ public interface EnterpriseProductUserService {
boolean existsByPushId(String pushID);
List queryAddUser(String start, String end);
+
+ EnterpriseProductUser getById(Long id, String[] fields);
}
diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/EnterpriseProductUserServiceImpl.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/EnterpriseProductUserServiceImpl.java
index 06bfdcf..eeab168 100644
--- a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/EnterpriseProductUserServiceImpl.java
+++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/EnterpriseProductUserServiceImpl.java
@@ -42,4 +42,9 @@ public class EnterpriseProductUserServiceImpl extends EntityService queryHousesByPage(int page, int limit, String[] fields);
}
diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/HouseInfoServiceImpl.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/HouseInfoServiceImpl.java
index d5d5477..8b6ec74 100644
--- a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/HouseInfoServiceImpl.java
+++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/HouseInfoServiceImpl.java
@@ -7,6 +7,7 @@ import java.util.TreeMap;
import org.springframework.stereotype.Service;
import com.cxytiandi.jdbc.EntityService;
+import com.cxytiandi.jdbc.util.PageBean;
import com.fangjia.job.youfang.po.HouseInfo;
@Service
@@ -122,5 +123,11 @@ public class HouseInfoServiceImpl extends EntityService implements Ho
}
return sum;
}
+
+ @Override
+ public List queryHousesByPage(int page, int limit, String[] fields) {
+ int start = PageBean.page2Start(page, limit);
+ return super.listForPage(fields, "remove_status", 0, start, limit);
+ }
}
diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/NewsService.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/NewsService.java
index 150a56c..2258498 100644
--- a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/NewsService.java
+++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/NewsService.java
@@ -1,19 +1,28 @@
package com.fangjia.job.youfang.service;
+import java.util.List;
+
+import com.fangjia.job.youfang.po.News;
+
public interface NewsService {
/**
* 发布新闻
+ *
* @param date
* @return
*/
void pushNews(String date);
-
+
/**
* 下架新闻
+ *
* @param date
* @return
*/
void offlineNews(String date);
-
+
+ List findTopNews(String city);
+
+ List findHousingEstate(String city);
}
diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/NewsServiceImpl.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/NewsServiceImpl.java
index ed11bfa..2bbafe0 100644
--- a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/NewsServiceImpl.java
+++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/NewsServiceImpl.java
@@ -1,5 +1,7 @@
package com.fangjia.job.youfang.service;
+import java.util.List;
+
import org.springframework.stereotype.Service;
import com.cxytiandi.jdbc.EntityService;
@@ -8,16 +10,34 @@ import com.fangjia.job.youfang.po.News;
@Service
public class NewsServiceImpl extends EntityService implements NewsService {
+ private static final int TOP_STATUS = 1;
+
+ private static final int ON_LINE_STATUS = 1;
+
+ private static final String HOUSING_ESTATE_TYPE = "推荐小区";
+
@Override
public void pushNews(String date) {
- String sql = "update news set `status`=1 where `status`=0 and deploy_time<='"+date+"'";
+ String sql = "update news set `status`=1 where `status`=0 and deploy_time<='" + date + "'";
super.getJdbcTemplate().execute(sql);
}
@Override
public void offlineNews(String date) {
- String sql = "update news set `status`=2 where `status`=1 and offline_time<='"+date+"'";
+ String sql = "update news set `status`=2 where `status`=1 and offline_time<='" + date + "'";
super.getJdbcTemplate().execute(sql);
}
+ @Override
+ public List findTopNews(String city) {
+ return super.list(new String[] { "status", "top_status", "city" },
+ new Object[] { ON_LINE_STATUS, TOP_STATUS, city });
+ }
+
+ @Override
+ public List findHousingEstate(String city) {
+ return super.list(new String[] { "status", "type", "city" },
+ new Object[] { ON_LINE_STATUS, HOUSING_ESTATE_TYPE, city });
+ }
+
}
diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/PushMessageService.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/PushMessageService.java
new file mode 100644
index 0000000..1bf7fd1
--- /dev/null
+++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/PushMessageService.java
@@ -0,0 +1,19 @@
+package com.fangjia.job.youfang.service;
+
+import com.fangjia.job.youfang.param.PushMessageParam;
+
+public interface PushMessageService {
+
+ /**
+ * 推送消息
+ * @param param
+ */
+ void push(PushMessageParam param);
+
+ /**
+ * 推送消息
+ * @param param
+ */
+ boolean pushByReturn(PushMessageParam param);
+
+}
diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/PushMessageServiceImpl.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/PushMessageServiceImpl.java
new file mode 100644
index 0000000..0ca4ed2
--- /dev/null
+++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/PushMessageServiceImpl.java
@@ -0,0 +1,67 @@
+package com.fangjia.job.youfang.service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import com.cxytiandi.jdbc.EntityService;
+import com.fangjia.job.common.base.Response;
+import com.fangjia.job.common.util.DingDingMessageUtil;
+import com.fangjia.job.common.util.RestApiCallUtils;
+import com.fangjia.job.youfang.param.PushMessageParam;
+import com.fangjia.job.youfang.po.PushMessage;
+import com.fangjia.job.youfang.remote.FshApiRemoteService;
+
+@Service
+public class PushMessageServiceImpl extends EntityService implements PushMessageService {
+
+ private Logger logger = LoggerFactory.getLogger(PushMessageServiceImpl.class);
+
+ @Value("${fsh.url}")
+ private String fshApiUrl;
+
+ @Override
+ public void push(PushMessageParam param) {
+ FshApiRemoteService fshApiRemoteService = RestApiCallUtils.getRestClient(FshApiRemoteService.class, fshApiUrl);
+ try {
+ Map params = new HashMap();
+ params.put("token", "goojia123456");
+ params.put("title", param.getTitle());
+ params.put("content", param.getContent());
+ params.put("operation", param.getOperation());
+ params.put("operationPage", param.getOperationPage());
+ params.put("pushClientId", param.getPushClientId());
+ params.put("userId", param.getUserId());
+ fshApiRemoteService.pushMessage(params);
+ } catch (Exception e) {
+ logger.error("消息推送异常:", e);
+ DingDingMessageUtil.sendTextMessage("消息推送异常:" + e.getMessage());
+ }
+ }
+
+ @Override
+ public boolean pushByReturn(PushMessageParam param) {
+ FshApiRemoteService fshApiRemoteService = RestApiCallUtils.getRestClient(FshApiRemoteService.class, fshApiUrl);
+ boolean result = false;
+ try {
+ Map params = new HashMap();
+ params.put("token", "goojia123456");
+ params.put("title", param.getTitle());
+ params.put("content", param.getContent());
+ params.put("operation", param.getOperation());
+ params.put("operationPage", param.getOperationPage());
+ params.put("pushClientId", param.getPushClientId());
+ params.put("userId", param.getUserId());
+ Response res = fshApiRemoteService.pushMessage(params);
+ result = res.getStatus();
+ } catch (Exception e) {
+ logger.error("消息推送异常:", e);
+ DingDingMessageUtil.sendTextMessage("消息推送异常:" + e.getMessage());
+ }
+ return result;
+ }
+
+}
diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/PushRecordMessageService.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/PushRecordMessageService.java
new file mode 100644
index 0000000..0d314fd
--- /dev/null
+++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/PushRecordMessageService.java
@@ -0,0 +1,5 @@
+package com.fangjia.job.youfang.service;
+
+public interface PushRecordMessageService {
+
+}
diff --git a/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/PushRecordMessageServiceImpl.java b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/PushRecordMessageServiceImpl.java
new file mode 100644
index 0000000..fb284ac
--- /dev/null
+++ b/fangjia-job/fangjia-job-youfang/src/main/java/com/fangjia/job/youfang/service/PushRecordMessageServiceImpl.java
@@ -0,0 +1,11 @@
+package com.fangjia.job.youfang.service;
+
+import org.springframework.stereotype.Service;
+
+import com.cxytiandi.jdbc.EntityService;
+import com.fangjia.job.youfang.po.PushRecordMessage;
+
+@Service
+public class PushRecordMessageServiceImpl extends EntityService implements PushRecordMessageService {
+
+}
diff --git a/fangjia-job/fangjia-job-youfang/src/main/resources/applicationContext.xml b/fangjia-job/fangjia-job-youfang/src/main/resources/applicationContext.xml
index d80c5a7..d734984 100644
--- a/fangjia-job/fangjia-job-youfang/src/main/resources/applicationContext.xml
+++ b/fangjia-job/fangjia-job-youfang/src/main/resources/applicationContext.xml
@@ -1,4 +1,4 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/fangjia-job/pom.xml b/fangjia-job/pom.xml
index 0888b67..d41e3d0 100644
--- a/fangjia-job/pom.xml
+++ b/fangjia-job/pom.xml
@@ -81,7 +81,27 @@
feign-core
${feign.version}
+
+
+ org.projectlombok
+ lombok
+ 1.16.20
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.6.1
+
+ 1.8
+ 1.8
+
+
+
+
\ No newline at end of file