mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 12:56:28 +08:00
5.0
This commit is contained in:
@@ -3,9 +3,12 @@ package com.gitee.sop.adminbackend.config;
|
||||
import com.gitee.sop.adminbackend.common.context.SpringContext;
|
||||
import com.gitee.sop.adminbackend.common.util.SystemUtil;
|
||||
import com.gitee.sop.adminbackend.interceptor.LoginInterceptor;
|
||||
import com.gitee.sop.adminbackend.service.sys.UserCacheService;
|
||||
import com.gitee.sop.adminbackend.service.sys.impl.LocalUserCacheService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -33,6 +36,12 @@ public class SopAdminConfiguration implements ApplicationContextAware, WebMvcCon
|
||||
SpringContext.setApplicationContext(applicationContext);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "user.cache.type", havingValue = "local", matchIfMissing = true)
|
||||
public UserCacheService userCacheService() {
|
||||
return new LocalUserCacheService();
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置拦截器
|
||||
*
|
||||
@@ -84,10 +93,10 @@ public class SopAdminConfiguration implements ApplicationContextAware, WebMvcCon
|
||||
frontRoot = homeDir + "/dist";
|
||||
}
|
||||
log.info("前端资源目录:{}", frontRoot);
|
||||
String frontLocation = "file:" + frontRoot;
|
||||
registry.addResourceHandler("/index.html").addResourceLocations(frontLocation + "/index.html");
|
||||
registry.addResourceHandler("/favicon.ico").addResourceLocations(frontLocation + "/favicon.ico");
|
||||
registry.addResourceHandler("/static/**").addResourceLocations(frontLocation + "/static/");
|
||||
String location = "file:" + frontRoot;
|
||||
registry.addResourceHandler("/index.html").addResourceLocations(location + "/index.html");
|
||||
registry.addResourceHandler("/favicon.ico").addResourceLocations(location + "/favicon.ico");
|
||||
registry.addResourceHandler("/static/**").addResourceLocations(location + "/static/");
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,6 +3,10 @@ spring.profiles.active=dev
|
||||
|
||||
spring.application.name=sop-admin-backend
|
||||
|
||||
####### admin config #######
|
||||
# user cache
|
||||
user.cache.type=local
|
||||
|
||||
dubbo.protocol.name=dubbo
|
||||
dubbo.protocol.port=-1
|
||||
dubbo.application.qos-enable=false
|
||||
|
@@ -88,6 +88,11 @@
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@@ -43,10 +43,10 @@ public class UserContext {
|
||||
|
||||
/**
|
||||
* 获取当前登录用户id
|
||||
* @return 返回id,没有返回-1
|
||||
* @return 返回id,没有返回null
|
||||
*/
|
||||
public static Long getUserId() {
|
||||
return Optional.ofNullable(getUser()).map(User::getUserId).orElse(-1L);
|
||||
return Optional.ofNullable(getUser()).map(User::getUserId).orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -0,0 +1,31 @@
|
||||
package com.gitee.sop.adminbackend.common.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
@Data
|
||||
public class UserDTO {
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private Long addBy;
|
||||
|
||||
/**
|
||||
* 添加人姓名
|
||||
*/
|
||||
private String addByName;
|
||||
|
||||
/**
|
||||
* 修改人id
|
||||
*/
|
||||
private Long updateBy;
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String updateByName;
|
||||
|
||||
}
|
@@ -4,6 +4,7 @@ import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
* @param <T> 参数类型
|
||||
*/
|
||||
public interface IEnum<T extends Serializable> {
|
||||
|
||||
|
@@ -0,0 +1,19 @@
|
||||
package com.gitee.sop.adminbackend.common.resp;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
@Data
|
||||
public class UserVO {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String username;
|
||||
|
||||
private String nickname;
|
||||
|
||||
private String showName;
|
||||
|
||||
}
|
@@ -0,0 +1,54 @@
|
||||
package com.gitee.sop.adminbackend.common.support;
|
||||
|
||||
import com.gitee.fastmybatis.core.mapper.BaseMapper;
|
||||
import com.gitee.fastmybatis.core.query.LambdaQuery;
|
||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||
import com.gitee.sop.adminbackend.common.context.UserContext;
|
||||
import com.gitee.sop.adminbackend.common.util.DateUtil;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @param <E> 实体类
|
||||
* @param <Mapper> Mapper
|
||||
* @author 六如
|
||||
*/
|
||||
public interface ServiceSupport<E, Mapper extends BaseMapper<E>> extends LambdaService<E, Mapper> {
|
||||
|
||||
@Override
|
||||
default LambdaQuery<E> query() {
|
||||
return new MyLambdaQuery<>(this.getEntityClass());
|
||||
}
|
||||
|
||||
class MyLambdaQuery<E> extends LambdaQuery<E> {
|
||||
private static final long serialVersionUID = 5232128649485429495L;
|
||||
|
||||
private static final String UPDATE_BY_FORMAT = "update_by = %s";
|
||||
private static final String UPDATE_TIME_FORMAT = "update_time = '%s'";
|
||||
|
||||
public MyLambdaQuery(Class<E> entityClass) {
|
||||
super(entityClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update() {
|
||||
this.appendUpdate();
|
||||
return super.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete() {
|
||||
this.appendUpdate();
|
||||
return super.delete();
|
||||
}
|
||||
|
||||
private void appendUpdate() {
|
||||
Long userId = UserContext.getUserId();
|
||||
if (userId != null) {
|
||||
this.setExpression(String.format(UPDATE_BY_FORMAT, userId));
|
||||
}
|
||||
this.setExpression(String.format(UPDATE_TIME_FORMAT, DateUtil.formatYmdhms(LocalDateTime.now())));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -12,6 +12,12 @@ public interface User {
|
||||
*/
|
||||
Long getUserId();
|
||||
|
||||
/**
|
||||
* 返回username
|
||||
* @return
|
||||
*/
|
||||
String getUsername();
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
* @return
|
||||
@@ -21,4 +27,9 @@ public interface User {
|
||||
Integer getStatus();
|
||||
|
||||
String getToken();
|
||||
|
||||
default String getShowName() {
|
||||
String nickname = getNickname();
|
||||
return nickname != null && !nickname.isEmpty() ? nickname : getUsername();
|
||||
}
|
||||
}
|
||||
|
@@ -8,8 +8,8 @@ import java.time.format.DateTimeFormatter;
|
||||
*/
|
||||
public class DateUtil {
|
||||
|
||||
static DateTimeFormatter FORMATTER_FRONT = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
|
||||
static DateTimeFormatter FORMATTER_YMDHMS = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
static final DateTimeFormatter FORMATTER_FRONT = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
|
||||
static final DateTimeFormatter FORMATTER_YMDHMS = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
public static String formatFrontDate(LocalDateTime localDateTime) {
|
||||
return FORMATTER_FRONT.format(localDateTime);
|
||||
|
@@ -350,6 +350,14 @@ public class RSATool {
|
||||
public void setPrivateKey(String privateKey) {
|
||||
this.privateKey = privateKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "KeyStore{" +
|
||||
"publicKey='" + publicKey + '\'' +
|
||||
", privateKey='" + privateKey + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@AllArgsConstructor
|
||||
|
@@ -0,0 +1,19 @@
|
||||
package com.gitee.sop.adminbackend.common;
|
||||
|
||||
import com.gitee.sop.adminbackend.common.util.RSATool;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
public class RSAToolTest {
|
||||
|
||||
@Test
|
||||
public void create() throws Exception {
|
||||
RSATool.KeyStore keys = new RSATool(RSATool.KeyFormat.PKCS1, RSATool.KeyLength.LENGTH_2048).createKeys();
|
||||
System.out.println(keys.getPrivateKey());
|
||||
System.out.println(keys.getPublicKey());
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -1,6 +1,7 @@
|
||||
package com.gitee.sop.adminbackend.service.doc;
|
||||
|
||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||
import com.gitee.sop.adminbackend.common.support.ServiceSupport;
|
||||
import com.gitee.sop.adminbackend.common.user.User;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import com.gitee.sop.adminbackend.dao.entity.DocApp;
|
||||
import com.gitee.sop.adminbackend.dao.mapper.DocAppMapper;
|
||||
@@ -16,7 +17,7 @@ import java.util.List;
|
||||
* @author 六如
|
||||
*/
|
||||
@Service
|
||||
public class DocAppService implements LambdaService<DocApp, DocAppMapper> {
|
||||
public class DocAppService implements ServiceSupport<DocApp, DocAppMapper> {
|
||||
|
||||
@Autowired
|
||||
private TornaClient tornaClient;
|
||||
@@ -26,7 +27,7 @@ public class DocAppService implements LambdaService<DocApp, DocAppMapper> {
|
||||
@Autowired
|
||||
private DocInfoSyncService docInfoSyncService;
|
||||
|
||||
public Long addDocApp(String token) {
|
||||
public Long addDocApp(String token, User user) {
|
||||
TornaModuleDTO tornaModuleDTO = tornaClient.execute("module.get", null, token, TornaModuleDTO.class);
|
||||
DocApp docApp = this.get(DocApp::getToken, token);
|
||||
if (docApp == null) {
|
||||
@@ -39,7 +40,7 @@ public class DocAppService implements LambdaService<DocApp, DocAppMapper> {
|
||||
this.update(docApp);
|
||||
}
|
||||
// 同步文档
|
||||
docInfoSyncService.syncDocInfo(docApp, null);
|
||||
docInfoSyncService.syncDocInfo(docApp, null, user);
|
||||
return docApp.getId();
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.gitee.sop.adminbackend.service.doc;
|
||||
|
||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||
import com.gitee.sop.adminbackend.common.support.ServiceSupport;
|
||||
import com.gitee.sop.adminbackend.dao.entity.DocContent;
|
||||
import com.gitee.sop.adminbackend.dao.mapper.DocContentMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -10,7 +10,7 @@ import org.springframework.stereotype.Service;
|
||||
* @author 六如
|
||||
*/
|
||||
@Service
|
||||
public class DocContentService implements LambdaService<DocContent, DocContentMapper> {
|
||||
public class DocContentService implements ServiceSupport<DocContent, DocContentMapper> {
|
||||
|
||||
public void saveContent(Long docInfoId, String content) {
|
||||
DocContent docContent = this.get(DocContent::getDocInfoId, docInfoId);
|
||||
|
@@ -1,10 +1,10 @@
|
||||
package com.gitee.sop.adminbackend.service.doc;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||
import com.gitee.fastmybatis.core.util.TreeUtil;
|
||||
import com.gitee.sop.adminbackend.common.constants.YesOrNo;
|
||||
import com.gitee.sop.adminbackend.common.exception.BizException;
|
||||
import com.gitee.sop.adminbackend.common.support.ServiceSupport;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import com.gitee.sop.adminbackend.dao.entity.DocApp;
|
||||
import com.gitee.sop.adminbackend.dao.entity.DocInfo;
|
||||
@@ -13,6 +13,8 @@ import com.gitee.sop.adminbackend.dao.mapper.DocInfoMapper;
|
||||
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.torna.TornaDocInfoViewDTO;
|
||||
import com.gitee.sop.adminbackend.service.sys.SysUserService;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -27,12 +29,14 @@ import java.util.stream.Collectors;
|
||||
* @author 六如
|
||||
*/
|
||||
@Service
|
||||
public class DocInfoService implements LambdaService<DocInfo, DocInfoMapper> {
|
||||
public class DocInfoService implements ServiceSupport<DocInfo, DocInfoMapper> {
|
||||
|
||||
@Autowired
|
||||
private DocAppMapper docAppMapper;
|
||||
@Autowired
|
||||
private DocContentService docContentService;
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
|
||||
public List<DocInfo> listChildDoc(Long parentId) {
|
||||
return this.list(DocInfo::getParentId, parentId);
|
||||
@@ -43,7 +47,11 @@ public class DocInfoService implements LambdaService<DocInfo, DocInfoMapper> {
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return new ArrayList<>(0);
|
||||
}
|
||||
Set<Long> userIds = list.stream().flatMap(docInfo -> Lists.newArrayList(docInfo.getAddBy(), docInfo.getUpdateBy()).stream())
|
||||
.filter(val -> val != null && val > 0)
|
||||
.collect(Collectors.toSet());
|
||||
List<DocInfoTreeDTO> docInfoTreeDTOS = CopyUtil.copyList(list, DocInfoTreeDTO::new);
|
||||
sysUserService.fillShowName(docInfoTreeDTOS);
|
||||
return TreeUtil.convertTree(docInfoTreeDTOS, 0L);
|
||||
}
|
||||
|
||||
|
@@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSON;
|
||||
import com.gitee.fastmybatis.core.util.TreeUtil;
|
||||
import com.gitee.sop.adminbackend.common.constants.YesOrNo;
|
||||
import com.gitee.sop.adminbackend.common.enums.DocSourceTypeEnum;
|
||||
import com.gitee.sop.adminbackend.common.user.User;
|
||||
import com.gitee.sop.adminbackend.dao.entity.DocApp;
|
||||
import com.gitee.sop.adminbackend.dao.entity.DocInfo;
|
||||
import com.gitee.sop.adminbackend.dao.mapper.DocAppMapper;
|
||||
@@ -42,18 +43,18 @@ public class DocInfoSyncService {
|
||||
@Autowired
|
||||
private DocContentService docContentService;
|
||||
|
||||
public void syncAppDoc(Long docAppId) {
|
||||
public void syncAppDoc(Long docAppId, User user) {
|
||||
DocApp docApp = docAppMapper.getById(docAppId);
|
||||
this.syncDocInfo(docApp, null);
|
||||
this.syncDocInfo(docApp, null, user);
|
||||
}
|
||||
|
||||
public void syncDoc(Long docInfoId) {
|
||||
public void syncDoc(Long docInfoId, User user) {
|
||||
DocInfo docInfo = docInfoService.getById(docInfoId);
|
||||
DocApp docApp = docAppMapper.getById(docInfo.getDocAppId());
|
||||
this.syncDocInfo(docApp, docInfoId);
|
||||
this.syncDocInfo(docApp, docInfoId, user);
|
||||
}
|
||||
|
||||
public void syncDocInfo(DocApp docApp, Long docInfoId) {
|
||||
public void syncDocInfo(DocApp docApp, Long docInfoId, User user) {
|
||||
Long docAppId = docApp.getId();
|
||||
Map<String, DocInfo> nameVersionMap = docInfoService.list(DocInfo::getDocAppId, docAppId)
|
||||
.stream()
|
||||
@@ -86,6 +87,7 @@ public class DocInfoSyncService {
|
||||
docInfo.setDescription(tornaDocInfoDTO.getDescription());
|
||||
docInfo.setIsFolder(tornaDocInfoDTO.getIsFolder().intValue());
|
||||
docInfo.setParentId(tornaDocInfoDTO.getParentId());
|
||||
docInfo.setUpdateBy(user.getUserId());
|
||||
updateList.add(docInfo);
|
||||
}
|
||||
}
|
||||
@@ -118,6 +120,7 @@ public class DocInfoSyncService {
|
||||
docInfo.setDescription(tornaDocInfoDTO.getDescription());
|
||||
docInfo.setIsFolder(tornaDocInfoDTO.getIsFolder().intValue());
|
||||
docInfo.setParentId(tornaDocInfoDTO.getParentId());
|
||||
docInfo.setAddBy(user.getUserId());
|
||||
return docInfo;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
@@ -1,9 +1,9 @@
|
||||
package com.gitee.sop.adminbackend.service.doc.dto;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* 备注:文档应用
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package com.gitee.sop.adminbackend.service.doc.dto;
|
||||
|
||||
import com.gitee.fastmybatis.core.support.TreeNode;
|
||||
import com.gitee.sop.adminbackend.common.dto.UserDTO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@@ -13,7 +14,7 @@ import java.util.List;
|
||||
* @author 六如
|
||||
*/
|
||||
@Data
|
||||
public class DocInfoTreeDTO implements TreeNode<DocInfoTreeDTO, Long> {
|
||||
public class DocInfoTreeDTO extends UserDTO implements TreeNode<DocInfoTreeDTO, Long> {
|
||||
|
||||
/**
|
||||
* id
|
||||
@@ -90,16 +91,6 @@ public class DocInfoTreeDTO implements TreeNode<DocInfoTreeDTO, Long> {
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private Long addBy;
|
||||
|
||||
/**
|
||||
* 修改人id
|
||||
*/
|
||||
private Long updateBy;
|
||||
|
||||
private List<DocInfoTreeDTO> children;
|
||||
|
||||
|
||||
|
@@ -2,12 +2,14 @@ package com.gitee.sop.adminbackend.service.isv;
|
||||
|
||||
import com.gitee.fastmybatis.core.PageInfo;
|
||||
import com.gitee.fastmybatis.core.query.LambdaQuery;
|
||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||
import com.gitee.sop.adminbackend.common.util.RSATool;
|
||||
import com.gitee.sop.adminbackend.common.constants.YesOrNo;
|
||||
import com.gitee.sop.adminbackend.common.context.SpringContext;
|
||||
import com.gitee.sop.adminbackend.common.dto.StatusUpdateDTO;
|
||||
import com.gitee.sop.adminbackend.common.enums.StatusEnum;
|
||||
import com.gitee.sop.adminbackend.common.constants.YesOrNo;
|
||||
import com.gitee.sop.adminbackend.common.support.ServiceSupport;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import com.gitee.sop.adminbackend.common.util.IdGen;
|
||||
import com.gitee.sop.adminbackend.common.util.RSATool;
|
||||
import com.gitee.sop.adminbackend.dao.entity.IsvInfo;
|
||||
import com.gitee.sop.adminbackend.dao.entity.IsvKeys;
|
||||
import com.gitee.sop.adminbackend.dao.mapper.IsvInfoMapper;
|
||||
@@ -17,8 +19,6 @@ import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoUpdateDTO;
|
||||
import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoUpdateKeysDTO;
|
||||
import com.gitee.sop.adminbackend.service.isv.dto.IsvKeysDTO;
|
||||
import com.gitee.sop.adminbackend.service.isv.event.ChangeIsvInfoEvent;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import com.gitee.sop.adminbackend.common.util.IdGen;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -38,7 +38,7 @@ import java.util.stream.Collectors;
|
||||
* @author 六如
|
||||
*/
|
||||
@Service
|
||||
public class IsvInfoService implements LambdaService<IsvInfo, IsvInfoMapper> {
|
||||
public class IsvInfoService implements ServiceSupport<IsvInfo, IsvInfoMapper> {
|
||||
|
||||
@Autowired
|
||||
private IsvKeysService isvKeysService;
|
||||
@@ -107,11 +107,11 @@ public class IsvInfoService implements LambdaService<IsvInfo, IsvInfoMapper> {
|
||||
}
|
||||
|
||||
public int update(IsvInfoUpdateDTO isvInfoUpdateDTO) {
|
||||
int cnt = this.query()
|
||||
.eq(IsvInfo::getId, isvInfoUpdateDTO.getId())
|
||||
.set(IsvInfo::getStatus, isvInfoUpdateDTO.getStatus())
|
||||
.set(IsvInfo::getRemark, isvInfoUpdateDTO.getRemark())
|
||||
.update();
|
||||
IsvInfo isvInfo = new IsvInfo();
|
||||
isvInfo.setId(isvInfoUpdateDTO.getId());
|
||||
isvInfo.setStatus(isvInfoUpdateDTO.getStatus());
|
||||
isvInfo.setRemark(isvInfoUpdateDTO.getRemark());
|
||||
int cnt = this.update(isvInfo);
|
||||
sendChangeEvent(isvInfoUpdateDTO.getId());
|
||||
return cnt;
|
||||
}
|
||||
|
@@ -1,12 +1,12 @@
|
||||
package com.gitee.sop.adminbackend.service.isv;
|
||||
|
||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||
import com.gitee.sop.adminbackend.common.context.SpringContext;
|
||||
import com.gitee.sop.adminbackend.common.support.ServiceSupport;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import com.gitee.sop.adminbackend.dao.entity.IsvKeys;
|
||||
import com.gitee.sop.adminbackend.dao.mapper.IsvKeysMapper;
|
||||
import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoUpdateKeysDTO;
|
||||
import com.gitee.sop.adminbackend.service.isv.event.ChangeIsvKeyEvent;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -16,7 +16,7 @@ import java.util.Collections;
|
||||
* @author 六如
|
||||
*/
|
||||
@Service
|
||||
public class IsvKeysService implements LambdaService<IsvKeys, IsvKeysMapper> {
|
||||
public class IsvKeysService implements ServiceSupport<IsvKeys, IsvKeysMapper> {
|
||||
|
||||
public int saveKeys(IsvInfoUpdateKeysDTO isvInfoUpdateKeysDTO) {
|
||||
IsvKeys isvKeys = this.get(IsvKeys::getIsvId, isvInfoUpdateKeysDTO.getIsvId());
|
||||
|
@@ -2,8 +2,8 @@ package com.gitee.sop.adminbackend.service.isv;
|
||||
|
||||
import com.gitee.fastmybatis.core.PageInfo;
|
||||
import com.gitee.fastmybatis.core.query.LambdaQuery;
|
||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||
import com.gitee.sop.adminbackend.common.context.SpringContext;
|
||||
import com.gitee.sop.adminbackend.common.support.ServiceSupport;
|
||||
import com.gitee.sop.adminbackend.dao.entity.ApiInfo;
|
||||
import com.gitee.sop.adminbackend.dao.entity.PermGroupPermission;
|
||||
import com.gitee.sop.adminbackend.dao.entity.PermIsvGroup;
|
||||
@@ -25,7 +25,7 @@ import java.util.stream.Collectors;
|
||||
* @author 六如
|
||||
*/
|
||||
@Service
|
||||
public class PermGroupPermissionService implements LambdaService<PermGroupPermission, PermGroupPermissionMapper> {
|
||||
public class PermGroupPermissionService implements ServiceSupport<PermGroupPermission, PermGroupPermissionMapper> {
|
||||
|
||||
@Autowired
|
||||
private ApiInfoMapper apiInfoMapper;
|
||||
|
@@ -2,8 +2,8 @@ package com.gitee.sop.adminbackend.service.isv;
|
||||
|
||||
import com.gitee.fastmybatis.core.PageInfo;
|
||||
import com.gitee.fastmybatis.core.query.LambdaQuery;
|
||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||
import com.gitee.sop.adminbackend.common.exception.BizException;
|
||||
import com.gitee.sop.adminbackend.common.support.ServiceSupport;
|
||||
import com.gitee.sop.adminbackend.dao.entity.PermGroup;
|
||||
import com.gitee.sop.adminbackend.dao.entity.PermIsvGroup;
|
||||
import com.gitee.sop.adminbackend.dao.mapper.PermGroupMapper;
|
||||
@@ -19,7 +19,7 @@ import java.util.Map;
|
||||
* @author 六如
|
||||
*/
|
||||
@Service
|
||||
public class PermGroupService implements LambdaService<PermGroup, PermGroupMapper> {
|
||||
public class PermGroupService implements ServiceSupport<PermGroup, PermGroupMapper> {
|
||||
|
||||
@Autowired
|
||||
PermIsvGroupMapper permIsvGroupMapper;
|
||||
|
@@ -2,7 +2,7 @@ package com.gitee.sop.adminbackend.service.isv;
|
||||
|
||||
import com.gitee.fastmybatis.core.PageInfo;
|
||||
import com.gitee.fastmybatis.core.query.LambdaQuery;
|
||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||
import com.gitee.sop.adminbackend.common.support.ServiceSupport;
|
||||
import com.gitee.sop.adminbackend.dao.entity.PermIsvGroup;
|
||||
import com.gitee.sop.adminbackend.dao.mapper.PermIsvGroupMapper;
|
||||
import com.gitee.sop.adminbackend.service.isv.dto.IsvGroupSettingDTO;
|
||||
@@ -24,7 +24,7 @@ import java.util.stream.Collectors;
|
||||
* @author 六如
|
||||
*/
|
||||
@Service
|
||||
public class PermIsvGroupService implements LambdaService<PermIsvGroup, PermIsvGroupMapper> {
|
||||
public class PermIsvGroupService implements ServiceSupport<PermIsvGroup, PermIsvGroupMapper> {
|
||||
|
||||
@Autowired
|
||||
private PermGroupService permGroupService;
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.gitee.sop.adminbackend.service.isv.dto;
|
||||
|
||||
import com.gitee.sop.adminbackend.service.jackson.convert.annotation.UserFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@@ -40,5 +41,16 @@ public class IsvInfoDTO {
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@UserFormat
|
||||
private Long addBy;
|
||||
|
||||
/**
|
||||
* 修改人id
|
||||
*/
|
||||
@UserFormat
|
||||
private Long updateBy;
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,31 @@
|
||||
package com.gitee.sop.adminbackend.service.jackson.convert.annotation;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.gitee.sop.adminbackend.service.jackson.convert.serde.UserFormatSerializer;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 序列化自动转换成用户名称
|
||||
*
|
||||
* @author 六如
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
@JacksonAnnotationsInside
|
||||
@JsonSerialize(using = UserFormatSerializer.class)
|
||||
public @interface UserFormat {
|
||||
|
||||
/**
|
||||
* 显示用户名称
|
||||
* @return
|
||||
*/
|
||||
boolean showName() default true;
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
package com.gitee.sop.adminbackend.service.jackson.convert.serde;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import com.gitee.sop.adminbackend.common.context.SpringContext;
|
||||
import com.gitee.sop.adminbackend.common.resp.UserVO;
|
||||
import com.gitee.sop.adminbackend.common.user.User;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import com.gitee.sop.adminbackend.service.sys.UserCacheService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
@Slf4j
|
||||
public class UserFormatSerializer extends JsonSerializer<Object> {
|
||||
|
||||
@Override
|
||||
public void serialize(Object value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
|
||||
if (value == null) {
|
||||
gen.writeNull();
|
||||
return;
|
||||
}
|
||||
Long userId = (Long) value;
|
||||
if (Objects.equals(userId, 0L)) {
|
||||
gen.writeNumber(userId);
|
||||
return;
|
||||
}
|
||||
Optional<User> userOpt = SpringContext.getBean(UserCacheService.class).getUser(userId);
|
||||
if (userOpt.isPresent()) {
|
||||
User user = userOpt.get();
|
||||
UserVO userVO = CopyUtil.copyBean(user, UserVO::new);
|
||||
gen.writeObject(userVO);
|
||||
} else {
|
||||
gen.writeObject(value);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1 @@
|
||||
package com.gitee.sop.adminbackend.service.jackson;
|
@@ -1,8 +1,8 @@
|
||||
package com.gitee.sop.adminbackend.service.serve;
|
||||
|
||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||
import com.gitee.sop.adminbackend.common.context.SpringContext;
|
||||
import com.gitee.sop.adminbackend.common.dto.StatusUpdateDTO;
|
||||
import com.gitee.sop.adminbackend.common.support.ServiceSupport;
|
||||
import com.gitee.sop.adminbackend.dao.entity.ApiInfo;
|
||||
import com.gitee.sop.adminbackend.dao.mapper.ApiInfoMapper;
|
||||
import com.gitee.sop.adminbackend.service.isv.event.ChangeApiInfoEvent;
|
||||
@@ -15,7 +15,7 @@ import java.util.Collections;
|
||||
* @author 六如
|
||||
*/
|
||||
@Service
|
||||
public class ApiInfoService implements LambdaService<ApiInfo, ApiInfoMapper> {
|
||||
public class ApiInfoService implements ServiceSupport<ApiInfo, ApiInfoMapper> {
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
@@ -34,11 +34,13 @@ public class ApiInfoService implements LambdaService<ApiInfo, ApiInfoMapper> {
|
||||
|
||||
@Override
|
||||
public int update(ApiInfo entity) {
|
||||
int cnt = LambdaService.super.update(entity);
|
||||
int cnt = ServiceSupport.super.update(entity);
|
||||
sendChangeEvent(entity.getId());
|
||||
return cnt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void sendChangeEvent(Long id) {
|
||||
SpringContext.publishEvent(new ChangeApiInfoEvent(Collections.singletonList(id)));
|
||||
}
|
||||
|
@@ -2,10 +2,10 @@ package com.gitee.sop.adminbackend.service.sys;
|
||||
|
||||
import com.gitee.fastmybatis.core.support.BaseLambdaService;
|
||||
import com.gitee.sop.adminbackend.common.config.IConfig;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import com.gitee.sop.adminbackend.dao.entity.SysConfig;
|
||||
import com.gitee.sop.adminbackend.dao.mapper.SysConfigMapper;
|
||||
import com.gitee.sop.adminbackend.service.sys.dto.SystemConfigDTO;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
|
@@ -1,11 +1,10 @@
|
||||
package com.gitee.sop.adminbackend.service.sys;
|
||||
|
||||
import com.gitee.fastmybatis.core.PageInfo;
|
||||
import com.gitee.fastmybatis.core.query.LambdaQuery;
|
||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||
import com.gitee.fastmybatis.core.util.TreeUtil;
|
||||
import com.gitee.sop.adminbackend.common.dto.StatusUpdateDTO;
|
||||
import com.gitee.sop.adminbackend.common.exception.BizException;
|
||||
import com.gitee.sop.adminbackend.common.support.ServiceSupport;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import com.gitee.sop.adminbackend.dao.entity.SysDept;
|
||||
import com.gitee.sop.adminbackend.dao.mapper.SysDeptMapper;
|
||||
@@ -20,7 +19,7 @@ import java.util.Objects;
|
||||
* @author 六如
|
||||
*/
|
||||
@Service
|
||||
public class SysDeptService implements LambdaService<SysDept, SysDeptMapper> {
|
||||
public class SysDeptService implements ServiceSupport<SysDept, SysDeptMapper> {
|
||||
|
||||
public Long addDept(SysDept sysDept) {
|
||||
long count = this.query()
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.gitee.sop.adminbackend.service.sys;
|
||||
|
||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||
import com.gitee.sop.adminbackend.common.support.ServiceSupport;
|
||||
import com.gitee.sop.adminbackend.dao.entity.SysResource;
|
||||
import com.gitee.sop.adminbackend.dao.mapper.SysResourceMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -10,6 +10,6 @@ import org.springframework.stereotype.Service;
|
||||
* @author 六如
|
||||
*/
|
||||
@Service
|
||||
public class SysResourceService implements LambdaService<SysResource, SysResourceMapper> {
|
||||
public class SysResourceService implements ServiceSupport<SysResource, SysResourceMapper> {
|
||||
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.gitee.sop.adminbackend.service.sys;
|
||||
|
||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||
import com.gitee.sop.adminbackend.common.support.ServiceSupport;
|
||||
import com.gitee.sop.adminbackend.dao.entity.SysRoleResource;
|
||||
import com.gitee.sop.adminbackend.dao.mapper.SysRoleResourceMapper;
|
||||
import com.gitee.sop.adminbackend.service.sys.dto.SysRoleResourceDTO;
|
||||
@@ -16,7 +16,7 @@ import java.util.stream.Collectors;
|
||||
* @author 六如
|
||||
*/
|
||||
@Service
|
||||
public class SysRoleResourceService implements LambdaService<SysRoleResource, SysRoleResourceMapper> {
|
||||
public class SysRoleResourceService implements ServiceSupport<SysRoleResource, SysRoleResourceMapper> {
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.gitee.sop.adminbackend.service.sys;
|
||||
|
||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||
import com.gitee.sop.adminbackend.common.dto.StatusUpdateDTO;
|
||||
import com.gitee.sop.adminbackend.common.support.ServiceSupport;
|
||||
import com.gitee.sop.adminbackend.dao.entity.SysRole;
|
||||
import com.gitee.sop.adminbackend.dao.mapper.SysRoleMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -11,7 +11,7 @@ import org.springframework.stereotype.Service;
|
||||
* @author 六如
|
||||
*/
|
||||
@Service
|
||||
public class SysRoleService implements LambdaService<SysRole, SysRoleMapper> {
|
||||
public class SysRoleService implements ServiceSupport<SysRole, SysRoleMapper> {
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.gitee.sop.adminbackend.service.sys;
|
||||
|
||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||
import com.gitee.sop.adminbackend.common.support.ServiceSupport;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import com.gitee.sop.adminbackend.dao.entity.SysDept;
|
||||
import com.gitee.sop.adminbackend.dao.entity.SysUserDept;
|
||||
@@ -25,7 +25,7 @@ import java.util.stream.Collectors;
|
||||
* @author 六如
|
||||
*/
|
||||
@Service
|
||||
public class SysUserDeptService implements LambdaService<SysUserDept, SysUserDeptMapper> {
|
||||
public class SysUserDeptService implements ServiceSupport<SysUserDept, SysUserDeptMapper> {
|
||||
|
||||
@Autowired
|
||||
SysDeptMapper sysDeptMapper;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.gitee.sop.adminbackend.service.sys;
|
||||
|
||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||
import com.gitee.sop.adminbackend.common.support.ServiceSupport;
|
||||
import com.gitee.sop.adminbackend.common.user.User;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import com.gitee.sop.adminbackend.dao.entity.SysRole;
|
||||
@@ -22,7 +22,7 @@ import java.util.stream.Collectors;
|
||||
* @author 六如
|
||||
*/
|
||||
@Service
|
||||
public class SysUserRoleService implements LambdaService<SysUserRole, SysUserRoleMapper> {
|
||||
public class SysUserRoleService implements ServiceSupport<SysUserRole, SysUserRoleMapper> {
|
||||
|
||||
@Autowired
|
||||
private SysRoleMapper sysRoleMapper;
|
||||
|
@@ -2,11 +2,12 @@ package com.gitee.sop.adminbackend.service.sys;
|
||||
|
||||
import com.gitee.fastmybatis.core.PageInfo;
|
||||
import com.gitee.fastmybatis.core.query.LambdaQuery;
|
||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||
import com.gitee.sop.adminbackend.common.config.Configs;
|
||||
import com.gitee.sop.adminbackend.common.dto.StatusUpdateBatchDTO;
|
||||
import com.gitee.sop.adminbackend.common.dto.StatusUpdateDTO;
|
||||
import com.gitee.sop.adminbackend.common.dto.UserDTO;
|
||||
import com.gitee.sop.adminbackend.common.enums.ConfigKeyEnum;
|
||||
import com.gitee.sop.adminbackend.common.support.ServiceSupport;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import com.gitee.sop.adminbackend.common.util.GenerateUtil;
|
||||
import com.gitee.sop.adminbackend.dao.entity.SysUser;
|
||||
@@ -24,6 +25,7 @@ import org.springframework.security.crypto.bcrypt.BCrypt;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -35,11 +37,40 @@ import java.util.stream.Collectors;
|
||||
* @author 六如
|
||||
*/
|
||||
@Service
|
||||
public class SysUserService implements LambdaService<SysUser, SysUserMapper> {
|
||||
public class SysUserService implements ServiceSupport<SysUser, SysUserMapper> {
|
||||
|
||||
@Autowired
|
||||
SysUserDeptService sysUserDeptService;
|
||||
|
||||
public <T extends UserDTO> void fillShowName(Collection<T> userDTOS) {
|
||||
if (CollectionUtils.isEmpty(userDTOS)) {
|
||||
return;
|
||||
}
|
||||
Set<Long> userIds = userDTOS.stream().flatMap(docInfo -> Lists.newArrayList(docInfo.getAddBy(), docInfo.getUpdateBy()).stream())
|
||||
.filter(val -> val != null && val > 0)
|
||||
.collect(Collectors.toSet());
|
||||
Map<Long, SysUserDTO> userIdMap = this.getUserInfo(userIds);
|
||||
for (T userDTO : userDTOS) {
|
||||
SysUserDTO addUser = userIdMap.get(userDTO.getAddBy());
|
||||
if (addUser != null) {
|
||||
userDTO.setAddByName(addUser.getShowName());
|
||||
}
|
||||
SysUserDTO updateUser = userIdMap.get(userDTO.getUpdateBy());
|
||||
if (updateUser != null) {
|
||||
userDTO.setUpdateByName(updateUser.getShowName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Map<Long, SysUserDTO> getUserInfo(Collection<Long> userIds) {
|
||||
if (CollectionUtils.isEmpty(userIds)) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
return this.query()
|
||||
.in(SysUser::getId, userIds)
|
||||
.map(SysUser::getId, sysUser -> CopyUtil.copyBean(sysUser, SysUserDTO::new));
|
||||
}
|
||||
|
||||
public PageInfo<SysUserDTO> doPage(SysUserSearchDTO sysUserSearchDTO) {
|
||||
LambdaQuery<SysUser> query = sysUserSearchDTO.toLambdaQuery(SysUser.class);
|
||||
Long deptId = sysUserSearchDTO.getDeptId();
|
||||
|
@@ -1,10 +1,10 @@
|
||||
package com.gitee.sop.adminbackend.service.sys;
|
||||
|
||||
import com.gitee.sop.adminbackend.common.enums.ConfigKeyEnum;
|
||||
import com.gitee.sop.adminbackend.common.util.PasswordUtil;
|
||||
import com.gitee.sop.adminbackend.dao.entity.SysUser;
|
||||
import com.gitee.sop.adminbackend.dao.mapper.UpgradeMapper;
|
||||
import com.gitee.sop.adminbackend.service.sys.login.enums.RegTypeEnum;
|
||||
import com.gitee.sop.adminbackend.common.util.PasswordUtil;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@@ -0,0 +1,14 @@
|
||||
package com.gitee.sop.adminbackend.service.sys;
|
||||
|
||||
import com.gitee.sop.adminbackend.common.user.User;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
public interface UserCacheService {
|
||||
|
||||
Optional<User> getUser(Long userId);
|
||||
|
||||
}
|
@@ -3,7 +3,6 @@ package com.gitee.sop.adminbackend.service.sys.dto;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.gitee.fastmybatis.core.support.TreeNode;
|
||||
import com.gitee.sop.adminbackend.common.jackson.convert.annotation.Bool;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
@@ -1,9 +1,8 @@
|
||||
package com.gitee.sop.adminbackend.service.sys.dto;
|
||||
|
||||
import com.gitee.sop.adminbackend.common.user.User;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
@@ -12,7 +11,7 @@ import java.time.LocalDateTime;
|
||||
* @author 六如
|
||||
*/
|
||||
@Data
|
||||
public class SysUserDTO {
|
||||
public class SysUserDTO implements User {
|
||||
|
||||
/**
|
||||
* id
|
||||
@@ -94,5 +93,17 @@ public class SysUserDTO {
|
||||
*/
|
||||
private SysDeptDTO dept;
|
||||
|
||||
|
||||
@Override
|
||||
public Long getUserId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToken() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getShowName() {
|
||||
return nickname != null && !nickname.isEmpty() ? nickname : username;
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,9 @@
|
||||
package com.gitee.sop.adminbackend.service.sys.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -0,0 +1,56 @@
|
||||
package com.gitee.sop.adminbackend.service.sys.impl;
|
||||
|
||||
import com.gitee.sop.adminbackend.common.user.User;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import com.gitee.sop.adminbackend.dao.entity.SysUser;
|
||||
import com.gitee.sop.adminbackend.service.sys.SysUserService;
|
||||
import com.gitee.sop.adminbackend.service.sys.UserCacheService;
|
||||
import com.gitee.sop.adminbackend.service.sys.dto.SysUserDTO;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
public class LocalUserCacheService implements UserCacheService {
|
||||
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
|
||||
// key: configKey, value: configValue
|
||||
private final LoadingCache<Long, Optional<User>> configCache = CacheBuilder.newBuilder()
|
||||
.expireAfterAccess(30, TimeUnit.MINUTES)
|
||||
.build(new CacheLoader<Long, Optional<User>>() {
|
||||
@Override
|
||||
public Optional<User> load(Long key) throws Exception {
|
||||
return Optional.ofNullable(loadFromDb(key));
|
||||
}
|
||||
});
|
||||
|
||||
@Override
|
||||
public Optional<User> getUser(Long userId) {
|
||||
return configCache.getUnchecked(userId);
|
||||
}
|
||||
|
||||
private User loadFromDb(Long userId) {
|
||||
SysUser sysUser = sysUserService.getById(userId);
|
||||
return CopyUtil.copyBean(sysUser, SysUserDTO::new);
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
List<SysUser> sysUsers = sysUserService.listAll();
|
||||
List<SysUserDTO> sysUserDTOS = CopyUtil.copyList(sysUsers, SysUserDTO::new);
|
||||
for (SysUserDTO sysUserDTO : sysUserDTOS) {
|
||||
configCache.put(sysUserDTO.getUserId(), Optional.of(sysUserDTO));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -1,12 +1,12 @@
|
||||
package com.gitee.sop.adminbackend.service.sys.login.impl;
|
||||
|
||||
import com.gitee.sop.adminbackend.common.user.User;
|
||||
import com.gitee.sop.adminbackend.common.enums.StatusEnum;
|
||||
import com.gitee.sop.adminbackend.common.manager.UserCacheManager;
|
||||
import com.gitee.sop.adminbackend.common.user.User;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import com.gitee.sop.adminbackend.dao.entity.SysUser;
|
||||
import com.gitee.sop.adminbackend.service.sys.SysUserService;
|
||||
import com.gitee.sop.adminbackend.common.manager.UserCacheManager;
|
||||
import com.gitee.sop.adminbackend.service.sys.login.dto.LoginUser;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.gitee.sop.adminbackend.controller.doc;
|
||||
|
||||
import com.gitee.sop.adminbackend.common.context.UserContext;
|
||||
import com.gitee.sop.adminbackend.common.req.IdParam;
|
||||
import com.gitee.sop.adminbackend.common.resp.Result;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
@@ -47,19 +48,19 @@ public class DocController {
|
||||
|
||||
@PostMapping("app/add")
|
||||
public Result<Long> addApp(@Validated @RequestBody DocAppAddParam param) {
|
||||
Long docAppId = docAppService.addDocApp(param.getTornaToken());
|
||||
Long docAppId = docAppService.addDocApp(param.getTornaToken(), UserContext.getUser());
|
||||
return Result.ok(docAppId);
|
||||
}
|
||||
|
||||
@PostMapping("app/syncAppDoc")
|
||||
public Result<Integer> syncAppDoc(@Validated @RequestBody IdParam param) {
|
||||
docInfoSyncService.syncAppDoc(param.getId());
|
||||
docInfoSyncService.syncAppDoc(param.getId(), UserContext.getUser());
|
||||
return Result.ok(1);
|
||||
}
|
||||
|
||||
@PostMapping("app/syncDoc")
|
||||
public Result<Integer> syncDoc(@Validated @RequestBody IdParam param) {
|
||||
docInfoSyncService.syncDoc(param.getId());
|
||||
docInfoSyncService.syncDoc(param.getId(), UserContext.getUser());
|
||||
return Result.ok(1);
|
||||
}
|
||||
|
||||
|
@@ -2,6 +2,7 @@ package com.gitee.sop.adminbackend.controller.doc.vo;
|
||||
|
||||
import com.gitee.fastmybatis.core.support.TreeNode;
|
||||
import com.gitee.sop.adminbackend.common.constants.YesOrNo;
|
||||
import com.gitee.sop.adminbackend.service.jackson.convert.annotation.UserFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@@ -95,11 +96,13 @@ public class DocInfoTreeVO implements TreeNode<DocInfoTreeVO, Long> {
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@UserFormat
|
||||
private Long addBy;
|
||||
|
||||
/**
|
||||
* 修改人id
|
||||
*/
|
||||
@UserFormat
|
||||
private Long updateBy;
|
||||
|
||||
|
||||
|
@@ -3,14 +3,16 @@ package com.gitee.sop.adminbackend.controller.isv;
|
||||
import com.gitee.fastmybatis.core.PageInfo;
|
||||
import com.gitee.fastmybatis.core.query.LambdaQuery;
|
||||
import com.gitee.fastmybatis.core.query.param.PageParam;
|
||||
import com.gitee.sop.adminbackend.common.util.RSATool;
|
||||
import com.gitee.sop.adminbackend.common.dto.StatusUpdateDTO;
|
||||
import com.gitee.sop.adminbackend.common.req.StatusUpdateParam;
|
||||
import com.gitee.sop.adminbackend.common.resp.Result;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import com.gitee.sop.adminbackend.common.util.RSATool;
|
||||
import com.gitee.sop.adminbackend.controller.isv.param.IsvInfoAddParam;
|
||||
import com.gitee.sop.adminbackend.controller.isv.param.IsvInfoUpdateKeysParam;
|
||||
import com.gitee.sop.adminbackend.controller.isv.param.IsvInfoUpdateParam;
|
||||
import com.gitee.sop.adminbackend.controller.isv.param.IsvKeysGenParam;
|
||||
import com.gitee.sop.adminbackend.controller.isv.vo.IsvInfoVO;
|
||||
import com.gitee.sop.adminbackend.dao.entity.IsvInfo;
|
||||
import com.gitee.sop.adminbackend.service.isv.IsvInfoService;
|
||||
import com.gitee.sop.adminbackend.service.isv.PermIsvGroupService;
|
||||
@@ -19,7 +21,6 @@ import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoDTO;
|
||||
import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoUpdateDTO;
|
||||
import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoUpdateKeysDTO;
|
||||
import com.gitee.sop.adminbackend.service.isv.dto.IsvKeysDTO;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -49,10 +50,11 @@ public class IsvInfoController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public Result<PageInfo<IsvInfoDTO>> page(PageParam param) {
|
||||
public Result<PageInfo<IsvInfoVO>> page(PageParam param) {
|
||||
LambdaQuery<IsvInfo> query = param.toLambdaQuery(IsvInfo.class);
|
||||
PageInfo<IsvInfoDTO> isvInfoDTOPageInfo = isvInfoService.doPage(query);
|
||||
return Result.ok(isvInfoDTOPageInfo);
|
||||
PageInfo<IsvInfoVO> retPage = isvInfoDTOPageInfo.convert(isvInfoDTO -> CopyUtil.copyBean(isvInfoDTO, IsvInfoVO::new));
|
||||
return Result.ok(retPage);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +65,7 @@ public class IsvInfoController {
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("createKeys")
|
||||
public Result<RSATool.KeyStore> createKeys(IsvKeysGenParam param) throws Exception {
|
||||
public Result<RSATool.KeyStore> createKeys(@Validated @RequestBody IsvKeysGenParam param) throws Exception {
|
||||
RSATool.KeyFormat format = RSATool.KeyFormat.of(param.getKeyFormat());
|
||||
RSATool.KeyStore keyStore = isvInfoService.createKeys(format);
|
||||
return Result.ok(keyStore);
|
||||
|
@@ -3,12 +3,12 @@ package com.gitee.sop.adminbackend.controller.isv;
|
||||
import com.gitee.fastmybatis.core.PageInfo;
|
||||
import com.gitee.fastmybatis.core.query.LambdaQuery;
|
||||
import com.gitee.sop.adminbackend.common.resp.Result;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import com.gitee.sop.adminbackend.controller.isv.param.PermGroupApiInfoParam;
|
||||
import com.gitee.sop.adminbackend.controller.isv.param.PermGroupPermissionParam;
|
||||
import com.gitee.sop.adminbackend.dao.entity.ApiInfo;
|
||||
import com.gitee.sop.adminbackend.service.isv.PermGroupPermissionService;
|
||||
import com.gitee.sop.adminbackend.service.isv.dto.PermGroupPermissionDTO;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
@@ -2,11 +2,11 @@ package com.gitee.sop.adminbackend.controller.isv;
|
||||
|
||||
import com.gitee.sop.adminbackend.common.context.SpringContext;
|
||||
import com.gitee.sop.adminbackend.common.resp.Result;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import com.gitee.sop.adminbackend.controller.isv.param.IsvGroupSettingParam;
|
||||
import com.gitee.sop.adminbackend.service.isv.PermIsvGroupService;
|
||||
import com.gitee.sop.adminbackend.service.isv.dto.IsvGroupSettingDTO;
|
||||
import com.gitee.sop.adminbackend.service.isv.event.ChangeIsvPermEvent;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
@@ -0,0 +1,56 @@
|
||||
package com.gitee.sop.adminbackend.controller.isv.vo;
|
||||
|
||||
import com.gitee.sop.adminbackend.service.jackson.convert.annotation.UserFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 六如
|
||||
*/
|
||||
@Data
|
||||
public class IsvInfoVO {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* appKey
|
||||
*/
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* 1启用,2禁用
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 是否有秘钥
|
||||
*/
|
||||
private Integer hasKeys;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
private String groupNames;
|
||||
|
||||
private LocalDateTime addTime;
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@UserFormat
|
||||
private Long addBy;
|
||||
|
||||
/**
|
||||
* 修改人id
|
||||
*/
|
||||
@UserFormat
|
||||
private Long updateBy;
|
||||
|
||||
}
|
@@ -5,10 +5,11 @@ import com.gitee.fastmybatis.core.query.Query;
|
||||
import com.gitee.sop.adminbackend.common.dto.StatusUpdateDTO;
|
||||
import com.gitee.sop.adminbackend.common.req.StatusUpdateParam;
|
||||
import com.gitee.sop.adminbackend.common.resp.Result;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import com.gitee.sop.adminbackend.controller.serve.param.ApiInfoPageParam;
|
||||
import com.gitee.sop.adminbackend.controller.serve.vo.ApiInfoVO;
|
||||
import com.gitee.sop.adminbackend.dao.entity.ApiInfo;
|
||||
import com.gitee.sop.adminbackend.service.serve.ApiInfoService;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -43,6 +44,7 @@ public class ApiInfoController {
|
||||
Query query = param.toQuery();
|
||||
query.orderByDesc("id");
|
||||
PageInfo<ApiInfo> pageInfo = apiInfoService.page(query);
|
||||
pageInfo.convert(apiInfo -> CopyUtil.copyBean(apiInfo, ApiInfoVO::new));
|
||||
return Result.ok(pageInfo);
|
||||
}
|
||||
|
||||
@@ -53,11 +55,11 @@ public class ApiInfoController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/listAll")
|
||||
public Result<List<ApiInfo>> listAll(ApiInfoPageParam param) {
|
||||
public Result<List<ApiInfoVO>> listAll(ApiInfoPageParam param) {
|
||||
Query query = param.toQuery();
|
||||
query.orderByDesc("id");
|
||||
List<ApiInfo> list = apiInfoService.list(query);
|
||||
return Result.ok(list);
|
||||
return Result.ok(CopyUtil.copyList(list, ApiInfoVO::new));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -0,0 +1,107 @@
|
||||
package com.gitee.sop.adminbackend.controller.serve.vo;
|
||||
|
||||
import com.gitee.sop.adminbackend.service.jackson.convert.annotation.UserFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
@Data
|
||||
public class ApiInfoVO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 所属应用
|
||||
*/
|
||||
private String application;
|
||||
|
||||
/**
|
||||
* 接口名称
|
||||
*/
|
||||
private String apiName;
|
||||
|
||||
/**
|
||||
* 版本号
|
||||
*/
|
||||
private String apiVersion;
|
||||
|
||||
/**
|
||||
* 接口描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 接口class
|
||||
*/
|
||||
private String interfaceClassName;
|
||||
|
||||
/**
|
||||
* 方法名称
|
||||
*/
|
||||
private String methodName;
|
||||
|
||||
/**
|
||||
* 参数信息
|
||||
*/
|
||||
private String paramInfo;
|
||||
|
||||
/**
|
||||
* 接口是否需要授权访问
|
||||
*/
|
||||
private Integer isPermission;
|
||||
|
||||
/**
|
||||
* 是否需要appAuthToken
|
||||
*/
|
||||
private Integer isNeedToken;
|
||||
|
||||
/**
|
||||
* 是否有公共响应参数
|
||||
*/
|
||||
private Integer hasCommonResponse;
|
||||
|
||||
/**
|
||||
* 注册来源,1-系统注册,2-手动注册
|
||||
*/
|
||||
private Integer regSource;
|
||||
|
||||
/**
|
||||
* 1启用,0禁用
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
private LocalDateTime addTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@UserFormat
|
||||
private Long addBy;
|
||||
|
||||
/**
|
||||
* 最后更新人id
|
||||
*/
|
||||
@UserFormat
|
||||
private Long updateBy;
|
||||
|
||||
}
|
@@ -2,13 +2,13 @@ package com.gitee.sop.adminbackend.controller.sys;
|
||||
|
||||
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.sys.param.LoginParam;
|
||||
import com.gitee.sop.adminbackend.controller.sys.vo.LoginResultVO;
|
||||
import com.gitee.sop.adminbackend.service.sys.login.LoginService;
|
||||
import com.gitee.sop.adminbackend.service.sys.login.dto.LoginDTO;
|
||||
import com.gitee.sop.adminbackend.service.sys.login.dto.LoginUser;
|
||||
import com.gitee.sop.adminbackend.service.sys.login.enums.RegTypeEnum;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
@@ -1,7 +1,5 @@
|
||||
package com.gitee.sop.adminbackend.controller.sys.param;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.gitee.fastmybatis.core.query.Operator;
|
||||
import com.gitee.fastmybatis.core.query.annotation.Condition;
|
||||
import com.gitee.fastmybatis.core.query.param.PageParam;
|
||||
|
@@ -1,11 +1,10 @@
|
||||
package com.gitee.sop.adminbackend.controller.sys.param;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -3,7 +3,6 @@ package com.gitee.sop.adminbackend.controller.sys.vo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
|
@@ -2,8 +2,6 @@ package com.gitee.sop.adminbackend.controller.sys.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
|
@@ -1,306 +0,0 @@
|
||||
import { computed, ref } from "vue";
|
||||
import {
|
||||
type ButtonsCallBackParams,
|
||||
type FieldValues,
|
||||
type PageInfo,
|
||||
type PlusColumn,
|
||||
useTable
|
||||
} from "plus-pro-components";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { api } from "@/api/sysAdminUser";
|
||||
|
||||
const isAdd = ref(false);
|
||||
|
||||
// ========= search form =========
|
||||
|
||||
// 查询表单对象
|
||||
export const searchFormData = ref({
|
||||
id: "",
|
||||
username: "",
|
||||
password: "",
|
||||
nickname: "",
|
||||
email: "",
|
||||
avatar: "",
|
||||
status: "",
|
||||
regType: "",
|
||||
addTime: "",
|
||||
updateTime: "",
|
||||
pageIndex: 1,
|
||||
pageSize: 10
|
||||
});
|
||||
|
||||
// 查询表单字段定义
|
||||
export const searchFormColumns: PlusColumn[] = [
|
||||
{
|
||||
label: "用户名",
|
||||
prop: "username"
|
||||
},
|
||||
{
|
||||
label: "密码",
|
||||
prop: "password"
|
||||
},
|
||||
{
|
||||
label: "用户名",
|
||||
prop: "nickname"
|
||||
},
|
||||
{
|
||||
label: "邮箱",
|
||||
prop: "email"
|
||||
},
|
||||
{
|
||||
label: "头像",
|
||||
prop: "avatar"
|
||||
},
|
||||
{
|
||||
label: "状态,1:启用,2:禁用",
|
||||
prop: "status"
|
||||
},
|
||||
{
|
||||
label: "注册类型",
|
||||
prop: "regType"
|
||||
},
|
||||
{
|
||||
label: "addTime",
|
||||
prop: "addTime"
|
||||
},
|
||||
{
|
||||
label: "updateTime",
|
||||
prop: "updateTime"
|
||||
}
|
||||
];
|
||||
|
||||
// ========= table =========
|
||||
|
||||
// 表格对象
|
||||
export const {
|
||||
tableData,
|
||||
total,
|
||||
pageInfo,
|
||||
buttons: actionButtons
|
||||
} = useTable<any[]>();
|
||||
// 默认每页条数,默认10
|
||||
pageInfo.value.pageSize = 10;
|
||||
|
||||
// 表格字段定义
|
||||
export const tableColumns: PlusColumn[] = [
|
||||
{
|
||||
label: "用户名",
|
||||
prop: "username"
|
||||
},
|
||||
{
|
||||
label: "密码",
|
||||
prop: "password"
|
||||
},
|
||||
{
|
||||
label: "用户名",
|
||||
prop: "nickname"
|
||||
},
|
||||
{
|
||||
label: "邮箱",
|
||||
prop: "email"
|
||||
},
|
||||
{
|
||||
label: "头像",
|
||||
prop: "avatar"
|
||||
},
|
||||
{
|
||||
label: "状态,1:启用,2:禁用",
|
||||
prop: "status"
|
||||
},
|
||||
{
|
||||
label: "注册类型",
|
||||
prop: "regType"
|
||||
},
|
||||
{
|
||||
label: "addTime",
|
||||
prop: "addTime"
|
||||
},
|
||||
{
|
||||
label: "updateTime",
|
||||
prop: "updateTime"
|
||||
}
|
||||
];
|
||||
// 表格按钮定义
|
||||
actionButtons.value = [
|
||||
{
|
||||
// 修改
|
||||
text: "修改",
|
||||
code: "edit",
|
||||
props: {
|
||||
type: "primary"
|
||||
},
|
||||
show: computed(() => true),
|
||||
onClick(params: ButtonsCallBackParams) {
|
||||
isAdd.value = false;
|
||||
editFormData.value = Object.assign({}, params.row);
|
||||
dlgTitle.value = "修改";
|
||||
dlgShow.value = true;
|
||||
}
|
||||
},
|
||||
{
|
||||
// 删除
|
||||
text: "删除",
|
||||
code: "delete",
|
||||
props: {
|
||||
type: "danger"
|
||||
},
|
||||
confirm: {
|
||||
options: { draggable: false }
|
||||
},
|
||||
onConfirm(params: ButtonsCallBackParams) {
|
||||
api.del(params).then(() => {
|
||||
ElMessage({
|
||||
message: "删除成功",
|
||||
type: "success"
|
||||
});
|
||||
dlgShow.value = false;
|
||||
search();
|
||||
});
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
// ========= dialog form =========
|
||||
|
||||
// 弹窗显示
|
||||
export const dlgShow = ref(false);
|
||||
export const dlgTitle = ref("");
|
||||
// 表单值
|
||||
const editFormDataGen = () => {
|
||||
return {
|
||||
username: "",
|
||||
password: "",
|
||||
nickname: "",
|
||||
email: "",
|
||||
avatar: "",
|
||||
status: "",
|
||||
regType: "",
|
||||
addTime: "",
|
||||
updateTime: ""
|
||||
};
|
||||
};
|
||||
export const editFormData = ref<FieldValues>(editFormDataGen());
|
||||
export const editFormRules = {
|
||||
id: [{ required: true, message: "请输入id" }],
|
||||
username: [{ required: true, message: "请输入用户名" }],
|
||||
password: [{ required: true, message: "请输入密码" }],
|
||||
nickname: [{ required: true, message: "请输入用户名" }],
|
||||
email: [{ required: true, message: "请输入邮箱" }],
|
||||
avatar: [{ required: true, message: "请输入头像" }],
|
||||
status: [{ required: true, message: "请输入状态,1:启用,2:禁用" }],
|
||||
regType: [{ required: true, message: "请输入注册类型" }],
|
||||
addTime: [{ required: true, message: "请输入addTime" }],
|
||||
updateTime: [{ required: true, message: "请输入updateTime" }]
|
||||
};
|
||||
|
||||
// 表单内容
|
||||
export const editFormColumns: PlusColumn[] = [
|
||||
{
|
||||
label: "id",
|
||||
prop: "id",
|
||||
valueType: "copy"
|
||||
},
|
||||
{
|
||||
label: "用户名",
|
||||
prop: "username",
|
||||
valueType: "copy"
|
||||
},
|
||||
{
|
||||
label: "密码",
|
||||
prop: "password",
|
||||
valueType: "copy"
|
||||
},
|
||||
{
|
||||
label: "用户名",
|
||||
prop: "nickname",
|
||||
valueType: "copy"
|
||||
},
|
||||
{
|
||||
label: "邮箱",
|
||||
prop: "email",
|
||||
valueType: "copy"
|
||||
},
|
||||
{
|
||||
label: "头像",
|
||||
prop: "avatar",
|
||||
valueType: "copy"
|
||||
},
|
||||
{
|
||||
label: "状态,1:启用,2:禁用",
|
||||
prop: "status",
|
||||
valueType: "copy"
|
||||
},
|
||||
{
|
||||
label: "注册类型",
|
||||
prop: "regType",
|
||||
valueType: "copy"
|
||||
},
|
||||
{
|
||||
label: "addTime",
|
||||
prop: "addTime",
|
||||
valueType: "copy"
|
||||
},
|
||||
{
|
||||
label: "updateTime",
|
||||
prop: "updateTime",
|
||||
valueType: "copy"
|
||||
}
|
||||
];
|
||||
|
||||
// ========= event =========
|
||||
|
||||
// 添加按钮事件
|
||||
export const handleAdd = () => {
|
||||
isAdd.value = true;
|
||||
editFormData.value = editFormDataGen();
|
||||
dlgTitle.value = "新增";
|
||||
dlgShow.value = true;
|
||||
};
|
||||
|
||||
// 保存按钮事件,校验成功后触发
|
||||
export const handleSave = () => {
|
||||
const postData = editFormData.value;
|
||||
const pms = isAdd.value ? api.add(postData) : api.update(postData);
|
||||
pms.then(() => {
|
||||
ElMessage({
|
||||
message: "保存成功",
|
||||
type: "success"
|
||||
});
|
||||
dlgShow.value = false;
|
||||
search();
|
||||
});
|
||||
};
|
||||
|
||||
// 点击查询按钮
|
||||
export const handleSearch = () => {
|
||||
pageInfo.value.page = 1;
|
||||
search();
|
||||
};
|
||||
|
||||
// 分页事件
|
||||
export const handlePaginationChange = (_pageInfo: PageInfo): void => {
|
||||
pageInfo.value = _pageInfo;
|
||||
search();
|
||||
};
|
||||
|
||||
// 查询
|
||||
const search = async () => {
|
||||
try {
|
||||
const { data } = await doSearch();
|
||||
tableData.value = data.list;
|
||||
total.value = data.total;
|
||||
} catch (error) {}
|
||||
};
|
||||
// 请求接口
|
||||
const doSearch = async () => {
|
||||
// 查询参数
|
||||
const data = searchFormData.value;
|
||||
// 添加分页参数
|
||||
data.pageIndex = pageInfo.value.page;
|
||||
data.pageSize = pageInfo.value.pageSize;
|
||||
|
||||
return api.page(data);
|
||||
};
|
||||
|
||||
// 页面加载
|
||||
search();
|
@@ -1,63 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
actionButtons,
|
||||
dlgShow,
|
||||
dlgTitle,
|
||||
editFormColumns,
|
||||
editFormData,
|
||||
editFormRules,
|
||||
handleAdd,
|
||||
handlePaginationChange,
|
||||
handleSave,
|
||||
handleSearch,
|
||||
pageInfo,
|
||||
searchFormColumns,
|
||||
searchFormData,
|
||||
tableColumns,
|
||||
tableData,
|
||||
total
|
||||
} from "./index";
|
||||
</script>
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<PlusSearch
|
||||
v-model="searchFormData"
|
||||
:columns="searchFormColumns"
|
||||
:show-number="2"
|
||||
label-position="right"
|
||||
:has-reset="false"
|
||||
@search="handleSearch"
|
||||
/>
|
||||
</template>
|
||||
<PlusTable
|
||||
:columns="tableColumns"
|
||||
:table-data="tableData"
|
||||
:action-bar="{ buttons: actionButtons, width: 120 }"
|
||||
:pagination="{
|
||||
total,
|
||||
modelValue: pageInfo,
|
||||
pageSizeList: [10, 20, 50, 100],
|
||||
align: 'right'
|
||||
}"
|
||||
@paginationChange="handlePaginationChange"
|
||||
>
|
||||
<template #title>
|
||||
<el-button type="primary" @click="handleAdd">新增</el-button>
|
||||
</template>
|
||||
</PlusTable>
|
||||
<PlusDialogForm
|
||||
v-model:visible="dlgShow"
|
||||
v-model="editFormData"
|
||||
:dialog="{ title: dlgTitle }"
|
||||
:form="{
|
||||
columns: editFormColumns,
|
||||
rules: editFormRules,
|
||||
labelWidth: '100px',
|
||||
labelPosition: 'right'
|
||||
}"
|
||||
:hasErrorTip="false"
|
||||
@confirm="handleSave"
|
||||
/>
|
||||
</el-card>
|
||||
</template>
|
@@ -66,10 +66,7 @@ export function useDocList() {
|
||||
},
|
||||
{
|
||||
label: "描述",
|
||||
prop: "description",
|
||||
tableColumnProps: {
|
||||
showOverflowTooltip: true
|
||||
}
|
||||
prop: "description"
|
||||
},
|
||||
{
|
||||
label: "发布状态",
|
||||
@@ -98,12 +95,22 @@ export function useDocList() {
|
||||
}
|
||||
},
|
||||
{
|
||||
width: 160,
|
||||
width: 100,
|
||||
label: "添加人",
|
||||
prop: "addBy.showName"
|
||||
},
|
||||
{
|
||||
width: 100,
|
||||
label: "修改人",
|
||||
prop: "updateBy.showName"
|
||||
},
|
||||
{
|
||||
width: 120,
|
||||
label: "添加时间",
|
||||
prop: "addTime"
|
||||
},
|
||||
{
|
||||
width: 160,
|
||||
width: 120,
|
||||
label: "修改时间",
|
||||
prop: "updateTime"
|
||||
}
|
||||
|
@@ -46,6 +46,7 @@ const {
|
||||
v-show="tabsData.length > 0"
|
||||
:columns="tableColumns"
|
||||
:table-data="tableRows"
|
||||
showOverflowTooltip
|
||||
:action-bar="{
|
||||
buttons: actionButtons,
|
||||
confirmType: 'popconfirm',
|
||||
|
@@ -1,17 +1,18 @@
|
||||
import { ref } from "vue";
|
||||
import { onMounted, ref } from "vue";
|
||||
import type { PlusColumn, FieldValues } from "plus-pro-components";
|
||||
import { api } from "@/api/docSetting";
|
||||
import { ElMessage } from "element-plus";
|
||||
|
||||
export const state = ref<FieldValues>({
|
||||
export function useDocSetting() {
|
||||
const state = ref<FieldValues>({
|
||||
tornaServerAddr: "",
|
||||
openProdUrl: "",
|
||||
openSandboxUrl: ""
|
||||
});
|
||||
|
||||
export const rules = {};
|
||||
const rules = {};
|
||||
|
||||
export const columns: PlusColumn[] = [
|
||||
const columns: PlusColumn[] = [
|
||||
{
|
||||
label: "Torna地址",
|
||||
prop: "tornaServerAddr",
|
||||
@@ -38,7 +39,7 @@ export const columns: PlusColumn[] = [
|
||||
}
|
||||
];
|
||||
|
||||
export const handleSubmit = (values: FieldValues) => {
|
||||
const handleSubmit = (values: FieldValues) => {
|
||||
api.save(values).then(() => {
|
||||
ElMessage.success("保存成功");
|
||||
});
|
||||
@@ -50,4 +51,9 @@ const loadSetting = () => {
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
loadSetting();
|
||||
});
|
||||
|
||||
return { state, rules, columns, handleSubmit };
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { state, rules, columns, handleSubmit } from "./index";
|
||||
import { useDocSetting } from "./index";
|
||||
const { state, rules, columns, handleSubmit } = useDocSetting();
|
||||
defineOptions({
|
||||
name: "DocSetting"
|
||||
});
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { ref } from "vue";
|
||||
import { onMounted, ref } from "vue";
|
||||
import {
|
||||
type ButtonsCallBackParams,
|
||||
type FieldValues,
|
||||
@@ -11,13 +11,13 @@ import { KeyFormatEnum, StatusEnum } from "@/model/enums";
|
||||
import { api } from "@/api/isvList";
|
||||
import { settingKeys } from "@/views/isv/list/isvKeys";
|
||||
import { settingGroup } from "@/views/isv/list/isvGroup";
|
||||
|
||||
export function useIsvList() {
|
||||
const isAdd = ref(false);
|
||||
|
||||
// ========= search form =========
|
||||
|
||||
// 查询表单对象
|
||||
export const searchFormData = ref({
|
||||
const searchFormData = ref({
|
||||
appId: "",
|
||||
status: "",
|
||||
pageIndex: 1,
|
||||
@@ -25,7 +25,7 @@ export const searchFormData = ref({
|
||||
});
|
||||
|
||||
// 查询表单字段定义
|
||||
export const searchFormColumns: PlusColumn[] = [
|
||||
const searchFormColumns: PlusColumn[] = [
|
||||
{
|
||||
label: "AppID",
|
||||
prop: "appId"
|
||||
@@ -52,7 +52,7 @@ export const searchFormColumns: PlusColumn[] = [
|
||||
// ========= table =========
|
||||
|
||||
// 表格对象
|
||||
export const {
|
||||
const {
|
||||
tableData,
|
||||
total,
|
||||
pageInfo,
|
||||
@@ -62,7 +62,7 @@ export const {
|
||||
pageInfo.value.pageSize = 10;
|
||||
|
||||
// 表格字段定义
|
||||
export const tableColumns: PlusColumn[] = [
|
||||
const tableColumns: PlusColumn[] = [
|
||||
{
|
||||
label: "AppID",
|
||||
prop: "appId",
|
||||
@@ -76,7 +76,7 @@ export const tableColumns: PlusColumn[] = [
|
||||
{
|
||||
label: "所属分组",
|
||||
prop: "groupNames",
|
||||
width: 200,
|
||||
width: 120,
|
||||
tableColumnProps: {
|
||||
showOverflowTooltip: true
|
||||
}
|
||||
@@ -107,14 +107,30 @@ export const tableColumns: PlusColumn[] = [
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "添加时间",
|
||||
prop: "addTime",
|
||||
width: 160
|
||||
width: 100,
|
||||
label: "添加人",
|
||||
prop: "addBy.showName"
|
||||
},
|
||||
{
|
||||
width: 100,
|
||||
label: "修改人",
|
||||
prop: "updateBy.showName"
|
||||
},
|
||||
{
|
||||
width: 120,
|
||||
label: "添加时间",
|
||||
prop: "addTime",
|
||||
tableColumnProps: {
|
||||
showOverflowTooltip: true
|
||||
}
|
||||
},
|
||||
{
|
||||
width: 120,
|
||||
label: "修改时间",
|
||||
prop: "updateTime",
|
||||
width: 160
|
||||
tableColumnProps: {
|
||||
showOverflowTooltip: true
|
||||
}
|
||||
}
|
||||
];
|
||||
// 表格按钮定义
|
||||
@@ -183,8 +199,8 @@ actionButtons.value = [
|
||||
// ========= dialog form =========
|
||||
|
||||
// 弹窗显示
|
||||
export const dlgShow = ref(false);
|
||||
export const dlgTitle = ref("");
|
||||
const dlgShow = ref(false);
|
||||
const dlgTitle = ref("");
|
||||
// 表单值
|
||||
const editFormDataGen = () => {
|
||||
return {
|
||||
@@ -194,11 +210,11 @@ const editFormDataGen = () => {
|
||||
remark: ""
|
||||
};
|
||||
};
|
||||
export const editFormData = ref<FieldValues>(editFormDataGen());
|
||||
export const editFormRules = {};
|
||||
const editFormData = ref<FieldValues>(editFormDataGen());
|
||||
const editFormRules = {};
|
||||
|
||||
// 表单内容
|
||||
export const editFormColumns: PlusColumn[] = [
|
||||
const editFormColumns: PlusColumn[] = [
|
||||
{
|
||||
label: "AppID",
|
||||
prop: "appId",
|
||||
@@ -238,7 +254,7 @@ export const editFormColumns: PlusColumn[] = [
|
||||
// ========= event =========
|
||||
|
||||
// 添加按钮事件
|
||||
export const handleAdd = () => {
|
||||
const handleAdd = () => {
|
||||
isAdd.value = true;
|
||||
editFormData.value = editFormDataGen();
|
||||
dlgTitle.value = "新增";
|
||||
@@ -246,7 +262,7 @@ export const handleAdd = () => {
|
||||
};
|
||||
|
||||
// 保存按钮事件,校验成功后触发
|
||||
export const handleSave = () => {
|
||||
const handleSave = () => {
|
||||
const postData = editFormData.value;
|
||||
const pms = isAdd.value ? api.add(postData) : api.update(postData);
|
||||
pms.then(() => {
|
||||
@@ -257,19 +273,19 @@ export const handleSave = () => {
|
||||
};
|
||||
|
||||
// 点击查询按钮
|
||||
export const handleSearch = () => {
|
||||
const handleSearch = () => {
|
||||
pageInfo.value.page = 1;
|
||||
search();
|
||||
};
|
||||
|
||||
// 分页事件
|
||||
export const handlePaginationChange = (_pageInfo: PageInfo): void => {
|
||||
const handlePaginationChange = (_pageInfo: PageInfo): void => {
|
||||
pageInfo.value = _pageInfo;
|
||||
search();
|
||||
};
|
||||
|
||||
// 查询
|
||||
export const search = async () => {
|
||||
const search = async () => {
|
||||
try {
|
||||
const { data } = await doSearch();
|
||||
tableData.value = data.list;
|
||||
@@ -287,5 +303,28 @@ const doSearch = async () => {
|
||||
return api.page(data);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
// 页面加载
|
||||
search();
|
||||
});
|
||||
|
||||
return {
|
||||
search,
|
||||
actionButtons,
|
||||
dlgShow,
|
||||
dlgTitle,
|
||||
editFormColumns,
|
||||
editFormData,
|
||||
editFormRules,
|
||||
handleAdd,
|
||||
handlePaginationChange,
|
||||
handleSave,
|
||||
handleSearch,
|
||||
pageInfo,
|
||||
searchFormColumns,
|
||||
searchFormData,
|
||||
tableColumns,
|
||||
tableData,
|
||||
total
|
||||
};
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
import { useIsvList } from "./index";
|
||||
const {
|
||||
actionButtons,
|
||||
dlgShow,
|
||||
dlgTitle,
|
||||
@@ -16,7 +17,7 @@ import {
|
||||
tableColumns,
|
||||
tableData,
|
||||
total
|
||||
} from "./index";
|
||||
} = useIsvList();
|
||||
import {
|
||||
dlgKeysShow,
|
||||
showKeysFormColumns,
|
||||
@@ -67,6 +68,7 @@ defineOptions({
|
||||
pageSizeList: [10, 20, 50, 100],
|
||||
align: 'right'
|
||||
}"
|
||||
showOverflowTooltip
|
||||
@paginationChange="handlePaginationChange"
|
||||
>
|
||||
<template #title>
|
||||
|
@@ -5,7 +5,9 @@ import { type OptionsRow, type PlusColumn } from "plus-pro-components";
|
||||
import { api } from "@/api/isvList";
|
||||
import { api as groupApi } from "@/api/permGroup";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { search } from "@/views/isv/list/index";
|
||||
import { useIsvList } from "@/views/isv/list/index";
|
||||
|
||||
const { search } = useIsvList();
|
||||
|
||||
// 弹窗显示
|
||||
export const dlgGroupSetting = ref(false);
|
||||
|
@@ -3,7 +3,9 @@ import type { PlusFormGroupRow } from "plus-pro-components";
|
||||
import { api } from "@/api/isvList";
|
||||
import { KeyFormatEnum } from "@/model/enums";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { search } from "./index";
|
||||
import { useIsvList } from "./index";
|
||||
|
||||
const { search } = useIsvList();
|
||||
|
||||
// 弹窗显示
|
||||
export const dlgKeysSetting = ref(false);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { ref } from "vue";
|
||||
import { onMounted, ref } from "vue";
|
||||
import {
|
||||
type ButtonsCallBackParams,
|
||||
type PlusColumn,
|
||||
@@ -8,17 +8,18 @@ import { ElMessage } from "element-plus";
|
||||
import { api } from "@/api/permGroup";
|
||||
import { searchTable } from "@/views/isv/perm/permGroupApi";
|
||||
|
||||
export function usePermGroup() {
|
||||
const isAdd = ref(false);
|
||||
|
||||
// ========= search form =========
|
||||
|
||||
// 查询表单对象
|
||||
export const searchFormData = ref({
|
||||
const searchFormData = ref({
|
||||
groupName: ""
|
||||
});
|
||||
|
||||
// 查询表单字段定义
|
||||
export const searchFormColumns: PlusColumn[] = [
|
||||
const searchFormColumns: PlusColumn[] = [
|
||||
{
|
||||
label: "分组描述",
|
||||
prop: "groupName"
|
||||
@@ -28,12 +29,12 @@ export const searchFormColumns: PlusColumn[] = [
|
||||
// ========= table =========
|
||||
|
||||
// 表格对象
|
||||
export const { tableData, buttons: actionButtons } = useTable<any[]>();
|
||||
const { tableData, buttons: actionButtons } = useTable<any[]>();
|
||||
|
||||
export const selectedGroupId = ref(0);
|
||||
const selectedGroupId = ref(0);
|
||||
|
||||
// 表格字段定义
|
||||
export const tableColumns: PlusColumn[] = [
|
||||
const tableColumns: PlusColumn[] = [
|
||||
{
|
||||
label: "分组名称",
|
||||
prop: "groupName"
|
||||
@@ -83,21 +84,21 @@ actionButtons.value = [
|
||||
// ========= dialog form =========
|
||||
|
||||
// 弹窗显示
|
||||
export const dlgShow = ref(false);
|
||||
export const dlgTitle = ref("");
|
||||
const dlgShow = ref(false);
|
||||
const dlgTitle = ref("");
|
||||
// 表单值
|
||||
const editFormDataGen = () => {
|
||||
return {
|
||||
groupName: ""
|
||||
};
|
||||
};
|
||||
export const editFormData = ref<any>(editFormDataGen());
|
||||
export const editFormRules = {
|
||||
const editFormData = ref<any>(editFormDataGen());
|
||||
const editFormRules = {
|
||||
groupName: [{ required: true, message: "请输入分组名称" }]
|
||||
};
|
||||
|
||||
// 表单内容
|
||||
export const editFormColumns: PlusColumn[] = [
|
||||
const editFormColumns: PlusColumn[] = [
|
||||
{
|
||||
label: "分组名称",
|
||||
prop: "groupName",
|
||||
@@ -108,14 +109,14 @@ export const editFormColumns: PlusColumn[] = [
|
||||
// ========= event =========
|
||||
|
||||
// 点击行
|
||||
export const handleRowClick = row => {
|
||||
const handleRowClick = row => {
|
||||
const groupId = row.id;
|
||||
selectedGroupId.value = groupId;
|
||||
searchTable(groupId);
|
||||
};
|
||||
|
||||
// 添加按钮事件
|
||||
export const handleAdd = () => {
|
||||
const handleAdd = () => {
|
||||
isAdd.value = true;
|
||||
editFormData.value = editFormDataGen();
|
||||
dlgTitle.value = "新增";
|
||||
@@ -123,7 +124,7 @@ export const handleAdd = () => {
|
||||
};
|
||||
|
||||
// 保存按钮事件,校验成功后触发
|
||||
export const handleSave = () => {
|
||||
const handleSave = () => {
|
||||
const postData = editFormData.value;
|
||||
const pms = isAdd.value ? api.add(postData) : api.update(postData);
|
||||
pms.then(() => {
|
||||
@@ -134,7 +135,7 @@ export const handleSave = () => {
|
||||
};
|
||||
|
||||
// 点击查询按钮
|
||||
export const handleSearch = () => {
|
||||
const handleSearch = () => {
|
||||
search();
|
||||
};
|
||||
|
||||
@@ -154,3 +155,26 @@ const doSearch = async () => {
|
||||
|
||||
// 页面加载
|
||||
search();
|
||||
|
||||
onMounted(() => {
|
||||
search();
|
||||
});
|
||||
|
||||
return {
|
||||
actionButtons,
|
||||
dlgShow,
|
||||
dlgTitle,
|
||||
editFormColumns,
|
||||
editFormData,
|
||||
editFormRules,
|
||||
handleAdd,
|
||||
handleRowClick,
|
||||
handleSave,
|
||||
handleSearch,
|
||||
searchFormColumns,
|
||||
searchFormData,
|
||||
selectedGroupId,
|
||||
tableColumns,
|
||||
tableData
|
||||
};
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
import { usePermGroup } from "./permGroup";
|
||||
const {
|
||||
actionButtons,
|
||||
dlgShow,
|
||||
dlgTitle,
|
||||
@@ -15,7 +16,7 @@ import {
|
||||
selectedGroupId,
|
||||
tableColumns,
|
||||
tableData
|
||||
} from "./permGroup";
|
||||
} = usePermGroup();
|
||||
import PermGroupApi from "./permGroupApi.vue";
|
||||
defineOptions({
|
||||
name: "IsvPermPermGroup"
|
||||
|
@@ -39,6 +39,7 @@ defineOptions({
|
||||
pageSizeList: [10, 20, 50, 100],
|
||||
align: 'right'
|
||||
}"
|
||||
showOverflowTooltip
|
||||
@paginationChange="handlePaginationChange"
|
||||
>
|
||||
<template #title>
|
||||
|
@@ -1,99 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { hasAuth, getAuths } from "@/router/utils";
|
||||
|
||||
defineOptions({
|
||||
name: "PermissionButtonRouter"
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<p class="mb-2">当前拥有的code列表:{{ getAuths() }}</p>
|
||||
|
||||
<el-card shadow="never" class="mb-2">
|
||||
<template #header>
|
||||
<div class="card-header">组件方式判断权限</div>
|
||||
</template>
|
||||
<el-space wrap>
|
||||
<Auth value="permission:btn:add">
|
||||
<el-button plain type="warning">
|
||||
拥有code:'permission:btn:add' 权限可见
|
||||
</el-button>
|
||||
</Auth>
|
||||
<Auth :value="['permission:btn:edit']">
|
||||
<el-button plain type="primary">
|
||||
拥有code:['permission:btn:edit'] 权限可见
|
||||
</el-button>
|
||||
</Auth>
|
||||
<Auth
|
||||
:value="[
|
||||
'permission:btn:add',
|
||||
'permission:btn:edit',
|
||||
'permission:btn:delete'
|
||||
]"
|
||||
>
|
||||
<el-button plain type="danger">
|
||||
拥有code:['permission:btn:add', 'permission:btn:edit',
|
||||
'permission:btn:delete'] 权限可见
|
||||
</el-button>
|
||||
</Auth>
|
||||
</el-space>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never" class="mb-2">
|
||||
<template #header>
|
||||
<div class="card-header">函数方式判断权限</div>
|
||||
</template>
|
||||
<el-space wrap>
|
||||
<el-button v-if="hasAuth('permission:btn:add')" plain type="warning">
|
||||
拥有code:'permission:btn:add' 权限可见
|
||||
</el-button>
|
||||
<el-button v-if="hasAuth(['permission:btn:edit'])" plain type="primary">
|
||||
拥有code:['permission:btn:edit'] 权限可见
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="
|
||||
hasAuth([
|
||||
'permission:btn:add',
|
||||
'permission:btn:edit',
|
||||
'permission:btn:delete'
|
||||
])
|
||||
"
|
||||
plain
|
||||
type="danger"
|
||||
>
|
||||
拥有code:['permission:btn:add', 'permission:btn:edit',
|
||||
'permission:btn:delete'] 权限可见
|
||||
</el-button>
|
||||
</el-space>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
指令方式判断权限(该方式不能动态修改权限)
|
||||
</div>
|
||||
</template>
|
||||
<el-space wrap>
|
||||
<el-button v-auth="'permission:btn:add'" plain type="warning">
|
||||
拥有code:'permission:btn:add' 权限可见
|
||||
</el-button>
|
||||
<el-button v-auth="['permission:btn:edit']" plain type="primary">
|
||||
拥有code:['permission:btn:edit'] 权限可见
|
||||
</el-button>
|
||||
<el-button
|
||||
v-auth="[
|
||||
'permission:btn:add',
|
||||
'permission:btn:edit',
|
||||
'permission:btn:delete'
|
||||
]"
|
||||
plain
|
||||
type="danger"
|
||||
>
|
||||
拥有code:['permission:btn:add', 'permission:btn:edit',
|
||||
'permission:btn:delete'] 权限可见
|
||||
</el-button>
|
||||
</el-space>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
@@ -1,109 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { hasPerms } from "@/utils/auth";
|
||||
import { useUserStoreHook } from "@/store/modules/user";
|
||||
|
||||
const { permissions } = useUserStoreHook();
|
||||
|
||||
defineOptions({
|
||||
name: "PermissionButtonLogin"
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<p class="mb-2">当前拥有的code列表:{{ permissions }}</p>
|
||||
<p v-show="permissions?.[0] === '*:*:*'" class="mb-2">
|
||||
*:*:* 代表拥有全部按钮级别权限
|
||||
</p>
|
||||
|
||||
<el-card shadow="never" class="mb-2">
|
||||
<template #header>
|
||||
<div class="card-header">组件方式判断权限</div>
|
||||
</template>
|
||||
<el-space wrap>
|
||||
<Perms value="permission:btn:add">
|
||||
<el-button plain type="warning">
|
||||
拥有code:'permission:btn:add' 权限可见
|
||||
</el-button>
|
||||
</Perms>
|
||||
<Perms :value="['permission:btn:edit']">
|
||||
<el-button plain type="primary">
|
||||
拥有code:['permission:btn:edit'] 权限可见
|
||||
</el-button>
|
||||
</Perms>
|
||||
<Perms
|
||||
:value="[
|
||||
'permission:btn:add',
|
||||
'permission:btn:edit',
|
||||
'permission:btn:delete'
|
||||
]"
|
||||
>
|
||||
<el-button plain type="danger">
|
||||
拥有code:['permission:btn:add', 'permission:btn:edit',
|
||||
'permission:btn:delete'] 权限可见
|
||||
</el-button>
|
||||
</Perms>
|
||||
</el-space>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never" class="mb-2">
|
||||
<template #header>
|
||||
<div class="card-header">函数方式判断权限</div>
|
||||
</template>
|
||||
<el-space wrap>
|
||||
<el-button v-if="hasPerms('permission:btn:add')" plain type="warning">
|
||||
拥有code:'permission:btn:add' 权限可见
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasPerms(['permission:btn:edit'])"
|
||||
plain
|
||||
type="primary"
|
||||
>
|
||||
拥有code:['permission:btn:edit'] 权限可见
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="
|
||||
hasPerms([
|
||||
'permission:btn:add',
|
||||
'permission:btn:edit',
|
||||
'permission:btn:delete'
|
||||
])
|
||||
"
|
||||
plain
|
||||
type="danger"
|
||||
>
|
||||
拥有code:['permission:btn:add', 'permission:btn:edit',
|
||||
'permission:btn:delete'] 权限可见
|
||||
</el-button>
|
||||
</el-space>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
指令方式判断权限(该方式不能动态修改权限)
|
||||
</div>
|
||||
</template>
|
||||
<el-space wrap>
|
||||
<el-button v-perms="'permission:btn:add'" plain type="warning">
|
||||
拥有code:'permission:btn:add' 权限可见
|
||||
</el-button>
|
||||
<el-button v-perms="['permission:btn:edit']" plain type="primary">
|
||||
拥有code:['permission:btn:edit'] 权限可见
|
||||
</el-button>
|
||||
<el-button
|
||||
v-perms="[
|
||||
'permission:btn:add',
|
||||
'permission:btn:edit',
|
||||
'permission:btn:delete'
|
||||
]"
|
||||
plain
|
||||
type="danger"
|
||||
>
|
||||
拥有code:['permission:btn:add', 'permission:btn:edit',
|
||||
'permission:btn:delete'] 权限可见
|
||||
</el-button>
|
||||
</el-space>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
@@ -1,66 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { initRouter } from "@/router/utils";
|
||||
import { storageLocal } from "@pureadmin/utils";
|
||||
import { type CSSProperties, ref, computed } from "vue";
|
||||
import { useUserStoreHook } from "@/store/modules/user";
|
||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||
|
||||
defineOptions({
|
||||
name: "PermissionPage"
|
||||
});
|
||||
|
||||
const elStyle = computed((): CSSProperties => {
|
||||
return {
|
||||
width: "85vw",
|
||||
justifyContent: "start"
|
||||
};
|
||||
});
|
||||
|
||||
const username = ref(useUserStoreHook()?.username);
|
||||
|
||||
const options = [
|
||||
{
|
||||
value: "admin",
|
||||
label: "管理员角色"
|
||||
},
|
||||
{
|
||||
value: "common",
|
||||
label: "普通角色"
|
||||
}
|
||||
];
|
||||
|
||||
function onChange() {
|
||||
useUserStoreHook()
|
||||
.loginByUsername({ username: username.value, password: "admin123" })
|
||||
.then(res => {
|
||||
if (res.success) {
|
||||
storageLocal().removeItem("async-routes");
|
||||
usePermissionStoreHook().clearAllCachePage();
|
||||
initRouter();
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<p class="mb-2">
|
||||
模拟后台根据不同角色返回对应路由,观察左侧菜单变化(管理员角色可查看系统管理菜单、普通角色不可查看系统管理菜单)
|
||||
</p>
|
||||
<el-card shadow="never" :style="elStyle">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>当前角色:{{ username }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-select v-model="username" class="!w-[160px]" @change="onChange">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
@@ -66,18 +66,12 @@ export const tableColumns: PlusColumn[] = [
|
||||
{
|
||||
label: "所属应用",
|
||||
prop: "application",
|
||||
minWidth: 150,
|
||||
tableColumnProps: {
|
||||
showOverflowTooltip: true
|
||||
}
|
||||
minWidth: 150
|
||||
},
|
||||
{
|
||||
label: "接口名称",
|
||||
prop: "apiName",
|
||||
minWidth: 200,
|
||||
tableColumnProps: {
|
||||
showOverflowTooltip: true
|
||||
}
|
||||
minWidth: 200
|
||||
},
|
||||
{
|
||||
label: "版本号",
|
||||
@@ -87,17 +81,11 @@ export const tableColumns: PlusColumn[] = [
|
||||
{
|
||||
label: "接口描述",
|
||||
prop: "description",
|
||||
minWidth: 100,
|
||||
tableColumnProps: {
|
||||
showOverflowTooltip: true
|
||||
}
|
||||
minWidth: 100
|
||||
},
|
||||
{
|
||||
label: "备注",
|
||||
prop: "remark",
|
||||
tableColumnProps: {
|
||||
showOverflowTooltip: true
|
||||
}
|
||||
prop: "remark"
|
||||
},
|
||||
{
|
||||
label: "需要授权",
|
||||
@@ -187,14 +175,14 @@ export const tableColumns: PlusColumn[] = [
|
||||
]
|
||||
},
|
||||
{
|
||||
width: 120,
|
||||
label: "添加时间",
|
||||
prop: "addTime",
|
||||
width: 160
|
||||
prop: "addTime"
|
||||
},
|
||||
{
|
||||
width: 120,
|
||||
label: "修改时间",
|
||||
prop: "updateTime",
|
||||
width: 160
|
||||
prop: "updateTime"
|
||||
}
|
||||
];
|
||||
// 表格按钮权限
|
||||
|
@@ -44,6 +44,7 @@ defineOptions({
|
||||
pageSizeList: [10, 20, 50, 100],
|
||||
align: 'right'
|
||||
}"
|
||||
showOverflowTooltip
|
||||
adaptive
|
||||
@paginationChange="handlePaginationChange"
|
||||
>
|
||||
|
@@ -1,4 +1,3 @@
|
||||
import dayjs from "dayjs";
|
||||
import editForm from "../form.vue";
|
||||
import { handleTree } from "@/utils/tree";
|
||||
import { message } from "@/utils/message";
|
||||
@@ -44,10 +43,9 @@ export function useDept() {
|
||||
},
|
||||
{
|
||||
label: "创建时间",
|
||||
minWidth: 200,
|
||||
prop: "createTime",
|
||||
formatter: ({ createTime }) =>
|
||||
dayjs(createTime).format("YYYY-MM-DD HH:mm:ss")
|
||||
width: 120,
|
||||
prop: "addTime",
|
||||
showOverflowTooltip: true
|
||||
},
|
||||
{
|
||||
label: "备注",
|
||||
|
@@ -1,4 +1,3 @@
|
||||
import dayjs from "dayjs";
|
||||
import editForm from "../form.vue";
|
||||
import { handleTree } from "@/utils/tree";
|
||||
import { message } from "@/utils/message";
|
||||
@@ -90,10 +89,9 @@ export function useRole(treeRef: Ref) {
|
||||
},
|
||||
{
|
||||
label: "创建时间",
|
||||
prop: "createTime",
|
||||
minWidth: 160,
|
||||
formatter: ({ createTime }) =>
|
||||
dayjs(createTime).format("YYYY-MM-DD HH:mm:ss")
|
||||
prop: "addTime",
|
||||
width: 120,
|
||||
showOverflowTooltip: true
|
||||
},
|
||||
{
|
||||
label: "操作",
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import "./reset.css";
|
||||
import dayjs from "dayjs";
|
||||
import roleForm from "../form/role.vue";
|
||||
import editForm from "../form/index.vue";
|
||||
import { zxcvbn } from "@zxcvbn-ts/core";
|
||||
@@ -157,10 +156,9 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
|
||||
},
|
||||
{
|
||||
label: "创建时间",
|
||||
minWidth: 90,
|
||||
prop: "createTime",
|
||||
formatter: ({ createTime }) =>
|
||||
dayjs(createTime).format("YYYY-MM-DD HH:mm:ss")
|
||||
width: 120,
|
||||
prop: "addTime",
|
||||
showOverflowTooltip: true
|
||||
},
|
||||
{
|
||||
label: "操作",
|
||||
|
@@ -15,7 +15,7 @@
|
||||
"isReplace": true,
|
||||
// 第三方jar中的class配置
|
||||
"jarClass": {
|
||||
"com.baomidou.mybatisplus.extension.plugins.pagination.Page": {
|
||||
"com.xx.Page": {
|
||||
"records": { "value": "查询数据列表", "example": "" },
|
||||
"total": { "value": "总数", "example": "100" },
|
||||
"size": { "value": "页数", "example": "10" },
|
||||
|
@@ -5,6 +5,8 @@ import com.gitee.sop.storyweb.open.resp.StoryResponse;
|
||||
import com.gitee.sop.support.annotation.Open;
|
||||
import com.gitee.sop.support.context.OpenContext;
|
||||
import com.gitee.sop.support.dto.FileData;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
@@ -15,6 +17,7 @@ import java.util.List;
|
||||
*
|
||||
* @author 六如
|
||||
*/
|
||||
@Api("故事服务")
|
||||
public interface OpenStory {
|
||||
|
||||
@Open("story.save")
|
||||
@@ -27,6 +30,7 @@ public interface OpenStory {
|
||||
@Open("story.updateError")
|
||||
Integer updateError(Integer id);
|
||||
|
||||
@ApiOperation(value = "根据id获取故事")
|
||||
@Open("story.get")
|
||||
StoryResponse getById(@NotNull(message = "id必填") Integer id);
|
||||
|
||||
@@ -46,6 +50,14 @@ public interface OpenStory {
|
||||
return storyResponse;
|
||||
}
|
||||
|
||||
// 默认方法,注解放在这里也有效
|
||||
@Open("alipay.story.find")
|
||||
default StoryResponse findByName(String name) {
|
||||
StoryResponse storyResponse = new StoryResponse();
|
||||
storyResponse.setName(name);
|
||||
return storyResponse;
|
||||
}
|
||||
|
||||
// 演示单文件上传
|
||||
@Open("story.upload")
|
||||
StoryResponse upload(StorySaveRequest storySaveRequest, FileData file);
|
||||
|
27
sop-example/example-story/src/main/resources/doc.json
Normal file
27
sop-example/example-story/src/main/resources/doc.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
// 开启推送
|
||||
"enable": true,
|
||||
// 扫描package,多个用;隔开
|
||||
"basePackage": "com.gitee.sop.storyweb.open",
|
||||
// 推送URL,IP端口对应Torna服务器
|
||||
"url": "http://localhost:7700/api",
|
||||
// 模块token
|
||||
"token": "d4f07434c9cf4a989e4c6d301684b357",
|
||||
// 推送人
|
||||
"author": "Jim",
|
||||
// 打开调试:true/false
|
||||
"debug": true,
|
||||
// 是否替换文档,true:替换,false:不替换(追加)。默认:true
|
||||
"isReplace": true,
|
||||
// 第三方jar中的class配置
|
||||
"jarClass": {
|
||||
"com.xx.Page": {
|
||||
"records": { "value": "查询数据列表", "example": "" },
|
||||
"total": { "value": "总数", "example": "100" },
|
||||
"size": { "value": "页数", "example": "10" },
|
||||
"current": { "value": "当前页", "example": "1" },
|
||||
"countId": { "hidden": true },
|
||||
"orders": { "hidden": true }
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package com.gitee.sop.storyweb;
|
||||
|
||||
|
||||
import cn.torna.swaggerplugin.SwaggerPlugin;
|
||||
|
||||
/**
|
||||
* 推送swagger文档
|
||||
* @author thc
|
||||
*/
|
||||
public class DocPushTest {
|
||||
public static void main(String[] args) {
|
||||
SwaggerPlugin.pushDoc();
|
||||
}
|
||||
}
|
@@ -1,13 +1,12 @@
|
||||
package com.gitee.sop.gateway.dao.entity;
|
||||
|
||||
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;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* 表名:api_info
|
||||
|
@@ -1,13 +1,12 @@
|
||||
package com.gitee.sop.gateway.dao.entity;
|
||||
|
||||
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;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* 表名:isv_keys
|
||||
|
@@ -1,13 +1,12 @@
|
||||
package com.gitee.sop.gateway.dao.entity;
|
||||
|
||||
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;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* 表名:perm_group_permission
|
||||
|
@@ -1,13 +1,12 @@
|
||||
package com.gitee.sop.gateway.dao.entity;
|
||||
|
||||
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;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* 表名:perm_isv_group
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.gitee.sop.gateway.exception;
|
||||
|
||||
import com.gitee.sop.gateway.response.ApiResponse;
|
||||
import com.gitee.sop.gateway.message.ErrorEnum;
|
||||
import com.gitee.sop.gateway.response.ApiResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.validation.FieldError;
|
||||
|
@@ -1,9 +1,9 @@
|
||||
package com.gitee.sop.gateway.interceptor.internal;
|
||||
|
||||
import com.gitee.sop.gateway.common.ApiInfoDTO;
|
||||
import com.gitee.sop.gateway.request.ApiRequestContext;
|
||||
import com.gitee.sop.gateway.interceptor.RouteInterceptor;
|
||||
import com.gitee.sop.gateway.interceptor.RouteInterceptorOrders;
|
||||
import com.gitee.sop.gateway.request.ApiRequestContext;
|
||||
import com.gitee.sop.support.dto.CommonFileData;
|
||||
import com.gitee.sop.support.dto.FileData;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@@ -7,8 +7,8 @@ import com.gitee.sop.gateway.service.manager.SecretManager;
|
||||
import com.gitee.sop.support.service.RefreshService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
|
@@ -11,8 +11,6 @@ import com.gitee.sop.gateway.service.ResultWrapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
|
@@ -35,7 +35,6 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package com.gitee.sop.gateway.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONWriter;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.gitee.sop.gateway.config.ApiConfig;
|
||||
@@ -11,7 +10,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -19,7 +17,7 @@ import java.util.Map;
|
||||
*/
|
||||
public class SerdeImpl implements Serde {
|
||||
|
||||
static JSONWriter.Context WRITE_CONTEXT;
|
||||
static JSONWriter.Context writeContext;
|
||||
|
||||
@Autowired
|
||||
protected ApiConfig apiConfig;
|
||||
@@ -29,7 +27,7 @@ public class SerdeImpl implements Serde {
|
||||
|
||||
@Override
|
||||
public String toJson(Object object) {
|
||||
return JSON.toJSONString(object);
|
||||
return JSON.toJSONString(object, writeContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,8 +46,8 @@ public class SerdeImpl implements Serde {
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
WRITE_CONTEXT = new JSONWriter.Context();
|
||||
WRITE_CONTEXT.setDateFormat(dateFormat);
|
||||
writeContext = new JSONWriter.Context();
|
||||
writeContext.setDateFormat(dateFormat);
|
||||
|
||||
this.doInit();
|
||||
}
|
||||
|
@@ -10,9 +10,9 @@ import com.gitee.sop.gateway.dao.mapper.PermGroupPermissionMapper;
|
||||
import com.gitee.sop.gateway.dao.mapper.PermIsvGroupMapper;
|
||||
import com.gitee.sop.gateway.service.manager.IsvApiPermissionManager;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
@@ -6,9 +6,9 @@ import com.gitee.sop.gateway.service.manager.IsvManager;
|
||||
import com.gitee.sop.gateway.service.manager.dto.IsvDTO;
|
||||
import com.gitee.sop.gateway.util.CopyUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
@@ -4,9 +4,9 @@ import com.gitee.sop.gateway.dao.entity.IsvKeys;
|
||||
import com.gitee.sop.gateway.dao.mapper.IsvKeysMapper;
|
||||
import com.gitee.sop.gateway.service.manager.SecretManager;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
@@ -6,12 +6,12 @@ import com.gitee.sop.gateway.dao.entity.ApiInfo;
|
||||
import com.gitee.sop.gateway.util.CopyUtil;
|
||||
import com.gitee.sop.gateway.util.JsonUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.BoundHashOperations;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@@ -7,11 +7,11 @@ import com.gitee.sop.gateway.dao.entity.IsvInfo;
|
||||
import com.gitee.sop.gateway.dao.mapper.IsvInfoMapper;
|
||||
import com.gitee.sop.gateway.util.JsonUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.BoundHashOperations;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@@ -7,10 +7,10 @@ import com.gitee.sop.gateway.service.manager.dto.IsvDTO;
|
||||
import com.gitee.sop.gateway.util.CopyUtil;
|
||||
import com.gitee.sop.gateway.util.JsonUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@@ -4,10 +4,10 @@ import com.gitee.sop.gateway.common.CacheKey;
|
||||
import com.gitee.sop.gateway.common.SopConstants;
|
||||
import com.gitee.sop.gateway.dao.entity.IsvKeys;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@@ -1,9 +1,9 @@
|
||||
package com.gitee.sop.gateway.service.validate;
|
||||
|
||||
import com.gitee.sop.gateway.request.ApiRequest;
|
||||
import com.gitee.sop.gateway.request.ApiRequestContext;
|
||||
import com.gitee.sop.gateway.exception.ApiException;
|
||||
import com.gitee.sop.gateway.message.ErrorEnum;
|
||||
import com.gitee.sop.gateway.request.ApiRequest;
|
||||
import com.gitee.sop.gateway.request.ApiRequestContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.common.utils.StringUtils;
|
||||
|
||||
|
@@ -17,6 +17,7 @@ import com.gitee.sop.gateway.service.manager.SecretManager;
|
||||
import com.gitee.sop.gateway.service.manager.dto.IsvDTO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
@@ -24,7 +25,6 @@ import org.springframework.util.unit.DataSize;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user