This commit is contained in:
六如
2024-11-25 00:18:47 +08:00
parent ba384660f1
commit 5e2c3fab46
37 changed files with 939 additions and 86 deletions

View File

@@ -0,0 +1,19 @@
package com.gitee.sop.adminbackend.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 来源类型,1-torna,2-自建
*
* @author 六如
*/
@Getter
@AllArgsConstructor
public enum DocSourceTypeEnum implements IntEnum {
TORNA(1, "Torna"),
CUSTOM(2, "自建");
private final Integer value;
private final String description;
}

View File

@@ -0,0 +1,21 @@
package com.gitee.sop.adminbackend.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 文档类型,0:http,1:dubbo,2:富文本,3:Markdown
*
* @author 六如
*/
@Getter
@AllArgsConstructor
public enum DocTypeEnum implements IntEnum {
HTTP(0, "HTTP"),
DUBBO(1, "dubbo"),
RICH_TEXT(2, "富文本"),
MARKDOWN(3, "Markdown");
private final Integer value;
private final String description;
}

View File

@@ -0,0 +1,24 @@
package com.gitee.sop.adminbackend.common.enums;
import java.io.Serializable;
/**
* @author 六如
*/
public interface IEnum<T extends Serializable> {
/**
* 获取值
*
* @return 返回枚举值
*/
T getValue();
/**
* 获取描述
*
* @return 返回枚举描述
*/
String getDescription();
}

View File

@@ -0,0 +1,24 @@
package com.gitee.sop.adminbackend.common.enums;
import java.util.Objects;
import java.util.Optional;
/**
* @author 六如
*/
public interface IntEnum extends IEnum<Integer> {
static <T extends IntEnum> Optional<T> of(T[] values, Integer value) {
for (IntEnum intEnum : values) {
if (Objects.equals(intEnum.getValue(), value)) {
return Optional.of((T) intEnum);
}
}
return Optional.empty();
}
static <T extends IntEnum> Optional<String> ofDescription(T[] values, Integer value) {
return of(values, value).map(IntEnum::getDescription);
}
}

View File

@@ -1,5 +1,6 @@
package com.gitee.sop.adminbackend.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Objects;
@@ -8,25 +9,23 @@ import java.util.Objects;
* @author 六如
*/
@Getter
public enum StatusEnum {
DISABLED((byte) 2),
ENABLE((byte) 1),
SET_PWD((byte) 3);
@AllArgsConstructor
public enum StatusEnum implements IntEnum {
DISABLED(2, "禁用"),
ENABLE(1, "启用"),
SET_PWD(3, "重置密码");
private final int status;
private final Integer value;
private final String description;
public static StatusEnum of(Integer value) {
for (StatusEnum statusEnum : StatusEnum.values()) {
if (Objects.equals(statusEnum.status, value)) {
if (Objects.equals(statusEnum.value, value)) {
return statusEnum;
}
}
return DISABLED;
}
StatusEnum(byte style) {
this.status = style;
}
}

View File

@@ -0,0 +1,24 @@
package com.gitee.sop.adminbackend.common.enums;
import java.util.Objects;
import java.util.Optional;
/**
* @author 六如
*/
public interface StringEnum extends IEnum<String> {
static <T extends StringEnum> Optional<T> of(T[] values, String value) {
for (StringEnum intEnum : values) {
if (Objects.equals(intEnum.getValue(), value)) {
return Optional.of((T) intEnum);
}
}
return Optional.empty();
}
static <T extends StringEnum> Optional<String> ofDescription(T[] values, String value) {
return of(values, value).map(StringEnum::getDescription);
}
}

View File

@@ -10,14 +10,18 @@ import java.util.Objects;
*/
@AllArgsConstructor
@Getter
public enum YesOrNoEnum {
YES(1),
NO(0);
public enum YesOrNoEnum implements IntEnum {
YES(1, ""),
NO(0, "");
private final int value;
private final Integer value;
private final String description;
public static YesOrNoEnum of(Integer value) {
return Objects.equals(value, YES.value) ? YES : NO;
public static YesOrNoEnum of(Number value) {
if (value == null) {
return NO;
}
return Objects.equals(value.intValue(), YES.value) ? YES : NO;
}
public static YesOrNoEnum of(Boolean value) {

View File

@@ -3,15 +3,20 @@ package com.gitee.sop.adminbackend.controller.doc;
import com.gitee.sop.adminbackend.common.resp.Result;
import com.gitee.sop.adminbackend.common.util.CopyUtil;
import com.gitee.sop.adminbackend.controller.doc.param.DocAppAddParam;
import com.gitee.sop.adminbackend.controller.doc.param.DocInfoUpdateParam;
import com.gitee.sop.adminbackend.controller.doc.vo.DocAppVO;
import com.gitee.sop.adminbackend.controller.doc.vo.DocInfoTreeVO;
import com.gitee.sop.adminbackend.service.doc.DocService;
import com.gitee.sop.adminbackend.service.website.dto.DocAppDTO;
import com.gitee.sop.adminbackend.service.doc.dto.DocAppDTO;
import com.gitee.sop.adminbackend.service.doc.dto.DocInfoTreeDTO;
import com.gitee.sop.adminbackend.service.doc.dto.DocInfoPublishUpdateDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@@ -34,9 +39,22 @@ public class DocController {
}
@PostMapping("app/add")
public Result<Integer> addApp(@Validated @RequestBody DocAppAddParam param) {
docService.addDocApp(param.getTornaToken());
return Result.ok(1);
public Result<Long> addApp(@Validated @RequestBody DocAppAddParam param) {
Long docAppId = docService.addDocApp(param.getTornaToken());
return Result.ok(docAppId);
}
@GetMapping("info/tree")
public Result<List<DocInfoTreeVO>> docTree(@RequestParam Long docAppId) {
List<DocInfoTreeDTO> docInfoTreeDTOS = docService.listDocTree(docAppId);
List<DocInfoTreeVO> docInfoTreeVOS = CopyUtil.deepCopyList(docInfoTreeDTOS, DocInfoTreeVO.class);
return Result.ok(docInfoTreeVOS);
}
@PostMapping("info/publish")
public Result<Integer> publish(@Validated @RequestBody DocInfoUpdateParam param) {
int cnt = docService.publish(CopyUtil.copyBean(param, DocInfoPublishUpdateDTO::new));
return Result.ok(cnt);
}
}

View File

@@ -0,0 +1,18 @@
package com.gitee.sop.adminbackend.controller.doc.param;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @author 六如
*/
@Data
public class DocInfoUpdateParam {
@NotNull
private Long id;
private Integer isPublish;
}

View File

@@ -1,10 +1,12 @@
package com.gitee.sop.adminbackend.controller.website.vo;
package com.gitee.sop.adminbackend.controller.doc.vo;
import com.gitee.fastmybatis.core.support.TreeNode;
import com.gitee.sop.adminbackend.common.enums.YesOrNoEnum;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
/**
@@ -30,6 +32,11 @@ public class DocInfoTreeVO implements TreeNode<DocInfoTreeVO, Long> {
*/
private Long docId;
/**
* 文档标题
*/
private String docTitle;
/**
* 文档code
*/
@@ -95,7 +102,7 @@ public class DocInfoTreeVO implements TreeNode<DocInfoTreeVO, Long> {
@Override
public Long takeId() {
return id;
return docId;
}
@Override
@@ -103,4 +110,11 @@ public class DocInfoTreeVO implements TreeNode<DocInfoTreeVO, Long> {
return parentId;
}
public String getDocName() {
if (Objects.equals(isFolder, YesOrNoEnum.YES.getValue())) {
return "";
}
return docName;
}
}

View File

@@ -4,10 +4,10 @@ import com.gitee.sop.adminbackend.common.annotation.NoToken;
import com.gitee.sop.adminbackend.common.resp.Result;
import com.gitee.sop.adminbackend.common.util.CopyUtil;
import com.gitee.sop.adminbackend.controller.doc.vo.DocAppVO;
import com.gitee.sop.adminbackend.controller.website.vo.DocInfoTreeVO;
import com.gitee.sop.adminbackend.controller.doc.vo.DocInfoTreeVO;
import com.gitee.sop.adminbackend.service.website.WebsiteService;
import com.gitee.sop.adminbackend.service.website.dto.DocAppDTO;
import com.gitee.sop.adminbackend.service.website.dto.DocInfoTreeDTO;
import com.gitee.sop.adminbackend.service.doc.dto.DocAppDTO;
import com.gitee.sop.adminbackend.service.doc.dto.DocInfoTreeDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

View File

@@ -34,6 +34,11 @@ public class DocInfo {
*/
private Long docId;
/**
* 文档标题
*/
private String docTitle;
/**
* 文档code
*/
@@ -54,6 +59,11 @@ public class DocInfo {
*/
private String docName;
/**
* 版本号
*/
private String docVersion;
/**
* 描述
*/

View File

@@ -0,0 +1,16 @@
package com.gitee.sop.adminbackend.service.doc;
import com.gitee.fastmybatis.core.support.LambdaService;
import com.gitee.sop.adminbackend.dao.entity.DocApp;
import com.gitee.sop.adminbackend.dao.mapper.DocAppMapper;
import org.springframework.stereotype.Service;
/**
* @author 六如
*/
@Service
public class DocAppService implements LambdaService<DocApp, DocAppMapper> {
}

View File

@@ -0,0 +1,107 @@
package com.gitee.sop.adminbackend.service.doc;
import com.gitee.fastmybatis.core.support.LambdaService;
import com.gitee.sop.adminbackend.common.enums.DocSourceTypeEnum;
import com.gitee.sop.adminbackend.common.enums.YesOrNoEnum;
import com.gitee.sop.adminbackend.dao.entity.DocApp;
import com.gitee.sop.adminbackend.dao.entity.DocInfo;
import com.gitee.sop.adminbackend.dao.mapper.DocAppMapper;
import com.gitee.sop.adminbackend.dao.mapper.DocInfoMapper;
import com.gitee.sop.adminbackend.service.doc.dto.TornaDocDTO;
import com.gitee.sop.adminbackend.service.doc.dto.TornaDocInfoDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @author 六如
*/
@Service
public class DocInfoService implements LambdaService<DocInfo, DocInfoMapper> {
@Autowired
private TornaClient tornaClient;
@Autowired
private DocAppMapper docAppMapper;
public List<DocInfo> listChildDoc(Long parentId) {
return this.list(DocInfo::getParentId, parentId);
}
public void syncDocInfo(Long docAppId) {
Map<Object, DocInfo> nameVersionMap = this.list(DocInfo::getDocAppId, docAppId)
.stream()
.collect(Collectors.toMap(docInfo -> docInfo.getDocName() + ":" + docInfo.getDocVersion(), Function.identity(), (v1, v2) -> v2));
DocApp docApp = docAppMapper.getById(docAppId);
String token = docApp.getToken();
// add doc
TornaDocDTO tornaDocDTO = tornaClient.execute("doc.list", null, token, TornaDocDTO.class);
List<TornaDocInfoDTO> docList = tornaDocDTO.getDocList();
if (!CollectionUtils.isEmpty(docList)) {
List<DocInfo> updateList = new ArrayList<>();
for (TornaDocInfoDTO tornaDocInfoDTO : docList) {
String key = tornaDocInfoDTO.getUrl() + ":" + tornaDocInfoDTO.getVersion();
DocInfo docInfo = nameVersionMap.get(key);
// 需要修改的文档
if (docInfo != null) {
docInfo.setDocId(tornaDocInfoDTO.getId());
docInfo.setDocTitle(tornaDocInfoDTO.getName());
docInfo.setDocCode("");
if (YesOrNoEnum.of(tornaDocInfoDTO.getIsFolder()) == YesOrNoEnum.YES) {
docInfo.setDocName(tornaDocInfoDTO.getName());
}
docInfo.setDocId(tornaDocInfoDTO.getId());
docInfo.setDocType(tornaDocInfoDTO.getType().intValue());
docInfo.setDescription(tornaDocInfoDTO.getDescription());
docInfo.setIsFolder(tornaDocInfoDTO.getIsFolder().intValue());
docInfo.setParentId(tornaDocInfoDTO.getParentId());
updateList.add(docInfo);
}
}
for (DocInfo docInfo : updateList) {
this.update(docInfo);
}
// 新增的文档
List<DocInfo> saveList = docList.stream()
.filter(tornaDocInfoDTO -> {
String key = tornaDocInfoDTO.getUrl() + ":" + tornaDocInfoDTO.getVersion();
return !nameVersionMap.containsKey(key);
})
.map(tornaDocInfoDTO -> {
DocInfo docInfo = new DocInfo();
docInfo.setDocAppId(docAppId);
docInfo.setDocId(tornaDocInfoDTO.getId());
docInfo.setDocTitle(tornaDocInfoDTO.getName());
docInfo.setDocCode("");
docInfo.setDocType(tornaDocInfoDTO.getType().intValue());
docInfo.setSourceType(DocSourceTypeEnum.TORNA.getValue());
if (YesOrNoEnum.of(tornaDocInfoDTO.getIsFolder()) == YesOrNoEnum.YES) {
docInfo.setDocName(tornaDocInfoDTO.getName());
} else {
docInfo.setDocName(tornaDocInfoDTO.getUrl());
}
docInfo.setDocVersion(tornaDocInfoDTO.getVersion());
docInfo.setDescription(tornaDocInfoDTO.getDescription());
docInfo.setIsFolder(tornaDocInfoDTO.getIsFolder().intValue());
docInfo.setIsPublish(YesOrNoEnum.NO.getValue());
docInfo.setParentId(tornaDocInfoDTO.getParentId());
return docInfo;
})
.collect(Collectors.toList());
this.saveBatch(saveList);
}
}
}

View File

@@ -1,30 +1,27 @@
package com.gitee.sop.adminbackend.service.doc;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.gitee.httphelper.HttpHelper;
import com.gitee.fastmybatis.core.util.TreeUtil;
import com.gitee.sop.adminbackend.common.enums.ConfigKeyEnum;
import com.gitee.sop.adminbackend.common.exception.BizException;
import com.gitee.sop.adminbackend.common.enums.YesOrNoEnum;
import com.gitee.sop.adminbackend.common.util.CopyUtil;
import com.gitee.sop.adminbackend.dao.entity.DocApp;
import com.gitee.sop.adminbackend.dao.mapper.DocAppMapper;
import com.gitee.sop.adminbackend.dao.entity.DocInfo;
import com.gitee.sop.adminbackend.service.doc.dto.DocAppDTO;
import com.gitee.sop.adminbackend.service.doc.dto.DocInfoPublishUpdateDTO;
import com.gitee.sop.adminbackend.service.doc.dto.DocInfoTreeDTO;
import com.gitee.sop.adminbackend.service.doc.dto.DocSettingDTO;
import com.gitee.sop.adminbackend.service.doc.dto.TornaModuleDTO;
import com.gitee.sop.adminbackend.service.sys.SysConfigService;
import com.gitee.sop.adminbackend.service.sys.dto.SystemConfigDTO;
import java.io.IOException;
import java.time.LocalDateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import com.gitee.sop.adminbackend.service.website.dto.DocAppDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import java.util.Set;
import java.util.stream.Collectors;
/**
@@ -37,10 +34,12 @@ public class DocService {
private SysConfigService sysConfigService;
@Autowired
private DocAppMapper docAppMapper;
private DocAppService docAppService;
@Autowired
private TornaClient tornaClient;
@Autowired
private DocInfoService docInfoService;
public DocSettingDTO getDocSetting() {
DocSettingDTO docSettingDTO = new DocSettingDTO();
@@ -58,21 +57,55 @@ public class DocService {
sysConfigService.save(systemConfigDTOS);
}
public void addDocApp(String token) {
if (docAppMapper.checkExist(DocApp::getToken, token)) {
throw new BizException("该应用已添加");
}
public Long addDocApp(String token) {
TornaModuleDTO tornaModuleDTO = tornaClient.execute("module.get", null, token, TornaModuleDTO.class);
DocApp docApp = new DocApp();
docApp.setAppName(tornaModuleDTO.getName());
docApp.setToken(token);
docAppMapper.saveIgnoreNull(docApp);
DocApp docApp = docAppService.get(DocApp::getToken, token);
if (docApp == null) {
docApp = new DocApp();
docApp.setAppName(tornaModuleDTO.getName());
docApp.setToken(token);
docAppService.save(docApp);
} else {
docApp.setAppName(tornaModuleDTO.getName());
docAppService.update(docApp);
}
// 同步文档
docInfoService.syncDocInfo(docApp.getId());
return docApp.getId();
}
public List<DocAppDTO> listDocApp() {
List<DocApp> docApps = docAppMapper.listAll();
List<DocApp> docApps = docAppService.listAll();
return CopyUtil.copyList(docApps, DocAppDTO::new);
}
public List<DocInfoTreeDTO> listDocTree(Long docAppId) {
List<DocInfo> list = docInfoService.list(DocInfo::getDocAppId, docAppId);
if (CollectionUtils.isEmpty(list)) {
return new ArrayList<>(0);
}
List<DocInfoTreeDTO> docInfoTreeDTOS = CopyUtil.copyList(list, DocInfoTreeDTO::new);
return TreeUtil.convertTree(docInfoTreeDTOS, 0L);
}
public int publish(DocInfoPublishUpdateDTO docInfoUpdateDTO) {
DocInfo docInfo = docInfoService.getById(docInfoUpdateDTO.getId());
// 如果是文件夹,发布下面所有的文档
if (YesOrNoEnum.of(docInfo.getIsFolder()) == YesOrNoEnum.YES) {
List<DocInfo> children = this.docInfoService.listChildDoc(docInfo.getDocId());
Set<Long> ids = children.stream().map(DocInfo::getId).collect(Collectors.toSet());
return docInfoService.query()
.in(DocInfo::getId, ids)
.set(DocInfo::getIsPublish, docInfoUpdateDTO.getIsPublish())
.update();
} else {
// 发布单个文档
return docInfoService.query()
.eq(DocInfo::getId, docInfoUpdateDTO.getId())
.set(DocInfo::getIsPublish, docInfoUpdateDTO.getIsPublish())
.update();
}
}
}

View File

@@ -1,6 +1,7 @@
package com.gitee.sop.adminbackend.service.doc;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.gitee.httphelper.HttpHelper;
import com.gitee.sop.adminbackend.common.enums.ConfigKeyEnum;
@@ -10,6 +11,7 @@ import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import java.io.IOException;
import java.util.List;
import java.util.Objects;
/**
@@ -19,6 +21,16 @@ import java.util.Objects;
public class TornaClient {
public <T> T execute(String name, Object param, String token, Class<T> respClass) {
JSONObject data = request(name, param, token).getJSONObject("data");
return data.toJavaObject(respClass);
}
public <T> List<T> executeList(String name, Object param, String token, Class<T> respClass) {
JSONArray data = request(name, param, token).getJSONArray("data");
return data.toList(respClass);
}
private JSONObject request(String name, Object param, String token) {
try {
HttpHelper httpHelper = HttpHelper.get(getTornaApiUrl())
.parameter("name", name)
@@ -33,8 +45,7 @@ public class TornaClient {
if (!Objects.equals("0", jsonObject.getString("code"))) {
throw new BizException(jsonObject.getString("msg"));
}
JSONObject data = jsonObject.getJSONObject("data");
return data.toJavaObject(respClass);
return jsonObject;
} catch (IOException e) {
throw new RuntimeException(e);
}

View File

@@ -1,11 +1,7 @@
package com.gitee.sop.adminbackend.service.website.dto;
package com.gitee.sop.adminbackend.service.doc.dto;
import java.time.LocalDateTime;
import com.gitee.fastmybatis.annotation.Pk;
import com.gitee.fastmybatis.annotation.PkStrategy;
import com.gitee.fastmybatis.annotation.Table;
import lombok.Data;

View File

@@ -0,0 +1,18 @@
package com.gitee.sop.adminbackend.service.doc.dto;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @author 六如
*/
@Data
public class DocInfoPublishUpdateDTO {
@NotNull
private Long id;
private Integer isPublish;
}

View File

@@ -1,4 +1,4 @@
package com.gitee.sop.adminbackend.service.website.dto;
package com.gitee.sop.adminbackend.service.doc.dto;
import com.gitee.fastmybatis.core.support.TreeNode;
import lombok.Data;
@@ -30,6 +30,11 @@ public class DocInfoTreeDTO implements TreeNode<DocInfoTreeDTO, Long> {
*/
private Long docId;
/**
* 文档标题
*/
private String docTitle;
/**
* 文档code
*/
@@ -50,6 +55,11 @@ public class DocInfoTreeDTO implements TreeNode<DocInfoTreeDTO, Long> {
*/
private String docName;
/**
* 版本号
*/
private String docVersion;
/**
* 描述
*/
@@ -95,7 +105,7 @@ public class DocInfoTreeDTO implements TreeNode<DocInfoTreeDTO, Long> {
@Override
public Long takeId() {
return id;
return docId;
}
@Override

View File

@@ -0,0 +1,15 @@
package com.gitee.sop.adminbackend.service.doc.dto;
import lombok.Data;
import java.util.List;
/**
* @author 六如
*/
@Data
public class TornaDocDTO {
private List<TornaDocInfoDTO> docList;
}

View File

@@ -0,0 +1,62 @@
package com.gitee.sop.adminbackend.service.doc.dto;
import lombok.Data;
/**
* @author tanghc
*/
@Data
public class TornaDocInfoDTO {
private Long id;
/**
* 文档名称
*/
private String name;
/**
* 文档概述
*/
private String description;
/**
* 访问URL
*/
private String url;
/**
* 版本号
*/
private String version;
/**
* http方法
*/
private String httpMethod;
/**
* contentType
*/
private String contentType;
/**
* 文档类型,0:http,1:dubbo,2:富文本,3:Markdown
*/
private Byte type;
/**
* 是否是分类0不是1
*/
private Byte isFolder;
/**
* 父节点
*/
private Long parentId;
/**
* 是否显示
*/
private Byte isShow;
}

View File

@@ -100,7 +100,7 @@ public class IsvInfoService implements LambdaService<IsvInfo, IsvInfoMapper> {
IsvInfo rec = CopyUtil.copyBean(isvInfoAddDTO, IsvInfo::new);
String appKey = new SimpleDateFormat("yyyyMMdd").format(new Date()) + IdGen.nextId();
rec.setAppId(appKey);
rec.setStatus(StatusEnum.ENABLE.getStatus());
rec.setStatus(StatusEnum.ENABLE.getValue());
this.save(rec);
this.sendChangeEvent(rec.getId());
return rec.getId();

View File

@@ -122,7 +122,7 @@ public class LoginService {
userInfo.setPassword(GenerateUtil.getUUID());
userInfo.setNickname(loginResult.getNickname());
userInfo.setAvatar("");
userInfo.setStatus(StatusEnum.ENABLE.getStatus());
userInfo.setStatus(StatusEnum.ENABLE.getValue());
userInfo.setRegType(loginResult.getRegTypeEnum().getValue());
userInfo.setEmail(loginResult.getEmail());
sysAdminUserService.save(userInfo);

View File

@@ -75,7 +75,7 @@ public class DefaultUserCacheManager implements UserCacheManager, InitializingBe
log.warn("登录用户不存在userId{}", id);
return null;
}
if (userInfo.getStatus() == StatusEnum.DISABLED.getStatus()) {
if (userInfo.getStatus() == StatusEnum.DISABLED.getValue()) {
log.warn("用户被禁用, userId:{}, username:{}, nickname:{}", userInfo.getId(), userInfo.getUsername(), userInfo.getNickname());
return null;
}

View File

@@ -6,8 +6,8 @@ import com.gitee.sop.adminbackend.dao.entity.DocApp;
import com.gitee.sop.adminbackend.dao.entity.DocInfo;
import com.gitee.sop.adminbackend.dao.mapper.DocAppMapper;
import com.gitee.sop.adminbackend.dao.mapper.DocInfoMapper;
import com.gitee.sop.adminbackend.service.website.dto.DocAppDTO;
import com.gitee.sop.adminbackend.service.website.dto.DocInfoTreeDTO;
import com.gitee.sop.adminbackend.service.doc.dto.DocAppDTO;
import com.gitee.sop.adminbackend.service.doc.dto.DocInfoTreeDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;