代码优化
This commit is contained in:
+8
-7
@@ -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);
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ 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());
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ 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());
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -16,7 +16,8 @@ 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 Orders[] { new Orders(ORDER_PARAM, OrderyType.ASC) });
|
||||
return super.list(new String[] {"uid"},new Object[] {"190075963655061504"},new Orders[] { new Orders(ORDER_PARAM, OrderyType.ASC) });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user