diff --git a/kcui/src/assets/img/typeHeadChoose.png b/kcui/src/assets/img/typeHeadChoose.png new file mode 100644 index 0000000..1b87ee9 Binary files /dev/null and b/kcui/src/assets/img/typeHeadChoose.png differ diff --git a/kcui/src/view/TWInfoXq.vue b/kcui/src/view/TWInfoXq.vue new file mode 100644 index 0000000..6d6b4d0 --- /dev/null +++ b/kcui/src/view/TWInfoXq.vue @@ -0,0 +1,215 @@ + + + diff --git a/src/main/java/com/main/woka/Web/Controller/FileUpdateController.java b/src/main/java/com/main/woka/Web/Controller/FileUpdateController.java new file mode 100644 index 0000000..65f08cb --- /dev/null +++ b/src/main/java/com/main/woka/Web/Controller/FileUpdateController.java @@ -0,0 +1,77 @@ +package com.main.woka.Web.Controller; + + +import com.main.woka.Common.core.AjaxResult; +import com.main.woka.Common.util.file.FileUploadUtils; +import com.main.woka.Common.util.file.FileUtils; +import com.main.woka.Config.RuoYiConfig; +import com.main.woka.Config.ServerConfig; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.text.SimpleDateFormat; +import java.util.Date; + +@RestController +@RequestMapping("/fileUpdate") +public class FileUpdateController extends BaseController { + + + // 定义上传文件的存储路径 + private static final String UPLOAD_DIR = "D:/kcfz/upload/"; + + @PostMapping("/upload") + public AjaxResult uploadFile(@RequestParam("file") MultipartFile file) { + if (file.isEmpty()) { + return AjaxResult.error(); + } + + try { + // 确保上传目录存在 + File uploadDir = new File(UPLOAD_DIR); + if (!uploadDir.exists()) { + uploadDir.mkdirs(); + } + + // 获取文件名并生成唯一的文件名 + String fileName = generateUniqueFileName(file.getOriginalFilename()); + Path filePath = Paths.get(UPLOAD_DIR, fileName); + + // 将文件写入磁盘 + Files.copy(file.getInputStream(), filePath); + + // 返回文件访问路径 + String fileAccessPath = "http://127.0.0.1:10031/profile/" + fileName; + AjaxResult ajaxResult = new AjaxResult(); + ajaxResult.put("fileName",fileName); + ajaxResult.put("url",fileAccessPath); + return AjaxResult.success(ajaxResult); + } catch (IOException e) { + e.printStackTrace(); + return AjaxResult.error(); + } + } + + // 生成唯一的文件名 + private String generateUniqueFileName(String originalFileName) { + String extension = ""; + int i = originalFileName.lastIndexOf('.'); + if (i > 0) { + extension = originalFileName.substring(i); + } + + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); + String timestamp = sdf.format(new Date()); + + return timestamp + "_" + Math.abs(originalFileName.hashCode()) + extension; + } +} diff --git a/src/main/java/com/main/woka/Web/Dao/KcTwImg.java b/src/main/java/com/main/woka/Web/Dao/KcTwImg.java new file mode 100644 index 0000000..021ae7a --- /dev/null +++ b/src/main/java/com/main/woka/Web/Dao/KcTwImg.java @@ -0,0 +1,41 @@ +package com.main.woka.Web.Dao; + +public class KcTwImg { + private Long imgId; + private Long twId; + private String imgUrl; + + + public Long getImgId() { + return imgId; + } + + public void setImgId(Long imgId) { + this.imgId = imgId; + } + + public Long getTwId() { + return twId; + } + + public void setTwId(Long twId) { + this.twId = twId; + } + + public String getImgUrl() { + return imgUrl; + } + + public void setImgUrl(String imgUrl) { + this.imgUrl = imgUrl; + } + + @Override + public String toString() { + return "KcTwImg{" + + "imgId=" + imgId + + ", twId=" + twId + + ", imgUrl='" + imgUrl + '\'' + + '}'; + } +} diff --git a/src/main/java/com/main/woka/Web/Mapper/TwImgMapper.java b/src/main/java/com/main/woka/Web/Mapper/TwImgMapper.java new file mode 100644 index 0000000..100cd86 --- /dev/null +++ b/src/main/java/com/main/woka/Web/Mapper/TwImgMapper.java @@ -0,0 +1,13 @@ +package com.main.woka.Web.Mapper; + +import com.main.woka.Web.Dao.KcTwImg; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface TwImgMapper { + public int insertTwImg(List list); + + List getKcTwImgList(Long id); +} diff --git a/src/main/resources/CoreNLP-chinese.properties b/src/main/resources/CoreNLP-chinese.properties new file mode 100644 index 0000000..073c26a --- /dev/null +++ b/src/main/resources/CoreNLP-chinese.properties @@ -0,0 +1,44 @@ +# Pipeline options - lemma is no-op for Chinese but currently needed because coref demands it (bad old requirements system) + +#设定了管道中包括哪些Annotators(一个Annotator就是你需要的文本分析分析工具, 他的结果就是一个或多个Annotation) +#segment:分词, ssplit:分隔, pos: 词性标注, lemma: has->have, ner:命名实体识别, parse:语法分析 +annotators = segment, ssplit, pos, lemma, ner, parse, sentiment, mention, coref +#annotators = segment, ssplit, pos, parse, sentiment + + +# segment 分词 +customAnnotatorClass.segment = edu.stanford.nlp.pipeline.ChineseSegmenterAnnotator +segment.model = D:/tupudata/nlp/stanford-corenlp-3.9.1-models-chinese/edu/stanford/nlp/models/segmenter/chinese/pku.gz +segment.sighanCorporaDict = D:/tupudata/nlp/stanford-corenlp-3.9.1-models-chinese/edu/stanford/nlp/models/segmenter/chinese +segment.serDictionary = D:/tupudata/nlp/stanford-corenlp-3.9.1-models-chinese/edu/stanford/nlp/models/segmenter/chinese/dict-chris6.ser.gz +segment.sighanPostProcessing = true + +# sentence split +ssplit.boundaryTokenRegex = [.]|[!?]+|[\u3002]|[\uFF01\uFF1F]+ + +# pos +pos.model = D:/tupudata/nlp/stanford-corenlp-3.9.1-models-chinese/edu/stanford/nlp/models/pos-tagger/chinese-distsim/chinese-distsim.tagger + +#ner 此处设定了ner使用的语言、模型(crf),目前SUTime只支持英文,不支持中文,所以设置为false。 +ner.language = chinese +ner.model = D:/tupudata/nlp/stanford-corenlp-3.9.1-models-chinese/edu/stanford/nlp/models/ner/chinese.misc.distsim.crf.ser.gz +ner.applyNumericClassifiers = true +ner.useSUTime = false + +#parse +parse.model = D:/tupudata/nlp/stanford-corenlp-3.9.1-models-chinese/edu/stanford/nlp/models/lexparser/chineseFactored.ser.gz + +# coref +coref.sieves = ChineseHeadMatch, ExactStringMatch, PreciseConstructs, StrictHeadMatch1, StrictHeadMatch2, StrictHeadMatch3, StrictHeadMatch4, PronounMatch +coref.input.type = raw +coref.postprocessing = true +coref.calculateFeatureImportance = false +coref.useConstituencyTree = true +coref.useSemantics = false +coref.md.type = RULE +coref.mode = hybrid +coref.path.word2vec = +coref.language = zh +coref.print.md.log = false +coref.defaultPronounAgreement = true +coref.zh.dict = D:/tupudata/nlp/stanford-corenlp-3.9.1-models-chinese/edu/stanford/nlp/models/dcoref/zh-attributes.txt.gz diff --git a/src/main/resources/Mapper/TwImgMapper.xml b/src/main/resources/Mapper/TwImgMapper.xml new file mode 100644 index 0000000..0995fa8 --- /dev/null +++ b/src/main/resources/Mapper/TwImgMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + INSERT INTO tw_img + (tw_id,img_url) + VALUES + + (#{item.twId},#{item.imgUrl}) + + + + + + + + + + +