@@ -2,6 +2,7 @@ package com.fangjia.job.fsh.job;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -76,11 +77,16 @@ public class UserStatJob implements SimpleJob {
|
||||
final List<LoanCustomersConfig> LoanCustomersConfigList = loanCustomersConfigService.queryAll();
|
||||
long total = enterpriseProductUserService.queryCount();
|
||||
int pages = PageBean.calcPages(total, 1000);
|
||||
final Semaphore semaphore = new Semaphore(10);
|
||||
for (int i = 1; i <= pages; i++) {
|
||||
List<EnterpriseProductUser> users = enterpriseProductUserService.queryByPage(i, 1000);
|
||||
for (EnterpriseProductUser user : users) {
|
||||
final EnterpriseProductUser u = user;
|
||||
if (u.getEid() %2 == Integer.parseInt(shardingContext.getShardingParameter())) {
|
||||
try {
|
||||
semaphore.acquire();
|
||||
} catch (InterruptedException e1) {
|
||||
}
|
||||
FangjiaThreadPoolExecutor.execute(new Runnable() {
|
||||
|
||||
@Override
|
||||
@@ -93,6 +99,8 @@ public class UserStatJob implements SimpleJob {
|
||||
} catch (Exception e) {
|
||||
logger.error("用户维度统计任务异常", e);
|
||||
DingDingMessageUtil.sendTextMessage("用户维度统计任务异常:" + e.getMessage());
|
||||
} finally {
|
||||
semaphore.release();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
+13
@@ -49,6 +49,19 @@ public class DistrictDetail {
|
||||
*/
|
||||
private DistrictBaseInfoDto districtBaseInfo;
|
||||
|
||||
/**
|
||||
* 小区潜力指数
|
||||
*/
|
||||
private Integer index;
|
||||
|
||||
public Integer getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public void setIndex(Integer index) {
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
public Date getModifyTime() {
|
||||
return modifyTime;
|
||||
}
|
||||
|
||||
+4
@@ -19,6 +19,7 @@ import org.springframework.data.mongodb.core.query.Query;
|
||||
import com.dangdang.ddframe.job.api.ShardingContext;
|
||||
import com.dangdang.ddframe.job.api.simple.SimpleJob;
|
||||
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.document.AgencyInfo;
|
||||
import com.fangjia.job.youfang.document.DistrictBaseInfoDto;
|
||||
@@ -90,6 +91,9 @@ public class DistrictInfoJob implements SimpleJob{
|
||||
districtDetail.setName(name);
|
||||
districtDetail.setModifyTime(new Date());
|
||||
DistrictEvaluateSingleDto dto = fshApiRemoteService.getDistrictNewPriceInfo(params);
|
||||
if (dto != null && dto.getResult() != null && dto.getResult().getTagBo() != null) {
|
||||
districtDetail.setIndex(dto.getResult().getTagBo().getIndex());
|
||||
}
|
||||
DistrictInfoDto districtInfoDto = fshApiRemoteService.detail(params);
|
||||
Map<String,Object> s = fshApiRemoteService.getAgencyInfo(params);
|
||||
params.put("size", 111.11);
|
||||
|
||||
-1
@@ -6,7 +6,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package com.fangjia.job.youfang.job;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.cxytiandi.jdbc.util.DateUtils;
|
||||
import com.dangdang.ddframe.job.api.ShardingContext;
|
||||
import com.dangdang.ddframe.job.api.simple.SimpleJob;
|
||||
import com.fangjia.job.common.util.DingDingMessageUtil;
|
||||
import com.fangjia.job.youfang.service.NewsService;
|
||||
|
||||
/**
|
||||
* 新闻定时发布和下架任务
|
||||
* @author yinjihuan
|
||||
*
|
||||
*/
|
||||
public class NewsPushJob implements SimpleJob {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(NewsPushJob.class);
|
||||
|
||||
@Autowired
|
||||
private NewsService newsService;
|
||||
|
||||
@Override
|
||||
public void execute(ShardingContext shardingContext) {
|
||||
try {
|
||||
String time = DateUtils.date2Str(new Date(), "yyyy-MM-dd HH");
|
||||
time = time + ":00:00";
|
||||
logger.info("开始执行新闻定时发布:"+ time);
|
||||
newsService.pushNews(time);
|
||||
newsService.offlineNews(time);
|
||||
} catch (Exception e) {
|
||||
logger.error("新闻定时发布和下架任务异常", e);
|
||||
DingDingMessageUtil.sendTextMessage("新闻定时发布和下架任务异常:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-1
@@ -13,7 +13,6 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import com.dangdang.ddframe.job.api.ShardingContext;
|
||||
import com.dangdang.ddframe.job.api.simple.SimpleJob;
|
||||
import com.fangjia.job.common.util.DingDingMessageUtil;
|
||||
import com.fangjia.job.common.util.RestApiCallUtils;
|
||||
import com.fangjia.job.youfang.remote.FshApiRemoteService;
|
||||
import com.mongodb.BasicDBObject;
|
||||
|
||||
@@ -0,0 +1,233 @@
|
||||
package com.fangjia.job.youfang.po;
|
||||
|
||||
import java.io.Serializable;
|
||||
import com.cxytiandi.jdbc.annotation.Field;
|
||||
import com.cxytiandi.jdbc.annotation.TableName;
|
||||
import com.cxytiandi.jdbc.annotation.AutoId;
|
||||
import java.util.Date;
|
||||
|
||||
@TableName(value = "news", author = "yinjihuan", desc = "新闻资讯表")
|
||||
public class News implements Serializable {
|
||||
private static final long serialVersionUID = 6641959266561982466L;
|
||||
|
||||
@AutoId
|
||||
@Field(value = "id", desc = "id")
|
||||
private Long id;
|
||||
|
||||
@Field(value = "title", desc = "标题")
|
||||
private String title;
|
||||
|
||||
@Field(value = "type", desc = "类型")
|
||||
private String type;
|
||||
|
||||
@Field(value = "status", desc = "发布状态(0:待发布 1:已发布 2:已下架)")
|
||||
private int status;
|
||||
|
||||
@Field(value = "deploy_time", desc = "发布时间")
|
||||
private Date deployTime;
|
||||
|
||||
@Field(value = "city", desc = "城市")
|
||||
private String city;
|
||||
|
||||
@Field(value = "source", desc = "来源")
|
||||
private String source;
|
||||
|
||||
@Field(value = "create_time", desc = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@Field(value = "offline_time", desc = "下架时间")
|
||||
private Date offlineTime;
|
||||
|
||||
@Field(value = "introduction", desc = "简介")
|
||||
private String introduction;
|
||||
|
||||
@Field(value = "cover_img", desc = "封面图片ID")
|
||||
private String coverImg;
|
||||
|
||||
@Field(value = "ad_url", desc = "广告地址(广告咨询时才有此值)")
|
||||
private String adUrl;
|
||||
|
||||
@Field(value = "content", desc = "内容")
|
||||
private String content;
|
||||
|
||||
@Field(value = "publish_status", desc = "是否已发布(0:未发布,1已发布)")
|
||||
private int publishStatus;
|
||||
|
||||
@Field(value = "top_status", desc = "是否置顶(0否 1是)")
|
||||
private int topStatus;
|
||||
|
||||
@Field(value = "sort_index", desc = "排序索引")
|
||||
private int sortIndex;
|
||||
|
||||
@Field(value = "visit_count", desc = "浏览量")
|
||||
private int visitCount;
|
||||
|
||||
@Field(value = "vote_favor_count", desc = "投票赞成数量")
|
||||
private int voteFavorCount;
|
||||
|
||||
@Field(value = "vote_no_favor_count", desc = "投票不赞成数量")
|
||||
private int voteNoFavorCount;
|
||||
|
||||
@Field(value = "user_id", desc = "创建用户ID")
|
||||
private Long userId;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Date getDeployTime() {
|
||||
return deployTime;
|
||||
}
|
||||
|
||||
public void setDeployTime(Date deployTime) {
|
||||
this.deployTime = deployTime;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Date getOfflineTime() {
|
||||
return offlineTime;
|
||||
}
|
||||
|
||||
public void setOfflineTime(Date offlineTime) {
|
||||
this.offlineTime = offlineTime;
|
||||
}
|
||||
|
||||
public String getIntroduction() {
|
||||
return introduction;
|
||||
}
|
||||
|
||||
public void setIntroduction(String introduction) {
|
||||
this.introduction = introduction;
|
||||
}
|
||||
|
||||
public String getCoverImg() {
|
||||
return coverImg;
|
||||
}
|
||||
|
||||
public void setCoverImg(String coverImg) {
|
||||
this.coverImg = coverImg;
|
||||
}
|
||||
|
||||
public String getAdUrl() {
|
||||
return adUrl;
|
||||
}
|
||||
|
||||
public void setAdUrl(String adUrl) {
|
||||
this.adUrl = adUrl;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public int getPublishStatus() {
|
||||
return publishStatus;
|
||||
}
|
||||
|
||||
public void setPublishStatus(int publishStatus) {
|
||||
this.publishStatus = publishStatus;
|
||||
}
|
||||
|
||||
public int getTopStatus() {
|
||||
return topStatus;
|
||||
}
|
||||
|
||||
public void setTopStatus(int topStatus) {
|
||||
this.topStatus = topStatus;
|
||||
}
|
||||
|
||||
public int getSortIndex() {
|
||||
return sortIndex;
|
||||
}
|
||||
|
||||
public void setSortIndex(int sortIndex) {
|
||||
this.sortIndex = sortIndex;
|
||||
}
|
||||
|
||||
public int getVisitCount() {
|
||||
return visitCount;
|
||||
}
|
||||
|
||||
public void setVisitCount(int visitCount) {
|
||||
this.visitCount = visitCount;
|
||||
}
|
||||
|
||||
public int getVoteFavorCount() {
|
||||
return voteFavorCount;
|
||||
}
|
||||
|
||||
public void setVoteFavorCount(int voteFavorCount) {
|
||||
this.voteFavorCount = voteFavorCount;
|
||||
}
|
||||
|
||||
public int getVoteNoFavorCount() {
|
||||
return voteNoFavorCount;
|
||||
}
|
||||
|
||||
public void setVoteNoFavorCount(int voteNoFavorCount) {
|
||||
this.voteNoFavorCount = voteNoFavorCount;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.fangjia.job.youfang.service;
|
||||
|
||||
public interface NewsService {
|
||||
|
||||
/**
|
||||
* 发布新闻
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
void pushNews(String date);
|
||||
|
||||
/**
|
||||
* 下架新闻
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
void offlineNews(String date);
|
||||
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.fangjia.job.youfang.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.cxytiandi.jdbc.EntityService;
|
||||
import com.fangjia.job.youfang.po.News;
|
||||
|
||||
@Service
|
||||
public class NewsServiceImpl extends EntityService<News> implements NewsService {
|
||||
|
||||
@Override
|
||||
public void pushNews(String 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+"'";
|
||||
super.getJdbcTemplate().execute(sql);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -103,6 +103,16 @@
|
||||
|
||||
</job:simple>
|
||||
|
||||
<!-- 有房小新闻定时发布 每小时执行一次 -->
|
||||
<job:simple id="newsPushJob" class="com.fangjia.job.youfang.job.NewsPushJob" registry-center-ref="regCenter"
|
||||
sharding-total-count="1" cron="0 0 * * * ?" sharding-item-parameters=""
|
||||
failover="true" description="【有房】 有房小新闻定时发布 每小时执行一次"
|
||||
overwrite="true" event-trace-rdb-data-source="elasticJobLog" job-exception-handler="com.fangjia.job.youfang.handler.CustomJobExceptionHandler">
|
||||
|
||||
<job:listener class="com.fangjia.job.youfang.listener.MessageElasticJobListener"></job:listener>
|
||||
|
||||
</job:simple>
|
||||
|
||||
<!-- 有房小区详情缓存刷新任务
|
||||
<job:simple id="refreshCacheJob" class="com.fangjia.job.youfang.job.RefreshCacheJob" registry-center-ref="regCenter"
|
||||
sharding-total-count="1" cron="0 30 11 * * ?" sharding-item-parameters="" disabled="true"
|
||||
|
||||
Reference in New Issue
Block a user