|
@ -1,6 +1,7 @@
|
|
package com.yihu.wlyy.web.third.jkedu.service;
|
|
package com.yihu.wlyy.web.third.jkedu.service;
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.yihu.edu.entity.dataClean.*;
|
|
import com.yihu.edu.entity.dataClean.*;
|
|
import com.yihu.es.entity.HealthEduArticleES;
|
|
import com.yihu.es.entity.HealthEduArticleES;
|
|
import com.yihu.es.entity.HealthEduArticleESResult;
|
|
import com.yihu.es.entity.HealthEduArticleESResult;
|
|
@ -341,13 +342,13 @@ public class EduArticleService {
|
|
" FROM " +
|
|
" FROM " +
|
|
" wlyy_health_edu_article_patient ap " +
|
|
" wlyy_health_edu_article_patient ap " +
|
|
" LEFT JOIN wlyy_patient p ON ap.patient = p.code " +
|
|
" LEFT JOIN wlyy_patient p ON ap.patient = p.code " +
|
|
" LEFT JOIN wlyy_admin_team t ON ap.admin_team_code = t.id" +
|
|
|
|
|
|
" LEFT JOIN wlyy_admin_team t ON ap.admin_team_code = t.id " +
|
|
" WHERE " +
|
|
" WHERE " +
|
|
" ap.admin_team_code IS NOT NULL ";
|
|
" ap.admin_team_code IS NOT NULL ";
|
|
if (StringUtils.isNotBlank(startTimeForSql)){
|
|
if (StringUtils.isNotBlank(startTimeForSql)){
|
|
resultSql += " AND ap.czrq > '"+startTimeForSql+"'ORDER BY ap.czrq ASC limit ?,?";
|
|
|
|
|
|
resultSql += " AND ap.czrq > '"+startTimeForSql+"' ORDER BY ap.czrq ASC limit ?,? ";
|
|
}else {
|
|
}else {
|
|
resultSql += " ORDER BY ap.czrq ASC limit ?,?";
|
|
|
|
|
|
resultSql += " ORDER BY ap.czrq ASC limit ?,? ";
|
|
}
|
|
}
|
|
|
|
|
|
for (int i = 1; i <= pageCount; i++) {
|
|
for (int i = 1; i <= pageCount; i++) {
|
|
@ -401,7 +402,7 @@ public class EduArticleService {
|
|
" LEFT JOIN wlyy_patient p ON ap.patient = p.code " +
|
|
" LEFT JOIN wlyy_patient p ON ap.patient = p.code " +
|
|
" LEFT JOIN wlyy_admin_team t ON ap.admin_team_code = t.id" +
|
|
" LEFT JOIN wlyy_admin_team t ON ap.admin_team_code = t.id" +
|
|
" WHERE " +
|
|
" WHERE " +
|
|
" ap.admin_team_code IS NOT NULL GROUP BY ap.batch_no ORDER BY ap.czrq ASC";
|
|
|
|
|
|
" ap.admin_team_code IS NOT NULL GROUP BY ap.batch_no ORDER BY ap.czrq ASC ";
|
|
List<Map<String,Object>> batchList = jdbcTemplate.queryForList(BartchNoSql);
|
|
List<Map<String,Object>> batchList = jdbcTemplate.queryForList(BartchNoSql);
|
|
List<HealthEduArticleES> batchEsList = new ArrayList<>();
|
|
List<HealthEduArticleES> batchEsList = new ArrayList<>();
|
|
if (batchList!=null && batchList.size()>0){
|
|
if (batchList!=null && batchList.size()>0){
|
|
@ -550,15 +551,17 @@ public class EduArticleService {
|
|
SearchResult result = jestClient.execute(search);
|
|
SearchResult result = jestClient.execute(search);
|
|
List<HealthEduArticleES> saveModels = result.getSourceAsObjectList(HealthEduArticleES.class);
|
|
List<HealthEduArticleES> saveModels = result.getSourceAsObjectList(HealthEduArticleES.class);
|
|
|
|
|
|
Bulk.Builder bulk = new Bulk.Builder().defaultIndex(esIndex).defaultType(esType);
|
|
|
|
|
|
Bulk.Builder bulk = new Bulk.Builder();
|
|
for (HealthEduArticleES obj : saveModels) {
|
|
for (HealthEduArticleES obj : saveModels) {
|
|
obj.setUserType(1);
|
|
obj.setUserType(1);
|
|
Update index = new Update.Builder(obj).build();
|
|
|
|
|
|
JSONObject jo = new JSONObject();
|
|
|
|
jo.put("doc", obj);
|
|
|
|
Update index = new Update.Builder(jo.toString()).index(esIndex).type(esType).id(obj.getId()).build();
|
|
bulk.addAction(index);
|
|
bulk.addAction(index);
|
|
}
|
|
}
|
|
BulkResult br = jestClient.execute(bulk.build());
|
|
BulkResult br = jestClient.execute(bulk.build());
|
|
logger.info("delete data count:" + saveModels.size());
|
|
|
|
logger.info("delete flag:" + br.isSucceeded());
|
|
|
|
|
|
logger.info("update data count:" + saveModels.size());
|
|
|
|
logger.info("update flag:" + br.isSucceeded());
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
flag = false;
|
|
flag = false;
|