From 04960a3911d18a5d1590c537aef16b176b67aea0 Mon Sep 17 00:00:00 2001
From: xuyang <748613696@qq.com>
Date: Mon, 28 Aug 2023 12:31:56 +0800
Subject: [PATCH] =?UTF-8?q?App=E7=94=A8=E6=88=B7=E6=B6=88=E6=81=AF?=
=?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=BF=81=E7=A7=BB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../njcn/user/pojo/param/AppInfoSetParam.java | 37 ++++++++++
.../com/njcn/user/pojo/po/app/AppInfoSet.java | 54 ++++++++++++++
pqs-user/user-boot/pom.xml | 5 --
.../controller/app/AppInfoSetController.java | 73 +++++++++++++++++++
.../njcn/user/mapper/AppInfoSetMapper.java | 16 ++++
.../njcn/user/service/IAppInfoSetService.java | 21 ++++++
.../service/impl/AppInfoSetServiceImpl.java | 30 ++++++++
.../user/service/impl/AppUserServiceImpl.java | 7 +-
8 files changed, 234 insertions(+), 9 deletions(-)
create mode 100644 pqs-user/user-api/src/main/java/com/njcn/user/pojo/param/AppInfoSetParam.java
create mode 100644 pqs-user/user-api/src/main/java/com/njcn/user/pojo/po/app/AppInfoSet.java
create mode 100644 pqs-user/user-boot/src/main/java/com/njcn/user/controller/app/AppInfoSetController.java
create mode 100644 pqs-user/user-boot/src/main/java/com/njcn/user/mapper/AppInfoSetMapper.java
create mode 100644 pqs-user/user-boot/src/main/java/com/njcn/user/service/IAppInfoSetService.java
create mode 100644 pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/AppInfoSetServiceImpl.java
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());