37 changed files with 2335 additions and 147 deletions
@ -0,0 +1,106 @@ |
|||
package org.dromara.productManagement.controller; |
|||
|
|||
import java.util.List; |
|||
|
|||
import lombok.RequiredArgsConstructor; |
|||
import jakarta.servlet.http.HttpServletResponse; |
|||
import jakarta.validation.constraints.*; |
|||
import cn.dev33.satoken.annotation.SaCheckPermission; |
|||
import org.dromara.common.encrypt.annotation.ApiEncrypt; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.dromara.common.idempotent.annotation.RepeatSubmit; |
|||
import org.dromara.common.log.annotation.Log; |
|||
import org.dromara.common.web.core.BaseController; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import org.dromara.common.core.domain.R; |
|||
import org.dromara.common.core.validate.AddGroup; |
|||
import org.dromara.common.core.validate.EditGroup; |
|||
import org.dromara.common.log.enums.BusinessType; |
|||
import org.dromara.common.excel.utils.ExcelUtil; |
|||
import org.dromara.productManagement.domain.vo.ModelPromptsVo; |
|||
import org.dromara.productManagement.domain.bo.ModelPromptsBo; |
|||
import org.dromara.productManagement.service.IModelPromptsService; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
|
|||
/** |
|||
* 模型提示词 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-05 |
|||
*/ |
|||
@Validated |
|||
@RequiredArgsConstructor |
|||
@RestController |
|||
@RequestMapping("/productManagement/ModelPrompts") |
|||
public class ModelPromptsController extends BaseController { |
|||
|
|||
private final IModelPromptsService modelPromptsService; |
|||
|
|||
/** |
|||
* 查询模型提示词列表 |
|||
*/ |
|||
@SaCheckPermission("productManagement:ModelPrompts:list") |
|||
@GetMapping("/list") |
|||
public TableDataInfo<ModelPromptsVo> list(ModelPromptsBo bo, PageQuery pageQuery) { |
|||
return modelPromptsService.queryPageList(bo, pageQuery); |
|||
} |
|||
|
|||
/** |
|||
* 导出模型提示词列表 |
|||
*/ |
|||
@SaCheckPermission("productManagement:ModelPrompts:export") |
|||
@Log(title = "模型提示词", businessType = BusinessType.EXPORT) |
|||
@PostMapping("/export") |
|||
public void export(ModelPromptsBo bo, HttpServletResponse response) { |
|||
List<ModelPromptsVo> list = modelPromptsService.queryList(bo); |
|||
ExcelUtil.exportExcel(list, "模型提示词", ModelPromptsVo.class, response); |
|||
} |
|||
|
|||
/** |
|||
* 获取模型提示词详细信息 |
|||
* |
|||
* @param id 主键 |
|||
*/ |
|||
@SaCheckPermission("productManagement:ModelPrompts:query") |
|||
@GetMapping("/{id}") |
|||
public R<ModelPromptsVo> getInfo(@NotNull(message = "主键不能为空") |
|||
@PathVariable Long id) { |
|||
return R.ok(modelPromptsService.queryById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增模型提示词 |
|||
*/ |
|||
@SaCheckPermission("productManagement:ModelPrompts:add") |
|||
@Log(title = "模型提示词", businessType = BusinessType.INSERT) |
|||
@RepeatSubmit() |
|||
@PostMapping() |
|||
public R<Void> add(@Validated(AddGroup.class) @RequestBody ModelPromptsBo bo) { |
|||
return toAjax(modelPromptsService.insertByBo(bo)); |
|||
} |
|||
|
|||
/** |
|||
* 修改模型提示词 |
|||
*/ |
|||
@SaCheckPermission("productManagement:ModelPrompts:edit") |
|||
@Log(title = "模型提示词", businessType = BusinessType.UPDATE) |
|||
@RepeatSubmit() |
|||
@PutMapping() |
|||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ModelPromptsBo bo) { |
|||
return toAjax(modelPromptsService.updateByBo(bo)); |
|||
} |
|||
|
|||
/** |
|||
* 删除模型提示词 |
|||
* |
|||
* @param ids 主键串 |
|||
*/ |
|||
@SaCheckPermission("productManagement:ModelPrompts:remove") |
|||
@Log(title = "模型提示词", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{ids}") |
|||
public R<Void> remove(@NotEmpty(message = "主键不能为空") |
|||
@PathVariable Long[] ids) { |
|||
return toAjax(modelPromptsService.deleteWithValidByIds(List.of(ids), true)); |
|||
} |
|||
} |
@ -0,0 +1,116 @@ |
|||
package org.dromara.productManagement.controller; |
|||
|
|||
import java.util.List; |
|||
|
|||
import lombok.RequiredArgsConstructor; |
|||
import jakarta.servlet.http.HttpServletResponse; |
|||
import jakarta.validation.constraints.*; |
|||
import cn.dev33.satoken.annotation.SaCheckPermission; |
|||
import org.dromara.common.encrypt.annotation.ApiEncrypt; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.dromara.common.idempotent.annotation.RepeatSubmit; |
|||
import org.dromara.common.log.annotation.Log; |
|||
import org.dromara.common.web.core.BaseController; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import org.dromara.common.core.domain.R; |
|||
import org.dromara.common.core.validate.AddGroup; |
|||
import org.dromara.common.core.validate.EditGroup; |
|||
import org.dromara.common.log.enums.BusinessType; |
|||
import org.dromara.common.excel.utils.ExcelUtil; |
|||
import org.dromara.productManagement.domain.vo.ModelPromptsHistoryVo; |
|||
import org.dromara.productManagement.domain.bo.ModelPromptsHistoryBo; |
|||
import org.dromara.productManagement.service.IModelPromptsHistoryService; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
|
|||
/** |
|||
* 模型提示词历史记录 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-05 |
|||
*/ |
|||
@Validated |
|||
@RequiredArgsConstructor |
|||
@RestController |
|||
@RequestMapping("/productManagement/ModelPromptsHistory") |
|||
public class ModelPromptsHistoryController extends BaseController { |
|||
|
|||
private final IModelPromptsHistoryService modelPromptsHistoryService; |
|||
|
|||
/** |
|||
* 查询模型提示词历史记录列表 |
|||
*/ |
|||
@SaCheckPermission("productManagement:ModelPromptsHistory:list") |
|||
@GetMapping("/list") |
|||
public TableDataInfo<ModelPromptsHistoryVo> list(ModelPromptsHistoryBo bo, PageQuery pageQuery) { |
|||
return modelPromptsHistoryService.queryPageList(bo, pageQuery); |
|||
} |
|||
|
|||
/** |
|||
* 导出模型提示词历史记录列表 |
|||
*/ |
|||
@SaCheckPermission("productManagement:ModelPromptsHistory:export") |
|||
@Log(title = "模型提示词历史记录", businessType = BusinessType.EXPORT) |
|||
@PostMapping("/export") |
|||
public void export(ModelPromptsHistoryBo bo, HttpServletResponse response) { |
|||
List<ModelPromptsHistoryVo> list = modelPromptsHistoryService.queryList(bo); |
|||
ExcelUtil.exportExcel(list, "模型提示词历史记录", ModelPromptsHistoryVo.class, response); |
|||
} |
|||
|
|||
/** |
|||
* 获取模型提示词历史记录详细信息 |
|||
* |
|||
* @param id 主键 |
|||
*/ |
|||
@SaCheckPermission("productManagement:ModelPromptsHistory:query") |
|||
@GetMapping("/{id}") |
|||
public R<ModelPromptsHistoryVo> getInfo(@NotNull(message = "主键不能为空") |
|||
@PathVariable Long id) { |
|||
return R.ok(modelPromptsHistoryService.queryById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增模型提示词历史记录 |
|||
*/ |
|||
@SaCheckPermission("productManagement:ModelPromptsHistory:add") |
|||
@Log(title = "模型提示词历史记录", businessType = BusinessType.INSERT) |
|||
@RepeatSubmit() |
|||
@PostMapping() |
|||
public R<Void> add(@Validated(AddGroup.class) @RequestBody ModelPromptsHistoryBo bo) { |
|||
return toAjax(modelPromptsHistoryService.insertByBo(bo)); |
|||
} |
|||
|
|||
/** |
|||
* 修改模型提示词历史记录 |
|||
*/ |
|||
@SaCheckPermission("productManagement:ModelPromptsHistory:edit") |
|||
@Log(title = "模型提示词历史记录", businessType = BusinessType.UPDATE) |
|||
@RepeatSubmit() |
|||
@PutMapping() |
|||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ModelPromptsHistoryBo bo) { |
|||
return toAjax(modelPromptsHistoryService.updateByBo(bo)); |
|||
} |
|||
|
|||
/** |
|||
* 删除模型提示词历史记录 |
|||
* |
|||
* @param ids 主键串 |
|||
*/ |
|||
@SaCheckPermission("productManagement:ModelPromptsHistory:remove") |
|||
@Log(title = "模型提示词历史记录", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{ids}") |
|||
public R<Void> remove(@NotEmpty(message = "主键不能为空") |
|||
@PathVariable Long[] ids) { |
|||
return toAjax(modelPromptsHistoryService.deleteWithValidByIds(List.of(ids), true)); |
|||
} |
|||
/** |
|||
* 修改模型提示词历史记录 |
|||
*/ |
|||
@SaCheckPermission("productManagement:ModelPromptsHistory:restore") |
|||
@Log(title = "模型提示词历史记录", businessType = BusinessType.UPDATE) |
|||
@RepeatSubmit() |
|||
@PostMapping("/restore/{id}") |
|||
public R<Void> restore(@Validated(EditGroup.class) @PathVariable Long id) { |
|||
return toAjax(modelPromptsHistoryService.restoreByid(id)); |
|||
} |
|||
} |
@ -0,0 +1,116 @@ |
|||
package org.dromara.productManagement.controller; |
|||
|
|||
import java.util.List; |
|||
|
|||
import lombok.RequiredArgsConstructor; |
|||
import jakarta.servlet.http.HttpServletResponse; |
|||
import jakarta.validation.constraints.*; |
|||
import cn.dev33.satoken.annotation.SaCheckPermission; |
|||
import org.dromara.common.satoken.utils.LoginHelper; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.dromara.common.idempotent.annotation.RepeatSubmit; |
|||
import org.dromara.common.log.annotation.Log; |
|||
import org.dromara.common.web.core.BaseController; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import org.dromara.common.core.domain.R; |
|||
import org.dromara.common.core.validate.AddGroup; |
|||
import org.dromara.common.core.validate.EditGroup; |
|||
import org.dromara.common.log.enums.BusinessType; |
|||
import org.dromara.common.excel.utils.ExcelUtil; |
|||
import org.dromara.productManagement.domain.vo.ModelUserPromptssettingVo; |
|||
import org.dromara.productManagement.domain.bo.ModelUserPromptssettingBo; |
|||
import org.dromara.productManagement.service.IModelUserPromptssettingService; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
|
|||
/** |
|||
* 模型提示词用户配置 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-06 |
|||
*/ |
|||
@Validated |
|||
@RequiredArgsConstructor |
|||
@RestController |
|||
@RequestMapping("/productManagement/ModelUserPromptssetting") |
|||
public class ModelUserPromptssettingController extends BaseController { |
|||
|
|||
private final IModelUserPromptssettingService modelUserPromptssettingService; |
|||
|
|||
/** |
|||
* 查询模型提示词用户配置列表 |
|||
*/ |
|||
@SaCheckPermission("productManagement:ModelUserPromptssetting:list") |
|||
@GetMapping("/list") |
|||
public TableDataInfo<ModelUserPromptssettingVo> list(ModelUserPromptssettingBo bo, PageQuery pageQuery) { |
|||
return modelUserPromptssettingService.queryPageList(bo, pageQuery); |
|||
} |
|||
|
|||
/** |
|||
* 导出模型提示词用户配置列表 |
|||
*/ |
|||
@SaCheckPermission("productManagement:ModelUserPromptssetting:export") |
|||
@Log(title = "模型提示词用户配置", businessType = BusinessType.EXPORT) |
|||
@PostMapping("/export") |
|||
public void export(ModelUserPromptssettingBo bo, HttpServletResponse response) { |
|||
List<ModelUserPromptssettingVo> list = modelUserPromptssettingService.queryList(bo); |
|||
ExcelUtil.exportExcel(list, "模型提示词用户配置", ModelUserPromptssettingVo.class, response); |
|||
} |
|||
|
|||
/** |
|||
* 获取模型提示词用户配置详细信息 |
|||
* |
|||
* @param id 主键 |
|||
*/ |
|||
@SaCheckPermission("productManagement:ModelUserPromptssetting:query") |
|||
@GetMapping("/{id}") |
|||
public R<ModelUserPromptssettingVo> getInfo(@NotNull(message = "主键不能为空") |
|||
@PathVariable Long id) { |
|||
return R.ok(modelUserPromptssettingService.queryById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增模型提示词用户配置 |
|||
*/ |
|||
@SaCheckPermission("productManagement:ModelUserPromptssetting:add") |
|||
@Log(title = "模型提示词用户配置", businessType = BusinessType.INSERT) |
|||
@RepeatSubmit() |
|||
@PostMapping() |
|||
public R<Void> add(@Validated(AddGroup.class) @RequestBody ModelUserPromptssettingBo bo) { |
|||
return toAjax(modelUserPromptssettingService.insertByBo(bo)); |
|||
} |
|||
|
|||
/** |
|||
* 修改模型提示词用户配置 |
|||
*/ |
|||
@SaCheckPermission("productManagement:ModelUserPromptssetting:edit") |
|||
@Log(title = "模型提示词用户配置", businessType = BusinessType.UPDATE) |
|||
@RepeatSubmit() |
|||
@PutMapping() |
|||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ModelUserPromptssettingBo bo) { |
|||
return toAjax(modelUserPromptssettingService.updateByBo(bo)); |
|||
} |
|||
|
|||
/** |
|||
* 删除模型提示词用户配置 |
|||
* |
|||
* @param ids 主键串 |
|||
*/ |
|||
@SaCheckPermission("productManagement:ModelUserPromptssetting:remove") |
|||
@Log(title = "模型提示词用户配置", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{ids}") |
|||
public R<Void> remove(@NotEmpty(message = "主键不能为空") |
|||
@PathVariable Long[] ids) { |
|||
return toAjax(modelUserPromptssettingService.deleteWithValidByIds(List.of(ids), true)); |
|||
} |
|||
/** |
|||
* 根据用户id获取模型提示词用户配置详细信息 |
|||
* |
|||
*/ |
|||
// @SaCheckPermission("productManagement:ModelUserPromptssetting:query")
|
|||
@GetMapping("/getInfoByuserId") |
|||
public R<ModelUserPromptssettingVo> getInfoByuserId() { |
|||
Long userId = LoginHelper.getUserId(); |
|||
return R.ok(modelUserPromptssettingService.queryByuserId(userId)); |
|||
} |
|||
} |
@ -0,0 +1,99 @@ |
|||
package org.dromara.productManagement.domain; |
|||
|
|||
import org.dromara.common.tenant.core.TenantEntity; |
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.io.Serial; |
|||
|
|||
/** |
|||
* 用于存储模型提示词对象 model_prompts |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-05 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@TableName("model_prompts") |
|||
public class ModelPrompts extends TenantEntity { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
@TableId(value = "id") |
|||
private Long id; |
|||
|
|||
/** |
|||
* 任务角色描述 |
|||
*/ |
|||
private String taskRoleDesc; |
|||
|
|||
/** |
|||
* 模型任务名称 |
|||
*/ |
|||
private String taskName; |
|||
|
|||
/** |
|||
* 模型所属区域 |
|||
*/ |
|||
private String taskRegion; |
|||
|
|||
/** |
|||
* 模型所属行业 |
|||
*/ |
|||
private String taskIndustry; |
|||
|
|||
/** |
|||
* 任务背景 |
|||
*/ |
|||
private String context; |
|||
|
|||
/** |
|||
* 任务描述 |
|||
*/ |
|||
private String description; |
|||
|
|||
/** |
|||
* 任务流程 |
|||
*/ |
|||
private String workflow; |
|||
|
|||
/** |
|||
* 输出说明 |
|||
*/ |
|||
private String outputDesc; |
|||
|
|||
/** |
|||
* 注意事项 |
|||
*/ |
|||
private String cautions; |
|||
|
|||
/** |
|||
* 模型版本 |
|||
*/ |
|||
private String modelVersion; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String note; |
|||
|
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
@TableLogic |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
@Version |
|||
private String version; |
|||
|
|||
|
|||
} |
@ -0,0 +1,103 @@ |
|||
package org.dromara.productManagement.domain; |
|||
|
|||
import org.dromara.common.tenant.core.TenantEntity; |
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.io.Serial; |
|||
|
|||
/** |
|||
* 模型提示词历史记录对象 model_prompts_history |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-05 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@TableName("model_prompts_history") |
|||
public class ModelPromptsHistory extends TenantEntity { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
@TableId(value = "id") |
|||
private Long id; |
|||
|
|||
/** |
|||
* 提示词id |
|||
*/ |
|||
private Long promptId; |
|||
|
|||
/** |
|||
* 任务角色描述 |
|||
*/ |
|||
private String taskRoleDesc; |
|||
|
|||
/** |
|||
* 模型任务名称 |
|||
*/ |
|||
private String taskName; |
|||
|
|||
/** |
|||
* 模型所属区域 |
|||
*/ |
|||
private String taskRegion; |
|||
|
|||
/** |
|||
* 模型所属行业 |
|||
*/ |
|||
private String taskIndustry; |
|||
|
|||
/** |
|||
* 任务背景 |
|||
*/ |
|||
private String context; |
|||
|
|||
/** |
|||
* 任务描述 |
|||
*/ |
|||
private String description; |
|||
|
|||
/** |
|||
* 任务流程 |
|||
*/ |
|||
private String workflow; |
|||
|
|||
/** |
|||
* 输出说明 |
|||
*/ |
|||
private String outputDesc; |
|||
|
|||
/** |
|||
* 注意事项 |
|||
*/ |
|||
private String cautions; |
|||
|
|||
/** |
|||
* 模型版本 |
|||
*/ |
|||
private String modelVersion; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String note; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
@TableLogic |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
@Version |
|||
private String version; |
|||
|
|||
|
|||
} |
@ -0,0 +1,63 @@ |
|||
package org.dromara.productManagement.domain; |
|||
|
|||
import org.dromara.common.tenant.core.TenantEntity; |
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.io.Serial; |
|||
|
|||
/** |
|||
* 模型提示词用户配置对象 model_user_promptssetting |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-06 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@TableName("model_user_promptssetting") |
|||
public class ModelUserPromptssetting extends TenantEntity { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
@TableId(value = "id") |
|||
private Long id; |
|||
|
|||
/** |
|||
* 模型所属行业 |
|||
*/ |
|||
private String taskIndustry; |
|||
|
|||
/** |
|||
* 模型所属区域 |
|||
*/ |
|||
private String taskRegion; |
|||
|
|||
/** |
|||
* 任务类型(名称) |
|||
*/ |
|||
private String taskName; |
|||
|
|||
/** |
|||
* 用户id |
|||
*/ |
|||
private Long userId; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
@TableLogic |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
@Version |
|||
private String version; |
|||
|
|||
|
|||
} |
@ -0,0 +1,93 @@ |
|||
package org.dromara.productManagement.domain.bo; |
|||
|
|||
import org.dromara.productManagement.domain.ModelPrompts; |
|||
import org.dromara.common.mybatis.core.domain.BaseEntity; |
|||
import org.dromara.common.core.validate.AddGroup; |
|||
import org.dromara.common.core.validate.EditGroup; |
|||
import io.github.linpeilie.annotations.AutoMapper; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import jakarta.validation.constraints.*; |
|||
|
|||
/** |
|||
* 用于存储模型提示词业务对象 model_prompts |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-05 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@AutoMapper(target = ModelPrompts.class, reverseConvertGenerate = false) |
|||
public class ModelPromptsBo extends BaseEntity { |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* 任务角色描述 |
|||
*/ |
|||
@NotBlank(message = "任务角色描述不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private String taskRoleDesc; |
|||
|
|||
/** |
|||
* 模型任务名称 |
|||
*/ |
|||
@NotBlank(message = "模型任务名称不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private String taskName; |
|||
|
|||
/** |
|||
* 模型所属区域 |
|||
*/ |
|||
@NotBlank(message = "模型所属区域不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private String taskRegion; |
|||
|
|||
/** |
|||
* 模型所属行业 |
|||
*/ |
|||
@NotBlank(message = "模型所属行业不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private String taskIndustry; |
|||
|
|||
/** |
|||
* 任务背景 |
|||
*/ |
|||
@NotBlank(message = "任务背景不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private String context; |
|||
|
|||
/** |
|||
* 任务描述 |
|||
*/ |
|||
@NotBlank(message = "任务描述不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private String description; |
|||
|
|||
/** |
|||
* 任务流程 |
|||
*/ |
|||
private String workflow; |
|||
|
|||
/** |
|||
* 输出说明 |
|||
*/ |
|||
@NotBlank(message = "输出说明不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private String outputDesc; |
|||
|
|||
/** |
|||
* 注意事项 |
|||
*/ |
|||
private String cautions; |
|||
|
|||
/** |
|||
* 模型版本 |
|||
*/ |
|||
private String modelVersion; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String note; |
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,89 @@ |
|||
package org.dromara.productManagement.domain.bo; |
|||
|
|||
import org.dromara.productManagement.domain.ModelPromptsHistory; |
|||
import org.dromara.common.mybatis.core.domain.BaseEntity; |
|||
import org.dromara.common.core.validate.AddGroup; |
|||
import org.dromara.common.core.validate.EditGroup; |
|||
import io.github.linpeilie.annotations.AutoMapper; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import jakarta.validation.constraints.*; |
|||
|
|||
/** |
|||
* 模型提示词历史记录业务对象 model_prompts_history |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-05 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@AutoMapper(target = ModelPromptsHistory.class, reverseConvertGenerate = false) |
|||
public class ModelPromptsHistoryBo extends BaseEntity { |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* 提示词id |
|||
*/ |
|||
private Long promptId; |
|||
|
|||
/** |
|||
* 任务角色描述 |
|||
*/ |
|||
private String taskRoleDesc; |
|||
|
|||
/** |
|||
* 模型任务名称 |
|||
*/ |
|||
private String taskName; |
|||
|
|||
/** |
|||
* 模型所属区域 |
|||
*/ |
|||
private String taskRegion; |
|||
|
|||
/** |
|||
* 模型所属行业 |
|||
*/ |
|||
private String taskIndustry; |
|||
|
|||
/** |
|||
* 任务背景 |
|||
*/ |
|||
private String context; |
|||
|
|||
/** |
|||
* 任务描述 |
|||
*/ |
|||
private String description; |
|||
|
|||
/** |
|||
* 任务流程 |
|||
*/ |
|||
private String workflow; |
|||
|
|||
/** |
|||
* 输出说明 |
|||
*/ |
|||
private String outputDesc; |
|||
|
|||
/** |
|||
* 注意事项 |
|||
*/ |
|||
private String cautions; |
|||
|
|||
/** |
|||
* 模型版本 |
|||
*/ |
|||
private String modelVersion; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String note; |
|||
|
|||
|
|||
} |
@ -0,0 +1,54 @@ |
|||
package org.dromara.productManagement.domain.bo; |
|||
|
|||
import org.dromara.productManagement.domain.ModelUserPromptssetting; |
|||
import org.dromara.common.mybatis.core.domain.BaseEntity; |
|||
import org.dromara.common.core.validate.AddGroup; |
|||
import org.dromara.common.core.validate.EditGroup; |
|||
import io.github.linpeilie.annotations.AutoMapper; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import jakarta.validation.constraints.*; |
|||
|
|||
/** |
|||
* 模型提示词用户配置业务对象 model_user_promptssetting |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-06 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@AutoMapper(target = ModelUserPromptssetting.class, reverseConvertGenerate = false) |
|||
public class ModelUserPromptssettingBo extends BaseEntity { |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
@NotNull(message = "id不能为空", groups = { EditGroup.class }) |
|||
private Long id; |
|||
|
|||
/** |
|||
* 模型所属行业 |
|||
*/ |
|||
@NotBlank(message = "模型所属行业不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private String taskIndustry; |
|||
|
|||
/** |
|||
* 模型所属区域 |
|||
*/ |
|||
@NotBlank(message = "模型所属区域不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private String taskRegion; |
|||
|
|||
/** |
|||
* 任务类型(名称) |
|||
*/ |
|||
@NotBlank(message = "任务类型(名称)不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private String taskName; |
|||
|
|||
/** |
|||
* 用户id |
|||
*/ |
|||
@NotNull(message = "用户id不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private Long userId; |
|||
|
|||
|
|||
} |
@ -0,0 +1,113 @@ |
|||
package org.dromara.productManagement.domain.vo; |
|||
|
|||
import org.dromara.productManagement.domain.ModelPromptsHistory; |
|||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
|||
import com.alibaba.excel.annotation.ExcelProperty; |
|||
import org.dromara.common.excel.annotation.ExcelDictFormat; |
|||
import org.dromara.common.excel.convert.ExcelDictConvert; |
|||
import io.github.linpeilie.annotations.AutoMapper; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serial; |
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 模型提示词历史记录视图对象 model_prompts_history |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-05 |
|||
*/ |
|||
@Data |
|||
@ExcelIgnoreUnannotated |
|||
@AutoMapper(target = ModelPromptsHistory.class) |
|||
public class ModelPromptsHistoryVo implements Serializable { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
@ExcelProperty(value = "id") |
|||
private Long id; |
|||
|
|||
/** |
|||
* 提示词id |
|||
*/ |
|||
@ExcelProperty(value = "提示词id") |
|||
private Long promptId; |
|||
|
|||
/** |
|||
* 任务角色描述 |
|||
*/ |
|||
@ExcelProperty(value = "任务角色描述") |
|||
private String taskRoleDesc; |
|||
|
|||
/** |
|||
* 模型任务名称 |
|||
*/ |
|||
@ExcelProperty(value = "模型任务名称", converter = ExcelDictConvert.class) |
|||
@ExcelDictFormat(dictType = "document_task") |
|||
private String taskName; |
|||
|
|||
/** |
|||
* 模型所属区域 |
|||
*/ |
|||
@ExcelProperty(value = "模型所属区域", converter = ExcelDictConvert.class) |
|||
@ExcelDictFormat(dictType = "model_region") |
|||
private String taskRegion; |
|||
|
|||
/** |
|||
* 模型所属行业 |
|||
*/ |
|||
@ExcelProperty(value = "模型所属行业", converter = ExcelDictConvert.class) |
|||
@ExcelDictFormat(dictType = "model_industry") |
|||
private String taskIndustry; |
|||
|
|||
/** |
|||
* 任务背景 |
|||
*/ |
|||
@ExcelProperty(value = "任务背景") |
|||
private String context; |
|||
|
|||
/** |
|||
* 任务描述 |
|||
*/ |
|||
@ExcelProperty(value = "任务描述") |
|||
private String description; |
|||
|
|||
/** |
|||
* 任务流程 |
|||
*/ |
|||
@ExcelProperty(value = "任务流程") |
|||
private String workflow; |
|||
|
|||
/** |
|||
* 输出说明 |
|||
*/ |
|||
@ExcelProperty(value = "输出说明") |
|||
private String outputDesc; |
|||
|
|||
/** |
|||
* 注意事项 |
|||
*/ |
|||
@ExcelProperty(value = "注意事项") |
|||
private String cautions; |
|||
|
|||
/** |
|||
* 模型版本 |
|||
*/ |
|||
@ExcelProperty(value = "模型版本") |
|||
private String modelVersion; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
@ExcelProperty(value = "备注") |
|||
private String note; |
|||
|
|||
|
|||
} |
@ -0,0 +1,107 @@ |
|||
package org.dromara.productManagement.domain.vo; |
|||
|
|||
import org.dromara.productManagement.domain.ModelPrompts; |
|||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
|||
import com.alibaba.excel.annotation.ExcelProperty; |
|||
import org.dromara.common.excel.annotation.ExcelDictFormat; |
|||
import org.dromara.common.excel.convert.ExcelDictConvert; |
|||
import io.github.linpeilie.annotations.AutoMapper; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serial; |
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 用于存储模型提示词视图对象 model_prompts |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-05 |
|||
*/ |
|||
@Data |
|||
@ExcelIgnoreUnannotated |
|||
@AutoMapper(target = ModelPrompts.class) |
|||
public class ModelPromptsVo implements Serializable { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
@ExcelProperty(value = "id") |
|||
private Long id; |
|||
|
|||
/** |
|||
* 任务角色描述 |
|||
*/ |
|||
@ExcelProperty(value = "任务角色描述") |
|||
private String taskRoleDesc; |
|||
|
|||
/** |
|||
* 模型任务名称 |
|||
*/ |
|||
@ExcelProperty(value = "模型任务名称", converter = ExcelDictConvert.class) |
|||
@ExcelDictFormat(dictType = "document_task") |
|||
private String taskName; |
|||
|
|||
/** |
|||
* 模型所属区域 |
|||
*/ |
|||
@ExcelProperty(value = "模型所属区域", converter = ExcelDictConvert.class) |
|||
@ExcelDictFormat(dictType = "model_region") |
|||
private String taskRegion; |
|||
|
|||
/** |
|||
* 模型所属行业 |
|||
*/ |
|||
@ExcelProperty(value = "模型所属行业", converter = ExcelDictConvert.class) |
|||
@ExcelDictFormat(dictType = "model_industry") |
|||
private String taskIndustry; |
|||
|
|||
/** |
|||
* 任务背景 |
|||
*/ |
|||
@ExcelProperty(value = "任务背景") |
|||
private String context; |
|||
|
|||
/** |
|||
* 任务描述 |
|||
*/ |
|||
@ExcelProperty(value = "任务描述") |
|||
private String description; |
|||
|
|||
/** |
|||
* 任务流程 |
|||
*/ |
|||
@ExcelProperty(value = "任务流程") |
|||
private String workflow; |
|||
|
|||
/** |
|||
* 输出说明 |
|||
*/ |
|||
@ExcelProperty(value = "输出说明") |
|||
private String outputDesc; |
|||
|
|||
/** |
|||
* 注意事项 |
|||
*/ |
|||
@ExcelProperty(value = "注意事项") |
|||
private String cautions; |
|||
|
|||
/** |
|||
* 模型版本 |
|||
*/ |
|||
@ExcelProperty(value = "模型版本") |
|||
private String modelVersion; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
@ExcelProperty(value = "备注") |
|||
private String note; |
|||
|
|||
|
|||
} |
@ -0,0 +1,63 @@ |
|||
package org.dromara.productManagement.domain.vo; |
|||
|
|||
import org.dromara.productManagement.domain.ModelUserPromptssetting; |
|||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
|||
import com.alibaba.excel.annotation.ExcelProperty; |
|||
import org.dromara.common.excel.annotation.ExcelDictFormat; |
|||
import org.dromara.common.excel.convert.ExcelDictConvert; |
|||
import io.github.linpeilie.annotations.AutoMapper; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serial; |
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 模型提示词用户配置视图对象 model_user_promptssetting |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-06 |
|||
*/ |
|||
@Data |
|||
@ExcelIgnoreUnannotated |
|||
@AutoMapper(target = ModelUserPromptssetting.class) |
|||
public class ModelUserPromptssettingVo implements Serializable { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
@ExcelProperty(value = "id") |
|||
private Long id; |
|||
|
|||
/** |
|||
* 模型所属行业 |
|||
*/ |
|||
@ExcelProperty(value = "模型所属行业") |
|||
private String taskIndustry; |
|||
|
|||
/** |
|||
* 模型所属区域 |
|||
*/ |
|||
@ExcelProperty(value = "模型所属区域") |
|||
private String taskRegion; |
|||
|
|||
/** |
|||
* 任务类型(名称) |
|||
*/ |
|||
@ExcelProperty(value = "任务类型", converter = ExcelDictConvert.class) |
|||
@ExcelDictFormat(readConverterExp = "名=称") |
|||
private String taskName; |
|||
|
|||
/** |
|||
* 用户id |
|||
*/ |
|||
@ExcelProperty(value = "用户id") |
|||
private Long userId; |
|||
|
|||
|
|||
} |
@ -0,0 +1,15 @@ |
|||
package org.dromara.productManagement.mapper; |
|||
|
|||
import org.dromara.productManagement.domain.ModelPromptsHistory; |
|||
import org.dromara.productManagement.domain.vo.ModelPromptsHistoryVo; |
|||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
|||
|
|||
/** |
|||
* 模型提示词历史记录Mapper接口 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-05 |
|||
*/ |
|||
public interface ModelPromptsHistoryMapper extends BaseMapperPlus<ModelPromptsHistory, ModelPromptsHistoryVo> { |
|||
|
|||
} |
@ -0,0 +1,15 @@ |
|||
package org.dromara.productManagement.mapper; |
|||
|
|||
import org.dromara.productManagement.domain.ModelPrompts; |
|||
import org.dromara.productManagement.domain.vo.ModelPromptsVo; |
|||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
|||
|
|||
/** |
|||
* 用于存储模型提示词Mapper接口 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-05 |
|||
*/ |
|||
public interface ModelPromptsMapper extends BaseMapperPlus<ModelPrompts, ModelPromptsVo> { |
|||
|
|||
} |
@ -0,0 +1,15 @@ |
|||
package org.dromara.productManagement.mapper; |
|||
|
|||
import org.dromara.productManagement.domain.ModelUserPromptssetting; |
|||
import org.dromara.productManagement.domain.vo.ModelUserPromptssettingVo; |
|||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
|||
|
|||
/** |
|||
* 模型提示词用户配置Mapper接口 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-06 |
|||
*/ |
|||
public interface ModelUserPromptssettingMapper extends BaseMapperPlus<ModelUserPromptssetting, ModelUserPromptssettingVo> { |
|||
|
|||
} |
@ -0,0 +1,75 @@ |
|||
package org.dromara.productManagement.service; |
|||
|
|||
import org.dromara.productManagement.domain.vo.ModelPromptsHistoryVo; |
|||
import org.dromara.productManagement.domain.bo.ModelPromptsHistoryBo; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
|
|||
import java.util.Collection; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 模型提示词历史记录Service接口 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-05 |
|||
*/ |
|||
public interface IModelPromptsHistoryService { |
|||
|
|||
/** |
|||
* 查询模型提示词历史记录 |
|||
* |
|||
* @param id 主键 |
|||
* @return 模型提示词历史记录 |
|||
*/ |
|||
ModelPromptsHistoryVo queryById(Long id); |
|||
|
|||
/** |
|||
* 分页查询模型提示词历史记录列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 模型提示词历史记录分页列表 |
|||
*/ |
|||
TableDataInfo<ModelPromptsHistoryVo> queryPageList(ModelPromptsHistoryBo bo, PageQuery pageQuery); |
|||
|
|||
/** |
|||
* 查询符合条件的模型提示词历史记录列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 模型提示词历史记录列表 |
|||
*/ |
|||
List<ModelPromptsHistoryVo> queryList(ModelPromptsHistoryBo bo); |
|||
|
|||
/** |
|||
* 新增模型提示词历史记录 |
|||
* |
|||
* @param bo 模型提示词历史记录 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
Boolean insertByBo(ModelPromptsHistoryBo bo); |
|||
|
|||
/** |
|||
* 修改模型提示词历史记录 |
|||
* |
|||
* @param bo 模型提示词历史记录 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
Boolean updateByBo(ModelPromptsHistoryBo bo); |
|||
|
|||
/** |
|||
* 校验并批量删除模型提示词历史记录信息 |
|||
* |
|||
* @param ids 待删除的主键集合 |
|||
* @param isValid 是否进行有效性校验 |
|||
* @return 是否删除成功 |
|||
*/ |
|||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
|||
/** |
|||
* 根据id恢复模型提示词历史记录 |
|||
* |
|||
* @param id 模型提示词历史记录id |
|||
* @return 是否恢复成功 |
|||
*/ |
|||
int restoreByid(Long id); |
|||
} |
@ -0,0 +1,68 @@ |
|||
package org.dromara.productManagement.service; |
|||
|
|||
import org.dromara.productManagement.domain.vo.ModelPromptsVo; |
|||
import org.dromara.productManagement.domain.bo.ModelPromptsBo; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
|
|||
import java.util.Collection; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 用于存储模型提示词Service接口 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-05 |
|||
*/ |
|||
public interface IModelPromptsService { |
|||
|
|||
/** |
|||
* 查询用于存储模型提示词 |
|||
* |
|||
* @param id 主键 |
|||
* @return 用于存储模型提示词 |
|||
*/ |
|||
ModelPromptsVo queryById(Long id); |
|||
|
|||
/** |
|||
* 分页查询用于存储模型提示词列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 用于存储模型提示词分页列表 |
|||
*/ |
|||
TableDataInfo<ModelPromptsVo> queryPageList(ModelPromptsBo bo, PageQuery pageQuery); |
|||
|
|||
/** |
|||
* 查询符合条件的用于存储模型提示词列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 用于存储模型提示词列表 |
|||
*/ |
|||
List<ModelPromptsVo> queryList(ModelPromptsBo bo); |
|||
|
|||
/** |
|||
* 新增用于存储模型提示词 |
|||
* |
|||
* @param bo 用于存储模型提示词 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
Boolean insertByBo(ModelPromptsBo bo); |
|||
|
|||
/** |
|||
* 修改用于存储模型提示词 |
|||
* |
|||
* @param bo 用于存储模型提示词 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
Boolean updateByBo(ModelPromptsBo bo); |
|||
|
|||
/** |
|||
* 校验并批量删除用于存储模型提示词信息 |
|||
* |
|||
* @param ids 待删除的主键集合 |
|||
* @param isValid 是否进行有效性校验 |
|||
* @return 是否删除成功 |
|||
*/ |
|||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
|||
} |
@ -0,0 +1,70 @@ |
|||
package org.dromara.productManagement.service; |
|||
|
|||
import org.dromara.productManagement.domain.vo.ModelUserPromptssettingVo; |
|||
import org.dromara.productManagement.domain.bo.ModelUserPromptssettingBo; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
|
|||
import java.util.Collection; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 模型提示词用户配置Service接口 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-06 |
|||
*/ |
|||
public interface IModelUserPromptssettingService { |
|||
|
|||
/** |
|||
* 查询模型提示词用户配置 |
|||
* |
|||
* @param id 主键 |
|||
* @return 模型提示词用户配置 |
|||
*/ |
|||
ModelUserPromptssettingVo queryById(Long id); |
|||
|
|||
/** |
|||
* 分页查询模型提示词用户配置列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 模型提示词用户配置分页列表 |
|||
*/ |
|||
TableDataInfo<ModelUserPromptssettingVo> queryPageList(ModelUserPromptssettingBo bo, PageQuery pageQuery); |
|||
|
|||
/** |
|||
* 查询符合条件的模型提示词用户配置列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 模型提示词用户配置列表 |
|||
*/ |
|||
List<ModelUserPromptssettingVo> queryList(ModelUserPromptssettingBo bo); |
|||
|
|||
/** |
|||
* 新增模型提示词用户配置 |
|||
* |
|||
* @param bo 模型提示词用户配置 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
Boolean insertByBo(ModelUserPromptssettingBo bo); |
|||
|
|||
/** |
|||
* 修改模型提示词用户配置 |
|||
* |
|||
* @param bo 模型提示词用户配置 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
Boolean updateByBo(ModelUserPromptssettingBo bo); |
|||
|
|||
/** |
|||
* 校验并批量删除模型提示词用户配置信息 |
|||
* |
|||
* @param ids 待删除的主键集合 |
|||
* @param isValid 是否进行有效性校验 |
|||
* @return 是否删除成功 |
|||
*/ |
|||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
|||
|
|||
ModelUserPromptssettingVo queryByuserId(Long userId); |
|||
} |
@ -0,0 +1,159 @@ |
|||
package org.dromara.productManagement.service.impl; |
|||
|
|||
import org.dromara.common.core.utils.MapstructUtils; |
|||
import org.dromara.common.core.utils.StringUtils; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.dromara.productManagement.domain.DocumentTasks; |
|||
import org.dromara.productManagement.domain.ModelPrompts; |
|||
import org.dromara.productManagement.domain.vo.ModelPromptsVo; |
|||
import org.dromara.productManagement.mapper.ModelPromptsMapper; |
|||
import org.springframework.beans.BeanUtils; |
|||
import org.springframework.stereotype.Service; |
|||
import org.dromara.productManagement.domain.bo.ModelPromptsHistoryBo; |
|||
import org.dromara.productManagement.domain.vo.ModelPromptsHistoryVo; |
|||
import org.dromara.productManagement.domain.ModelPromptsHistory; |
|||
import org.dromara.productManagement.mapper.ModelPromptsHistoryMapper; |
|||
import org.dromara.productManagement.service.IModelPromptsHistoryService; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Collection; |
|||
|
|||
/** |
|||
* 模型提示词历史记录Service业务层处理 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-05 |
|||
*/ |
|||
@RequiredArgsConstructor |
|||
@Service |
|||
public class ModelPromptsHistoryServiceImpl implements IModelPromptsHistoryService { |
|||
|
|||
private final ModelPromptsHistoryMapper baseMapper; |
|||
private final ModelPromptsMapper modelPromptsMapper; |
|||
/** |
|||
* 查询模型提示词历史记录 |
|||
* |
|||
* @param id 主键 |
|||
* @return 模型提示词历史记录 |
|||
*/ |
|||
@Override |
|||
public ModelPromptsHistoryVo queryById(Long id){ |
|||
return baseMapper.selectVoById(id); |
|||
} |
|||
|
|||
/** |
|||
* 分页查询模型提示词历史记录列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 模型提示词历史记录分页列表 |
|||
*/ |
|||
@Override |
|||
public TableDataInfo<ModelPromptsHistoryVo> queryPageList(ModelPromptsHistoryBo bo, PageQuery pageQuery) { |
|||
LambdaQueryWrapper<ModelPromptsHistory> lqw = buildQueryWrapper(bo); |
|||
Page<ModelPromptsHistoryVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
|||
return TableDataInfo.build(result); |
|||
} |
|||
|
|||
/** |
|||
* 查询符合条件的模型提示词历史记录列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 模型提示词历史记录列表 |
|||
*/ |
|||
@Override |
|||
public List<ModelPromptsHistoryVo> queryList(ModelPromptsHistoryBo bo) { |
|||
LambdaQueryWrapper<ModelPromptsHistory> lqw = buildQueryWrapper(bo); |
|||
return baseMapper.selectVoList(lqw); |
|||
} |
|||
|
|||
private LambdaQueryWrapper<ModelPromptsHistory> buildQueryWrapper(ModelPromptsHistoryBo bo) { |
|||
Map<String, Object> params = bo.getParams(); |
|||
LambdaQueryWrapper<ModelPromptsHistory> lqw = Wrappers.lambdaQuery(); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getTaskName()), ModelPromptsHistory::getTaskName, bo.getTaskName()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getTaskRegion()), ModelPromptsHistory::getTaskRegion, bo.getTaskRegion()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getTaskIndustry()), ModelPromptsHistory::getTaskIndustry, bo.getTaskIndustry()); |
|||
lqw.orderByDesc(ModelPromptsHistory::getCreateTime).orderByDesc(ModelPromptsHistory::getModelVersion); |
|||
return lqw; |
|||
} |
|||
|
|||
/** |
|||
* 新增模型提示词历史记录 |
|||
* |
|||
* @param bo 模型提示词历史记录 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
@Override |
|||
public Boolean insertByBo(ModelPromptsHistoryBo bo) { |
|||
ModelPromptsHistory add = MapstructUtils.convert(bo, ModelPromptsHistory.class); |
|||
validEntityBeforeSave(add); |
|||
boolean flag = baseMapper.insert(add) > 0; |
|||
if (flag) { |
|||
bo.setId(add.getId()); |
|||
} |
|||
return flag; |
|||
} |
|||
|
|||
/** |
|||
* 修改模型提示词历史记录 |
|||
* |
|||
* @param bo 模型提示词历史记录 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
@Override |
|||
public Boolean updateByBo(ModelPromptsHistoryBo bo) { |
|||
ModelPromptsHistory update = MapstructUtils.convert(bo, ModelPromptsHistory.class); |
|||
validEntityBeforeSave(update); |
|||
return baseMapper.updateById(update) > 0; |
|||
} |
|||
|
|||
/** |
|||
* 保存前的数据校验 |
|||
*/ |
|||
private void validEntityBeforeSave(ModelPromptsHistory entity){ |
|||
//TODO 做一些数据校验,如唯一约束
|
|||
} |
|||
|
|||
/** |
|||
* 校验并批量删除模型提示词历史记录信息 |
|||
* |
|||
* @param ids 待删除的主键集合 |
|||
* @param isValid 是否进行有效性校验 |
|||
* @return 是否删除成功 |
|||
*/ |
|||
@Override |
|||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { |
|||
if(isValid){ |
|||
//TODO 做一些业务上的校验,判断是否需要校验
|
|||
} |
|||
return baseMapper.deleteByIds(ids) > 0; |
|||
} |
|||
|
|||
@Override |
|||
public int restoreByid(Long id) { |
|||
//根据id查询出历史记录
|
|||
ModelPromptsHistory modelPromptsHistory = baseMapper.selectById(id); |
|||
ModelPrompts modelPrompts = new ModelPrompts(); |
|||
BeanUtils.copyProperties(modelPromptsHistory, modelPrompts); |
|||
|
|||
modelPrompts.setId(modelPromptsHistory.getPromptId()); |
|||
//查询当前模型
|
|||
ModelPromptsVo modelPromptsVo = modelPromptsMapper.selectVoById(modelPromptsHistory.getPromptId()); |
|||
int version = Integer.parseInt(modelPromptsVo.getModelVersion()); |
|||
modelPrompts.setModelVersion(String.valueOf(version+1)); |
|||
modelPromptsMapper.updateById(modelPrompts); |
|||
//更新历史记录
|
|||
ModelPromptsHistory history = new ModelPromptsHistory(); |
|||
BeanUtils.copyProperties(modelPromptsVo, history); |
|||
history.setId(null); |
|||
history.setPromptId(modelPromptsVo.getId()); |
|||
baseMapper.insert(history); |
|||
return 1; |
|||
} |
|||
} |
@ -0,0 +1,166 @@ |
|||
package org.dromara.productManagement.service.impl; |
|||
|
|||
import cn.hutool.core.util.StrUtil; |
|||
import org.dromara.common.core.utils.MapstructUtils; |
|||
import org.dromara.common.core.utils.StringUtils; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.dromara.productManagement.domain.ModelPromptsHistory; |
|||
import org.dromara.productManagement.mapper.ModelPromptsHistoryMapper; |
|||
import org.springframework.beans.BeanUtils; |
|||
import org.springframework.stereotype.Service; |
|||
import org.dromara.productManagement.domain.bo.ModelPromptsBo; |
|||
import org.dromara.productManagement.domain.vo.ModelPromptsVo; |
|||
import org.dromara.productManagement.domain.ModelPrompts; |
|||
import org.dromara.productManagement.mapper.ModelPromptsMapper; |
|||
import org.dromara.productManagement.service.IModelPromptsService; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Collection; |
|||
|
|||
/** |
|||
* 用于存储模型提示词Service业务层处理 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-05 |
|||
*/ |
|||
@RequiredArgsConstructor |
|||
@Service |
|||
public class ModelPromptsServiceImpl implements IModelPromptsService { |
|||
|
|||
private final ModelPromptsMapper baseMapper; |
|||
private final ModelPromptsHistoryMapper historyMapper; |
|||
/** |
|||
* 查询用于存储模型提示词 |
|||
* |
|||
* @param id 主键 |
|||
* @return 用于存储模型提示词 |
|||
*/ |
|||
@Override |
|||
public ModelPromptsVo queryById(Long id){ |
|||
return baseMapper.selectVoById(id); |
|||
} |
|||
|
|||
/** |
|||
* 分页查询用于存储模型提示词列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 用于存储模型提示词分页列表 |
|||
*/ |
|||
@Override |
|||
public TableDataInfo<ModelPromptsVo> queryPageList(ModelPromptsBo bo, PageQuery pageQuery) { |
|||
LambdaQueryWrapper<ModelPrompts> lqw = buildQueryWrapper(bo); |
|||
Page<ModelPromptsVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
|||
return TableDataInfo.build(result); |
|||
} |
|||
|
|||
/** |
|||
* 查询符合条件的用于存储模型提示词列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 用于存储模型提示词列表 |
|||
*/ |
|||
@Override |
|||
public List<ModelPromptsVo> queryList(ModelPromptsBo bo) { |
|||
LambdaQueryWrapper<ModelPrompts> lqw = buildQueryWrapper(bo); |
|||
return baseMapper.selectVoList(lqw); |
|||
} |
|||
|
|||
private LambdaQueryWrapper<ModelPrompts> buildQueryWrapper(ModelPromptsBo bo) { |
|||
Map<String, Object> params = bo.getParams(); |
|||
LambdaQueryWrapper<ModelPrompts> lqw = Wrappers.lambdaQuery(); |
|||
lqw.eq(bo.getId() != null, ModelPrompts::getId, bo.getId()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getTaskName()), ModelPrompts::getTaskName, bo.getTaskName()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getTaskRegion()), ModelPrompts::getTaskRegion, bo.getTaskRegion()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getTaskIndustry()), ModelPrompts::getTaskIndustry, bo.getTaskIndustry()); |
|||
return lqw; |
|||
} |
|||
|
|||
/** |
|||
* 新增用于存储模型提示词 |
|||
* |
|||
* @param bo 用于存储模型提示词 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
@Override |
|||
public Boolean insertByBo(ModelPromptsBo bo) { |
|||
ModelPrompts add = MapstructUtils.convert(bo, ModelPrompts.class); |
|||
validEntityBeforeSave(add); |
|||
//查询版本号是否存在
|
|||
if(StrUtil.isBlankIfStr(bo.getModelVersion())){ |
|||
add.setModelVersion("1"); |
|||
}else{ |
|||
//获取版本号字符串,转成int,加1,再转成字符串
|
|||
int version = Integer.parseInt(bo.getModelVersion()); |
|||
add.setModelVersion(String.valueOf(version+1)); |
|||
} |
|||
boolean flag = baseMapper.insert(add) > 0; |
|||
if (flag) { |
|||
add.setId(add.getId()); |
|||
} |
|||
return flag; |
|||
} |
|||
|
|||
/** |
|||
* 修改用于存储模型提示词 |
|||
* |
|||
* @param bo 用于存储模型提示词 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
@Override |
|||
public Boolean updateByBo(ModelPromptsBo bo) { |
|||
ModelPrompts update = MapstructUtils.convert(bo, ModelPrompts.class); |
|||
validEntityBeforeSave(update); |
|||
//更新前查询原数据
|
|||
ModelPrompts old = baseMapper.selectById(update.getId()); |
|||
//原数据跟新到历史记录表
|
|||
ModelPromptsHistory modelPromptsHistory = new ModelPromptsHistory(); |
|||
BeanUtils.copyProperties(old, modelPromptsHistory); |
|||
modelPromptsHistory.setId(null); |
|||
modelPromptsHistory.setPromptId(update.getId()); |
|||
historyMapper.insert(modelPromptsHistory); |
|||
//更新最新数据
|
|||
//获取版本号字符串,转成int,加1,再转成字符串
|
|||
int version = Integer.parseInt(bo.getModelVersion()); |
|||
update.setModelVersion(String.valueOf(version+1)); |
|||
return baseMapper.updateById(update) > 0; |
|||
} |
|||
|
|||
/** |
|||
* 保存前的数据校验 |
|||
*/ |
|||
private void validEntityBeforeSave(ModelPrompts entity){ |
|||
//TODO 做一些数据校验,如唯一约束
|
|||
//根据任务名称、区域、行业查询是否存在相同的提示词
|
|||
LambdaQueryWrapper<ModelPrompts> lqw = Wrappers.lambdaQuery(); |
|||
lqw.eq(ModelPrompts::getTaskName, entity.getTaskName()); |
|||
lqw.eq(ModelPrompts::getTaskRegion, entity.getTaskRegion()); |
|||
lqw.eq(ModelPrompts::getTaskIndustry, entity.getTaskIndustry()); |
|||
lqw.ne(ModelPrompts::getId, entity.getId()); |
|||
Long count = baseMapper.selectCount(lqw); |
|||
if(count > 0){ |
|||
throw new IllegalArgumentException("任务名称、区域、行业不能重复!"); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 校验并批量删除用于存储模型提示词信息 |
|||
* |
|||
* @param ids 待删除的主键集合 |
|||
* @param isValid 是否进行有效性校验 |
|||
* @return 是否删除成功 |
|||
*/ |
|||
@Override |
|||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { |
|||
if(isValid){ |
|||
//TODO 做一些业务上的校验,判断是否需要校验
|
|||
} |
|||
return baseMapper.deleteByIds(ids) > 0; |
|||
} |
|||
} |
@ -0,0 +1,148 @@ |
|||
package org.dromara.productManagement.service.impl; |
|||
|
|||
import org.dromara.common.core.utils.MapstructUtils; |
|||
import org.dromara.common.core.utils.StringUtils; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.springframework.stereotype.Service; |
|||
import org.dromara.productManagement.domain.bo.ModelUserPromptssettingBo; |
|||
import org.dromara.productManagement.domain.vo.ModelUserPromptssettingVo; |
|||
import org.dromara.productManagement.domain.ModelUserPromptssetting; |
|||
import org.dromara.productManagement.mapper.ModelUserPromptssettingMapper; |
|||
import org.dromara.productManagement.service.IModelUserPromptssettingService; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Collection; |
|||
|
|||
/** |
|||
* 模型提示词用户配置Service业务层处理 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-06 |
|||
*/ |
|||
@RequiredArgsConstructor |
|||
@Service |
|||
public class ModelUserPromptssettingServiceImpl implements IModelUserPromptssettingService { |
|||
|
|||
private final ModelUserPromptssettingMapper baseMapper; |
|||
|
|||
/** |
|||
* 查询模型提示词用户配置 |
|||
* |
|||
* @param id 主键 |
|||
* @return 模型提示词用户配置 |
|||
*/ |
|||
@Override |
|||
public ModelUserPromptssettingVo queryById(Long id){ |
|||
return baseMapper.selectVoById(id); |
|||
} |
|||
|
|||
/** |
|||
* 分页查询模型提示词用户配置列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 模型提示词用户配置分页列表 |
|||
*/ |
|||
@Override |
|||
public TableDataInfo<ModelUserPromptssettingVo> queryPageList(ModelUserPromptssettingBo bo, PageQuery pageQuery) { |
|||
LambdaQueryWrapper<ModelUserPromptssetting> lqw = buildQueryWrapper(bo); |
|||
Page<ModelUserPromptssettingVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
|||
return TableDataInfo.build(result); |
|||
} |
|||
|
|||
/** |
|||
* 查询符合条件的模型提示词用户配置列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 模型提示词用户配置列表 |
|||
*/ |
|||
@Override |
|||
public List<ModelUserPromptssettingVo> queryList(ModelUserPromptssettingBo bo) { |
|||
LambdaQueryWrapper<ModelUserPromptssetting> lqw = buildQueryWrapper(bo); |
|||
return baseMapper.selectVoList(lqw); |
|||
} |
|||
|
|||
private LambdaQueryWrapper<ModelUserPromptssetting> buildQueryWrapper(ModelUserPromptssettingBo bo) { |
|||
Map<String, Object> params = bo.getParams(); |
|||
LambdaQueryWrapper<ModelUserPromptssetting> lqw = Wrappers.lambdaQuery(); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getTaskIndustry()), ModelUserPromptssetting::getTaskIndustry, bo.getTaskIndustry()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getTaskRegion()), ModelUserPromptssetting::getTaskRegion, bo.getTaskRegion()); |
|||
lqw.like(StringUtils.isNotBlank(bo.getTaskName()), ModelUserPromptssetting::getTaskName, bo.getTaskName()); |
|||
lqw.eq(bo.getUserId() != null, ModelUserPromptssetting::getUserId, bo.getUserId()); |
|||
return lqw; |
|||
} |
|||
|
|||
/** |
|||
* 新增模型提示词用户配置 |
|||
* |
|||
* @param bo 模型提示词用户配置 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
@Override |
|||
public Boolean insertByBo(ModelUserPromptssettingBo bo) { |
|||
ModelUserPromptssetting add = MapstructUtils.convert(bo, ModelUserPromptssetting.class); |
|||
validEntityBeforeSave(add); |
|||
boolean flag = baseMapper.insert(add) > 0; |
|||
if (flag) { |
|||
bo.setId(add.getId()); |
|||
} |
|||
return flag; |
|||
} |
|||
|
|||
/** |
|||
* 修改模型提示词用户配置 |
|||
* |
|||
* @param bo 模型提示词用户配置 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
@Override |
|||
public Boolean updateByBo(ModelUserPromptssettingBo bo) { |
|||
ModelUserPromptssetting update = MapstructUtils.convert(bo, ModelUserPromptssetting.class); |
|||
validEntityBeforeSave(update); |
|||
return baseMapper.updateById(update) > 0; |
|||
} |
|||
|
|||
/** |
|||
* 保存前的数据校验 |
|||
*/ |
|||
private void validEntityBeforeSave(ModelUserPromptssetting entity){ |
|||
//TODO 做一些数据校验,如唯一约束
|
|||
} |
|||
|
|||
/** |
|||
* 校验并批量删除模型提示词用户配置信息 |
|||
* |
|||
* @param ids 待删除的主键集合 |
|||
* @param isValid 是否进行有效性校验 |
|||
* @return 是否删除成功 |
|||
*/ |
|||
@Override |
|||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { |
|||
if(isValid){ |
|||
//TODO 做一些业务上的校验,判断是否需要校验
|
|||
} |
|||
return baseMapper.deleteByIds(ids) > 0; |
|||
} |
|||
|
|||
@Override |
|||
public ModelUserPromptssettingVo queryByuserId(Long userId) { |
|||
LambdaQueryWrapper<ModelUserPromptssetting> lqw = Wrappers.lambdaQuery(); |
|||
lqw.eq(ModelUserPromptssetting::getUserId, userId); |
|||
ModelUserPromptssetting modelUserPromptssetting = baseMapper.selectOne(lqw); |
|||
ModelUserPromptssettingVo modelUserPromptssettingVo = new ModelUserPromptssettingVo(); |
|||
if (modelUserPromptssetting != null) { |
|||
modelUserPromptssettingVo =MapstructUtils.convert(modelUserPromptssetting, ModelUserPromptssettingVo.class); |
|||
}else{ |
|||
//不存在配置返回默认通用
|
|||
modelUserPromptssettingVo.setTaskIndustry("normal"); |
|||
modelUserPromptssettingVo.setTaskRegion("normal"); |
|||
} |
|||
return modelUserPromptssettingVo; |
|||
} |
|||
} |
@ -0,0 +1,77 @@ |
|||
package org.dromara.productManagement.utils; |
|||
|
|||
import okhttp3.*; |
|||
import org.dromara.common.satoken.utils.LoginHelper; |
|||
import org.dromara.productManagement.domain.vo.DocumentTasksVo; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
|
|||
import java.io.File; |
|||
import java.io.IOException; |
|||
import java.net.URLEncoder; |
|||
import java.nio.charset.StandardCharsets; |
|||
|
|||
public class MyHttpUtils { |
|||
// chatUrl 应该是静态字段,因为它在静态方法中使用
|
|||
private static String chatUrl; |
|||
|
|||
// 添加setter方法以注入值
|
|||
@Value("${chat.chatUrl}") |
|||
public void setChatUrl(String url) { |
|||
MyHttpUtils.chatUrl = url; |
|||
} |
|||
|
|||
public static void sendTaskStartMessage(String url,Long taskId, String taskName, String filename,Long priority) { |
|||
OkHttpClient client = new OkHttpClient.Builder().build(); |
|||
if (url == null) { |
|||
throw new IllegalArgumentException("无效的任务名称: " + taskName); |
|||
} |
|||
|
|||
// Request request = new Request.Builder()
|
|||
// .url(url+"?userId="+ LoginHelper.getUserId()+"&taskId="+taskId+"&filename="+filename+"&taskName="+taskName+"&priority="+priority)
|
|||
// .build();
|
|||
HttpUrl.Builder urlBuilder = HttpUrl.parse(url).newBuilder(); |
|||
urlBuilder.addQueryParameter("userId", String.valueOf(LoginHelper.getUserId())); |
|||
urlBuilder.addQueryParameter("taskId", String.valueOf(taskId)); |
|||
urlBuilder.addQueryParameter("filename", filename); |
|||
urlBuilder.addQueryParameter("taskName", taskName); |
|||
urlBuilder.addQueryParameter("priority", String.valueOf(priority)); |
|||
Request request = new Request.Builder() |
|||
.url(urlBuilder.build()) |
|||
.build(); |
|||
// 使用异步调用
|
|||
client.newCall(request).enqueue(new Callback() { |
|||
@Override |
|||
public void onFailure(Call call, IOException e) { |
|||
e.printStackTrace(); // 处理请求失败
|
|||
} |
|||
|
|||
@Override |
|||
public void onResponse(Call call, Response response) throws IOException { |
|||
// 忽略返回内容
|
|||
response.close(); // 确保响应被关闭
|
|||
} |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 校验文档是否正常 |
|||
* @param url 校验接口地址 |
|||
* @param filePath 文档路径 |
|||
*/ |
|||
public static Boolean sendFileCheckMessage(String url, String filePath) { |
|||
OkHttpClient client = new OkHttpClient.Builder().build(); |
|||
String fullUrl = url + "?filePath=" + URLEncoder.encode(filePath, StandardCharsets.UTF_8); |
|||
|
|||
Request request = new Request.Builder() |
|||
.url(fullUrl) |
|||
.get() // 使用 GET 请求方法
|
|||
.build(); |
|||
|
|||
try (Response response = client.newCall(request).execute()) { |
|||
return response.isSuccessful(); |
|||
} catch (IOException e) { |
|||
e.printStackTrace(); |
|||
} |
|||
return false; |
|||
} |
|||
} |
@ -0,0 +1,44 @@ |
|||
package org.dromara.productManagement.utils; |
|||
|
|||
import org.springframework.beans.factory.annotation.Value; |
|||
|
|||
import java.time.Duration; |
|||
import java.time.LocalDateTime; |
|||
import java.time.ZoneId; |
|||
import java.util.Date; |
|||
public class MyTimeUtils { |
|||
// chatUrl 应该是静态字段,因为它在静态方法中使用
|
|||
private static String chatUrl; |
|||
|
|||
// 添加setter方法以注入值
|
|||
@Value("${chat.chatUrl}") |
|||
public void setChatUrl(String url) { |
|||
MyTimeUtils.chatUrl = url; |
|||
} |
|||
/** |
|||
* 计算并格式化两个 Date 对象之间的时间差 |
|||
* |
|||
* @param createTime 创建时间 |
|||
* @param updateTime 更新时间 |
|||
* @return 格式化后的时间差字符串 |
|||
*/ |
|||
public static String formatTimeDifference(Date createTime, Date updateTime) { |
|||
// 将 Date 转换为 LocalDateTime
|
|||
LocalDateTime createLocalDateTime = createTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); |
|||
LocalDateTime updateLocalDateTime = updateTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); |
|||
|
|||
// 计算两个时间之间的差值
|
|||
Duration duration = Duration.between(createLocalDateTime, updateLocalDateTime); |
|||
|
|||
// 获取小时数和分钟数
|
|||
long hours = duration.toHours(); |
|||
long minutes = duration.toMinutes() % 60; |
|||
|
|||
// 格式化时间差
|
|||
if (hours > 0) { |
|||
return String.format("%d小时%d分钟", hours, minutes); |
|||
} else { |
|||
return String.format("%d分钟", minutes); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,7 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper |
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="org.dromara.productManagement.mapper.ModelPromptsHistoryMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,7 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper |
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="org.dromara.productManagement.mapper.ModelPromptsMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,7 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper |
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="org.dromara.productManagement.mapper.ModelUserPromptssettingMapper"> |
|||
|
|||
</mapper> |
Loading…
Reference in new issue