Merge branch 'FSHJOB1.2' of 192.168.0.27:dev0/fangjia-job into FSHJOB1.2

This commit is contained in:
尹吉欢
2018-05-21 17:02:32 +08:00
7 changed files with 22 additions and 17 deletions
@@ -18,5 +18,7 @@ public class FangjiaConstant {
public static final int SUCCESS_RESPONSE_CODE = 200;
public static final int SEND_THREAD_NUM = 100;
public static final int URL_SEND_TYPE = 2;
}
@@ -94,7 +94,7 @@ public class CityRankingSendJob implements SimpleJob {
// 涨幅前10
topTenList = upList.subList(0, NUM);
// 跌幅前10
bottomTenList = upList.subList(copyList.size() - NUM, copyList.size());
bottomTenList = upList.subList(upList.size() - NUM, upList.size());
Collections.reverse(bottomTenList);// 涨幅后10名倒序
// 深复制失败,再次访问,用新list做潜力排序
CityNewPriceResultDto resultDto2 = fshApiRemoteService.getAllCitys(token);
@@ -134,7 +134,7 @@ public class CityRankingSendJob implements SimpleJob {
}
/**
* 首次遍历,并返回排名,没有则返回null
* 首次遍历(包含检查),并返回排名,没有则返回null
*
* @param city
* @param list
@@ -144,6 +144,7 @@ public class CityRankingSendJob implements SimpleJob {
private Integer sendRankings(CityCollect city, List<CityStatInfoDto> list, byte sendType) {
List<CitySendLog> 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;// 排名
@@ -156,13 +157,13 @@ public class CityRankingSendJob implements SimpleJob {
}
/**
* 再次遍历,直接使用上次的排名
* 再次遍历(包含检查),直接使用上次的排名
*
* @param city
* @param rankings
* @param sendType
*/
private void sendRankings(CityCollect city, Integer rankings, byte sendType) {
private void sendAndInspect(CityCollect city, Integer rankings, byte sendType) {
List<CitySendLog> sendList = citySendLogService.find(city.getUid(), null, sendType);
if ((null == sendList || sendList.isEmpty()) && null != rankings) {
baseSend(city, rankings, sendType);
@@ -194,8 +195,8 @@ public class CityRankingSendJob implements SimpleJob {
PushMessageParam param = new PushMessageParam();
param.setTitle("排行榜提醒");
param.setContent(title);
param.setOperation(1);
param.setOperationPage("");
param.setOperation(FangjiaConstant.URL_SEND_TYPE);
param.setOperationPage("/views/house/cityDetail.html?city="+city.getCity());
param.setPushClientId(user.getPushClientId());
pushMessageService.push(param);
// 记录
@@ -220,9 +221,9 @@ public class CityRankingSendJob implements SimpleJob {
@Override
public void run() {
try {
baseSend(city, topRankings, FangjiaConstant.INCREASE_SEND_TYPE);
sendRankings(city, bottomRankings, FangjiaConstant.INCREASE_SEND_TYPE);
sendRankings(city, potentialRankings, FangjiaConstant.POTENTIAL_SEND_TYPE);
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);
}
@@ -75,13 +75,13 @@ public class HousingEstateNewsSendJob implements SimpleJob {
// 3.发送
EnterpriseProductUser user = enterpriseProductUserService.getById(city.getUid(),
new String[] { "push_client_id" });
String pushMsg = n.getContent();
String pushMsg = n.getIntroduction();
LOG.info(pushMsg);
PushMessageParam param = new PushMessageParam();
param.setTitle(n.getTitle());
param.setContent(pushMsg);
param.setOperation(1);
param.setOperationPage("");
param.setOperation(FangjiaConstant.URL_SEND_TYPE);
param.setOperationPage("/views/news/newsDetail.html?newsId=" + n.getId());
param.setPushClientId(user.getPushClientId());
pushMessageService.push(param);
// 4.记录
@@ -76,13 +76,13 @@ public class TopNewsSendJob implements SimpleJob {
// 3.发送
EnterpriseProductUser user = enterpriseProductUserService.getById(city.getUid(),
new String[] { "push_client_id" });
String pushMsg = n.getContent();
String pushMsg = n.getIntroduction();
LOG.info(pushMsg);
PushMessageParam param = new PushMessageParam();
param.setTitle(n.getTitle());
param.setContent(pushMsg);
param.setOperation(1);
param.setOperationPage("");
param.setOperation(FangjiaConstant.URL_SEND_TYPE);
param.setOperationPage("/views/news/newsDetail.html?newsId=" + n.getId());
param.setPushClientId(user.getPushClientId());
pushMessageService.push(param);
// 4.记录
@@ -278,11 +278,11 @@ public class News implements Serializable {
this.thumbsUpCount = thumbsUpCount;
}
public Date getmDate() {
public Date getMDate() {
return mDate;
}
public void setmDate(Date mDate) {
public void setMDate(Date mDate) {
this.mDate = mDate;
}
@@ -17,6 +17,7 @@ public class CityCollectServiceImpl extends EntityService<CityCollect> implement
@Override
public List<CityCollect> 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) });
}
}
@@ -2,6 +2,7 @@ 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;