mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 12:56:28 +08:00
5.0
This commit is contained in:
@@ -22,38 +22,18 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- sop接入依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.gitee.sop</groupId>
|
||||
<artifactId>sop-spring-boot-starter</artifactId>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- nacos注册中心 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-nacos-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
|
@@ -33,27 +33,12 @@
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- nacos注册中心 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-nacos-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
|
@@ -1,22 +1,23 @@
|
||||
package com.gitee.sop.storyweb.open.impl;
|
||||
package com.gitee.sop.storyweb.impl;
|
||||
|
||||
import com.gitee.sop.storyweb.message.StoryMessageEnum;
|
||||
import com.gitee.sop.storyweb.open.OpenStory;
|
||||
import com.gitee.sop.storyweb.open.req.StorySaveDTO;
|
||||
import com.gitee.sop.storyweb.open.resp.StoryResponse;
|
||||
import com.gitee.sop.support.context.OpenContext;
|
||||
import com.gitee.sop.support.dto.CommonFileData;
|
||||
import com.gitee.sop.support.dto.FileData;
|
||||
import com.gitee.sop.support.exception.OpenException;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
||||
/**
|
||||
* 开放接口实现
|
||||
@@ -53,6 +54,14 @@ public class OpenStoryImpl implements OpenStory {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer updateError(Integer id) {
|
||||
// 抛出业务异常
|
||||
if (id == null || id == 0) {
|
||||
throw new OpenException(StoryMessageEnum.ISV_PARAM_ERROR, "id is null or 0");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StoryResponse getById(Integer id) {
|
@@ -0,0 +1,32 @@
|
||||
package com.gitee.sop.storyweb.message;
|
||||
|
||||
import com.gitee.sop.support.message.OpenError;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum StoryMessageEnum implements OpenError {
|
||||
/**
|
||||
* 未知错误
|
||||
*/
|
||||
ISP_UNKNOWN_ERROR("isp.service-unknown-error"),
|
||||
/**
|
||||
* 参数错误
|
||||
*/
|
||||
ISV_PARAM_ERROR("isv.invalid-parameter"),
|
||||
/**
|
||||
* 通用错误
|
||||
*/
|
||||
ISV_COMMON_ERROR("isv.common-error");
|
||||
|
||||
private final String subCode;
|
||||
|
||||
@Override
|
||||
public String modulePrefix() {
|
||||
return "isp.error_";
|
||||
}
|
||||
}
|
@@ -22,6 +22,10 @@ public interface OpenStory {
|
||||
@Open("story.update")
|
||||
Integer update(Integer id, StorySaveDTO storySaveDTO);
|
||||
|
||||
// 演示抛出异常
|
||||
@Open("story.updateError")
|
||||
Integer updateError(Integer id);
|
||||
|
||||
@Open("story.get")
|
||||
StoryResponse getById(@NotNull(message = "id必填") Integer id);
|
||||
|
||||
|
Reference in New Issue
Block a user