提交 fa3936d3 作者: 925993793@qq.com

资讯编辑时修改updateDate字段

上级 073ed35b
......@@ -96,7 +96,6 @@ public class InformationController {
@GetMapping(value = "/collectionQueryById")
public Result<?> collectionQueryById(@RequestParam String id, @RequestParam String index) {
DisplayInfo info = informationService.queryInfo(1, index, id);
//todo 浏览记录
return Result.OK(info);
}
......
......@@ -13,26 +13,20 @@ import com.google.common.base.Charsets;
import com.zzsn.event.constant.Constants;
import com.zzsn.event.entity.Event;
import com.zzsn.event.entity.Subject;
import com.zzsn.event.entity.SubjectStatisticInfo;
import com.zzsn.event.service.*;
import com.zzsn.event.util.DateUtil;
import com.zzsn.event.util.EsDateUtil;
import com.zzsn.event.util.EsIndexUtil;
import com.zzsn.event.util.EsOpUtil;
import com.zzsn.event.util.*;
import com.zzsn.event.util.tree.Node;
import com.zzsn.event.vo.*;
import com.zzsn.event.vo.es.DisplayInfo;
import com.zzsn.event.vo.es.Label;
import com.zzsn.event.vo.es.SpecialInformation;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.apache.commons.lang3.StringUtils;
import org.apache.lucene.search.join.ScoreMode;
import org.elasticsearch.action.get.GetRequest;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.client.HttpAsyncResponseConsumerFactory;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
......@@ -40,7 +34,6 @@ import org.elasticsearch.common.text.Text;
import org.elasticsearch.index.query.*;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.SearchHits;
import org.elasticsearch.search.aggregations.Aggregation;
import org.elasticsearch.search.aggregations.AggregationBuilders;
import org.elasticsearch.search.aggregations.Aggregations;
import org.elasticsearch.search.aggregations.BucketOrder;
......@@ -2771,6 +2764,7 @@ public class EsService {
public void updateLabelsById(String index, String id, List<Label> labels) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("labels", labels);
jsonObject.put("updateDate", EsDateUtil.esFieldDateFormat(DateUtils.formatDateTime()));
esOpUtil.docUpdateById(index, id, jsonObject.toString());
}
}
......@@ -438,6 +438,7 @@ public class InformationServiceImpl implements InformationService {
labels.add(dataSet);
}
information.setLabels(labels);
information.setUpdateDate(EsDateUtil.esFieldDateFormat(DateUtils.formatDateTime()));
if (map.containsKey(index)) {
map.get(index).add(information);
} else {
......@@ -462,6 +463,7 @@ public class InformationServiceImpl implements InformationService {
}
}
information.setLabels(newLabels);
information.setUpdateDate(EsDateUtil.esFieldDateFormat(DateUtils.formatDateTime()));
if (map.containsKey(index)) {
map.get(index).add(information);
} else {
......@@ -841,6 +843,7 @@ public class InformationServiceImpl implements InformationService {
int topNum = esService.getTopNum(index, subjectInfoVo.getSubjectId());
updateFields.put("topNum", topNum + 1);
}
updateFields.put("updateDate", EsDateUtil.esFieldDateFormat(DateUtils.formatDateTime()));
esOpUtil.updateById(index, id, updateFields);
//发送 人工操作 日志
CompletableFuture.runAsync(() -> {
......@@ -1080,6 +1083,7 @@ public class InformationServiceImpl implements InformationService {
}
}
specialInformation.setLabels(newLabels);
specialInformation.setUpdateDate(EsDateUtil.esFieldDateFormat(DateUtils.formatDateTime()));
dataList.add(specialInformation);
}
} else {
......@@ -1193,6 +1197,7 @@ public class InformationServiceImpl implements InformationService {
Map<String, Object> modifyParams = new HashMap<>();
modifyParams.put("checkStatus", 1);
modifyParams.put("deleteFlag",0);
modifyParams.put("updateDate",EsDateUtil.esFieldDateFormat(DateUtils.formatDateTime()));
long start = System.currentTimeMillis();
esOpUtil.batchUpdateScript(indexArr, buildQuery, modifyParams);
log.info("添加到精选,耗时:{}", System.currentTimeMillis()-start);
......@@ -1214,6 +1219,7 @@ public class InformationServiceImpl implements InformationService {
Map<String, Object> modifyParams = new HashMap<>();
modifyParams.put("checkStatus",3);
modifyParams.put("deleteFlag",0);
modifyParams.put("updateDate",EsDateUtil.esFieldDateFormat(DateUtils.formatDateTime()));
long start = System.currentTimeMillis();
esOpUtil.batchUpdateScript(indexArr, buildQuery, modifyParams);
log.info("添加到待定,耗时:{}", System.currentTimeMillis()-start);
......@@ -1234,6 +1240,7 @@ public class InformationServiceImpl implements InformationService {
}
Map<String, Object> modifyParams = new HashMap<>();
modifyParams.put("deleteFlag",1);
modifyParams.put("updateDate",EsDateUtil.esFieldDateFormat(DateUtils.formatDateTime()));
long start = System.currentTimeMillis();
esOpUtil.batchUpdateScript(indexArr, buildQuery, modifyParams);
log.info("添加到删除,耗时:{}", System.currentTimeMillis()-start);
......@@ -1249,6 +1256,7 @@ public class InformationServiceImpl implements InformationService {
Map<String, Object> modifyParams = new HashMap<>();
modifyParams.put("checkStatus",0);
modifyParams.put("deleteFlag",0);
modifyParams.put("updateDate",EsDateUtil.esFieldDateFormat(DateUtils.formatDateTime()));
long start = System.currentTimeMillis();
esOpUtil.batchUpdateScript(indexArr, buildQuery, modifyParams);
log.info("初始化数据,耗时:{}", System.currentTimeMillis()-start);
......@@ -1289,6 +1297,14 @@ public class InformationServiceImpl implements InformationService {
long start = System.currentTimeMillis();
esOpUtil.batchReplaceScript(indexArr, buildQuery, modifyFields, oldWord, newWord);
log.info("字符串替换-{},耗时:{}", oldWord,System.currentTimeMillis()-start);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
Map<String, Object> modifyParams = new HashMap<>();
modifyParams.put("updateDate",EsDateUtil.esFieldDateFormat(DateUtils.formatDateTime()));
esOpUtil.batchUpdateScript(indexArr, buildQuery, modifyParams);
}
@Override
......@@ -1316,6 +1332,14 @@ public class InformationServiceImpl implements InformationService {
} catch (InterruptedException e) {
e.printStackTrace();
}
Map<String, Object> modifyParams = new HashMap<>();
modifyParams.put("updateDate",EsDateUtil.esFieldDateFormat(DateUtils.formatDateTime()));
esOpUtil.batchUpdateScript(indexArr, buildQuery, modifyParams);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
......
......@@ -10,13 +10,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zzsn.event.constant.Constants;
import com.zzsn.event.entity.*;
import com.zzsn.event.enums.CodePrefixEnum;
import com.zzsn.event.es.EsService;
import com.zzsn.event.feign.api.RemoteModelService;
import com.zzsn.event.service.*;
import com.zzsn.event.util.CodeGenerateUtil;
import com.zzsn.event.util.CronUtil;
import com.zzsn.event.util.EsOpUtil;
import com.zzsn.event.util.PythonUtil;
import com.zzsn.event.util.*;
import com.zzsn.event.util.user.UserUtil;
import com.zzsn.event.util.user.UserVo;
import com.zzsn.event.vo.*;
......@@ -30,7 +26,6 @@ import org.elasticsearch.index.query.QueryBuilders;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -464,6 +459,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
}
}
information.setLabels(labels);
information.setUpdateDate(EsDateUtil.esFieldDateFormat(DateUtils.formatDateTime()));
}
if (updateMap.containsKey(index)) {
updateMap.get(index).add(information);
......@@ -485,6 +481,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
for (SpecialInformation information : informationList) {
String index = information.getDbIndex();
information.setCheckStatus(0);
information.setUpdateDate(EsDateUtil.esFieldDateFormat(DateUtils.formatDateTime()));
if (updateMap.containsKey(index)) {
updateMap.get(index).add(information);
} else {
......@@ -505,6 +502,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
for (SpecialInformation information : informationList) {
String index = information.getDbIndex();
information.setDeleteFlag(1);
information.setUpdateDate(EsDateUtil.esFieldDateFormat(DateUtils.formatDateTime()));
if (updateMap.containsKey(index)) {
updateMap.get(index).add(information);
} else {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论