1. 统一包名修改
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package com.zt.plat.module.infra;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 项目的启动类
|
||||
* <p>
|
||||
* 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
|
||||
* 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
|
||||
* 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
|
||||
*
|
||||
* @author ZT
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class InfraServerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
|
||||
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
|
||||
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
|
||||
|
||||
SpringApplication.run(InfraServerApplication.class, args);
|
||||
|
||||
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
|
||||
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
|
||||
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.zt.plat.module.infra.api.businessfile;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
import com.zt.plat.module.infra.api.businessfile.dto.BusinessFilePageReqDTO;
|
||||
import com.zt.plat.module.infra.api.businessfile.dto.BusinessFileRespDTO;
|
||||
import com.zt.plat.module.infra.api.businessfile.dto.BusinessFileSaveReqDTO;
|
||||
import com.zt.plat.module.infra.api.businessfile.dto.BusinessFileWithUrlRespDTO;
|
||||
import com.zt.plat.module.infra.controller.admin.businessfile.vo.BusinessFilePageReqVO;
|
||||
import com.zt.plat.module.infra.controller.admin.businessfile.vo.BusinessFileSaveReqVO;
|
||||
import com.zt.plat.module.infra.controller.admin.businessfile.vo.BusinessFileWithUrlRespVO;
|
||||
import com.zt.plat.module.infra.dal.dataobject.businessfile.BusinessFileDO;
|
||||
import com.zt.plat.module.infra.service.businessfile.BusinessFileService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* 业务附件关联 API 实现
|
||||
* @author chenbowen
|
||||
*/
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class BusinessFileApiImpl implements BusinessFileApi {
|
||||
|
||||
@Resource
|
||||
private BusinessFileService businessFileService;
|
||||
|
||||
@Override
|
||||
public CommonResult<Long> createBusinessFile(BusinessFileSaveReqDTO createReqDTO) {
|
||||
return success(businessFileService.createBusinessFile(BeanUtils.toBean(createReqDTO, BusinessFileSaveReqVO.class)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<Long>> batchCreateBusinessFile(List<BusinessFileSaveReqDTO> createReqDTOList) {
|
||||
List<BusinessFileSaveReqVO> createReqVOList = BeanUtils.toBean(createReqDTOList, BusinessFileSaveReqVO.class);
|
||||
List<Long> ids = businessFileService.batchCreateBusinessFile(createReqVOList);
|
||||
return success(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> updateBusinessFile(BusinessFileSaveReqDTO updateReqDTO) {
|
||||
businessFileService.updateBusinessFile(BeanUtils.toBean(updateReqDTO, BusinessFileSaveReqVO.class));
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> deleteBusinessFile(Long id) {
|
||||
businessFileService.deleteBusinessFile(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> deleteBusinessFileList(List<Long> ids) {
|
||||
businessFileService.deleteBusinessFileListByIds(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<BusinessFileRespDTO> getBusinessFile(Long id) {
|
||||
BusinessFileDO businessFile = businessFileService.getBusinessFile(id);
|
||||
return success(BeanUtils.toBean(businessFile, BusinessFileRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<PageResult<BusinessFileRespDTO>> getBusinessFilePage(BusinessFilePageReqDTO pageReqDTO) {
|
||||
PageResult<BusinessFileDO> pageResult = businessFileService.getBusinessFilePage(BeanUtils.toBean(pageReqDTO, BusinessFilePageReqVO.class));
|
||||
return success(BeanUtils.toBean(pageResult, BusinessFileRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<PageResult<BusinessFileWithUrlRespDTO>> getBusinessFilePageWithUrl(BusinessFilePageReqDTO pageReqDTO) {
|
||||
PageResult<BusinessFileWithUrlRespVO> pageResult = businessFileService.getBusinessFilePageWithUrl(BeanUtils.toBean(pageReqDTO, BusinessFilePageReqVO.class));
|
||||
return success(BeanUtils.toBean(pageResult, BusinessFileWithUrlRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> deleteBusinessFileByBusinessIdAndSource(Long businessId, String source) {
|
||||
businessFileService.deleteBusinessFileByBusinessIdAndSource(businessId, source);
|
||||
return success(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.zt.plat.module.infra.api.config;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.module.infra.dal.dataobject.config.ConfigDO;
|
||||
import com.zt.plat.module.infra.service.config.ConfigService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class ConfigApiImpl implements ConfigApi {
|
||||
|
||||
@Resource
|
||||
private ConfigService configService;
|
||||
|
||||
@Override
|
||||
public CommonResult<String> getConfigValueByKey(String key) {
|
||||
ConfigDO config = configService.getConfigByKey(key);
|
||||
return success(config != null ? config.getValue() : null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.zt.plat.module.infra.api.file;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.module.infra.api.file.dto.FileCreateReqDTO;
|
||||
import com.zt.plat.module.infra.service.file.FileService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class FileApiImpl implements FileApi {
|
||||
|
||||
@Resource
|
||||
private FileService fileService;
|
||||
|
||||
@Override
|
||||
public CommonResult<String> createFile(FileCreateReqDTO createReqDTO) {
|
||||
return success(fileService.createFile(createReqDTO.getContent(), createReqDTO.getName(),
|
||||
createReqDTO.getDirectory(), createReqDTO.getType(), false));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.zt.plat.module.infra.api.logger;
|
||||
|
||||
import com.zt.plat.framework.common.biz.infra.logger.ApiAccessLogCommonApi;
|
||||
import com.zt.plat.framework.common.biz.infra.logger.dto.ApiAccessLogCreateReqDTO;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.module.infra.service.logger.ApiAccessLogService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class ApiAccessLogApiImpl implements ApiAccessLogCommonApi {
|
||||
|
||||
@Resource
|
||||
private ApiAccessLogService apiAccessLogService;
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> createApiAccessLog(ApiAccessLogCreateReqDTO createDTO) {
|
||||
apiAccessLogService.createApiAccessLog(createDTO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.zt.plat.module.infra.api.logger;
|
||||
|
||||
import com.zt.plat.framework.common.biz.infra.logger.ApiErrorLogCommonApi;
|
||||
import com.zt.plat.framework.common.biz.infra.logger.dto.ApiErrorLogCreateReqDTO;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.module.infra.service.logger.ApiErrorLogService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class ApiErrorLogApiImpl implements ApiErrorLogCommonApi {
|
||||
|
||||
@Resource
|
||||
private ApiErrorLogService apiErrorLogService;
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> createApiErrorLog(ApiErrorLogCreateReqDTO createDTO) {
|
||||
apiErrorLogService.createApiErrorLog(createDTO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
package com.zt.plat.module.infra.api;
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.zt.plat.module.infra.api.websocket;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.websocket.core.sender.WebSocketMessageSender;
|
||||
import com.zt.plat.module.infra.api.websocket.dto.WebSocketSendReqDTO;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class WebSocketSenderApiImpl implements WebSocketSenderApi {
|
||||
|
||||
@Resource
|
||||
private WebSocketMessageSender webSocketMessageSender;
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> send(WebSocketSendReqDTO message) {
|
||||
if (StrUtil.isNotEmpty(message.getSessionId())) {
|
||||
webSocketMessageSender.send(message.getSessionId(),
|
||||
message.getMessageType(), message.getMessageContent());
|
||||
} else if (message.getUserType() != null && message.getUserId() != null) {
|
||||
webSocketMessageSender.send(message.getUserType(), message.getUserId(),
|
||||
message.getMessageType(), message.getMessageContent());
|
||||
} else if (message.getUserType() != null) {
|
||||
webSocketMessageSender.send(message.getUserType(),
|
||||
message.getMessageType(), message.getMessageContent());
|
||||
}
|
||||
return success(true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.zt.plat.module.infra.config;
|
||||
|
||||
import com.zt.plat.module.infra.websocket.DocWebSocketHandler;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.socket.config.annotation.EnableWebSocket;
|
||||
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
|
||||
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
/**
|
||||
* WebSocket 配置
|
||||
*
|
||||
* @author ZT
|
||||
*/
|
||||
@Configuration
|
||||
@EnableWebSocket
|
||||
public class WebSocketConfig implements WebSocketConfigurer {
|
||||
|
||||
@Resource
|
||||
private DocWebSocketHandler docWebSocketHandler;
|
||||
|
||||
@Override
|
||||
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
|
||||
// 注册文档协作WebSocket处理器
|
||||
registry.addHandler(docWebSocketHandler, "/doc-collaboration")
|
||||
.setAllowedOrigins("*") // 允许跨域,生产环境应该限制域名
|
||||
.withSockJS(); // 启用SockJS支持
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user