Merge branch 'dev' into 'test'

bug优化

See merge request jygk/dsc-base!7
This commit is contained in:
付鹏飞
2025-09-28 08:17:43 +00:00
26 changed files with 230 additions and 103 deletions

View File

@@ -19,7 +19,7 @@
<url>https://github.com/YunaiV/ruoyi-vue-pro</url> <url>https://github.com/YunaiV/ruoyi-vue-pro</url>
<properties> <properties>
<revision>3.0.40</revision> <revision>3.0.41</revision>
<!-- Maven 相关 --> <!-- Maven 相关 -->
<java.version>17</java.version> <java.version>17</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source> <maven.compiler.source>${java.version}</maven.compiler.source>

View File

@@ -9,6 +9,7 @@ public interface ErrorCodeConstants {
ErrorCode TMPL_FLD_NOT_EXISTS = new ErrorCode(1_027_000_501, "模板字段不存在"); ErrorCode TMPL_FLD_NOT_EXISTS = new ErrorCode(1_027_000_501, "模板字段不存在");
ErrorCode TMPL_FLD_CODE_EXISTS = new ErrorCode(1_027_000_502, "字段编码已存在"); ErrorCode TMPL_FLD_CODE_EXISTS = new ErrorCode(1_027_000_502, "字段编码已存在");
ErrorCode TMPL_ITM_NOT_EXISTS = new ErrorCode(1_027_000_503, "模板条款不存在"); ErrorCode TMPL_ITM_NOT_EXISTS = new ErrorCode(1_027_000_503, "模板条款不存在");
ErrorCode TMPL_ITM_NAME_EXISTS = new ErrorCode(1_027_000_503, "模板条款名字已存在");
ErrorCode TEMPLATE_INSTANCE_NOT_EXISTS = new ErrorCode(1_027_000_504, "模板实例不存在"); ErrorCode TEMPLATE_INSTANCE_NOT_EXISTS = new ErrorCode(1_027_000_504, "模板实例不存在");
ErrorCode TMPL_TP_SATUS_ERROR = new ErrorCode(1_027_000_506, "状态变更失败"); ErrorCode TMPL_TP_SATUS_ERROR = new ErrorCode(1_027_000_506, "状态变更失败");
ErrorCode TMPL_TP_DEl_ERROR = new ErrorCode(1_027_000_507, "模版分类删除失败"); ErrorCode TMPL_TP_DEl_ERROR = new ErrorCode(1_027_000_507, "模版分类删除失败");

View File

@@ -7,6 +7,7 @@ import com.zt.plat.module.base.service.tmpltp.TemplateInstanceService;
import com.zt.plat.module.infra.api.file.FileApi; import com.zt.plat.module.infra.api.file.FileApi;
import com.zt.plat.module.infra.api.file.dto.FileCreateReqDTO; import com.zt.plat.module.infra.api.file.dto.FileCreateReqDTO;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@@ -42,6 +43,7 @@ import org.springframework.web.multipart.MultipartFile;
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*; import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
@Slf4j
@Tag(name = "管理后台 - 模板实例") @Tag(name = "管理后台 - 模板实例")
@RestController @RestController
@RequestMapping("/base/template-instance") @RequestMapping("/base/template-instance")
@@ -103,14 +105,16 @@ public class TemplateInstanceController extends AbstractFileUploadController {
@Operation(summary = "获得模板实例") @Operation(summary = "获得模板实例")
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('bse:template-instance:query')") @PreAuthorize("@ss.hasPermission('bse:template-instance:query')")
public CommonResult<TemplateInstanceRespVO> getTemplateInstance(@RequestParam("id") Long id) { public CommonResult<TemplateInstanceRespVO> getTemplateInstance(@Valid @NotEmpty(message = "编号不能为空") @RequestParam("id") String id) {
TemplateInstanceDO templateInstance = templateInstanceService.getTemplateInstance(id); TemplateInstanceDO templateInstance = templateInstanceService.getTemplateInstance(Long.valueOf(id));
TemplateInstanceRespVO templateInstanceRespVO = BeanUtils.toBean(templateInstance, TemplateInstanceRespVO.class); TemplateInstanceRespVO templateInstanceRespVO = BeanUtils.toBean(templateInstance, TemplateInstanceRespVO.class);
if (templateInstance == null) { if (templateInstanceRespVO != null) {
templateInstanceService.getDetailedInfo(templateInstanceRespVO);
log.info("==================模板实例详情查询成功=================");
return success(templateInstanceRespVO); return success(templateInstanceRespVO);
} }
templateInstanceService.getDetailedInfo(templateInstanceRespVO);
return success(templateInstanceRespVO); return success(null);
} }
@GetMapping("/page") @GetMapping("/page")
@@ -195,4 +199,11 @@ public class TemplateInstanceController extends AbstractFileUploadController {
public CommonResult<List<TemplateInstanceRespVO>> listByTemplateCode(@RequestParam("cdg") @Valid @NotEmpty(message = "模版编号不能为空") String templateCode) { public CommonResult<List<TemplateInstanceRespVO>> listByTemplateCode(@RequestParam("cdg") @Valid @NotEmpty(message = "模版编号不能为空") String templateCode) {
return success(templateInstanceService.listByCdg(templateCode)); return success(templateInstanceService.listByCdg(templateCode));
} }
//通过实例id获取字段和条款详情
@GetMapping("/field-and-clause-detail")
@Operation(summary = "通过实例id获取字段和条款详情")
public CommonResult<FieldAndClauseRespVO> getFieldAndClauseDetail(@Valid @NotEmpty(message = "模版实例id不能为空") @RequestParam("id") String id) {
return success(templateInstanceService.getFieldAndClauseDetail(id));
}
} }

View File

@@ -115,6 +115,4 @@ public class TemplateInstanceDataController implements BusinessControllerMarker
ExcelUtils.write(response, "实例字段值.xls", "数据", TemplateInstanceDataRespVO.class, ExcelUtils.write(response, "实例字段值.xls", "数据", TemplateInstanceDataRespVO.class,
BeanUtils.toBean(list, TemplateInstanceDataRespVO.class)); BeanUtils.toBean(list, TemplateInstanceDataRespVO.class));
} }
} }

View File

@@ -4,6 +4,7 @@ package com.zt.plat.module.base.controller.admin.templtp;
import com.zt.plat.module.base.controller.admin.templtp.vo.*; import com.zt.plat.module.base.controller.admin.templtp.vo.*;
import com.zt.plat.module.base.dal.dataobject.tmpltp.TmplTpDO; import com.zt.plat.module.base.dal.dataobject.tmpltp.TmplTpDO;
import com.zt.plat.module.base.service.tmpltp.TmplTpService; import com.zt.plat.module.base.service.tmpltp.TmplTpService;
import jakarta.validation.constraints.NotEmpty;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@@ -85,8 +86,8 @@ public class TmplTpController extends AbstractFileUploadController implements Bu
@Operation(summary = "获得模板分类") @Operation(summary = "获得模板分类")
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('bse:tmpl-tp:query')") @PreAuthorize("@ss.hasPermission('bse:tmpl-tp:query')")
public CommonResult<TmplTpRespVO> getTmplTp(@RequestParam("id") Long id) { public CommonResult<TmplTpRespVO> getTmplTp(@Valid @NotEmpty(message = "编号不能为空") @RequestParam("id") String id) {
TmplTpDO tmplTp = tmplTpService.getTmplTp(id); TmplTpDO tmplTp = tmplTpService.getTmplTp(Long.valueOf(id));
return success(BeanUtils.toBean(tmplTp, TmplTpRespVO.class)); return success(BeanUtils.toBean(tmplTp, TmplTpRespVO.class));
} }
@@ -114,10 +115,10 @@ public class TmplTpController extends AbstractFileUploadController implements Bu
@GetMapping("/field-and-clause") @GetMapping("/field-and-clause")
@Operation(summary = "获得字段和条款",description = "字段和条款回显,传入模版分类的id") @Operation(summary = "获得字段和条款",description = "字段和条款回显,传入模版分类的id")
@PreAuthorize("@ss.hasPermission('bse:tmpl-tp:query')") @PreAuthorize("@ss.hasPermission('bse:tmpl-tp:query')")
public CommonResult<Map<String, Object>> getFieldAndClause(@RequestParam("id") Long id) { public CommonResult<Map<String, Object>> getFieldAndClause(@Valid @NotEmpty(message = "编号不能为空")@RequestParam("id") String id) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("field", tmplTpService.getField(id)); map.put("field", tmplTpService.getField(Long.valueOf(id)));
map.put("clause", tmplTpService.getClause(id)); map.put("clause", tmplTpService.getClause(Long.valueOf(id)));
return success(map); return success(map);
} }
//获取分类树 //获取分类树

View File

@@ -71,8 +71,8 @@ public class OnlyOfficeCallbackServiceImpl implements OnlyOfficeCallbackService
if (callback.getActions() != null) { if (callback.getActions() != null) {
for (Action action : callback.getActions()) { for (Action action : callback.getActions()) {
String actionType = switch (action.getType()) { String actionType = switch (action.getType()) {
case 0 -> "断开了"; case 0 -> "断开了连接";
case 1 -> "连接"; case 1 -> "连接成功";
case 2 -> "在中点击了强制保存"; case 2 -> "在中点击了强制保存";
default -> "在中执行了未知操作"; default -> "在中执行了未知操作";
}; };
@@ -146,15 +146,16 @@ public class OnlyOfficeCallbackServiceImpl implements OnlyOfficeCallbackService
MultipartFile file = downloadFileAsMultipart(callback.getUrl()); MultipartFile file = downloadFileAsMultipart(callback.getUrl());
// 1. 验证文件是否为空 // 1. 验证文件是否为空
String directory = "模版实例"; String directory = "模版实例";
FileCreateReqDTO fileCreateReqDTO = new FileCreateReqDTO(); FileCreateReqDTO fileCreateReqDTO = new FileCreateReqDTO();
fileCreateReqDTO.setName(fileName); fileCreateReqDTO.setName(fileName);
fileCreateReqDTO.setContent(file.getBytes()); fileCreateReqDTO.setContent(file.getBytes());
fileCreateReqDTO.setType(file.getContentType()); // 使用真实的MIME类型 fileCreateReqDTO.setType(file.getContentType()); // 使用真实的MIME类型
fileCreateReqDTO.setDirectory(directory); // 设置文件存储目录 fileCreateReqDTO.setDirectory(directory); // 设置文件存储目录
if (file.getSize() <=0){
log.error("文件大小为0");
return;
}
// 7. 调用文件服务创建文件 // 7. 调用文件服务创建文件
CommonResult<FileRespDTO> result = fileApi.createFileWithReturn(fileCreateReqDTO); CommonResult<FileRespDTO> result = fileApi.createFileWithReturn(fileCreateReqDTO);
if (result.isSuccess()) { if (result.isSuccess()) {

View File

@@ -50,7 +50,9 @@ public class UrlFileDownloader {
String contentType = connection.getContentType() == null ? "application/octet-stream" : connection.getContentType(); String contentType = connection.getContentType() == null ? "application/octet-stream" : connection.getContentType();
// 3. 读取文件字节内容 // 3. 读取文件字节内容
byte[] fileBytes = readFileBytes(connection.getInputStream()); byte[] fileBytes = readFileBytes(connection.getInputStream());
if (fileBytes.length == 0){
throw new IOException("文件内容为空");
}
// 4. 使用自定义MultipartFile实现类封装不依赖Spring Test // 4. 使用自定义MultipartFile实现类封装不依赖Spring Test
return new CustomMultipartFile( return new CustomMultipartFile(
"file", // 表单字段名(与上传接口的@RequestParam("file")对应) "file", // 表单字段名(与上传接口的@RequestParam("file")对应)

View File

@@ -0,0 +1,16 @@
package com.zt.plat.module.base.controller.admin.templtp.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Schema(description = "管理后台 - 合同动态表单 响应 VO")
@Data
public class FieldAndClauseRespVO {
@Schema(description = "模板分类")
List<TmplFldRespVO> tmplFldRespVOS;
@Schema(description = "条款")
List<TmplItmRespVO> tmplItmRespVOS;
}

View File

@@ -21,7 +21,7 @@ public class TemplateInstanceDataSaveReqVO {
private String fldKy; private String fldKy;
@Schema(description = "用户填写的值", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "用户填写的值", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "用户填写的值不能为空") // @NotEmpty(message = "用户填写的值不能为空")
private String fldVal; private String fldVal;
} }

View File

@@ -8,6 +8,8 @@ import com.zt.plat.module.base.dal.dataobject.tmpltp.TemplateInstanceDataDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 实例字段值 Mapper * 实例字段值 Mapper
@@ -25,7 +27,7 @@ public interface TemplateInstanceDataMapper extends BaseMapperX<TemplateInstance
.betweenIfPresent(TemplateInstanceDataDO::getCreateTime, reqVO.getCreateTime()) .betweenIfPresent(TemplateInstanceDataDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(TemplateInstanceDataDO::getId)); .orderByDesc(TemplateInstanceDataDO::getId));
} }
int deleteByTemplateInstanceId(@Param("templateInstanceId") Long templateInstanceId); int deleteByTemplateInstanceIds(@Param("templateInstanceIds") List<Long> templateInstanceIds);
int updateFldValById(@Param("inscId") String inscId, @Param("fldVal") String fldVal, @Param("fldKy") String fldKy); int updateFldValById(@Param("inscId") String inscId, @Param("fldVal") String fldVal, @Param("fldKy") String fldKy);

Some files were not shown because too many files have changed in this diff Show More