Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -9,6 +9,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode TMPL_FLD_NOT_EXISTS = new ErrorCode(1_027_000_501, "模板字段不存在");
|
||||
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_NAME_EXISTS = new ErrorCode(1_027_000_503, "模板条款名字已存在");
|
||||
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_DEl_ERROR = new ErrorCode(1_027_000_507, "模版分类删除失败");
|
||||
@@ -23,6 +24,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode NOT_FOUND_CLASS= new ErrorCode(1_027_000_516, "找不到对应的类");
|
||||
ErrorCode UTIL_NOT_INIT= new ErrorCode(1_027_000_517, "工具类为未初始化");
|
||||
ErrorCode TMPL_INS_FLD_CODE_EXISTS = new ErrorCode(1_027_000_518, "字段已存在");
|
||||
ErrorCode TMPL_ITM_EXISTS = new ErrorCode(1_027_000_503, "模板条款已存在");
|
||||
//Illegal operation type
|
||||
}
|
||||
|
||||
|
||||
@@ -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.dto.FileCreateReqDTO;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
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.*;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Tag(name = "管理后台 - 模板实例")
|
||||
@RestController
|
||||
@RequestMapping("/base/template-instance")
|
||||
@@ -103,14 +105,16 @@ public class TemplateInstanceController extends AbstractFileUploadController {
|
||||
@Operation(summary = "获得模板实例")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('bse:template-instance:query')")
|
||||
public CommonResult<TemplateInstanceRespVO> getTemplateInstance(@RequestParam("id") Long id) {
|
||||
TemplateInstanceDO templateInstance = templateInstanceService.getTemplateInstance(id);
|
||||
public CommonResult<TemplateInstanceRespVO> getTemplateInstance(@Valid @NotEmpty(message = "编号不能为空") @RequestParam("id") String id) {
|
||||
TemplateInstanceDO templateInstance = templateInstanceService.getTemplateInstance(Long.valueOf(id));
|
||||
TemplateInstanceRespVO templateInstanceRespVO = BeanUtils.toBean(templateInstance, TemplateInstanceRespVO.class);
|
||||
if (templateInstance == null) {
|
||||
if (templateInstanceRespVO != null) {
|
||||
templateInstanceService.getDetailedInfo(templateInstanceRespVO);
|
||||
log.info("==================模板实例详情查询成功=================");
|
||||
return success(templateInstanceRespVO);
|
||||
}
|
||||
templateInstanceService.getDetailedInfo(templateInstanceRespVO);
|
||||
return success(templateInstanceRespVO);
|
||||
|
||||
return success(null);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@@ -195,4 +199,11 @@ public class TemplateInstanceController extends AbstractFileUploadController {
|
||||
public CommonResult<List<TemplateInstanceRespVO>> listByTemplateCode(@RequestParam("cdg") @Valid @NotEmpty(message = "模版编号不能为空") String 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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,6 +115,4 @@ public class TemplateInstanceDataController implements BusinessControllerMarker
|
||||
ExcelUtils.write(response, "实例字段值.xls", "数据", TemplateInstanceDataRespVO.class,
|
||||
BeanUtils.toBean(list, TemplateInstanceDataRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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.dal.dataobject.tmpltp.TmplTpDO;
|
||||
import com.zt.plat.module.base.service.tmpltp.TmplTpService;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -85,8 +86,8 @@ public class TmplTpController extends AbstractFileUploadController implements Bu
|
||||
@Operation(summary = "获得模板分类")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('bse:tmpl-tp:query')")
|
||||
public CommonResult<TmplTpRespVO> getTmplTp(@RequestParam("id") Long id) {
|
||||
TmplTpDO tmplTp = tmplTpService.getTmplTp(id);
|
||||
public CommonResult<TmplTpRespVO> getTmplTp(@Valid @NotEmpty(message = "编号不能为空") @RequestParam("id") String id) {
|
||||
TmplTpDO tmplTp = tmplTpService.getTmplTp(Long.valueOf(id));
|
||||
return success(BeanUtils.toBean(tmplTp, TmplTpRespVO.class));
|
||||
}
|
||||
|
||||
@@ -114,10 +115,10 @@ public class TmplTpController extends AbstractFileUploadController implements Bu
|
||||
@GetMapping("/field-and-clause")
|
||||
@Operation(summary = "获得字段和条款",description = "字段和条款回显,传入模版分类的id")
|
||||
@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.put("field", tmplTpService.getField(id));
|
||||
map.put("clause", tmplTpService.getClause(id));
|
||||
map.put("field", tmplTpService.getField(Long.valueOf(id)));
|
||||
map.put("clause", tmplTpService.getClause(Long.valueOf(id)));
|
||||
return success(map);
|
||||
}
|
||||
//获取分类树
|
||||
|
||||
@@ -71,8 +71,8 @@ public class OnlyOfficeCallbackServiceImpl implements OnlyOfficeCallbackService
|
||||
if (callback.getActions() != null) {
|
||||
for (Action action : callback.getActions()) {
|
||||
String actionType = switch (action.getType()) {
|
||||
case 0 -> "断开了与";
|
||||
case 1 -> "连接到";
|
||||
case 0 -> "断开了连接";
|
||||
case 1 -> "连接成功";
|
||||
case 2 -> "在中点击了强制保存";
|
||||
default -> "在中执行了未知操作";
|
||||
};
|
||||
@@ -146,15 +146,16 @@ public class OnlyOfficeCallbackServiceImpl implements OnlyOfficeCallbackService
|
||||
MultipartFile file = downloadFileAsMultipart(callback.getUrl());
|
||||
// 1. 验证文件是否为空
|
||||
|
||||
|
||||
|
||||
String directory = "模版实例";
|
||||
FileCreateReqDTO fileCreateReqDTO = new FileCreateReqDTO();
|
||||
fileCreateReqDTO.setName(fileName);
|
||||
fileCreateReqDTO.setContent(file.getBytes());
|
||||
fileCreateReqDTO.setType(file.getContentType()); // 使用真实的MIME类型
|
||||
fileCreateReqDTO.setDirectory(directory); // 设置文件存储目录
|
||||
|
||||
if (file.getSize() <=0){
|
||||
log.error("文件大小为0");
|
||||
return;
|
||||
}
|
||||
// 7. 调用文件服务创建文件
|
||||
CommonResult<FileRespDTO> result = fileApi.createFileWithReturn(fileCreateReqDTO);
|
||||
if (result.isSuccess()) {
|
||||
|
||||
@@ -50,7 +50,9 @@ public class UrlFileDownloader {
|
||||
String contentType = connection.getContentType() == null ? "application/octet-stream" : connection.getContentType();
|
||||
// 3. 读取文件字节内容
|
||||
byte[] fileBytes = readFileBytes(connection.getInputStream());
|
||||
|
||||
if (fileBytes.length == 0){
|
||||
throw new IOException("文件内容为空");
|
||||
}
|
||||
// 4. 使用自定义MultipartFile实现类封装(不依赖Spring Test)
|
||||
return new CustomMultipartFile(
|
||||
"file", // 表单字段名(与上传接口的@RequestParam("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;
|
||||
|
||||
}
|
||||
@@ -21,7 +21,7 @@ public class TemplateInstanceDataSaveReqVO {
|
||||
private String fldKy;
|
||||
|
||||
@Schema(description = "用户填写的值", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "用户填写的值不能为空")
|
||||
// @NotEmpty(message = "用户填写的值不能为空")
|
||||
private String fldVal;
|
||||
|
||||
}
|
||||
|
||||
@@ -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.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 实例字段值 Mapper
|
||||
@@ -25,7 +27,7 @@ public interface TemplateInstanceDataMapper extends BaseMapperX<TemplateInstance
|
||||
.betweenIfPresent(TemplateInstanceDataDO::getCreateTime, reqVO.getCreateTime())
|
||||
.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);
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ import com.zt.plat.module.base.dal.dataobject.tmpltp.TemplateInstanceItemDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 实例条款值 Mapper
|
||||
@@ -26,5 +28,5 @@ public interface TemplateInstanceItemMapper extends BaseMapperX<TemplateInstance
|
||||
.orderByDesc(TemplateInstanceItemDO::getId));
|
||||
}
|
||||
|
||||
int deleteByTemplateInstanceId(@Param("templateInstanceId") Long templateInstanceId);
|
||||
int deleteByTemplateInstanceIds(@Param("templateInstanceIds") List<Long> templateInstanceIds);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user