diff --git a/pqs-user/user-api/src/main/java/com/njcn/user/pojo/param/AppInfoSetParam.java b/pqs-user/user-api/src/main/java/com/njcn/user/pojo/param/AppInfoSetParam.java new file mode 100644 index 000000000..2a8f2432b --- /dev/null +++ b/pqs-user/user-api/src/main/java/com/njcn/user/pojo/param/AppInfoSetParam.java @@ -0,0 +1,37 @@ +package com.njcn.user.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/pqs-user/user-api/src/main/java/com/njcn/user/pojo/po/app/AppInfoSet.java b/pqs-user/user-api/src/main/java/com/njcn/user/pojo/po/app/AppInfoSet.java new file mode 100644 index 000000000..3c4533470 --- /dev/null +++ b/pqs-user/user-api/src/main/java/com/njcn/user/pojo/po/app/AppInfoSet.java @@ -0,0 +1,54 @@ +package com.njcn.user.pojo.po.app; + +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/pqs-user/user-boot/pom.xml b/pqs-user/user-boot/pom.xml index 5507fc803..ea47e0536 100644 --- a/pqs-user/user-boot/pom.xml +++ b/pqs-user/user-boot/pom.xml @@ -23,11 +23,6 @@ user-api ${project.version} - - com.njcn - cs-system-api - 1.0.0 - com.njcn system-api diff --git a/pqs-user/user-boot/src/main/java/com/njcn/user/controller/app/AppInfoSetController.java b/pqs-user/user-boot/src/main/java/com/njcn/user/controller/app/AppInfoSetController.java new file mode 100644 index 000000000..73b5daf16 --- /dev/null +++ b/pqs-user/user-boot/src/main/java/com/njcn/user/controller/app/AppInfoSetController.java @@ -0,0 +1,73 @@ +package com.njcn.user.controller.app; + + +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.user.pojo.param.AppInfoSetParam; +import com.njcn.user.pojo.po.app.AppInfoSet; +import com.njcn.user.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.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +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/pqs-user/user-boot/src/main/java/com/njcn/user/mapper/AppInfoSetMapper.java b/pqs-user/user-boot/src/main/java/com/njcn/user/mapper/AppInfoSetMapper.java new file mode 100644 index 000000000..b83a73754 --- /dev/null +++ b/pqs-user/user-boot/src/main/java/com/njcn/user/mapper/AppInfoSetMapper.java @@ -0,0 +1,16 @@ +package com.njcn.user.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.njcn.user.pojo.po.app.AppInfoSet; + +/** + *

+ * Mapper 接口 + *

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

+ * 服务类 + *

+ * + * @author xuyang + * @since 2023-08-21 + */ +public interface IAppInfoSetService extends IService { + /** + * 更新用户消息配置 + */ + void updateAppInfo(AppInfoSetParam param); + +} diff --git a/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/AppInfoSetServiceImpl.java b/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/AppInfoSetServiceImpl.java new file mode 100644 index 000000000..58152417f --- /dev/null +++ b/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/AppInfoSetServiceImpl.java @@ -0,0 +1,30 @@ +package com.njcn.user.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.user.mapper.AppInfoSetMapper; +import com.njcn.user.pojo.param.AppInfoSetParam; +import com.njcn.user.pojo.po.app.AppInfoSet; +import com.njcn.user.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); + } +} diff --git a/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/AppUserServiceImpl.java b/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/AppUserServiceImpl.java index 46925683c..5a1fd8a0e 100644 --- a/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/AppUserServiceImpl.java +++ b/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/AppUserServiceImpl.java @@ -8,8 +8,6 @@ import com.njcn.common.pojo.constant.PatternRegex; import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.utils.PubUtils; import com.njcn.common.utils.sm.Sm4Utils; -import com.njcn.cssystem.api.AppInfoSetFeignClient; -import com.njcn.cssystem.pojo.po.AppInfoSet; import com.njcn.redis.pojo.enums.RedisKeyEnum; import com.njcn.redis.utils.RedisUtil; import com.njcn.user.enums.AppRoleEnum; @@ -21,6 +19,7 @@ import com.njcn.user.pojo.constant.UserType; import com.njcn.user.pojo.po.Role; import com.njcn.user.pojo.po.User; import com.njcn.user.pojo.po.UserSet; +import com.njcn.user.pojo.po.app.AppInfoSet; import com.njcn.user.pojo.po.app.AppSendMsg; import com.njcn.user.service.*; import com.njcn.user.util.SmsUtil; @@ -59,7 +58,7 @@ public class AppUserServiceImpl extends ServiceImpl impleme private final IUserRoleService userRoleService; - private final AppInfoSetFeignClient appInfoSetFeignClient; + private final IAppInfoSetService appInfoSetService; private final SmsUtil smsUtil; @@ -145,7 +144,7 @@ public class AppUserServiceImpl extends ServiceImpl impleme appInfoSet.setEventInfo(1); appInfoSet.setSystemInfo(1); appInfoSet.setDataInfo(1); - appInfoSetFeignClient.add(appInfoSet); + appInfoSetService.save(appInfoSet); //发送用户初始密码 try { password = redisUtil.getStringByKey(newUser.getId());