diff --git a/cs-system/cs-system-api/src/main/java/com/njcn/cssystem/api/AppInfoSetFeignClient.java b/cs-system/cs-system-api/src/main/java/com/njcn/cssystem/api/AppInfoSetFeignClient.java deleted file mode 100644 index ca4a947..0000000 --- a/cs-system/cs-system-api/src/main/java/com/njcn/cssystem/api/AppInfoSetFeignClient.java +++ /dev/null @@ -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 add(@RequestBody AppInfoSet appInfoSet); - - @PostMapping("/queryByUserId") - HttpResult queryByUserId(); - -} diff --git a/cs-system/cs-system-api/src/main/java/com/njcn/cssystem/api/fallback/AppInfoSetFeignClientFallbackFactory.java b/cs-system/cs-system-api/src/main/java/com/njcn/cssystem/api/fallback/AppInfoSetFeignClientFallbackFactory.java deleted file mode 100644 index 367d785..0000000 --- a/cs-system/cs-system-api/src/main/java/com/njcn/cssystem/api/fallback/AppInfoSetFeignClientFallbackFactory.java +++ /dev/null @@ -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 { - @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 add(AppInfoSet appInfoSet) { - log.error("{}异常,降级处理,异常为:{}","新增用户消息推送配置",cause.toString()); - throw new BusinessException(finalExceptionEnum); - } - - @Override - public HttpResult queryByUserId() { - log.error("{}异常,降级处理,异常为:{}","查看用户消息推送配置",cause.toString()); - throw new BusinessException(finalExceptionEnum); - } - - }; - } -} diff --git a/cs-system/cs-system-api/src/main/java/com/njcn/cssystem/pojo/param/AppInfoSetParam.java b/cs-system/cs-system-api/src/main/java/com/njcn/cssystem/pojo/param/AppInfoSetParam.java deleted file mode 100644 index 3662d9d..0000000 --- a/cs-system/cs-system-api/src/main/java/com/njcn/cssystem/pojo/param/AppInfoSetParam.java +++ /dev/null @@ -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; - } - -} diff --git a/cs-system/cs-system-api/src/main/java/com/njcn/cssystem/pojo/po/AppInfoSet.java b/cs-system/cs-system-api/src/main/java/com/njcn/cssystem/pojo/po/AppInfoSet.java deleted file mode 100644 index ea1e972..0000000 --- a/cs-system/cs-system-api/src/main/java/com/njcn/cssystem/pojo/po/AppInfoSet.java +++ /dev/null @@ -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; - -/** - *

- * - *

- * - * @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; - - -} diff --git a/cs-system/cs-system-boot/src/main/java/com/njcn/cssystem/controller/messageConfig/AppInfoSetController.java b/cs-system/cs-system-boot/src/main/java/com/njcn/cssystem/controller/messageConfig/AppInfoSetController.java deleted file mode 100644 index 845e0c6..0000000 --- a/cs-system/cs-system-boot/src/main/java/com/njcn/cssystem/controller/messageConfig/AppInfoSetController.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.njcn.cssystem.controller.messageConfig; - - -import com.njcn.common.pojo.annotation.OperateInfo; -import com.njcn.common.pojo.enums.common.LogEnum; -import com.njcn.common.pojo.enums.response.CommonResponseEnum; -import com.njcn.common.pojo.response.HttpResult; -import com.njcn.common.utils.HttpResultUtil; -import com.njcn.cssystem.pojo.param.AppInfoSetParam; -import com.njcn.cssystem.pojo.po.AppInfoSet; -import com.njcn.cssystem.service.IAppInfoSetService; -import com.njcn.web.controller.BaseController; -import com.njcn.web.utils.RequestUtil; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import lombok.AllArgsConstructor; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import springfox.documentation.annotations.ApiIgnore; - -/** - *

- * 前端控制器 - *

- * 用户推送消息配置 - * @author xuyang - * @since 2023-08-21 - */ -@RestController -@RequestMapping("/appInfoSet") -@Api(tags = "用户推送消息配置") -@AllArgsConstructor -@Validated -public class AppInfoSetController extends BaseController { - - private final IAppInfoSetService appInfoSetService; - - @OperateInfo(info = LogEnum.BUSINESS_COMMON) - @PostMapping("/add") - @ApiOperation("新增用户消息推送配置") - @ApiImplicitParam(name = "appInfoSet", value = "参数实体", required = true) - @ApiIgnore - public HttpResult add(@RequestBody AppInfoSet appInfoSet){ - String methodDescribe = getMethodDescribe("add"); - appInfoSetService.save(appInfoSet); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, "success", methodDescribe); - } - - @OperateInfo(info = LogEnum.BUSINESS_COMMON) - @PostMapping("/queryByUserId") - @ApiOperation("查看用户消息推送配置") - public HttpResult queryByUserId(){ - String methodDescribe = getMethodDescribe("queryByUserId"); - AppInfoSet appInfoSet = appInfoSetService.lambdaQuery().eq(AppInfoSet::getUserId,RequestUtil.getUserIndex()).one(); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, appInfoSet, methodDescribe); - } - - @OperateInfo(info = LogEnum.BUSINESS_COMMON) - @PostMapping("/update") - @ApiOperation("更新消息推送配置") - @ApiImplicitParam(name = "param", value = "参数实体", required = true) - public HttpResult update(@RequestBody AppInfoSetParam.AppInfoSetUpdateParam param){ - String methodDescribe = getMethodDescribe("update"); - appInfoSetService.updateAppInfo(param); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); - } - -} - diff --git a/cs-system/cs-system-boot/src/main/java/com/njcn/cssystem/mapper/AppInfoSetMapper.java b/cs-system/cs-system-boot/src/main/java/com/njcn/cssystem/mapper/AppInfoSetMapper.java deleted file mode 100644 index 5d41cf0..0000000 --- a/cs-system/cs-system-boot/src/main/java/com/njcn/cssystem/mapper/AppInfoSetMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.njcn.cssystem.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.njcn.cssystem.pojo.po.AppInfoSet; - -/** - *

- * Mapper 接口 - *

- * - * @author xuyang - * @since 2023-08-21 - */ -public interface AppInfoSetMapper extends BaseMapper { - -} diff --git a/cs-system/cs-system-boot/src/main/java/com/njcn/cssystem/service/IAppInfoSetService.java b/cs-system/cs-system-boot/src/main/java/com/njcn/cssystem/service/IAppInfoSetService.java deleted file mode 100644 index bd105e3..0000000 --- a/cs-system/cs-system-boot/src/main/java/com/njcn/cssystem/service/IAppInfoSetService.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.njcn.cssystem.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.njcn.cssystem.pojo.param.AppInfoSetParam; -import com.njcn.cssystem.pojo.po.AppInfoSet; - -/** - *

- * 服务类 - *

- * - * @author xuyang - * @since 2023-08-21 - */ -public interface IAppInfoSetService extends IService { - /** - * 更新用户消息配置 - */ - void updateAppInfo(AppInfoSetParam param); - -} diff --git a/cs-system/cs-system-boot/src/main/java/com/njcn/cssystem/service/impl/AppInfoSetServiceImpl.java b/cs-system/cs-system-boot/src/main/java/com/njcn/cssystem/service/impl/AppInfoSetServiceImpl.java deleted file mode 100644 index 542ee61..0000000 --- a/cs-system/cs-system-boot/src/main/java/com/njcn/cssystem/service/impl/AppInfoSetServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.njcn.cssystem.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.njcn.cssystem.mapper.AppInfoSetMapper; -import com.njcn.cssystem.pojo.param.AppInfoSetParam; -import com.njcn.cssystem.pojo.po.AppInfoSet; -import com.njcn.cssystem.service.IAppInfoSetService; -import com.njcn.web.utils.RequestUtil; -import org.springframework.beans.BeanUtils; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author xuyang - * @since 2023-08-21 - */ -@Service -public class AppInfoSetServiceImpl extends ServiceImpl implements IAppInfoSetService { - - @Override - public void updateAppInfo(AppInfoSetParam param) { - AppInfoSet appInfoSet = new AppInfoSet(); - BeanUtils.copyProperties(param,appInfoSet); - appInfoSet.setUserId(RequestUtil.getUserIndex()); - this.updateById(appInfoSet); - } -}