Pārlūkot izejas kodu

智谱 应用,知识库,知识,图片信息查询保存,定时任务

S0025136190 1 gadu atpakaļ
vecāks
revīzija
6cb4e59e00
18 mainītis faili ar 374 papildinājumiem un 21 dzēšanām
  1. 13 1
      takai-admin/src/main/java/com/takai/web/controller/bigmodel/BigModelController.java
  2. 7 1
      takai-admin/src/main/resources/application-prd.yml
  3. 1 1
      takai-admin/src/main/resources/application.yml
  4. 14 0
      takai-bigmodel/src/main/java/com/takai/bigmodel/domain/entity/BmApplication.java
  5. 26 0
      takai-bigmodel/src/main/java/com/takai/bigmodel/domain/entity/BmDocument.java
  6. 15 0
      takai-bigmodel/src/main/java/com/takai/bigmodel/domain/entity/BmKnowledge.java
  7. 15 0
      takai-bigmodel/src/main/java/com/takai/bigmodel/domain/entity/BmMediaReplacement.java
  8. 10 0
      takai-bigmodel/src/main/java/com/takai/bigmodel/mapper/BmApplicationMapper.java
  9. 8 0
      takai-bigmodel/src/main/java/com/takai/bigmodel/mapper/BmDocumentMapper.java
  10. 8 0
      takai-bigmodel/src/main/java/com/takai/bigmodel/mapper/BmKnowledgeMapper.java
  11. 8 0
      takai-bigmodel/src/main/java/com/takai/bigmodel/mapper/BmMediaReplacementMapper.java
  12. 140 4
      takai-bigmodel/src/main/java/com/takai/bigmodel/service/impl/BigModelServiceImpl.java
  13. 25 5
      takai-bigmodel/src/main/resources/mapper/bm/BmApplicationMapper.xml
  14. 29 1
      takai-bigmodel/src/main/resources/mapper/bm/BmDocumentMapper.xml
  15. 19 0
      takai-bigmodel/src/main/resources/mapper/bm/BmKnowledgeMapper.xml
  16. 22 7
      takai-bigmodel/src/main/resources/mapper/bm/BmMediaReplacementMapper.xml
  17. 4 0
      takai-quartz/pom.xml
  18. 10 1
      takai-quartz/src/main/java/com/takai/quartz/task/TkTask.java

+ 13 - 1
takai-admin/src/main/java/com/takai/web/controller/bigmodel/BigModelController.java

@@ -1,8 +1,12 @@
 package com.takai.web.controller.bigmodel;
 
+import com.takai.bigmodel.domain.entity.BmApplication;
 import com.takai.bigmodel.domain.entity.SseParams;
 import com.takai.bigmodel.service.IBigModelService;
 import com.takai.common.config.BigModelConfig;
+import com.takai.common.core.controller.BaseController;
+import com.takai.common.core.domain.AjaxResult;
+import com.takai.common.core.domain.entity.SysDept;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
@@ -13,6 +17,7 @@ import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.util.List;
 
 /**
  * 智谱接口
@@ -22,7 +27,7 @@ import java.io.IOException;
 @Slf4j
 @RestController
 @RequestMapping("/bigmodel/api")
-public class BigModelController {
+public class BigModelController extends BaseController {
 
 
     @Autowired
@@ -46,4 +51,11 @@ public class BigModelController {
         return bigModelService.sseInvoke(id,sseParams);
     }
 
+    @GetMapping("/application/list")
+    public AjaxResult appList()
+    {
+        List<BmApplication> apps = bigModelService.getApplicationList();
+        return success(apps);
+    }
+
 }

+ 7 - 1
takai-admin/src/main/resources/application-prd.yml

@@ -58,4 +58,10 @@ spring:
                     merge-sql: true
                 wall:
                     config:
-                        multi-statement-allow: true
+                        multi-statement-allow: true
+
+# 日志配置
+logging:
+    level:
+        com.takai: info
+        org.springframework: warn

+ 1 - 1
takai-admin/src/main/resources/application.yml

@@ -54,7 +54,7 @@ spring:
     # 国际化资源文件路径
     basename: i18n/messages
   profiles:
-    active: druid
+    active: dev
   # 文件上传
   servlet:
     multipart:

+ 14 - 0
takai-bigmodel/src/main/java/com/takai/bigmodel/domain/entity/BmApplication.java

@@ -157,4 +157,18 @@ public class BmApplication extends BaseEntity
             .append("updateTime", getUpdateTime())
             .toString();
     }
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        BmApplication that = (BmApplication) o;
+
+        return appId.equals(that.appId);
+    }
+
+    @Override
+    public int hashCode() {
+        return  appId.hashCode();
+    }
 }

+ 26 - 0
takai-bigmodel/src/main/java/com/takai/bigmodel/domain/entity/BmDocument.java

@@ -19,6 +19,8 @@ public class BmDocument extends BaseEntity
     /** 知识ID */
     private String documentId;
 
+    private String knowledgeId;
+
     /** 切片规则 */
     private String customSeparator;
 
@@ -50,6 +52,14 @@ public class BmDocument extends BaseEntity
         this.documentId = documentId;
     }
 
+    public String getKnowledgeId() {
+        return knowledgeId;
+    }
+
+    public void setKnowledgeId(String knowledgeId) {
+        this.knowledgeId = knowledgeId;
+    }
+
     public String getCustomSeparator() {
         return customSeparator;
     }
@@ -118,6 +128,7 @@ public class BmDocument extends BaseEntity
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
             .append("documentId", getDocumentId())
+            .append("knowledgeId", getKnowledgeId())
             .append("customSeparator", getCustomSeparator())
             .append("knowledgeType", getKnowledgeType())
             .append("sentenceSize", getSentenceSize())
@@ -132,4 +143,19 @@ public class BmDocument extends BaseEntity
             .append("updateTime", getUpdateTime())
             .toString();
     }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        BmDocument that = (BmDocument) o;
+
+        return documentId.equals(that.documentId);
+    }
+
+    @Override
+    public int hashCode() {
+        return  documentId.hashCode();
+    }
 }

+ 15 - 0
takai-bigmodel/src/main/java/com/takai/bigmodel/domain/entity/BmKnowledge.java

@@ -133,4 +133,19 @@ public class BmKnowledge extends BaseEntity
             .append("updateTime", getUpdateTime())
             .toString();
     }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        BmKnowledge that = (BmKnowledge) o;
+
+        return knowledgeId.equals(that.knowledgeId);
+    }
+
+    @Override
+    public int hashCode() {
+        return  knowledgeId.hashCode();
+    }
 }

+ 15 - 0
takai-bigmodel/src/main/java/com/takai/bigmodel/domain/entity/BmMediaReplacement.java

@@ -105,4 +105,19 @@ public class BmMediaReplacement extends BaseEntity
             .append("updateTime", getUpdateTime())
             .toString();
     }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        BmMediaReplacement that = (BmMediaReplacement) o;
+
+        return id.longValue() == that.id.longValue();
+    }
+
+    @Override
+    public int hashCode() {
+        return  id.hashCode();
+    }
 }

+ 10 - 0
takai-bigmodel/src/main/java/com/takai/bigmodel/mapper/BmApplicationMapper.java

@@ -37,4 +37,14 @@ public interface BmApplicationMapper
      */
     public int insertApplication(BmApplication mData);
 
+    /**
+     * 更新应用信息
+     *
+     * @param mData 应用信息
+     * @return 结果
+     */
+    public int updateApplication(BmApplication mData);
+
+
+
 }

+ 8 - 0
takai-bigmodel/src/main/java/com/takai/bigmodel/mapper/BmDocumentMapper.java

@@ -36,4 +36,12 @@ public interface BmDocumentMapper
      */
     public int insertDocument(BmDocument mData);
 
+    /**
+     * 更新知识信息
+     *
+     * @param mData 知识信息
+     * @return 结果
+     */
+    public int updateDocument(BmDocument mData);
+
 }

+ 8 - 0
takai-bigmodel/src/main/java/com/takai/bigmodel/mapper/BmKnowledgeMapper.java

@@ -36,4 +36,12 @@ public interface BmKnowledgeMapper
      */
     public int insertKnowledge(BmKnowledge mData);
 
+    /**
+     * 更新知识库信息
+     *
+     * @param mData 知识库信息
+     * @return 结果
+     */
+    public int updateKnowledge(BmKnowledge mData);
+
 }

+ 8 - 0
takai-bigmodel/src/main/java/com/takai/bigmodel/mapper/BmMediaReplacementMapper.java

@@ -38,4 +38,12 @@ public interface BmMediaReplacementMapper
      */
     public int insertMedia(BmMediaReplacement mData);
 
+    /**
+     * 更新媒体对照信息
+     *
+     * @param mData 媒体对照信息
+     * @return 结果
+     */
+    public int updateMedia(BmMediaReplacement mData);
+
 }

+ 140 - 4
takai-bigmodel/src/main/java/com/takai/bigmodel/service/impl/BigModelServiceImpl.java

@@ -26,6 +26,7 @@ import javax.validation.constraints.NotNull;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 import java.util.concurrent.TimeUnit;
 
 /**
@@ -171,17 +172,17 @@ public class BigModelServiceImpl implements IBigModelService
     @Override
     public void initZhiPuInfo() {
         //获取应用列表
-        //List<BmApplication> appList = getApplicationList();
+        List<BmApplication> appList = getValidAppList();
         //获取知识库列表
-        List<BmKnowledge> knowledgeList = getKnowledgeList();
+        List<BmKnowledge> knowledgeList = getValidKnowledgeList();
         //获取知识列表
         if(!knowledgeList.isEmpty()) {
             for(BmKnowledge bmKnowledge : knowledgeList) {
-                List<BmDocument> documentList = getDocumentList(bmKnowledge.getKnowledgeId());
+                List<BmDocument> documentList = getValidDocumentList(bmKnowledge.getKnowledgeId());
                 if(!documentList.isEmpty()) {
                     for (BmDocument bmDocument : documentList) {
                         //获取知识图片列表
-                        List<BmMediaReplacement> imageList = getDocumentImageList(bmDocument.getDocumentId());
+                        List<BmMediaReplacement> imageList = getValidImageList(bmDocument.getDocumentId());
                         if(!imageList.isEmpty()) {
                             for(BmMediaReplacement image : imageList) {
                                 redisCache.setCacheObject(image.getOriginText(),image.getMediaUrl());
@@ -193,6 +194,141 @@ public class BigModelServiceImpl implements IBigModelService
         }
     }
 
+    private List<BmApplication> getValidAppList() {
+        //接口获取数据
+        List<BmApplication> appList = getApplicationList();
+        if(!appList.isEmpty()) {
+            //更新数据库
+            updateAppList(appList);
+        } else {
+            //数据库获取数据
+            appList = bmApplicationMapper.selectApplicationList(null);
+        }
+        return appList;
+    }
+
+    private List<BmKnowledge> getValidKnowledgeList() {
+        //接口获取数据
+        List<BmKnowledge> knowledgeList = getKnowledgeList();
+        if(!knowledgeList.isEmpty()) {
+            //更新数据库
+            updateKnowledgeList(knowledgeList);
+        } else {
+            //数据库获取数据
+            knowledgeList = bmKnowledgeMapper.selectKnowledgeList(null);
+        }
+        return knowledgeList;
+    }
+
+    private List<BmDocument> getValidDocumentList(String knowledgeId) {
+        //接口获取数据
+        List<BmDocument> documentList = getDocumentList(knowledgeId);
+        if(!documentList.isEmpty()) {
+            //更新数据库
+            updateDocumentList(documentList,knowledgeId);
+        } else {
+            //数据库获取数据
+            BmDocument conditon = BmDocument.builder().knowledgeId(knowledgeId).build();
+            documentList = bmDocumentMapper.selectDocumentList(conditon);
+        }
+        return documentList;
+    }
+
+    private List<BmMediaReplacement> getValidImageList(String documentId) {
+        //接口获取数据
+        List<BmMediaReplacement> imageList = getDocumentImageList(documentId);
+        if(!imageList.isEmpty()) {
+            //更新数据库
+            updateImageList(imageList,documentId);
+        } else {
+            //数据库获取数据
+            BmMediaReplacement conditon = BmMediaReplacement.builder().documentId(documentId).build();
+            imageList = bmMediaReplacementMapper.selectMediaList(conditon);
+        }
+        return imageList;
+    }
+
+
+
+    private void updateAppList(List<BmApplication> appList) {
+        List<BmApplication>  dbList = bmApplicationMapper.selectApplicationList(null);
+        for(BmApplication app : appList) {
+            Optional<BmApplication> optObj = dbList.stream().filter(a -> a.getAppId().equals(app.getAppId())).findFirst();
+            if (!optObj.isPresent()) {
+                bmApplicationMapper.insertApplication(app);
+            } else if(!optObj.get().getName().equals(app.getName())) {
+                BmApplication updateObj = optObj.get();
+                updateObj.setName(app.getName());
+                updateObj.setDesc(app.getDesc());
+                updateObj.setPrompt(app.getPrompt());
+                updateObj.setKnowledgeIds(app.getKnowledgeIds());
+
+                bmApplicationMapper.updateApplication(updateObj);
+            }
+        }
+    }
+
+    private void updateKnowledgeList(List<BmKnowledge> knowledgeList) {
+        List<BmKnowledge>  dbList = bmKnowledgeMapper.selectKnowledgeList(null);
+        for(BmKnowledge knowledge : knowledgeList) {
+            Optional<BmKnowledge> optObj = dbList.stream().filter(a -> a.getKnowledgeId().equals(knowledge.getKnowledgeId())).findFirst();
+            if (!optObj.isPresent()) {
+                bmKnowledgeMapper.insertKnowledge(knowledge);
+            } else if(!optObj.get().getName().equals(knowledge.getName())) {
+                BmKnowledge updateObj = optObj.get();
+                updateObj.setName(knowledge.getName());
+                updateObj.setDescription(knowledge.getDescription());
+                updateObj.setWordNum(knowledge.getWordNum());
+                updateObj.setDocumentSize(knowledge.getDocumentSize());
+                updateObj.setLength(knowledge.getLength());
+
+                bmKnowledgeMapper.updateKnowledge(updateObj);
+            }
+        }
+    }
+
+    private void updateDocumentList(List<BmDocument> documentList, String knowledgeId) {
+        BmDocument conditon = BmDocument.builder().knowledgeId(knowledgeId).build();
+        List<BmDocument>  dbList = bmDocumentMapper.selectDocumentList(conditon);
+        for(BmDocument document : documentList) {
+            Optional<BmDocument> optObj = dbList.stream().filter(a -> a.getDocumentId().equals(document.getDocumentId())).findFirst();
+            if (!optObj.isPresent()) {
+                document.setKnowledgeId(knowledgeId);
+                bmDocumentMapper.insertDocument(document);
+            } else if(!optObj.get().getName().equals(document.getName())) {
+                BmDocument updateObj = optObj.get();
+                updateObj.setName(document.getName());
+                updateObj.setCustomSeparator(document.getCustomSeparator());
+                updateObj.setWordNum(document.getWordNum());
+                updateObj.setKnowledgeType(document.getKnowledgeType());
+                updateObj.setLength(document.getLength());
+                updateObj.setParseImage(document.getParseImage());
+
+                bmDocumentMapper.updateDocument(updateObj);
+            }
+        }
+    }
+
+    private void updateImageList(List<BmMediaReplacement> imageList,String documentId) {
+        BmMediaReplacement condition = BmMediaReplacement.builder().documentId(documentId).build();
+        List<BmMediaReplacement>  dbList = bmMediaReplacementMapper.selectMediaList(condition);
+        for(BmMediaReplacement image : imageList) {
+            Optional<BmMediaReplacement> optObj = dbList.stream().filter(a -> a.getOriginText().equals(image.getOriginText())).findFirst();
+            if (!optObj.isPresent()) {
+                image.setDocumentId(documentId);
+                bmMediaReplacementMapper.insertMedia(image);
+            } else if(!optObj.get().getOriginText().equals(image.getOriginText())
+                        || !optObj.get().getMediaUrl().equals(image.getMediaUrl())) {
+                BmMediaReplacement updateObj = optObj.get();
+                updateObj.setDocumentId(image.getDocumentId());
+                updateObj.setOriginText(image.getOriginText());
+                updateObj.setMediaUrl(image.getMediaUrl());
+
+                bmMediaReplacementMapper.updateMedia(updateObj);
+            }
+        }
+    }
+
     @Override
     public List<BmMediaReplacement> getDocumentImageList(String documentId) {
         String url = bigModelConfig.getBaseurl() + bigModelConfig.getImage().replace("{id}",documentId);

+ 25 - 5
takai-bigmodel/src/main/resources/mapper/bm/BmApplicationMapper.xml

@@ -7,7 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	<resultMap type="BmApplication" id="BmApplicationResult">
 		<id property="appId"   column="appId"   />
 		<result property="name"  column="name"  />
-		<result property="desc"  column="desc"  />
+		<result property="desc"  column="description"  />
 		<result property="prompt"   column="prompt"   />
 		<result property="topP"   column="top_p"   />
 		<result property="temperature"   column="temperature"   />
@@ -24,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</resultMap>
 	
 	<sql id="selectSql">
-        select app_id, name, desc, prompt, top_p, temperature, knowledge_ids, slice_count,model,icon_color,icon_type,create_by, create_time, remark
+        select appId, name, description, prompt, top_p, temperature, knowledge_ids, slice_count,model,icon_color,icon_type,create_by, create_time, remark
 		from bm_application
     </sql>
 
@@ -32,7 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	    <include refid="selectSql"/>
 		<where>
 		    <if test="appId != null and appId != ''">
-				AND app_id = #{appId}
+				AND appId = #{appId}
 			</if>
 		</where>
 		order by create_time asc
@@ -44,10 +44,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
  	
  	<insert id="insertApplication" parameterType="BmApplication">
- 		insert into bm_media_replacement(
+ 		insert into bm_application(
  			<if test="appId != null">appId,</if>
  			<if test="name != null and name != ''">name,</if>
- 			<if test="desc != null and desc != ''">desc,</if>
+ 			<if test="desc != null and desc != ''">description,</if>
  			<if test="prompt != null and prompt != ''">prompt,</if>
  			<if test="topP != null and topP != ''">top_p,</if>
 			<if test="temperature != null and temperature != ''">temperature,</if>
@@ -76,5 +76,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			sysdate()
  		)
 	</insert>
+
+	<update id="updateApplication" parameterType="BmApplication">
+		update mh_sys_config
+		<set>
+			<if test="name != null and name != ''">name = #{name},</if>
+			<if test="desc != null and desc != ''">description = #{desc},</if>
+			<if test="prompt != null and prompt != ''">prompt = #{prompt},</if>
+			<if test="topP != null and topP != ''">top_p = #{topP},</if>
+			<if test="temperature != null and temperature != ''">temperature = #{temperature},</if>
+			<if test="knowledgeIds != null and knowledgeIds != ''">knowledge_ids = #{knowledgeIds},</if>
+			<if test="sliceCount != null">slice_count = #{sliceCount},</if>
+			<if test="model != null and model != ''">model = #{model},</if>
+			<if test="iconColor != null and iconColor != ''">icon_color = #{iconColor},</if>
+			<if test="iconType != null and iconType != ''">icon_type = #{iconType},</if>
+			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
+			<if test="remark != null">remark = #{remark},</if>
+			update_time = sysdate()
+		</set>
+		where appId = #{appId}
+	</update>
 	
 </mapper> 

+ 29 - 1
takai-bigmodel/src/main/resources/mapper/bm/BmDocumentMapper.xml

@@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	
 	<resultMap type="BmDocument" id="BmDocumentResult">
 		<id property="documentId"   column="document_id"   />
+		<result property="knowledgeId"  column="knowledge_id"  />
 		<result property="customSeparator"  column="custom_separator"  />
 		<result property="knowledgeType"  column="knowledge_type"  />
 		<result property="sentenceSize"   column="sentence_size"   />
@@ -13,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<result property="wordNum"   column="word_num"   />
 		<result property="name"   column="name"   />
 		<result property="url"   column="url"   />
+		<result property="parseImage"   column="parse_image"   />
 		<result property="remark"   column="remark"   />
 		<result property="createBy"   column="create_by"   />
 		<result property="createTime" column="create_time" />
@@ -21,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</resultMap>
 	
 	<sql id="selectSql">
-        select document_id, custom_separator, knowledge_type, sentence_size, length, word_num, name,url, create_by, create_time, remark
+        select document_id, knowledge_id,custom_separator, knowledge_type, sentence_size, length, word_num, name,url, create_by, create_time, remark
 		from bm_document
     </sql>
 
@@ -31,6 +33,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		    <if test="documentId != null and documentId != ''">
 				AND document_id = #{documentId}
 			</if>
+			<if test="knowledgeId != null and knowledgeId != ''">
+				AND knowledge_id = #{knowledgeId}
+			</if>
 		</where>
 		order by create_time asc
 	</select>
@@ -43,6 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  	<insert id="insertDocument" parameterType="BmDocument">
  		insert into bm_document(
  			<if test="documentId != null  and documentId != ''">document_id,</if>
+			<if test="knowledgeId != null  and knowledgeId != ''">knowledge_id,</if>
 			<if test="customSeparator != null  and customSeparator != ''">custom_separator,</if>
  			<if test="knowledgeType != null">knowledge_type,</if>
  			<if test="sentenceSize != null and sentenceSize != ''">sentence_size,</if>
@@ -50,11 +56,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			<if test="length != null">length,</if>
 			<if test="name != null and name != ''">name,</if>
 			<if test="url != null and url != ''">url,</if>
+		    <if test="parseImage != null">parse_image,</if>
  			<if test="remark != null and remark != ''">remark,</if>
  			<if test="createBy != null and createBy != ''">create_by,</if>
  			create_time
  		)values(
 			<if test="documentId != null  and documentId != ''">#{documentId},</if>
+			<if test="knowledgeId != null  and knowledgeId != ''">#{knowledgeId},</if>
 			<if test="customSeparator != null  and customSeparator != ''">#{customSeparator},</if>
 			<if test="knowledgeType != null">#{knowledgeType},</if>
 			<if test="sentenceSize != null and sentenceSize != ''">#{sentenceSize},</if>
@@ -62,10 +70,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			<if test="length != null">#{length},</if>
 			<if test="name != null and name != ''">#{name},</if>
 			<if test="url != null and url != ''">#{url},</if>
+			<if test="parseImage != null">#{parseImage},</if>
  			<if test="remark != null and remark != ''">#{remark},</if>
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
  			sysdate()
  		)
 	</insert>
+
+
+	<update id="updateDocument" parameterType="BmDocument">
+		update bm_document
+		<set>
+			<if test="customSeparator != null  and customSeparator != ''">custom_separator = #{customSeparator},</if>
+			<if test="knowledgeType != null">knowledge_type = #{knowledgeType},</if>
+			<if test="sentenceSize != null and sentenceSize != ''">sentence_size = #{sentenceSize},</if>
+			<if test="wordNum != null">word_num = #{wordNum},</if>
+			<if test="length != null">length = #{length},</if>
+			<if test="name != null and name != ''">name = #{name},</if>
+			<if test="url != null and url != ''">url = #{url},</if>
+			<if test="parseImage != null">parse_image = #{parseImage},</if>
+			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
+			<if test="remark != null">remark = #{remark},</if>
+			update_time = sysdate()
+		</set>
+		where document_id = #{documentId}
+	</update>
 	
 </mapper> 

+ 19 - 0
takai-bigmodel/src/main/resources/mapper/bm/BmKnowledgeMapper.xml

@@ -70,5 +70,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			sysdate()
  		)
 	</insert>
+
+	<update id="updateKnowledge" parameterType="BmKnowledge">
+		update bm_knowledge
+		<set>
+			<if test="knowledgeId != null  and knowledgeId != ''">knowledge_id = #{knowledgeId},</if>
+			<if test="embeddingId != null">embedding_id = #{embeddingId},</if>
+			<if test="name != null and name != ''">name = #{name},</if>
+			<if test="description != null and description != ''">description = #{description},</if>
+			<if test="background != null and background != ''">background = #{background},</if>
+			<if test="icon != null and icon != ''">icon = #{icon},</if>
+			<if test="wordNum != null">word_num = #{wordNum},</if>
+			<if test="length != null">length = #{length},</if>
+			<if test="documentSize != null">document_size = #{documentSize},</if>
+			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
+			<if test="remark != null">remark = #{remark},</if>
+			update_time = sysdate()
+		</set>
+		where knowledge_id = #{knowledgeId}
+	</update>
 	
 </mapper> 

+ 22 - 7
takai-bigmodel/src/main/resources/mapper/bm/BmMediaReplacementMapper.xml

@@ -6,7 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	
 	<resultMap type="BmMediaReplacement" id="BmMediaReplacementResult">
 		<id     property="id"   column="id"   />
-		<result property="appId"   column="app_id"   />
+		<result property="documentId"   column="document_id"   />
 		<result property="originText"  column="origin_text"  />
 		<result property="mediaType"  column="media_type"  />
 		<result property="mediaKey"   column="media_key"   />
@@ -19,15 +19,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</resultMap>
 	
 	<sql id="selectSql">
-        select id, app_id, origin_text, mediaType, mediaKey, mediaUrl, create_by, create_time, remark
+        select id, document_id, origin_text, media_type, media_key, media_url, create_by, create_time, remark
 		from bm_media_replacement
     </sql>
 
 	<select id="selectMediaList" parameterType="BmMediaReplacement" resultMap="BmMediaReplacementResult">
 	    <include refid="selectSql"/>
 		<where>
-		    <if test="appId != null and appId != ''">
-				AND app_id = #{appId}
+		    <if test="documentId != null and documentId != ''">
+				AND document_id = #{documentId}
 			</if>
 			<if test="mediaType != null and mediaType != ''">
 				AND media_type = #{mediaType}
@@ -38,7 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	
 	<select id="selectTargetMedia" parameterType="BmMediaReplacement" resultMap="BmMediaReplacementResult">
 		<include refid="selectSql"/>
-		where app_id = #{appId}
+		where document_id = #{documentId}
 		and media_type = #{mediaType}
 		and media_key = #{mediaKey}
 
@@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  	
  	<insert id="insertMedia" parameterType="BmMediaReplacement">
  		insert into bm_media_replacement(
- 			<if test="appId != null">app_id,</if>
+ 			<if test="documentId != null">document_id,</if>
  			<if test="originText != null and originText != ''">origin_text,</if>
  			<if test="mediaType != null and mediaType != ''">media_type,</if>
  			<if test="mediaKey != null and mediaKey != ''">media_key,</if>
@@ -55,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="createBy != null and createBy != ''">create_by,</if>
  			create_time
  		)values(
- 		    <if test="appId != null">#{appId},</if>
+ 		    <if test="documentId != null">#{documentId},</if>
  		    <if test="originText != null and originText != ''">#{originText},</if>
  			<if test="mediaType != null and mediaType != ''">#{mediaType},</if>
  			<if test="mediaKey != null and mediaKey != ''">#{mediaKey},</if>
@@ -65,5 +65,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			sysdate()
  		)
 	</insert>
+
+	<update id="updateMedia" parameterType="BmMediaReplacement">
+		update bm_media_replacement
+		<set>
+			<if test="documentId != null">document_id = #{documentId},</if>
+			<if test="originText != null and originText != ''">origin_text = #{originText},</if>
+			<if test="mediaType != null and mediaType != ''">media_type = #{mediaType},</if>
+			<if test="mediaKey != null and mediaKey != ''">media_key = #{mediaKey},</if>
+			<if test="mediaUrl != null and mediaUrl != ''">media_url = #{mediaUrl},</if>
+			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
+			<if test="remark != null">remark = #{remark},</if>
+			update_time = sysdate()
+		</set>
+		where id = #{id}
+	</update>
 	
 </mapper> 

+ 4 - 0
takai-quartz/pom.xml

@@ -34,6 +34,10 @@
             <groupId>com.takai</groupId>
             <artifactId>takai-common</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.takai</groupId>
+            <artifactId>takai-bigmodel</artifactId>
+        </dependency>
 
     </dependencies>
 

+ 10 - 1
takai-quartz/src/main/java/com/takai/quartz/task/TkTask.java

@@ -1,5 +1,8 @@
 package com.takai.quartz.task;
 
+import com.takai.bigmodel.service.IBigModelService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import com.takai.common.utils.StringUtils;
 
@@ -8,9 +11,13 @@ import com.takai.common.utils.StringUtils;
  * 
  * @author takai
  */
+@Slf4j
 @Component("tkTask")
 public class TkTask
 {
+    @Autowired
+    private IBigModelService bigModelService;
+
     public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i)
     {
         System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i));
@@ -23,6 +30,8 @@ public class TkTask
 
     public void ryNoParams()
     {
-        System.out.println("执行无参方法");
+        log.info("===================获取智谱应用信息Job开始执行==============");
+        bigModelService.initZhiPuInfo();
+        log.info("===================获取智谱应用信息Job执行结束==============");
     }
 }