App用户消息配置迁移
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* <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;
|
||||
|
||||
|
||||
}
|
||||
@@ -23,11 +23,6 @@
|
||||
<artifactId>user-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>cs-system-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>system-api</artifactId>
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
* 用户推送消息配置
|
||||
* @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<String> 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<AppInfoSet> 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<String> update(@RequestBody AppInfoSetParam.AppInfoSetUpdateParam param){
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
appInfoSetService.updateAppInfo(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.user.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.user.pojo.po.app.AppInfoSet;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-08-21
|
||||
*/
|
||||
public interface AppInfoSetMapper extends BaseMapper<AppInfoSet> {
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-08-21
|
||||
*/
|
||||
public interface IAppInfoSetService extends IService<AppInfoSet> {
|
||||
/**
|
||||
* 更新用户消息配置
|
||||
*/
|
||||
void updateAppInfo(AppInfoSetParam param);
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-08-21
|
||||
*/
|
||||
@Service
|
||||
public class AppInfoSetServiceImpl extends ServiceImpl<AppInfoSetMapper, AppInfoSet> implements IAppInfoSetService {
|
||||
|
||||
@Override
|
||||
public void updateAppInfo(AppInfoSetParam param) {
|
||||
AppInfoSet appInfoSet = new AppInfoSet();
|
||||
BeanUtils.copyProperties(param,appInfoSet);
|
||||
appInfoSet.setUserId(RequestUtil.getUserIndex());
|
||||
this.updateById(appInfoSet);
|
||||
}
|
||||
}
|
||||
@@ -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<AppUserMapper, User> 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<AppUserMapper, User> impleme
|
||||
appInfoSet.setEventInfo(1);
|
||||
appInfoSet.setSystemInfo(1);
|
||||
appInfoSet.setDataInfo(1);
|
||||
appInfoSetFeignClient.add(appInfoSet);
|
||||
appInfoSetService.save(appInfoSet);
|
||||
//发送用户初始密码
|
||||
try {
|
||||
password = redisUtil.getStringByKey(newUser.getId());
|
||||
|
||||
Reference in New Issue
Block a user