新增管理的发布时间字段

This commit is contained in:
潘荣晟
2025-09-25 18:08:09 +08:00
parent 327fd9bdcb
commit 7f940ff257
12 changed files with 574 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ import com.zt.plat.module.base.controller.admin.templtp.vo.*;
import com.zt.plat.module.base.dal.dataobject.tmpltp.TemplateInstanceDO; import com.zt.plat.module.base.dal.dataobject.tmpltp.TemplateInstanceDO;
import com.zt.plat.module.base.service.tmpltp.TemplateInstanceService; 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 jakarta.validation.constraints.NotEmpty; 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;
@@ -35,6 +36,7 @@ import static com.zt.plat.framework.common.pojo.CommonResult.success;
import com.zt.plat.framework.excel.core.util.ExcelUtils; import com.zt.plat.framework.excel.core.util.ExcelUtils;
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog; import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
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.*;
@@ -53,10 +55,15 @@ public class TemplateInstanceController extends AbstractFileUploadController {
setFileUploadInfo(annotation); setFileUploadInfo(annotation);
} }
} }
@Resource @Resource
private TemplateInstanceService templateInstanceService; private TemplateInstanceService templateInstanceService;
//上传文件
@PostMapping("/save-file")
@Operation(summary = "上传文件", description = "上传文件,传入文件对象和模版实例id")
public CommonResult<Map<String, Object>> uploadFile(@NotEmpty(message = "文件不能为空") @RequestParam("file") MultipartFile file,@RequestParam("id") String id) {
return success(templateInstanceService.saveFile(file,id));
}
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建模板实例") @Operation(summary = "创建模板实例")

View File

@@ -0,0 +1,14 @@
//package com.zt.plat.module.base.controller.admin.templtp.onlyoffice.config;
//
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.client.RestTemplate;
//
//@Configuration
//public class OnlyOfficeConfig {
//
// @Bean
// public RestTemplate restTemplate() {
// return new RestTemplate();
// }
//}

View File

@@ -0,0 +1,42 @@
package com.zt.plat.module.base.controller.admin.templtp.onlyoffice.controller;
import com.zt.plat.framework.tenant.core.aop.TenantIgnore;
import com.zt.plat.module.base.controller.admin.templtp.onlyoffice.pojo.OnlyOfficeCallback;
import com.zt.plat.module.base.controller.admin.templtp.onlyoffice.service.OnlyOfficeCallbackService;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.security.PermitAll;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/base/onlyoffice")
@Tag(name = "管理后台 - onlyOffice回调")
public class OnlyOfficeCallbackController {
private final OnlyOfficeCallbackService callbackService;
public OnlyOfficeCallbackController(OnlyOfficeCallbackService callbackService) {
this.callbackService = callbackService;
}
/**
* 处理OnlyOffice文档编辑服务发送的回调
*/
@PostMapping("/callback/{id}")
@PermitAll
@TenantIgnore
public ResponseEntity<Map<String, Integer>> handleCallback(@RequestBody OnlyOfficeCallback callback, @PathVariable String id) {
// 处理回调逻辑
callbackService.processCallback(callback,id);
// 返回必须的响应否则OnlyOffice会显示错误
Map<String, Integer> response = new HashMap<>();
response.put("error", 0);
return new ResponseEntity<>(response, HttpStatus.OK);
}
}

View File

@@ -0,0 +1,23 @@
package com.zt.plat.module.base.controller.admin.templtp.onlyoffice.pojo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
@Data
public class Action {
/**
* 操作类型:
* 0 - 用户断开与文档共同编辑的连接
* 1 - 新用户连接到文档共同编辑
* 2 - 用户单击强制保存按钮
*/
@JsonProperty("type")
private int type;
/**
* 用户标识符
*/
@JsonProperty("userid")
private String userId;
}

View File

@@ -0,0 +1,20 @@
package com.zt.plat.module.base.controller.admin.templtp.onlyoffice.pojo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
@Data
public class History {
/**
* 更改内容
*/
@JsonProperty("changes")
private Object changes;
/**
* 服务器版本
*/
@JsonProperty("serverVersion")
private String serverVersion;
}

View File

@@ -0,0 +1,83 @@
package com.zt.plat.module.base.controller.admin.templtp.onlyoffice.pojo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.List;
@Data
public class OnlyOfficeCallback {
/**
* 编辑的文档标识符(必需)
*/
@JsonProperty("key")
private String key;
/**
* 文档的状态(必需)
*/
@JsonProperty("status")
private int status;
/**
* 用户对文档执行的操作数组
*/
@JsonProperty("actions")
private List<Action> actions;
/**
* 文档更改历史的对象数组已删除使用history替代
*/
@JsonProperty("changeshistory")
@Deprecated
private List<Object> changesHistory;
/**
* 文档更改历史记录的文件链接
*/
@JsonProperty("changesurl")
private String changesUrl;
/**
* 文档的扩展名
*/
@JsonProperty("filetype")
private String fileType;
/**
* 强制保存请求的启动器类型
*/
@JsonProperty("forcesavetype")
private Integer forceSaveType;
/**
* 提交的表单数据的JSON文件URL
*/
@JsonProperty("formsdataurl")
private String formsDataUrl;
/**
* 文档更改历史的对象
*/
@JsonProperty("history")
private History history;
/**
* 已编辑的要保存的文档的链接
*/
@JsonProperty("url")
private String url;
/**
* 发送到命令服务的自定义信息
*/
@JsonProperty("userdata")
private String userData;
/**
* 打开文档进行编辑的用户标识符列表
*/
@JsonProperty("users")
private List<String> users;
}

View File

@@ -0,0 +1,12 @@
package com.zt.plat.module.base.controller.admin.templtp.onlyoffice.service;
import com.zt.plat.module.base.controller.admin.templtp.onlyoffice.pojo.OnlyOfficeCallback;
public interface OnlyOfficeCallbackService {
/**
* 处理OnlyOffice回调
* @param callback 回调数据
*/
void processCallback(OnlyOfficeCallback callback,String id);
}

View File

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO; import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
import lombok.*; import lombok.*;
@@ -75,6 +76,7 @@ public class TemplateInstanceDO extends BusinessBaseDO {
/** /**
* 发布时间 * 发布时间
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime publishTime; private LocalDateTime publishTime;
// /** // /**
// * 公司编号 // * 公司编号

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