8 changed files with 687 additions and 0 deletions
@ -0,0 +1,107 @@ |
|||
package org.dromara.productManagement.controller; |
|||
|
|||
import java.io.IOException; |
|||
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.productManagement.domain.vo.DocumentTasksVo; |
|||
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.ContractualTasksVo; |
|||
import org.dromara.productManagement.domain.bo.ContractualTasksBo; |
|||
import org.dromara.productManagement.service.IContractualTasksService; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
|
|||
/** |
|||
* 合同任务 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-11 |
|||
*/ |
|||
@Validated |
|||
@RequiredArgsConstructor |
|||
@RestController |
|||
@RequestMapping("/productManagement/ContractualTasks") |
|||
public class ContractualTasksController extends BaseController { |
|||
|
|||
private final IContractualTasksService contractualTasksService; |
|||
|
|||
/** |
|||
* 查询合同任务列表 |
|||
*/ |
|||
@SaCheckPermission("productManagement:ContractualTasks:list") |
|||
@GetMapping("/list") |
|||
public TableDataInfo<DocumentTasksVo> list(ContractualTasksBo bo, PageQuery pageQuery) { |
|||
return contractualTasksService.queryPageList(bo, pageQuery); |
|||
} |
|||
|
|||
/** |
|||
* 导出合同任务列表 |
|||
*/ |
|||
@SaCheckPermission("productManagement:ContractualTasks:export") |
|||
@Log(title = "合同任务", businessType = BusinessType.EXPORT) |
|||
@PostMapping("/export") |
|||
public void export(ContractualTasksBo bo, HttpServletResponse response) { |
|||
List<DocumentTasksVo> list = contractualTasksService.queryList(bo); |
|||
ExcelUtil.exportExcel(list, "合同任务", DocumentTasksVo.class, response); |
|||
} |
|||
|
|||
/** |
|||
* 获取合同任务详细信息 |
|||
* |
|||
* @param id 主键 |
|||
*/ |
|||
@SaCheckPermission("productManagement:ContractualTasks:query") |
|||
@GetMapping("/{id}") |
|||
public R<DocumentTasksVo> getInfo(@NotNull(message = "主键不能为空") |
|||
@PathVariable Long id) { |
|||
return R.ok(contractualTasksService.queryById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增合同任务 |
|||
*/ |
|||
@SaCheckPermission("productManagement:ContractualTasks:add") |
|||
@Log(title = "合同任务", businessType = BusinessType.INSERT) |
|||
@RepeatSubmit() |
|||
@PostMapping() |
|||
public R<Void> add(@Validated(AddGroup.class) @RequestBody ContractualTasksBo bo) throws IOException, InterruptedException { |
|||
return toAjax(contractualTasksService.insertByBo(bo)); |
|||
} |
|||
|
|||
/** |
|||
* 修改合同任务 |
|||
*/ |
|||
@SaCheckPermission("productManagement:ContractualTasks:edit") |
|||
@Log(title = "合同任务", businessType = BusinessType.UPDATE) |
|||
@RepeatSubmit() |
|||
@PutMapping() |
|||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ContractualTasksBo bo) { |
|||
return toAjax(contractualTasksService.updateByBo(bo)); |
|||
} |
|||
|
|||
/** |
|||
* 删除合同任务 |
|||
* |
|||
* @param ids 主键串 |
|||
*/ |
|||
@SaCheckPermission("productManagement:ContractualTasks:remove") |
|||
@Log(title = "合同任务", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{ids}") |
|||
public R<Void> remove(@NotEmpty(message = "主键不能为空") |
|||
@PathVariable Long[] ids) { |
|||
return toAjax(contractualTasksService.deleteWithValidByIds(List.of(ids), true)); |
|||
} |
|||
} |
@ -0,0 +1,87 @@ |
|||
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.util.Date; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
|
|||
import java.io.Serial; |
|||
|
|||
/** |
|||
* 合同任务对象 contractual_tasks |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-11 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@TableName("contractual_tasks") |
|||
public class ContractualTasks extends TenantEntity { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
@TableId(value = "id") |
|||
private Long id; |
|||
|
|||
/** |
|||
* 模型所属行业 |
|||
*/ |
|||
private String taskIndustry; |
|||
|
|||
/** |
|||
* 模型所属区域 |
|||
*/ |
|||
private String taskRegion; |
|||
|
|||
/** |
|||
* 合同任务名称 |
|||
*/ |
|||
private String taskName; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String documentName; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private Long ossId; |
|||
|
|||
/** |
|||
* 预计完成时间 |
|||
*/ |
|||
private Date estimatedCompletionTime; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String progressStatus; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
@TableLogic |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
@Version |
|||
private Long version; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 列队任务id |
|||
*/ |
|||
private String taskId; |
|||
|
|||
|
|||
} |
@ -0,0 +1,67 @@ |
|||
package org.dromara.productManagement.domain.bo; |
|||
|
|||
import org.dromara.productManagement.domain.ContractualTasks; |
|||
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.*; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
|
|||
/** |
|||
* 合同任务业务对象 contractual_tasks |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-11 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@AutoMapper(target = ContractualTasks.class, reverseConvertGenerate = false) |
|||
public class ContractualTasksBo extends BaseEntity { |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* 模型所属行业 |
|||
*/ |
|||
@NotBlank(message = "模型所属行业不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private String taskIndustry; |
|||
|
|||
/** |
|||
* 模型所属区域 |
|||
*/ |
|||
@NotBlank(message = "模型所属区域不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private String taskRegion; |
|||
|
|||
/** |
|||
* 合同任务名称 |
|||
*/ |
|||
private String contractTaskName; |
|||
@NotEmpty(message = "任务名称列表不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private List<@NotBlank(message = "任务名称不能为空") String> taskNameList; |
|||
/** |
|||
* |
|||
*/ |
|||
private String documentName; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
@NotNull(message = "不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private Long ossId; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String progressStatus; |
|||
|
|||
|
|||
} |
@ -0,0 +1,91 @@ |
|||
package org.dromara.productManagement.domain.vo; |
|||
|
|||
import java.util.Date; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import org.dromara.productManagement.domain.ContractualTasks; |
|||
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; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 合同任务视图对象 contractual_tasks |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-11 |
|||
*/ |
|||
@Data |
|||
@ExcelIgnoreUnannotated |
|||
@AutoMapper(target = ContractualTasks.class) |
|||
public class ContractualTasksVo implements Serializable { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
@ExcelProperty(value = "") |
|||
private Long id; |
|||
|
|||
/** |
|||
* 模型所属行业 |
|||
*/ |
|||
@ExcelProperty(value = "模型所属行业", converter = ExcelDictConvert.class) |
|||
@ExcelDictFormat(dictType = "model_industry") |
|||
private String taskIndustry; |
|||
|
|||
/** |
|||
* 模型所属区域 |
|||
*/ |
|||
@ExcelProperty(value = "模型所属区域", converter = ExcelDictConvert.class) |
|||
@ExcelDictFormat(dictType = "model_region") |
|||
private String taskRegion; |
|||
|
|||
/** |
|||
* 合同任务名称 |
|||
*/ |
|||
@ExcelProperty(value = "合同任务名称") |
|||
private String contractTaskName; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
@ExcelProperty(value = "文档名称") |
|||
private String documentName; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
@ExcelProperty(value = "文件id") |
|||
private Long ossId; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
@ExcelProperty(value = "完成情况") |
|||
private String progressStatus; |
|||
/** |
|||
* 创建者 |
|||
*/ |
|||
private Long createBy; |
|||
@ExcelProperty(value = "提交人") |
|||
private String createUser; |
|||
/** |
|||
* 任务时长 |
|||
*/ |
|||
private String taskDuration; |
|||
@ExcelProperty(value = "跟新时间") |
|||
private Date updateTime; |
|||
@ExcelProperty(value = "上传时间") |
|||
private Date createTime; |
|||
|
|||
} |
@ -0,0 +1,15 @@ |
|||
package org.dromara.productManagement.mapper; |
|||
|
|||
import org.dromara.productManagement.domain.ContractualTasks; |
|||
import org.dromara.productManagement.domain.vo.ContractualTasksVo; |
|||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
|||
|
|||
/** |
|||
* 合同任务Mapper接口 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-11 |
|||
*/ |
|||
public interface ContractualTasksMapper extends BaseMapperPlus<ContractualTasks, ContractualTasksVo> { |
|||
|
|||
} |
@ -0,0 +1,70 @@ |
|||
package org.dromara.productManagement.service; |
|||
|
|||
import org.dromara.productManagement.domain.vo.ContractualTasksVo; |
|||
import org.dromara.productManagement.domain.bo.ContractualTasksBo; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import org.dromara.productManagement.domain.vo.DocumentTasksVo; |
|||
|
|||
import java.io.IOException; |
|||
import java.util.Collection; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 合同任务Service接口 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-11 |
|||
*/ |
|||
public interface IContractualTasksService { |
|||
|
|||
/** |
|||
* 查询合同任务 |
|||
* |
|||
* @param id 主键 |
|||
* @return 合同任务 |
|||
*/ |
|||
DocumentTasksVo queryById(Long id); |
|||
|
|||
/** |
|||
* 分页查询合同任务列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 合同任务分页列表 |
|||
*/ |
|||
TableDataInfo<DocumentTasksVo> queryPageList(ContractualTasksBo bo, PageQuery pageQuery); |
|||
|
|||
/** |
|||
* 查询符合条件的合同任务列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 合同任务列表 |
|||
*/ |
|||
List<DocumentTasksVo> queryList(ContractualTasksBo bo); |
|||
|
|||
/** |
|||
* 新增合同任务 |
|||
* |
|||
* @param bo 合同任务 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
Boolean insertByBo(ContractualTasksBo bo) throws IOException, InterruptedException; |
|||
|
|||
/** |
|||
* 修改合同任务 |
|||
* |
|||
* @param bo 合同任务 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
Boolean updateByBo(ContractualTasksBo bo); |
|||
|
|||
/** |
|||
* 校验并批量删除合同任务信息 |
|||
* |
|||
* @param ids 待删除的主键集合 |
|||
* @param isValid 是否进行有效性校验 |
|||
* @return 是否删除成功 |
|||
*/ |
|||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
|||
} |
@ -0,0 +1,243 @@ |
|||
package org.dromara.productManagement.service.impl; |
|||
|
|||
import cn.dev33.satoken.stp.StpUtil; |
|||
import jakarta.validation.constraints.NotBlank; |
|||
import org.dromara.common.core.service.DictService; |
|||
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.common.satoken.utils.LoginHelper; |
|||
import org.dromara.productManagement.domain.DocumentTasks; |
|||
import org.dromara.productManagement.domain.bo.DocumentTasksBo; |
|||
import org.dromara.productManagement.domain.vo.DocumentTasksPermissionsVo; |
|||
import org.dromara.productManagement.domain.vo.DocumentTasksVo; |
|||
import org.dromara.productManagement.mapper.DocumentTasksMapper; |
|||
import org.dromara.productManagement.mapper.DocumentTasksPermissionsMapper; |
|||
import org.dromara.productManagement.service.IDocumentTasksPermissionsService; |
|||
import org.dromara.productManagement.service.IDocumentTasksService; |
|||
import org.dromara.productManagement.utils.MyHttpUtils; |
|||
import org.dromara.productManagement.utils.MyTimeUtils; |
|||
import org.dromara.system.domain.vo.SysOssVo; |
|||
import org.dromara.system.service.ISysOssService; |
|||
import org.dromara.system.service.ISysUserService; |
|||
import org.springframework.beans.BeanUtils; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.stereotype.Service; |
|||
import org.dromara.productManagement.domain.bo.ContractualTasksBo; |
|||
import org.dromara.productManagement.domain.vo.ContractualTasksVo; |
|||
import org.dromara.productManagement.domain.ContractualTasks; |
|||
import org.dromara.productManagement.mapper.ContractualTasksMapper; |
|||
import org.dromara.productManagement.service.IContractualTasksService; |
|||
|
|||
import java.io.File; |
|||
import java.io.IOException; |
|||
import java.io.InputStream; |
|||
import java.text.SimpleDateFormat; |
|||
import java.util.*; |
|||
|
|||
/** |
|||
* 合同任务Service业务层处理 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-12-11 |
|||
*/ |
|||
@RequiredArgsConstructor |
|||
@Service |
|||
public class ContractualTasksServiceImpl implements IContractualTasksService { |
|||
|
|||
private final ContractualTasksMapper baseMapper; |
|||
private final ISysOssService ossService; |
|||
private final ISysUserService userService; |
|||
private final IDocumentTasksService documentTasksService; |
|||
private final DocumentTasksMapper documentTasksMapper; |
|||
@Value("${chat.chatUrl}") |
|||
private String chatUrl; |
|||
//根目录地址
|
|||
@Value("${chat.filePath}") |
|||
private String fileRootPath; |
|||
@Value("${chat.tempfilePath}") |
|||
private String tempfilePath; |
|||
/** |
|||
* 查询合同任务 |
|||
* |
|||
* @param id 主键 |
|||
* @return 合同任务 |
|||
*/ |
|||
@Override |
|||
public DocumentTasksVo queryById(Long id){ |
|||
return documentTasksMapper.selectVoById(id); |
|||
} |
|||
|
|||
/** |
|||
* 分页查询合同任务列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 合同任务分页列表 |
|||
*/ |
|||
@Override |
|||
public TableDataInfo<DocumentTasksVo> queryPageList(ContractualTasksBo bo, PageQuery pageQuery) { |
|||
DocumentTasksBo documentTasksBo = new DocumentTasksBo(); |
|||
BeanUtils.copyProperties(bo, documentTasksBo); |
|||
if(bo.getTaskNameList()==null || bo.getTaskNameList().size() == 0){ |
|||
String[] list= {"contractReview"}; |
|||
documentTasksBo.setTaskNameList(Arrays.asList(list)); |
|||
} |
|||
return documentTasksService.queryPageList(documentTasksBo, pageQuery); |
|||
} |
|||
|
|||
/** |
|||
* 查询符合条件的合同任务列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 合同任务列表 |
|||
*/ |
|||
@Override |
|||
public List<DocumentTasksVo> queryList(ContractualTasksBo bo) { |
|||
|
|||
DocumentTasksBo documentTasksBo = new DocumentTasksBo(); |
|||
BeanUtils.copyProperties(bo, documentTasksBo); |
|||
if(bo.getTaskNameList()==null || bo.getTaskNameList().size() == 0){ |
|||
String[] list= {"contractReview"}; |
|||
documentTasksBo.setTaskNameList(Arrays.asList(list)); |
|||
} |
|||
return documentTasksService.queryList(documentTasksBo); |
|||
} |
|||
|
|||
private LambdaQueryWrapper<ContractualTasks> buildQueryWrapper(ContractualTasksBo bo) { |
|||
LambdaQueryWrapper<ContractualTasks> lqw = Wrappers.lambdaQuery(); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getTaskIndustry()), ContractualTasks::getTaskIndustry, bo.getTaskIndustry()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getTaskRegion()), ContractualTasks::getTaskRegion, bo.getTaskRegion()); |
|||
lqw.like(StringUtils.isNotBlank(bo.getDocumentName()), ContractualTasks::getDocumentName, bo.getDocumentName()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getProgressStatus()), ContractualTasks::getProgressStatus, bo.getProgressStatus()); |
|||
List<String> taskNames = bo.getTaskNameList(); |
|||
if (taskNames != null && !taskNames.isEmpty()) { |
|||
lqw.in(ContractualTasks::getTaskName, taskNames); |
|||
} |
|||
lqw.orderByDesc(ContractualTasks::getCreateTime); |
|||
return lqw; |
|||
} |
|||
|
|||
/** |
|||
* 新增合同任务 |
|||
* |
|||
* @param bo 合同任务 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
@Override |
|||
public Boolean insertByBo(ContractualTasksBo bo) throws IOException, InterruptedException { |
|||
List<String> taskNames = bo.getTaskNameList(); |
|||
boolean flag = false; |
|||
Long ossId = bo.getOssId(); |
|||
SysOssVo fileInfo = ossService.getById(ossId); |
|||
String fileName = fileInfo.getOriginalName(); |
|||
String filePath =fileRootPath+fileInfo.getFileName(); |
|||
String timestamp = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()); // 获取当前时间戳
|
|||
String parentPath = new File(filePath).getParent(); |
|||
// 获取文件扩展名
|
|||
String fileExtension = ""; |
|||
int lastIndexOfDot = fileName.lastIndexOf('.'); |
|||
if (lastIndexOfDot != -1) { |
|||
fileExtension = fileName.substring(lastIndexOfDot); // 获取文件扩展名
|
|||
fileName = fileName.substring(0, lastIndexOfDot); // 获取文件名
|
|||
} |
|||
|
|||
// 拼接新的文件名
|
|||
String newFileName = fileName + "_" + timestamp + fileExtension; |
|||
|
|||
bo.setDocumentName(fileInfo.getOriginalName()); |
|||
if (taskNames != null && !taskNames.isEmpty()) { |
|||
for (String taskName : taskNames) { |
|||
// 创建 DocumentTasks 实体并设置属性
|
|||
ContractualTasks add = MapstructUtils.convert(bo, ContractualTasks.class); |
|||
add.setTaskName(taskName); |
|||
// 验证实体并保存
|
|||
validEntityBeforeSave(add); |
|||
if(!fileExtension.contains("docx")){ |
|||
//文件转换为docx
|
|||
// ProcessBuilder builder = new ProcessBuilder("unoconv", "-o", parentPath, "-f", "docx", filePath);
|
|||
ProcessBuilder builder = new ProcessBuilder("libreoffice", "--headless", "--convert-to", "docx",filePath, "--outdir", parentPath); |
|||
Process process = builder.start(); |
|||
int completed = process.waitFor(); |
|||
if (completed != 0) { |
|||
InputStream errorStream = process.getErrorStream(); |
|||
String errorMessage = new String(errorStream.readAllBytes()); |
|||
process.destroyForcibly(); |
|||
String failMsg = fileName + "转docx失败,请检查文件是否正确~ 错误信息: " + errorMessage; |
|||
throw new RuntimeException(failMsg); |
|||
} else { |
|||
process.destroyForcibly(); |
|||
// 获取文件名部分
|
|||
int lastDotIndex = filePath.lastIndexOf('.'); |
|||
if (lastDotIndex == -1) { |
|||
// 如果没有扩展名,直接添加 .docx
|
|||
filePath= filePath + ".docx"; |
|||
} else { |
|||
// 如果有其他扩展名,替换为 .docx
|
|||
filePath= filePath.substring(0, lastDotIndex) + ".docx"; |
|||
} |
|||
} |
|||
|
|||
} |
|||
//参数 add.id,taskName。newFileName;
|
|||
add.setProgressStatus("PENDING"); |
|||
DocumentTasks documentTasks = new DocumentTasks(); |
|||
BeanUtils.copyProperties(add, documentTasks); |
|||
flag = documentTasksMapper.insert(documentTasks) > 0; |
|||
Long priority=1L; |
|||
//获取当前用户的任务优先级
|
|||
// if(!StpUtil.hasRole("superadmin")){
|
|||
// DocumentTasksPermissionsVo documentTasksPermissionsVo = documentTasksPermissionsMapper.selectDocumentPermissionsByUserIdAndTaskType(LoginHelper.getUserId(),taskName);
|
|||
// priority = documentTasksPermissionsVo.getPriority();
|
|||
// }
|
|||
MyHttpUtils.sendTaskStartMessage(chatUrl+"/back/taskStart",documentTasks.getId(), taskName, filePath, priority); |
|||
|
|||
if (!flag) { |
|||
throw new RuntimeException("新增文档任务失败"); |
|||
} |
|||
} |
|||
} |
|||
|
|||
return flag; |
|||
} |
|||
|
|||
/** |
|||
* 修改合同任务 |
|||
* |
|||
* @param bo 合同任务 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
@Override |
|||
public Boolean updateByBo(ContractualTasksBo bo) { |
|||
ContractualTasks update = MapstructUtils.convert(bo, ContractualTasks.class); |
|||
validEntityBeforeSave(update); |
|||
return baseMapper.updateById(update) > 0; |
|||
} |
|||
|
|||
/** |
|||
* 保存前的数据校验 |
|||
*/ |
|||
private void validEntityBeforeSave(ContractualTasks entity){ |
|||
//TODO 做一些数据校验,如唯一约束
|
|||
} |
|||
|
|||
/** |
|||
* 校验并批量删除合同任务信息 |
|||
* |
|||
* @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,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.ContractualTasksMapper"> |
|||
|
|||
</mapper> |
Loading…
Reference in new issue