|
@ -1265,50 +1265,65 @@ public class EduArticleService {
|
|
|
return resultMap;
|
|
|
}
|
|
|
|
|
|
public void getArticleStatics()throws Exception{
|
|
|
thirdJkEduArticleService.insertArticleStatistic();
|
|
|
String articleSql = "SELECT code FROM wlyy_health_edu_article GROUP BY code";
|
|
|
String collectSql ="SELECT article,COUNT(*) AS collectNumber FROM wlyy_health_edu_article_doctor GROUP BY article";
|
|
|
String ophistorySql ="SELECT code,status,COUNT(*) AS statusCount FROM wlyy_health_edu_article_op_history GROUP BY code,status";
|
|
|
String esSql = "SELECT articleId,count(*) as sendCount FROM "+esIndex+" where userType=1 group by articleId";
|
|
|
|
|
|
List<Map<String,Object>> articleList = jdbcTemplate.queryForList(articleSql);
|
|
|
List<Map<String,Object>> collectList = jdbcTemplate.queryForList(collectSql);
|
|
|
List<Map<String,Object>> opList = jdbcTemplate.queryForList(ophistorySql);
|
|
|
List<Map<String, Object>> esList = elasticsearchUtil.excuteDataModel(esSql);
|
|
|
|
|
|
for (Map<String,Object> map : articleList){
|
|
|
int collection = 0;
|
|
|
int share = 0;
|
|
|
int push = 0;
|
|
|
map.put("collection",0);
|
|
|
map.put("share",0);
|
|
|
map.put("push",0);
|
|
|
//循环收藏人数
|
|
|
for (Map<String,Object> cmap : collectList){
|
|
|
if (map.get("code").toString().equals(cmap.get("article").toString())){
|
|
|
collection = Integer.valueOf(String.valueOf(cmap.get("collectNumber")));
|
|
|
public boolean getArticleStatics(){
|
|
|
int result = 0;
|
|
|
int articleSize = 0;
|
|
|
boolean flag = true;
|
|
|
try {
|
|
|
thirdJkEduArticleService.insertArticleStatistic();
|
|
|
String articleSql = "SELECT code FROM wlyy_health_edu_article GROUP BY code";
|
|
|
String collectSql ="SELECT article,COUNT(*) AS collectNumber FROM wlyy_health_edu_article_doctor GROUP BY article";
|
|
|
String ophistorySql ="SELECT code,status,COUNT(*) AS statusCount FROM wlyy_health_edu_article_op_history GROUP BY code,status";
|
|
|
String esSql = "SELECT articleId,count(*) as sendCount FROM "+esIndex+" where userType=1 group by articleId";
|
|
|
|
|
|
List<Map<String,Object>> articleList = jdbcTemplate.queryForList(articleSql);
|
|
|
List<Map<String,Object>> collectList = jdbcTemplate.queryForList(collectSql);
|
|
|
List<Map<String,Object>> opList = jdbcTemplate.queryForList(ophistorySql);
|
|
|
List<Map<String, Object>> esList = elasticsearchUtil.excuteDataModel(esSql);
|
|
|
articleSize = articleList.size();
|
|
|
|
|
|
for (Map<String,Object> map : articleList){
|
|
|
int collection = 0;
|
|
|
int share = 0;
|
|
|
int push = 0;
|
|
|
map.put("collection",0);
|
|
|
map.put("share",0);
|
|
|
map.put("push",0);
|
|
|
//循环收藏人数
|
|
|
for (Map<String,Object> cmap : collectList){
|
|
|
if (map.get("code").toString().equals(cmap.get("article").toString())){
|
|
|
collection = Integer.valueOf(String.valueOf(cmap.get("collectNumber")));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//循环1.阅读3.转发
|
|
|
for (Map<String,Object> omap : opList){
|
|
|
if (map.get("code").toString().equals(omap.get("code").toString())){
|
|
|
if ("3".equals(omap.get("status").toString())){
|
|
|
share = Integer.valueOf(String.valueOf(omap.get("statusCount")));
|
|
|
//循环1.阅读3.转发
|
|
|
for (Map<String,Object> omap : opList){
|
|
|
if (map.get("code").toString().equals(omap.get("code").toString())){
|
|
|
if ("3".equals(omap.get("status").toString())){
|
|
|
share = Integer.valueOf(String.valueOf(omap.get("statusCount")));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//循环发送数目
|
|
|
for (Map<String,Object> emap : esList){
|
|
|
if (map.get("code").toString().equals(emap.get("articleId").toString())){
|
|
|
push = Integer.valueOf(String.valueOf(emap.get("sendCount")));
|
|
|
//循环发送数目
|
|
|
for (Map<String,Object> emap : esList){
|
|
|
if (map.get("code").toString().equals(emap.get("articleId").toString())){
|
|
|
push = Double.valueOf(String.valueOf(emap.get("sendCount"))).intValue();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//执行更新.
|
|
|
jkeduStatisticsArticleDao.modifyStatics(String.valueOf(map.get("code")),share,collection,push);
|
|
|
//执行更新.
|
|
|
int a = jkeduStatisticsArticleDao.modifyStatics(String.valueOf(map.get("code")),share,collection,push);
|
|
|
result += a;
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
flag = false;
|
|
|
}finally {
|
|
|
if (result<articleSize){
|
|
|
flag = false;
|
|
|
}
|
|
|
}
|
|
|
return flag;
|
|
|
}
|
|
|
|
|
|
}
|