Merge branch 'develop_master' into FOTON

This commit is contained in:
super_liu
2022-06-09 17:36:32 +08:00
3 changed files with 41 additions and 15 deletions
@@ -1369,6 +1369,10 @@ public class SearchCenterServiceImpl implements SearchCenterService {
.should(QueryBuilders.wildcardQuery("yearOrder.keyword", searchInfoEO.getSelectValue().toUpperCase() + "*").boost(1003f))
.should(QueryBuilders.wildcardQuery("nameTitle.keyword", "*" + searchInfoEO.getSelectValue().toUpperCase() + "*").boost(1002f))
.should(QueryBuilders.wildcardQuery("title.keyword", "*" + searchInfoEO.getSelectValue().toUpperCase() + "*").boost(1000f));
// queryBuilder1 = QueryBuilders.multiMatchQuery(searchInfoEO.getSelectValue(),
// "sortTitle","numberTitle","yearOrder","nameTitle","title"
// ).field("sortTitle",1005f).field("numberTitle",1004f).field("yearOrder",1003f).field("nameTitle",1002f).field("title",1000f);
// queryBuilder1 = QueryBuilders.wildcardQuery("title.keyword","*" + searchInfoEO.getSelectValue() + "*");
// queryBuilder1 = QueryBuilders.multiMatchQuery(searchInfoEO.getSelectValue(),
// "title"
@@ -1452,7 +1456,9 @@ public class SearchCenterServiceImpl implements SearchCenterService {
//高亮标题覆盖原标题
String titleStr = sourceAsMap.get("title").toString();
titleStr = titleStr.replace(searchInfoEO.getSelectValue(),"<span class='highlight-Es-class'>"+searchInfoEO.getSelectValue()+"</span>");
int i = indexOfToKMP(titleStr.toUpperCase(), searchInfoEO.getSelectValue().toUpperCase(), 0, getNextValInstance());
String selectValue = titleStr.substring(i,i+searchInfoEO.getSelectValue().length());
titleStr = titleStr.replace(selectValue,"<span class='highlight-Es-class'>"+selectValue+"</span>");
if(StringUtils.isNotBlank(textStatusColor)){
sourceAsMap.put("title", "<span class='"+textStatusColor+"'>"+titleStr+"</span>");
}else {
@@ -1481,8 +1487,16 @@ public class SearchCenterServiceImpl implements SearchCenterService {
return result;
}
public static void main(String[] args) {
String str = "GB B005-2022 啊啊啊啊啊";
String str1 = "B005";
int i = indexOfToKMP(str, str1, 0, getNextValInstance());
System.out.println(i);
}
// 改进版的nextVal数组
public NextArray getNextValInstance() {
public static NextArray getNextValInstance() {
return target -> {
// 初始化数组大小
int[] nextVal = new int[target.length()];
@@ -1518,7 +1532,7 @@ public class SearchCenterServiceImpl implements SearchCenterService {
* @param nextArray 函数式接口,传入获取next数组的方法(因为next数组上面定义了两种获取方式)
* @return 目标字符串在源字符串中第一次出现的索引位置
*/
public int indexOfToKMP(String source, String target, int pos, NextArray nextArray) {
public static int indexOfToKMP(String source, String target, int pos, NextArray nextArray) {
int i, j;
// 调用接口中的方法,获取next数组
int[] next = nextArray.getNext(target);
@@ -10,6 +10,7 @@ import com.adc.da.util.http.Result;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@@ -37,18 +38,26 @@ public class ReplyController extends BaseController<Reply> {
@PostMapping("/insertReply")
public ResponseMessage insertReply(@RequestBody Reply reply){
reply.setAppendixId(reply.getFileList().get(0).getAttId());
reply.setAppendixName(reply.getFileList().get(0).getName());
if(StringUtils.isEmpty(reply.getReply())){
return Result.error("-1","请输入回答内容");
}
if(reply.getFileList().size() >0) {
reply.setAppendixId(reply.getFileList().get(0).getAttId());
reply.setAppendixName(reply.getFileList().get(0).getName());
}
reply.setReplyTime(new Date());
reply.setId(UUIDUtils.randomUUID20());
if(replyService.save(reply)){
return Result.success("200","添加成功");
return Result.success("200","提交成功");
}else {
return Result.error("200","添加失败");
return Result.error("-1","添加失败");
}
}
@PostMapping("/updateReply")
public ResponseMessage updateReply(String id){
if(StringUtils.isEmpty(id)){
return Result.error("-1","请选择要归档的回答");
}
List<String> list = Arrays.asList(id.split(","));
for (String s: list) {
UpdateWrapper updateWrapper = new UpdateWrapper();
@@ -68,17 +68,20 @@
SELECT reply.ID, reply.REPLY,reply.REPLY_TIME,t2.UNAME ANSWERER,reply.APPENDIX_ID,APPENDIX_NAME
FROM reply
LEFT JOIN ts_user t2 ON t2.USID = reply.ANSWERER
<where>
<if test="id !=null and id !=''">
AND reply.ASK_ID = #{id}
</if>
</where>
<where>
<if test="id !=null and id !=''">
AND reply.ASK_ID = #{id}
</if>
</where>
order by reply.REPLY_TIME
</select>
<select id="getReplyDetails" resultType="com.adc.da.slrs.StandardQA.entity.AskQuestions">
SELECT aq.ID,aq.CLASSIFICATION,aq.PROBLEM_DESCRIPTION,t1.UNAME QUESTIONER,aq.QUESTION_TIME,aq.STANDARD_ENCDOING,
aq.STANDARD_NAME,aq.STANDARD_ID,reply.REPLY,reply.REPLY_TIME,t2.UNAME ANSWERER,
reply.APPENDIX,reply.APPENDIX_ID,reply.APPENDIX_NAME
SELECT
DISTINCT
aq.STANDARD_ID,aq.CLASSIFICATION,aq.STANDARD_ENCDOING,
aq.STANDARD_NAME
FROM ask_questions aq
LEFT JOIN reply ON aq.ID = reply.ASK_ID AND reply.STATE = '0'
LEFT JOIN ts_user t1 ON t1.USID = aq.QUESTIONER