App用户消息配置迁移
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
package com.njcn.cssystem.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.cssystem.api.fallback.AppInfoSetFeignClientFallbackFactory;
|
||||
import com.njcn.cssystem.pojo.po.AppInfoSet;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.CS_SYSTEM_BOOT, path = "/appInfoSet", fallbackFactory = AppInfoSetFeignClientFallbackFactory.class,contextId = "appInfoSet")
|
||||
|
||||
public interface AppInfoSetFeignClient {
|
||||
|
||||
@PostMapping("/add")
|
||||
HttpResult<String> add(@RequestBody AppInfoSet appInfoSet);
|
||||
|
||||
@PostMapping("/queryByUserId")
|
||||
HttpResult<AppInfoSet> queryByUserId();
|
||||
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package com.njcn.cssystem.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.cssystem.api.AppInfoSetFeignClient;
|
||||
import com.njcn.cssystem.pojo.po.AppInfoSet;
|
||||
import com.njcn.cssystem.utils.CsSystemEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/4/10 20:09
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AppInfoSetFeignClientFallbackFactory implements FallbackFactory<AppInfoSetFeignClient> {
|
||||
@Override
|
||||
public AppInfoSetFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
exceptionEnum = CsSystemEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new AppInfoSetFeignClient() {
|
||||
|
||||
@Override
|
||||
public HttpResult<String> add(AppInfoSet appInfoSet) {
|
||||
log.error("{}异常,降级处理,异常为:{}","新增用户消息推送配置",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<AppInfoSet> queryByUserId() {
|
||||
log.error("{}异常,降级处理,异常为:{}","查看用户消息推送配置",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.njcn.cssystem.pojo.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/8/21 10:17
|
||||
*/
|
||||
@Data
|
||||
public class AppInfoSetParam {
|
||||
|
||||
@ApiModelProperty(value = "事件消息模块")
|
||||
private Integer eventInfo;
|
||||
|
||||
@ApiModelProperty(value = "数据消息模块")
|
||||
private Integer dataInfo;
|
||||
|
||||
@ApiModelProperty(value = "终端消息模块")
|
||||
private Integer deviceInfo;
|
||||
|
||||
@ApiModelProperty(value = "系统消息模块")
|
||||
private Integer systemInfo;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class AppInfoSetUpdateParam extends AppInfoSetParam {
|
||||
|
||||
@ApiModelProperty("用户id")
|
||||
private String userId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package com.njcn.cssystem.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-08-21
|
||||
*/
|
||||
@Data
|
||||
@TableName("app_info_set")
|
||||
public class AppInfoSet {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户索引
|
||||
*/
|
||||
@TableId("user_id")
|
||||
@ApiModelProperty("用户索引")
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 0:关闭 ;1:开启 事件消息模块
|
||||
*/
|
||||
@ApiModelProperty("事件消息模块")
|
||||
private Integer eventInfo;
|
||||
|
||||
/**
|
||||
* 0:关闭 ;1:开启 数据消息模块
|
||||
*/
|
||||
@ApiModelProperty("数据消息模块")
|
||||
private Integer dataInfo;
|
||||
|
||||
/**
|
||||
* 0:关闭 ;1:开启 终端消息模块
|
||||
*/
|
||||
@ApiModelProperty("终端消息模块")
|
||||
private Integer deviceInfo;
|
||||
|
||||
/**
|
||||
* 0:关闭 ;1:开启 系统消息模块
|
||||
*/
|
||||
@ApiModelProperty("系统消息模块")
|
||||
private Integer systemInfo;
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user