微服务版后端初始化
This commit is contained in:
16
xjrsoft-service/xjrsoft-service-system/Dockerfile
Normal file
16
xjrsoft-service/xjrsoft-service-system/Dockerfile
Normal file
@ -0,0 +1,16 @@
|
||||
# 基础镜像
|
||||
FROM nexus.gdyditc.com:8082/openjdk:11-arm64
|
||||
# author
|
||||
MAINTAINER xjrsoft
|
||||
|
||||
# 挂载目录
|
||||
VOLUME /home/xjrsoft
|
||||
# 创建目录
|
||||
RUN mkdir -p /home/xjrsoft
|
||||
# 指定路径
|
||||
WORKDIR /home/xjrsoft
|
||||
# 复制jar文件到路径
|
||||
RUN ls
|
||||
COPY ./target/xjrsoft-service-system.jar /home/xjrsoft/xjrsoft-service-system.jar
|
||||
# 启动认证服务
|
||||
ENTRYPOINT ["java","-Dfile.encoding=utf-8","--add-opens","java.base/java.lang.reflect=ALL-UNNAMED","-jar","xjrsoft-service-system.jar"]
|
||||
162
xjrsoft-service/xjrsoft-service-system/pom.xml
Normal file
162
xjrsoft-service/xjrsoft-service-system/pom.xml
Normal file
@ -0,0 +1,162 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>xjrsoft-service</artifactId>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>xjrsoft-service-system</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-service-system-api</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-common-core</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-common-mybatis</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-service-organization-api</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-service-bi-api</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-service-desktop-api</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-commom-oss</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-service-generate-api</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-service-form-api</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>me.zhyd.oauth</groupId>
|
||||
<artifactId>JustAuth</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- excel导入导出 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<!-- <scope>provided</scope>-->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<!-- <scope>provided</scope>-->
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-loadbalancer</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.syyai.spring.boot</groupId>
|
||||
<artifactId>ureport-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>liteflow-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 钉钉用到的jar包 -->
|
||||
<dependency>
|
||||
<groupId>taobao-sdk-java-auto</groupId>
|
||||
<artifactId>taobao-sdk-java-auto</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/src/main/resources/lib/taobao-sdk-java-auto.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-service-workflow-api</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,23 @@
|
||||
package com.xjrsoft.system;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/9/19 15:04
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
@EnableFeignClients(basePackages = "com.xjrsoft")
|
||||
@MapperScan(value = "com.xjrsoft.**.mapper")
|
||||
@ComponentScan(value = "com.xjrsoft")
|
||||
public class SystemApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SystemApplication.class, args);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.xjrsoft.system.client;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.system.entity.Area;
|
||||
import com.xjrsoft.system.mapper.AreaMapper;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/10 17:57
|
||||
*/
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class AreaClient implements IAreaClient {
|
||||
|
||||
private final AreaMapper areaMapper;
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/getAreaListFeign")
|
||||
public List<Area> getAreaListFeign(List<Long> areaIds) {
|
||||
return areaMapper.selectList(Wrappers.<Area>query().lambda().in(Area::getId, areaIds));
|
||||
}
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/getAreaByIdFeign")
|
||||
public Area getAreaByIdFeign(Long id) {
|
||||
return areaMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Area getAreaByNameFeign(String name, Long parentId) {
|
||||
return areaMapper.selectOne(Wrappers.lambdaQuery(Area.class).eq(Area::getName, name)
|
||||
.eq(parentId != null, Area::getParentId, parentId));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
package com.xjrsoft.system.client;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.system.dto.SetRoleAuthDto;
|
||||
import com.xjrsoft.system.entity.Authorize;
|
||||
import com.xjrsoft.system.service.IAuthorizeService;
|
||||
import com.xjrsoft.system.vo.RoleAuthVo;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/11 9:59
|
||||
*/
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class AuthorizeClient implements IAuthorizeClient {
|
||||
|
||||
private final IAuthorizeService authorizeService;
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/removeAuthorieFeign")
|
||||
public void removeAuthorieFeign(Long menuId) {
|
||||
|
||||
authorizeService.remove(Wrappers.<Authorize>query().lambda().eq(Authorize::getObjectId, menuId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置角色权限
|
||||
* @param
|
||||
*/
|
||||
@Override
|
||||
@PostMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/setRoleAuthFeign")
|
||||
public Boolean setRoleAuthFeign(@RequestBody SetRoleAuthDto dto) {
|
||||
return authorizeService.setRoleAuth(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色权限
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/getRoleAuthFeign")
|
||||
public RoleAuthVo getRoleAuthFeign(Long roleId) {
|
||||
return authorizeService.getRoleAuth(roleId);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
package com.xjrsoft.system.client;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.enums.EnabledMark;
|
||||
import com.xjrsoft.system.entity.CodeRule;
|
||||
import com.xjrsoft.system.entity.CodeRuleSeed;
|
||||
import com.xjrsoft.system.service.ICodeRuleSeedService;
|
||||
import com.xjrsoft.system.service.ICodeRuleService;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/11 10:11
|
||||
*/
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class CodeRuleClient implements ICodeRuleClient {
|
||||
|
||||
|
||||
private final ICodeRuleService codeRuleService;
|
||||
|
||||
private final ICodeRuleSeedService codeRuleSeedService;
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/useEnCodeFeign")
|
||||
public boolean useEnCodeFeign(List<String> encodeList) {
|
||||
if (CollectionUtils.isEmpty(encodeList)) {
|
||||
return false;
|
||||
}
|
||||
List<CodeRule> codeRuleList = codeRuleService.list(Wrappers.<CodeRule>query().lambda().select(CodeRule::getId)
|
||||
.eq(CodeRule::getEnabledMark, EnabledMark.ENABLED.getCode())
|
||||
.in(encodeList.size() > 1, CodeRule::getCode, encodeList)
|
||||
.eq(encodeList.size() == 1, CodeRule::getCode, encodeList.get(0)));
|
||||
if (CollectionUtil.isEmpty(codeRuleList)) {
|
||||
return false;
|
||||
}
|
||||
List<Long> ruleIdList = codeRuleList.stream().map(CodeRule::getId).collect(Collectors.toList());
|
||||
Wrapper<CodeRuleSeed> deleteWrapper = Wrappers.<CodeRuleSeed>query().lambda()
|
||||
.in(ruleIdList.size() > 1, CodeRuleSeed::getRuleId, ruleIdList)
|
||||
.eq(ruleIdList.size() == 1, CodeRuleSeed::getRuleId, ruleIdList.get(0))
|
||||
.eq(CodeRuleSeed::getUserId, StpUtil.getLoginIdAsLong());
|
||||
return codeRuleSeedService.remove(deleteWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/useEnCodeStringFeign")
|
||||
public boolean useEnCodeFeign(String encode) {
|
||||
return useEnCodeFeign(StrUtil.split(encode, StringPool.COMMA));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.xjrsoft.system.client;
|
||||
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.system.entity.CodeSchema;
|
||||
import com.xjrsoft.system.service.ICodeSchemaService;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/11 15:35
|
||||
*/
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class CodeSchemaClient implements ICodeSchemaClient {
|
||||
|
||||
private final ICodeSchemaService codeSchemaService;
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/getCodeSchemeByIdFeign")
|
||||
public CodeSchema getCodeSchemeByIdFeign(Long id) {
|
||||
return codeSchemaService.getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/saveOrUpdateCodeSchemaFeign")
|
||||
public boolean saveOrUpdateCodeSchemaFeign(CodeSchema codeSchema) {
|
||||
return codeSchemaService.saveOrUpdate(codeSchema);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package com.xjrsoft.system.client;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.redis.service.RedisUtil;
|
||||
import com.xjrsoft.system.entity.DataAuthTableRelation;
|
||||
import com.xjrsoft.system.service.IDataAuthTableRelationService;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/11 14:36
|
||||
*/
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class DataAuthTableRelationClient implements IDataAuthTableRelationClient {
|
||||
|
||||
private final IDataAuthTableRelationService dataAuthTableRelationService;
|
||||
|
||||
private final RedisUtil redisUtil;
|
||||
@Override
|
||||
@PostMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/saveDataAuthTableRelationsFeign")
|
||||
public void saveDataAuthTableRelationsFeign(String tableName, List<Long> dataAuthList) {
|
||||
List<DataAuthTableRelation> toSaveList = new ArrayList<>();
|
||||
// 先删除原有的关联关系
|
||||
boolean isRemoved = dataAuthTableRelationService.remove(Wrappers.<DataAuthTableRelation>query().lambda().eq(DataAuthTableRelation::getTableName, tableName));
|
||||
boolean isSuccessAdd = false;
|
||||
if (CollectionUtils.isNotEmpty(dataAuthList)) {
|
||||
for (Long id : dataAuthList) {
|
||||
DataAuthTableRelation item = new DataAuthTableRelation();
|
||||
item.setDataAuthId(id);
|
||||
item.setTableName(tableName);
|
||||
toSaveList.add(item);
|
||||
}
|
||||
isSuccessAdd = dataAuthTableRelationService.saveBatch(toSaveList);
|
||||
}
|
||||
if (isRemoved || isSuccessAdd) {
|
||||
// 更新缓存
|
||||
List<DataAuthTableRelation> list = dataAuthTableRelationService.list();
|
||||
redisUtil.set(GlobalConstant.DATA_AUTH_TABLE_RELATION_CACHE_KEY, list);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.xjrsoft.system.client;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties;
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.JdbcUtils;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.system.entity.Databaselink;
|
||||
import com.xjrsoft.system.service.IDatabaselinkService;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/11 11:23
|
||||
*/
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class DatabaselinkClient implements IDatabaselinkClient {
|
||||
|
||||
private final IDatabaselinkService databaselinkService;
|
||||
|
||||
private final DynamicDataSourceProperties dynamicDataSourceProperties;
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/getDatabaselinkDbTypeFeign")
|
||||
public DbType getDatabaselinkDbTypeFeign(String id) {
|
||||
String url = null;
|
||||
if (StrUtil.equalsIgnoreCase(id, dynamicDataSourceProperties.getPrimary())) {
|
||||
url = dynamicDataSourceProperties.getDatasource().get(dynamicDataSourceProperties.getPrimary()).getUrl();
|
||||
} else {
|
||||
Databaselink databaselink = databaselinkService.getById(id);
|
||||
if (databaselink != null) {
|
||||
url = databaselink.getHost();
|
||||
}
|
||||
}
|
||||
return JdbcUtils.getDbType(url);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.xjrsoft.system.client;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.redis.service.RedisUtil;
|
||||
import com.xjrsoft.system.entity.DictionaryDetail;
|
||||
import com.xjrsoft.system.service.IDictionarydetailService;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/19 15:09
|
||||
*/
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class DictionaryDetailClient implements IDictionaryDetailClient {
|
||||
|
||||
private final IDictionarydetailService dictionarydetailService;
|
||||
|
||||
private final RedisUtil redisUtil;
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/getDicDetailByIdFeign")
|
||||
public DictionaryDetail getDicDetailByIdFeign(Long id) {
|
||||
return dictionarydetailService.getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/getDicDetailListByItemIdFeign")
|
||||
public List<DictionaryDetail> getDicDetailListByItemIdFeign(Long itemId) {
|
||||
|
||||
//获取所有的供应商类型
|
||||
|
||||
return dictionarydetailService.list(Wrappers.<DictionaryDetail>query().lambda().eq(DictionaryDetail::getItemId, itemId));
|
||||
}
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/dictionaryDetailCacheFeign")
|
||||
public void dictionaryDetailCacheFeign() {
|
||||
dictionarydetailService.dictionaryDetailCache();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package com.xjrsoft.system.client;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.system.dto.UpdateFileFeighDto;
|
||||
import com.xjrsoft.system.entity.File;
|
||||
import com.xjrsoft.system.service.IFileService;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/18 10:01
|
||||
*/
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class FileClient implements IFileClient {
|
||||
|
||||
private final IFileService fileService;
|
||||
|
||||
|
||||
@Override
|
||||
@PutMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/updateFileFeign")
|
||||
public void updateFileFeign(@RequestBody UpdateFileFeighDto dto) {
|
||||
if (dto.getFileFolderIds() != null && dto.getFileFolderIds().size() > 0) {
|
||||
File file = new File();
|
||||
file.setProcessId(dto.getProcessId());
|
||||
LambdaQueryWrapper<File> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(File::getFolderId, dto.getFileFolderIds());
|
||||
fileService.update(file, lambdaQueryWrapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package com.xjrsoft.system.client;
|
||||
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.system.entity.LiteflowChain;
|
||||
import com.xjrsoft.system.service.ILiteflowChainService;
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/18 14:55
|
||||
*/
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class LiteflowChainClient implements ILiteflowChainClient {
|
||||
|
||||
private final ILiteflowChainService liteflowChainService;
|
||||
|
||||
private final FlowExecutor flowExecutor;
|
||||
|
||||
/**
|
||||
* 获取规则引擎信息
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/getLiteflowChainByIdFeign")
|
||||
public LiteflowChain getLiteflowChainByIdFeign(String id) {
|
||||
return liteflowChainService.getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/execute2RespFeign")
|
||||
public void execute2RespFeign(@RequestParam("chainName") String chainName,@RequestBody Map<String, Object> params) {
|
||||
flowExecutor.execute2Resp(chainName,params);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package com.xjrsoft.system.client;
|
||||
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.system.entity.LoginConfig;
|
||||
import com.xjrsoft.system.service.ILoginConfigService;
|
||||
import com.xjrsoft.tenant.util.TenantUtil;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hnyyzy
|
||||
* @version 1.0
|
||||
* @date 2024/1/24 10:13
|
||||
*/
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class LoginConfigClient implements ILoginConfigClient{
|
||||
|
||||
private final ILoginConfigService loginConfigService;
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/getAllListFeign")
|
||||
public List<LoginConfig> getAllListFeign() {
|
||||
TenantUtil.ignore(Boolean.TRUE);
|
||||
List<LoginConfig> loginConfigList = loginConfigService.list();
|
||||
TenantUtil.clear();
|
||||
return loginConfigList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/addLoginConfigFeign")
|
||||
public boolean addLoginConfigFeign(LoginConfig loginConfig) {
|
||||
return loginConfigService.save(loginConfig);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
package com.xjrsoft.system.client;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.system.entity.MenuButton;
|
||||
import com.xjrsoft.system.service.IMenuButtonService;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/10 19:40
|
||||
*/
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class MenuButtonClient implements IMenuButtonClient {
|
||||
|
||||
|
||||
private final IMenuButtonService menuButtonService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/getMenuButtonByMenuIdFeign")
|
||||
public List<MenuButton> getMenuButtonByMenuIdFeign(Long menuId) {
|
||||
return menuButtonService.list(Wrappers.lambdaQuery(MenuButton.class)
|
||||
.select(MenuButton::getId, MenuButton::getCode).eq(MenuButton::getMenuId, menuId));
|
||||
}
|
||||
|
||||
@Override
|
||||
@DeleteMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/deleteMenuButtonByMenuIdFeign")
|
||||
public void deleteMenuButtonByMenuIdFeign(@RequestBody Long menuId) {
|
||||
menuButtonService.remove(Wrappers.lambdaQuery(MenuButton.class).eq(MenuButton::getMenuId, menuId));
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/saveMenuButtonBatchFeign")
|
||||
public void saveMenuButtonBatchFeign(@RequestBody List<MenuButton> buttonList) {
|
||||
menuButtonService.saveBatch(buttonList);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,113 @@
|
||||
package com.xjrsoft.system.client;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.yulichang.toolkit.MPJWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.system.entity.Menu;
|
||||
import com.xjrsoft.system.mapper.MenuMapper;
|
||||
import com.xjrsoft.system.service.IMenuService;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/10 15:21
|
||||
*/
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class MenuClient implements IMenuClient {
|
||||
|
||||
private final MenuMapper menuMapper;
|
||||
|
||||
private final IMenuService menuService;
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/getMenuByIdFeign")
|
||||
public Menu getMenuByIdFeign(Long menuId) {
|
||||
return menuMapper.selectById(menuId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/getMenuListByIdsFeign")
|
||||
public List<Menu> getMenuListByIdsFeign(List<Long> menuIds) {
|
||||
|
||||
|
||||
return menuMapper.selectJoinList(Menu.class,
|
||||
MPJWrappers.<Menu>lambdaJoin()
|
||||
.disableLogicDel()
|
||||
.in(ObjectUtils.isNotEmpty(menuIds) && menuIds.size() > 0, Menu::getId, menuIds));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/getMenuByCodeFeign")
|
||||
public Menu getMenuByCodeFeign(String code) {
|
||||
return menuMapper.selectOne(Wrappers.lambdaQuery(Menu.class).select(Menu::getId).eq(Menu::getCode, code));
|
||||
}
|
||||
|
||||
@Override
|
||||
@PutMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/updateMenuFeign")
|
||||
public void updateMenuFeign(Menu menu) {
|
||||
menuMapper.updateById(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/insertMenuFeign")
|
||||
public void insertMenuFeign(@RequestBody Menu menu) {
|
||||
menuMapper.insert(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
@DeleteMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/deleteMenuFeign")
|
||||
public void deleteMenuFeign(Long menuId) {
|
||||
menuMapper.deleteById(menuId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@DeleteMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/deleteMenuBatchFeign")
|
||||
public void deleteMenuBatchFeign(@RequestBody List<Long> menuIds) {
|
||||
menuMapper.deleteBatchIds(menuIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME+ "/existsMenuFeign")
|
||||
public boolean existsMenuFeign(String code) {
|
||||
return menuMapper.exists(Wrappers.<Menu>lambdaQuery().eq(Menu::getCode, code));
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/saveOrUpdateMenuFeign")
|
||||
public Menu saveOrUpdateMenuFeign(@RequestBody Menu menu) {
|
||||
menuService.saveOrUpdate(menu);
|
||||
return menu;
|
||||
}
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/getAllMenuListFeign")
|
||||
public List<Menu> getAllMenuListFeign() {
|
||||
return menuService.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Menu getOne(Menu menu) {
|
||||
MPJLambdaWrapper<Menu> queryWrapper = new MPJLambdaWrapper<>();
|
||||
queryWrapper.eq(ObjectUtils.isNotEmpty(menu.getFormId()), Menu::getFormId, menu.getFormId());
|
||||
return menuService.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Menu> getList(Menu menu) {
|
||||
MPJLambdaWrapper<Menu> queryWrapper = new MPJLambdaWrapper<>();
|
||||
queryWrapper.like(ObjectUtils.isNotEmpty(menu.getName()), Menu::getName, menu.getName());
|
||||
return menuService.list(queryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
package com.xjrsoft.system.client;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.system.entity.MenuColumn;
|
||||
import com.xjrsoft.system.service.IMenuColumnService;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/10 19:45
|
||||
*/
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class MenuColumnClient implements IMenuColumnClient {
|
||||
|
||||
private final IMenuColumnService menuColumnService;
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/getMenuColumnByMenuIdFeign")
|
||||
public List<MenuColumn> getMenuColumnByMenuIdFeign(Long menuId) {
|
||||
return menuColumnService.list(Wrappers.lambdaQuery(MenuColumn.class)
|
||||
.select(MenuColumn::getId, MenuColumn::getCode).eq(MenuColumn::getMenuId, menuId));
|
||||
}
|
||||
|
||||
@Override
|
||||
@DeleteMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/deleteMenuColumnByMenuIdFeign")
|
||||
public void deleteMenuColumnByMenuIdFeign(@RequestBody Long menuId) {
|
||||
menuColumnService.remove(Wrappers.lambdaQuery(MenuColumn.class).eq(MenuColumn::getMenuId, menuId));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/saveMenuColumnBatchFeign")
|
||||
public void saveMenuColumnBatchFeign(@RequestBody List<MenuColumn> columnList) {
|
||||
menuColumnService.saveBatch(columnList);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package com.xjrsoft.system.client;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.system.entity.MenuForm;
|
||||
import com.xjrsoft.system.service.IMenuFormService;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/10 19:47
|
||||
*/
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class MenuFormClient implements IMenuFormClient {
|
||||
|
||||
private final IMenuFormService menuFormService;
|
||||
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/getMenuFormByMenuIdFeign")
|
||||
public List<MenuForm> getMenuFormByMenuIdFeign(Long menuId) {
|
||||
return menuFormService.list(Wrappers.lambdaQuery(MenuForm.class)
|
||||
.select(MenuForm::getId, MenuForm::getCode).eq(MenuForm::getMenuId, menuId));
|
||||
}
|
||||
|
||||
@Override
|
||||
@DeleteMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/deleteMenuFormByMenuIdFeign")
|
||||
public void deleteMenuFormByMenuIdFeign(@RequestBody Long menuId) {
|
||||
menuFormService.remove(Wrappers.lambdaQuery(MenuForm.class).eq(MenuForm::getMenuId, menuId));
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/saveMenuFormBatchFeign")
|
||||
public void saveMenuFormBatchFeign(@RequestBody List<MenuForm> formList) {
|
||||
menuFormService.saveBatch(formList);
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
package com.xjrsoft.system.client;
|
||||
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.system.model.MessageNoticePolicyParam;
|
||||
import com.xjrsoft.system.utils.SendMessageUtil;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/18 15:13
|
||||
*/
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class MessageClient implements IMessageClient {
|
||||
|
||||
@Override
|
||||
@PostMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/sendWorkflowTimeoutMessageFeign")
|
||||
public void sendWorkflowTimeoutMessageFeign(@RequestBody MessageNoticePolicyParam param) {
|
||||
SendMessageUtil.sendWorkflowTimeoutMessage(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/sendWorkflowCirculatedMessageFeign")
|
||||
public void sendWorkflowCirculatedMessageFeign(@RequestBody MessageNoticePolicyParam param) {
|
||||
SendMessageUtil.sendWorkflowCirculatedMessage(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/sendWorkflowApproveMessageFeign")
|
||||
public void sendWorkflowApproveMessageFeign(@RequestBody MessageNoticePolicyParam param) {
|
||||
SendMessageUtil.sendWorkflowApproveMessage(param);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@PostMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/sendWorkflowCirculatedEmailFeign")
|
||||
public void sendWorkflowCirculatedEmailFeign(@RequestBody MessageNoticePolicyParam param) {
|
||||
SendMessageUtil.sendWorkflowCirculatedEmail(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/sendWorkflowApproveWechatFeign")
|
||||
public void sendWorkflowApproveWechatFeign(@RequestBody MessageNoticePolicyParam param) {
|
||||
SendMessageUtil.sendWorkflowApproveWechat(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/sendWorkflowCirculatedWechatFeign")
|
||||
public void sendWorkflowCirculatedWechatFeign(@RequestBody MessageNoticePolicyParam param) {
|
||||
SendMessageUtil.sendWorkflowCirculatedWechat(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/sendWorkflowTimeoutWechatFeign")
|
||||
public void sendWorkflowTimeoutWechatFeign(@RequestBody MessageNoticePolicyParam param) {
|
||||
SendMessageUtil.sendWorkflowTimeoutWechat(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/sendWorkflowApproveDingtalkFeign")
|
||||
public void sendWorkflowApproveDingtalkFeign(@RequestBody MessageNoticePolicyParam param) {
|
||||
SendMessageUtil.sendWorkflowApproveDingtalk(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/sendWorkflowCirculatedDingtalkFeign")
|
||||
public void sendWorkflowCirculatedDingtalkFeign(@RequestBody MessageNoticePolicyParam param) {
|
||||
SendMessageUtil.sendWorkflowCirculatedDingtalk(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/sendWorkflowTimeoutDingtalkFeign")
|
||||
public void sendWorkflowTimeoutDingtalkFeign(@RequestBody MessageNoticePolicyParam param) {
|
||||
SendMessageUtil.sendWorkflowTimeoutDingtalk(param);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package com.xjrsoft.system.client;
|
||||
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.system.entity.Stamp;
|
||||
import com.xjrsoft.system.service.IStampService;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yjw
|
||||
* @createDate 2024-08-09
|
||||
*/
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class StampClient implements IStampClient{
|
||||
|
||||
private final IStampService stampService;
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/getStampByIdFeign")
|
||||
public Stamp getStampByIdFeign(Long id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/getDefaultStampByUserIdFeign")
|
||||
public List<Stamp> getDefaultStampByUserIdFeign(Long id) {
|
||||
return stampService.getDefaultStampByUserId(id);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.xjrsoft.system.client;
|
||||
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.system.entity.XjrSystemConfig;
|
||||
import com.xjrsoft.system.service.ISystemConfigService;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author yjw
|
||||
* @createDate 2024-08-07
|
||||
*/
|
||||
@Hidden
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class SystemConfigClient implements ISystemConfigClient {
|
||||
|
||||
private final ISystemConfigService systemConfigService;
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/queryByCode")
|
||||
public XjrSystemConfig queryByCode(String code) {
|
||||
return systemConfigService.queryByCode(code);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package com.xjrsoft.system.client;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.enums.EnabledMark;
|
||||
import com.xjrsoft.system.entity.Tenant;
|
||||
import com.xjrsoft.system.service.ITenantService;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/12/8 14:44
|
||||
*/
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class TenantClient implements ITenantClient{
|
||||
|
||||
private final ITenantService tenantService;
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/getTenantByCodeFeign")
|
||||
public Tenant getTenantByCodeFeign(String code) {
|
||||
|
||||
|
||||
// return tenantService.getOne(Wrappers.lambdaQuery(Tenant.class).eq(Tenant::getCode, code));
|
||||
return tenantService.getAvailableOne(code);
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_SYSTEM_NAME + "/getEnableTenantsByIdsFeign")
|
||||
public List<Tenant> getEnableTenantsByIdsFeign(List<Long> ids, boolean isAdmin) {
|
||||
return tenantService.list(Wrappers.lambdaQuery(Tenant.class)
|
||||
.in(!isAdmin, Tenant::getId, ids)
|
||||
.eq(Tenant::getEnabledMark, EnabledMark.ENABLED.getCode())
|
||||
.orderByAsc(Tenant::getSortCode));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.xjrsoft.system.components;
|
||||
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/4/7 10:38
|
||||
*/
|
||||
@LiteflowComponent("a")
|
||||
@Slf4j
|
||||
public class AComponent extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
log.info("ACmp executed!");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.xjrsoft.system.components;
|
||||
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/4/7 10:40
|
||||
*/
|
||||
@LiteflowComponent("b")
|
||||
@Slf4j
|
||||
public class BComponent extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
log.info("BCmp executed!");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.xjrsoft.system.components;
|
||||
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/4/7 10:40
|
||||
*/
|
||||
@LiteflowComponent("c")
|
||||
@Slf4j
|
||||
public class CComponent extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
log.info("CCmp executed!");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.xjrsoft.system.components;
|
||||
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/4/7 10:41
|
||||
*/
|
||||
@LiteflowComponent("d")
|
||||
@Slf4j
|
||||
public class DComponent extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
log.info("DCmp executed!");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package com.xjrsoft.system.config;
|
||||
|
||||
import com.bstek.ureport.console.UReportServlet;
|
||||
import com.bstek.ureport.definition.datasource.BuildinDatasource;
|
||||
import com.xjrsoft.common.core.exception.MyException;
|
||||
import com.xjrsoft.common.mybatis.utils.DatasourceUtil;
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2022/5/20 15:56
|
||||
*/
|
||||
@Configuration
|
||||
@ConfigurationProperties("xjrsoft.ureport")
|
||||
@Data
|
||||
public class UReportConfig implements BuildinDatasource {
|
||||
|
||||
private final static String DEFAULT_NAME = "默认数据源";
|
||||
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
return DEFAULT_NAME;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Connection getConnection() {
|
||||
try {
|
||||
return DatasourceUtil.getDatasourceMaster().getConnection();
|
||||
} catch (SQLException e) {
|
||||
throw new MyException("UReport获取数据源失败!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// @Bean
|
||||
// public ServletRegistrationBean<DocumentUreportServlet> buildUReportServlet() {
|
||||
// return new ServletRegistrationBean<>(new DocumentUreportServlet(), "/ureport/*");
|
||||
// }
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean<UReportServlet> buildUReportServlet() {
|
||||
return new ServletRegistrationBean<>(new UReportServlet(), "/ureport/*");
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,119 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.pinyin.PinyinUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.system.dto.AddAreaDto;
|
||||
import com.xjrsoft.system.dto.UpdateAreaDto;
|
||||
import com.xjrsoft.system.entity.Area;
|
||||
import com.xjrsoft.system.service.IAreaService;
|
||||
import com.xjrsoft.system.vo.AreaListVo;
|
||||
import com.xjrsoft.system.vo.AreaVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 行政区域表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-06-16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.SYSTEM_MODULE_PREFIX + "/area")
|
||||
@Tag(name = GlobalConstant.SYSTEM_MODULE_PREFIX + "/area", description = "行政区域")
|
||||
@AllArgsConstructor
|
||||
public class AreaController {
|
||||
|
||||
private final IAreaService areaService;
|
||||
|
||||
|
||||
@GetMapping("/province")
|
||||
@Operation(summary = "获取所有省份")
|
||||
public R getAllProvinceArea(@RequestParam(required = false) String keyword) {
|
||||
List<Area> provinceList = areaService.list(Wrappers.<Area>query().lambda().eq(Area::getParentId, GlobalConstant.FIRST_NODE_VALUE).like(StrUtil.isNotBlank(keyword), Area::getName, keyword));
|
||||
List<AreaListVo> resultList = BeanUtil.copyToList(provinceList, AreaListVo.class);
|
||||
return R.ok(resultList);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/child")
|
||||
@Operation(summary = "根据id 查询下级区域")
|
||||
public R getAreaByParentId(@RequestParam(required = false) Long id, @RequestParam(required = false) String keyword) {
|
||||
List<Area> provinceList = areaService.list(Wrappers.<Area>query().lambda()
|
||||
.eq(id != null, Area::getParentId, id)
|
||||
.eq(id == null, Area::getParentId, GlobalConstant.FIRST_NODE_VALUE)
|
||||
.and(StrUtil.isNotBlank(keyword), x -> {
|
||||
x.like(StrUtil.isNotBlank(keyword), Area::getName, keyword).or();
|
||||
x.like(StrUtil.isNotBlank(keyword), Area::getSimpleSpelling, keyword).or();
|
||||
x.like(StrUtil.isNotBlank(keyword), Area::getQuickQuery, keyword);
|
||||
}));
|
||||
|
||||
List<AreaListVo> resultList = BeanUtil.copyToList(provinceList, AreaListVo.class);
|
||||
return R.ok(resultList);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/info")
|
||||
@Operation(summary = "根据id 获取详情信息")
|
||||
public R info(@RequestParam String id) {
|
||||
Area area = areaService.getById(id);
|
||||
if (area == null) {
|
||||
R.error("找不到此区域!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(area, AreaVo.class));
|
||||
}
|
||||
|
||||
@GetMapping("/info/multi")
|
||||
@Operation(summary = "根据id 获取详情信息")
|
||||
public R infoMulti(@RequestParam String ids) {
|
||||
List<String> idList = StrUtil.split(ids, StringPool.COMMA);
|
||||
List<Area> areaList = areaService.listByIds(idList);
|
||||
return R.ok(BeanUtil.copyToList(areaList, AreaVo.class));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增")
|
||||
public R add(@Valid @RequestBody AddAreaDto dto) {
|
||||
long count = areaService.count(Wrappers.<Area>query().lambda().eq(Area::getCode, dto.getCode()));
|
||||
if (count > 0) {
|
||||
return R.error("区域编码已经存在!");
|
||||
}
|
||||
|
||||
Area area = BeanUtil.toBean(dto, Area.class);
|
||||
area.setQuickQuery(PinyinUtil.getPinyin(area.getName(), StringPool.EMPTY));
|
||||
return R.ok(areaService.save(area));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改")
|
||||
public R update(@Valid @RequestBody UpdateAreaDto dto) {
|
||||
long count = areaService.count(Wrappers.<Area>query().lambda()
|
||||
.eq(Area::getCode, dto.getCode())
|
||||
.ne(Area::getId, dto.getId()));
|
||||
if (count > 0) {
|
||||
return R.error("区域编码已经存在!");
|
||||
}
|
||||
Area area = BeanUtil.toBean(dto, Area.class);
|
||||
area.setQuickQuery(PinyinUtil.getPinyin(area.getName(), StringPool.EMPTY));
|
||||
|
||||
return R.ok(areaService.updateById(area));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
public R delete(@Valid @RequestBody List<Long> ids) {
|
||||
return R.ok(areaService.removeByIds(ids));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.system.service.IAuthorizeService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-03-16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.SYSTEM_MODULE_PREFIX + "/authorize")
|
||||
@Tag(name = GlobalConstant.SYSTEM_MODULE_PREFIX + "/authorize",description = "授权表")
|
||||
@AllArgsConstructor
|
||||
public class AuthorizeController {
|
||||
|
||||
private final IAuthorizeService authorizeService;
|
||||
|
||||
@GetMapping("/permissions")
|
||||
@Operation(summary="授权信息表")
|
||||
public R permissions(){
|
||||
return R.ok(authorizeService.getPermissions());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,126 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.yulichang.toolkit.MPJWrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.page.PageInput;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.organization.entity.User;
|
||||
import com.xjrsoft.system.dto.AddCodeRuleDto;
|
||||
import com.xjrsoft.system.dto.UpdateCodeRuleDto;
|
||||
import com.xjrsoft.system.entity.CodeRule;
|
||||
import com.xjrsoft.system.service.ICodeRuleService;
|
||||
import com.xjrsoft.system.vo.CodeRuleVo;
|
||||
import com.xjrsoft.tenant.config.TenantConfig;
|
||||
import com.xjrsoft.tenant.util.TenantUtil;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 编号规则表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zlf
|
||||
* @since 2022-06-23
|
||||
*/
|
||||
@Tag(name = "自动编码模块")
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.SYSTEM_MODULE_PREFIX + "/code-rule")
|
||||
@AllArgsConstructor
|
||||
public class CodeRuleController {
|
||||
|
||||
private ICodeRuleService codeRuleService;
|
||||
|
||||
private final TenantConfig tenantConfig;
|
||||
|
||||
@Operation(summary = "获取编码规则分页")
|
||||
@GetMapping("/page")
|
||||
public R page(PageInput dto) {
|
||||
TableName annotation = CodeRule.class.getAnnotation(TableName.class);
|
||||
if (annotation != null) {
|
||||
TenantUtil.ignore(tenantConfig.getIgnoreTable().stream().anyMatch(x -> x.equalsIgnoreCase(annotation.value())));
|
||||
}
|
||||
//因为多表关联 会有多个表都使用了id字段, 所以必须专门指定主表的Id,要使用创建用户createUserId去查询对应的用户名,并对应赋值给createUserName
|
||||
IPage<CodeRuleVo> page = codeRuleService.selectJoinListPage(ConventPage.getPage(dto), CodeRuleVo.class,
|
||||
MPJWrappers.<CodeRule>lambdaJoin()
|
||||
.like(StrUtil.isNotBlank(dto.getKeyword()), CodeRule::getName, dto.getKeyword())
|
||||
.select(CodeRule::getId)
|
||||
.select(CodeRule.class, x -> VoToColumnUtil.fieldsToColumns(CodeRuleVo.class).contains(x.getProperty()))
|
||||
.selectAs(User::getName, CodeRuleVo::getCreateUserName)
|
||||
.leftJoin(User.class, User::getId, CodeRule::getCreateUserId)
|
||||
.orderByAsc(CodeRule::getSortCode));
|
||||
|
||||
if (annotation != null) TenantUtil.clear();
|
||||
PageOutput<CodeRuleVo> pageOutput = ConventPage.getPageOutput(page);
|
||||
// return R.ok(codeRuleService.getCodeRulePageList(dto));
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取编码规则分页")
|
||||
@GetMapping("/list")
|
||||
public R list(@RequestParam(required = false) String keyword) {
|
||||
List<CodeRule> codeRuleList = codeRuleService.list(Wrappers.<CodeRule>query().lambda()
|
||||
.like(StrUtil.isNotBlank(keyword), CodeRule::getName, keyword));
|
||||
return R.ok(BeanUtil.copyToList(codeRuleList, CodeRuleVo.class));
|
||||
}
|
||||
|
||||
@GetMapping("/info")
|
||||
@Operation(summary = "根据id 查询编码规则详情")
|
||||
public R info(@RequestParam Long id) {
|
||||
CodeRule codeRule = codeRuleService.getById(id);
|
||||
return R.ok(BeanUtil.toBean(codeRule, CodeRuleVo.class));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增编码规则")
|
||||
public R add(@RequestBody AddCodeRuleDto addCodeRuleDto) {
|
||||
CodeRule codeRule = BeanUtil.toBean(addCodeRuleDto, CodeRule.class);
|
||||
codeRule.setCreateUserId(StpUtil.getLoginIdAsLong());
|
||||
return R.ok(codeRuleService.save(codeRule));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改编码规则")
|
||||
public R update(@RequestBody UpdateCodeRuleDto addCodeRuleDto) {
|
||||
CodeRule codeRule = BeanUtil.toBean(addCodeRuleDto, CodeRule.class);
|
||||
return R.ok(codeRuleService.updateById(codeRule));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除编码规则")
|
||||
public R delete(@RequestBody List<Long> ids) {
|
||||
return R.ok(codeRuleService.removeByIds(ids));
|
||||
}
|
||||
|
||||
@GetMapping("/generate")
|
||||
@Operation(summary = "生成自动编码")
|
||||
public R generate(@RequestParam String encode) {
|
||||
String code = codeRuleService.genEncode(encode);
|
||||
if (StrUtil.isEmpty(code)) {
|
||||
return R.error();
|
||||
}
|
||||
return R.ok(code);
|
||||
}
|
||||
|
||||
@GetMapping("/use")
|
||||
@Operation(summary = "使用自动编码")
|
||||
public R use(@RequestParam String encode) {
|
||||
if (codeRuleService.useEncode(encode)) {
|
||||
return R.ok();
|
||||
}
|
||||
return R.error("没有编码可用,请生成!");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,82 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.generate.model.OutputConfig;
|
||||
import com.xjrsoft.generate.dto.CodeFirstGeneratorDto;
|
||||
import com.xjrsoft.system.dto.AddCodeSchemaDto;
|
||||
import com.xjrsoft.system.dto.CodeSchemaPageDto;
|
||||
import com.xjrsoft.system.dto.UpdateCodeSchemaDto;
|
||||
import com.xjrsoft.system.entity.CodeSchema;
|
||||
import com.xjrsoft.system.service.ICodeSchemaService;
|
||||
import com.xjrsoft.system.vo.CodeSchemaVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 代码模板 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zlf
|
||||
* @since 2022-09-29
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.SYSTEM_MODULE_PREFIX + "/code-schema")
|
||||
@Tag(name = "/code-schema", description = "代码模板模块")
|
||||
@AllArgsConstructor
|
||||
public class CodeSchemaController {
|
||||
|
||||
private ICodeSchemaService codeSchemeService;
|
||||
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
@Operation(summary="获取代码模板分页")
|
||||
@GetMapping("/page")
|
||||
public R page(CodeSchemaPageDto dto){
|
||||
return R.ok(codeSchemeService.page(dto));
|
||||
}
|
||||
|
||||
@GetMapping("/info")
|
||||
@Operation(summary="根据id 查询代码模板详情")
|
||||
public R info(Long id){
|
||||
CodeSchema codeSchema = codeSchemeService.getById(id);
|
||||
return R.ok(BeanUtil.toBean(codeSchema, CodeSchemaVo.class));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary="新增代码模板")
|
||||
public R add(@RequestBody AddCodeSchemaDto codeSchemaDto) {
|
||||
CodeSchema codeSchema = BeanUtil.toBean(codeSchemaDto, CodeSchema.class);
|
||||
buildCodeSchema(codeSchema, codeSchemaDto.getContent());
|
||||
return R.ok(codeSchemeService.save(codeSchema));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary="修改代码模板")
|
||||
public R update(@RequestBody UpdateCodeSchemaDto codeSchemaDto) {
|
||||
CodeSchema codeSchema = BeanUtil.toBean(codeSchemaDto, CodeSchema.class);
|
||||
buildCodeSchema(codeSchema, codeSchemaDto.getContent());
|
||||
return R.ok(codeSchemeService.updateById(codeSchema));
|
||||
}
|
||||
@DeleteMapping
|
||||
@Operation(summary="删除代码模板")
|
||||
public R delete(@RequestBody List<Long> ids) {
|
||||
return R.ok(codeSchemeService.removeBatchByIds(ids));
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
private void buildCodeSchema(CodeSchema codeSchema, String content) {
|
||||
CodeFirstGeneratorDto dto = objectMapper.readValue(content, CodeFirstGeneratorDto.class);
|
||||
OutputConfig outputConfig = dto.getOutputConfig();
|
||||
codeSchema.setCategory(Long.parseLong(outputConfig.getOutputArea()));
|
||||
codeSchema.setDescription(outputConfig.getComment());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据权限自定义配置详情表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-02-27
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(GlobalConstant.AUTHORITY_MODULE_PREFIX + "/data-auth-config")
|
||||
public class DataAuthConfigController {
|
||||
|
||||
}
|
||||
@ -0,0 +1,148 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.common.redis.service.RedisUtil;
|
||||
import com.xjrsoft.organization.entity.User;
|
||||
import com.xjrsoft.system.dto.AddDataAuthDto;
|
||||
import com.xjrsoft.system.dto.DataAuthListDto;
|
||||
import com.xjrsoft.system.dto.DataAuthPageDto;
|
||||
import com.xjrsoft.system.dto.UpdateDataAuthDto;
|
||||
import com.xjrsoft.system.entity.DataAuth;
|
||||
import com.xjrsoft.system.service.IDataAuthService;
|
||||
import com.xjrsoft.system.vo.DataAuthListVo;
|
||||
import com.xjrsoft.system.vo.DataAuthPageVo;
|
||||
import com.xjrsoft.system.vo.DataAuthVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据权限表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-02-27
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.AUTHORITY_MODULE_PREFIX + "/data-auth")
|
||||
@Tag(name = GlobalConstant.ORGANIZATION_MODULE_PREFIX + "/data-auth", description = "数据权限")
|
||||
@AllArgsConstructor
|
||||
public class DataAuthController {
|
||||
|
||||
private IDataAuthService authService;
|
||||
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@GetMapping(value = "/list")
|
||||
@Operation(summary = "数据权限(不分页)")
|
||||
public R list(@Valid DataAuthListDto dto) {
|
||||
//因为多表关联 会有多个表都使用了id字段, 所以必须专门指定主表的Id
|
||||
List<DataAuthListVo> list = authService.selectJoinList(DataAuthListVo.class,
|
||||
new MPJLambdaWrapper<DataAuth>()
|
||||
.disableSubLogicDel()
|
||||
.and(StrUtil.isNotBlank(dto.getKeyword()), wrapper -> wrapper.like(DataAuth::getName, dto.getKeyword()).or().like(DataAuth::getCode, dto.getKeyword()))
|
||||
.select(DataAuth::getId)
|
||||
.select(DataAuth.class, x -> VoToColumnUtil.fieldsToColumns(DataAuthListVo.class).contains(x.getProperty()))
|
||||
.leftJoin(User.class, User::getId, DataAuth::getCreateUserId, ext -> ext.selectAs(User::getName, DataAuthListVo::getCreateUserName))
|
||||
.leftJoin(User.class, User::getId, DataAuth::getModifyUserId, ext -> ext.selectAs(User::getName, DataAuthListVo::getModifyUserName))
|
||||
// .leftJoin(DataAuthRelation.class, DataAuthRelation::getDataAuthId, DataAuth::getId)
|
||||
// .selectCollection(DataAuthRelation.class, DataAuth::getAuthObjectList)
|
||||
.orderByDesc(DataAuth::getCreateDate)
|
||||
// .leftJoin(User.class, User::getId, DataAuthRelation::getObjectId, ext -> ext.selectCollection(User::getName,Data))
|
||||
);
|
||||
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "数据权限(分页)")
|
||||
public R page(@Valid DataAuthPageDto dto) {
|
||||
//因为多表关联 会有多个表都使用了id字段, 所以必须专门指定主表的Id
|
||||
IPage<DataAuthPageVo> page = authService.selectJoinListPage(ConventPage.getPage(dto), DataAuthPageVo.class,
|
||||
new MPJLambdaWrapper<DataAuth>()
|
||||
.disableSubLogicDel()
|
||||
.and(StrUtil.isNotBlank(dto.getKeyword()), wrapper -> wrapper.like(DataAuth::getName, dto.getKeyword()).or().like(DataAuth::getCode, dto.getKeyword()))
|
||||
.select(DataAuth::getId)
|
||||
.select(DataAuth.class, x -> VoToColumnUtil.fieldsToColumns(DataAuthPageVo.class).contains(x.getProperty()))
|
||||
.leftJoin(User.class, User::getId, DataAuth::getCreateUserId, ext -> ext.selectAs(User::getName, DataAuthListVo::getCreateUserName))
|
||||
.leftJoin(User.class, User::getId, DataAuth::getModifyUserId, ext -> ext.selectAs(User::getName, DataAuthListVo::getModifyUserName))
|
||||
// .leftJoin(DataAuthRelation.class, DataAuthRelation::getDataAuthId, DataAuth::getId)
|
||||
// .selectCollection(DataAuthRelation.class, DataAuth::getAuthObjectList)
|
||||
.orderByDesc(DataAuth::getCreateDate)
|
||||
// .leftJoin(User.class, User::getId, DataAuthRelation::getObjectId, ext -> ext.selectCollection(User::getName,Data))
|
||||
);
|
||||
|
||||
|
||||
PageOutput<DataAuthPageVo> pageOutput = ConventPage.getPageOutput(page);
|
||||
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "根据id查询数据权限信息")
|
||||
public R info(@RequestParam Long id) {
|
||||
|
||||
DataAuth dataAuth = authService.getByIdDeep(id);
|
||||
if (dataAuth == null) {
|
||||
R.error("找不到此权限数据!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(dataAuth, DataAuthVo.class));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增权限")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R add(@Valid @RequestBody AddDataAuthDto dto) {
|
||||
long count = authService.count(Wrappers.<DataAuth>query().lambda().eq(DataAuth::getName, dto.getName()).or().eq(DataAuth::getCode, dto.getCode()));
|
||||
if (count > 0) {
|
||||
return R.error("数据权限名称或编码已存在!");
|
||||
}
|
||||
return R.ok(authService.add(dto));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改权限")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R update(@Valid @RequestBody UpdateDataAuthDto dto) {
|
||||
|
||||
long count = authService.count(Wrappers.<DataAuth>query().lambda()
|
||||
.eq(DataAuth::getCode, dto.getCode())
|
||||
.ne(DataAuth::getId, dto.getId()));
|
||||
|
||||
if (count > 0) {
|
||||
return R.error("编码已经存在!");
|
||||
}
|
||||
return R.ok(authService.edit(dto));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除用户(可批量)")
|
||||
public R delete(@RequestBody List<Long> ids) {
|
||||
|
||||
boolean isSuccess = authService.removeBatchByIds(ids);
|
||||
redisUtil.set(GlobalConstant.DATA_AUTH_CACHE_KEY, authService.list());
|
||||
return R.ok(isSuccess);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/auth-objects")
|
||||
@Operation(summary = "查询数据权限授权对象")
|
||||
public R getAuthObjectsInfo(@RequestParam Long id) {
|
||||
return R.ok(authService.getAuthObjectsInfo(id));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据权限 对象类型关联表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-02-27
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(GlobalConstant.AUTHORITY_MODULE_PREFIX + "/data-auth-relation")
|
||||
public class DataAuthRelationController {
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据权限 与 表 关联关系表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-02-28
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/authority/dataAuthTableRelation")
|
||||
public class DataAuthTableRelationController {
|
||||
|
||||
}
|
||||
@ -0,0 +1,302 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.db.meta.Column;
|
||||
import cn.hutool.db.meta.MetaUtil;
|
||||
import cn.hutool.db.meta.Table;
|
||||
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty;
|
||||
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties;
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.JdbcUtils;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.common.generate.model.TableFieldConfig;
|
||||
import com.xjrsoft.common.generate.model.TableStructureConfig;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.common.mybatis.utils.DatasourceUtil;
|
||||
import com.xjrsoft.system.dto.*;
|
||||
import com.xjrsoft.system.entity.Databaselink;
|
||||
import com.xjrsoft.system.service.IDatabaselinkService;
|
||||
import com.xjrsoft.system.vo.DatabaseLinkListVo;
|
||||
import com.xjrsoft.system.vo.DatabaseLinkVo;
|
||||
import com.xjrsoft.system.vo.DatabaselinkPageVo;
|
||||
import com.xjrsoft.system.vo.ValidateTableResultVo;
|
||||
import com.xjrsoft.tenant.config.TenantConfig;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据库连接表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-03-04
|
||||
*/
|
||||
@Tag(name = "数据库链接模块")
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.SYSTEM_MODULE_PREFIX+ "/databaselink")
|
||||
@AllArgsConstructor
|
||||
public class DatabaselinkController {
|
||||
|
||||
private final IDatabaselinkService databaselinkService;
|
||||
|
||||
private final DynamicDataSourceProperties dataSourceProperties;
|
||||
|
||||
private final TenantConfig tenantConfig;
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "查询数据库链接(分页)")
|
||||
public R page(@Valid DatabaseLinkPageDto dto){
|
||||
|
||||
LambdaQueryWrapper<Databaselink> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(StrUtil.isNotBlank(dto.getKeyword()),Databaselink::getDbName,dto.getKeyword())
|
||||
.like(StrUtil.isNotBlank(dto.getDbName()),Databaselink::getDbName,dto.getDbName())
|
||||
.like(StrUtil.isNotBlank(dto.getDbType()),Databaselink::getDbType,dto.getDbType())
|
||||
.select(Databaselink.class,x -> VoToColumnUtil.fieldsToColumns(DatabaselinkPageVo.class).contains(x.getProperty()));
|
||||
|
||||
IPage<Databaselink> page = databaselinkService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<DatabaselinkPageVo> pageOutput = ConventPage.getPageOutput(page, DatabaselinkPageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Operation(summary = "查询数据库链接(不分页)")
|
||||
public R list(@Valid DatabaseLinkListDto dto){
|
||||
|
||||
LambdaQueryWrapper<Databaselink> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(StrUtil.isNotBlank(dto.getDbName()),Databaselink::getDbName,dto.getDbName())
|
||||
.like(StrUtil.isNotBlank(dto.getDbType()),Databaselink::getDbType,dto.getDbType())
|
||||
.select(Databaselink.class,x -> VoToColumnUtil.fieldsToColumns(DatabaselinkPageVo.class).contains(x.getProperty()));
|
||||
List<Databaselink> databaseLinkList = databaselinkService.list(queryWrapper);
|
||||
List<DatabaseLinkListVo> resultList = new ArrayList<>();
|
||||
resultList.add(BeanUtil.toBean(masterInfo().getData(), DatabaseLinkListVo.class));
|
||||
resultList.addAll(BeanUtil.copyToList(databaseLinkList, DatabaseLinkListVo.class));
|
||||
return R.ok(resultList);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/master-info")
|
||||
@Operation(summary = "查询主数据库链接详情")
|
||||
public R masterInfo() {
|
||||
DatabaseLinkVo vo = new DatabaseLinkVo();
|
||||
String primary = dataSourceProperties.getPrimary();
|
||||
vo.setId(primary);
|
||||
vo.setDbName("默认数据库");
|
||||
DataSourceProperty dataSourceProperty = dataSourceProperties.getDatasource().get(primary);
|
||||
vo.setDbType(JdbcUtils.getDbType(dataSourceProperty.getUrl()).getDb());
|
||||
vo.setHost(dataSourceProperty.getUrl());
|
||||
vo.setUsername(dataSourceProperty.getUsername());
|
||||
vo.setDriver(dataSourceProperty.getDriverClassName());
|
||||
return R.ok(vo);
|
||||
}
|
||||
|
||||
@GetMapping("/info")
|
||||
@Operation(summary = "查询数据库链接详情")
|
||||
public R info(@RequestParam Long id){
|
||||
Databaselink databaselink = databaselinkService.getById(id);
|
||||
if (databaselink == null) {
|
||||
R.error("找不到此链接详情!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(databaselink, DatabaseLinkVo.class));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增数据库链接")
|
||||
public R add(@Valid @RequestBody AddDatabaseLinkDto dto){
|
||||
return R.ok(databaselinkService.add(dto));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改数据库链接")
|
||||
public R update(@Valid @RequestBody UpdateDatabaseLinkDto dto){
|
||||
|
||||
long count = databaselinkService.count(Wrappers.<Databaselink>query().lambda().eq(Databaselink::getDbName,dto.getDbName()).ne(Databaselink::getId,dto.getId()));
|
||||
if(count > 0){
|
||||
return R.error("数据库名称已经存在!");
|
||||
}
|
||||
|
||||
Databaselink databaselink = BeanUtil.toBean(dto, Databaselink.class);
|
||||
|
||||
if(!databaselinkService.test(databaselink)){
|
||||
return R.error("数据库无法连接,请检查参数信息!");
|
||||
}
|
||||
|
||||
return R.ok(databaselinkService.updateById(databaselink));
|
||||
}
|
||||
|
||||
@PostMapping("/test")
|
||||
@Operation(summary = "修改数据库链接")
|
||||
public R test(@Valid @RequestBody AddDatabaseLinkDto dto){
|
||||
Databaselink databaselink = BeanUtil.toBean(dto, Databaselink.class);
|
||||
return R.ok(databaselinkService.test(databaselink));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
public R delete(@RequestBody List<Long> ids){
|
||||
return R.ok(databaselinkService.removeBatchByIds(ids));
|
||||
}
|
||||
|
||||
@GetMapping("/table")
|
||||
@Operation(summary = "获取当前数据库连接下的所有表")
|
||||
public R getTable(@RequestParam String id,@RequestParam(required = false) String tableName){
|
||||
return R.ok(databaselinkService.getTables(id,tableName));
|
||||
}
|
||||
|
||||
@GetMapping("/table/data")
|
||||
@Operation(summary = "获取当前数据库连接下的所选表数据")
|
||||
public R getTableData(@RequestParam String id,@RequestParam(required = false) String tableName){
|
||||
return R.ok(databaselinkService.getTablesData(id,tableName));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/table/columns")
|
||||
@Operation(summary = "获取当前数据库连接下某个表的所有字段")
|
||||
public R getTableColumn(@RequestParam String id,@RequestParam String tableName){
|
||||
return R.ok(databaselinkService.getTableColumns(id,tableName));
|
||||
}
|
||||
|
||||
@GetMapping("/table/columns-name")
|
||||
@Operation(summary = "获取当前数据库连接下某个表的所有字段")
|
||||
public R getTableColumnName(@RequestParam String id,@RequestParam String tableName){
|
||||
return R.ok(databaselinkService.getTableColumnName(id,tableName));
|
||||
}
|
||||
|
||||
@GetMapping("/table/columns/multi")
|
||||
@Operation(summary = "根据表名获取多个表字段信息")
|
||||
public R getMultiTableColumn(@RequestParam String id,@RequestParam String tableNames){
|
||||
return R.ok(databaselinkService.getMultiTableColumns(id,tableNames));
|
||||
}
|
||||
|
||||
@GetMapping("/table/columns-name/multi")
|
||||
@Operation(summary = "根据表名获取多个表字段名")
|
||||
public R getMultiTableColumnName(@RequestParam String id,@RequestParam String tableNames){
|
||||
return R.ok(databaselinkService.getMultiTableColumnName(id,tableNames));
|
||||
}
|
||||
|
||||
@GetMapping("/table/validate-name")
|
||||
@Operation(summary = "验证表名是否存在")
|
||||
public R validateTableName(@RequestParam String id, @RequestParam String tableNames){
|
||||
List<String> allTableNameList = MetaUtil.getTables(DatasourceUtil.getDataSource(id));
|
||||
String[] tableNameArray = StringUtils.split(tableNames, StringPool.COMMA);
|
||||
List<String> existTableList = new ArrayList<>();
|
||||
for (String validatedName : tableNameArray) {
|
||||
for (String tableName : allTableNameList) {
|
||||
if (StringUtils.equalsIgnoreCase(tableName, validatedName)) {
|
||||
existTableList.add(validatedName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(existTableList)) {
|
||||
return R.error("表名已存在:" + existTableList);
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping("/table/validate")
|
||||
@Operation(summary = "验证表结构")
|
||||
@SneakyThrows
|
||||
public R validateTable(@RequestBody ValidateTableDto dto) {
|
||||
String databaseId = dto.getDatabaseId();
|
||||
DataSource dataSource = DatasourceUtil.getDataSource(databaseId);
|
||||
String databaseName = null;
|
||||
DbType dbType = null;
|
||||
if (StrUtil.equalsIgnoreCase(databaseId, GlobalConstant.DEFAULT_DATASOURCE_KEY)) {
|
||||
databaseName = "默认数据库";
|
||||
dbType = DatasourceUtil.getDataSourceMasterDbType();
|
||||
} else {
|
||||
Databaselink databaselink = databaselinkService.getById(Long.valueOf(databaseId));
|
||||
databaselink.getDbName();
|
||||
dbType = JdbcUtils.getDbType(databaselink.getHost());
|
||||
}
|
||||
List<String> allTableNameList = MetaUtil.getTables(dataSource);
|
||||
List<ValidateTableResultVo> resultList = new ArrayList<>();
|
||||
for (TableStructureConfig tableStructureConfig : dto.getTableStructureConfigs()) {
|
||||
String tableName = tableStructureConfig.getTableName();
|
||||
ValidateTableResultVo resultVo = new ValidateTableResultVo();
|
||||
resultVo.setDatabaseName(databaseName);
|
||||
resultVo.setTableName(tableName);
|
||||
if (allTableNameList.stream().anyMatch(x -> StringUtils.equalsIgnoreCase(tableName, x))) {
|
||||
// 数据库表信息
|
||||
Table table = MetaUtil.getTableMeta(dataSource, tableName);
|
||||
// 添加主表主键
|
||||
TableFieldConfig pk = new TableFieldConfig();
|
||||
pk.setFieldName(GlobalConstant.DEFAULT_PK);
|
||||
pk.setFieldType(6);
|
||||
tableStructureConfig.getTableFieldConfigs().add(pk);
|
||||
if (!tableStructureConfig.getIsMain()) {
|
||||
// 不是主表加入外键
|
||||
TableFieldConfig fk = new TableFieldConfig();
|
||||
fk.setFieldName(GlobalConstant.DEFAULT_FK);
|
||||
fk.setFieldType(6);
|
||||
tableStructureConfig.getTableFieldConfigs().add(fk);
|
||||
}
|
||||
if (tenantConfig.getEnabled()) {
|
||||
// 不是主表加入外键
|
||||
TableFieldConfig tenantField = new TableFieldConfig();
|
||||
tenantField.setFieldName(tenantConfig.getTenantField());
|
||||
tenantField.setFieldType(6);
|
||||
tableStructureConfig.getTableFieldConfigs().add(tenantField);
|
||||
}
|
||||
if (tableStructureConfig.getTableFieldConfigs().size() != table.getColumns().size()) {
|
||||
// 表字段数量不一致
|
||||
resultVo.setStatus(2);
|
||||
}
|
||||
// 对比表字段差异
|
||||
if (resultVo.getStatus() == null) {
|
||||
for (TableFieldConfig fieldConfig : tableStructureConfig.getTableFieldConfigs()) {
|
||||
boolean isMatchField = false;
|
||||
for (Column tableField : table.getColumns()) {
|
||||
Integer fieldLength = fieldConfig.getFieldLength();
|
||||
Integer type = fieldConfig.getFieldType();
|
||||
String dataType = DatasourceUtil.getDbType(dbType, type);
|
||||
if (StrUtil.equalsIgnoreCase(fieldConfig.getFieldName(), tableField.getName())
|
||||
&& StrUtil.equalsIgnoreCase(dataType, tableField.getTypeName())
|
||||
&& (type != 0 || fieldLength.equals(tableField.getSize()))) {
|
||||
isMatchField = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isMatchField) {
|
||||
resultVo.setStatus(2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (resultVo.getStatus() == null) {
|
||||
// 表结构相同
|
||||
resultVo.setStatus(1);
|
||||
}
|
||||
}
|
||||
if (resultVo.getStatus() == null) {
|
||||
// 不存在该表
|
||||
resultVo.setStatus(3);
|
||||
}
|
||||
resultList.add(resultVo);
|
||||
}
|
||||
return R.ok(resultList);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,137 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.yulichang.toolkit.MPJWrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.system.dto.AddDatasourceDto;
|
||||
import com.xjrsoft.system.dto.DatasourcePageDto;
|
||||
import com.xjrsoft.system.dto.GetDataPageDto;
|
||||
import com.xjrsoft.system.dto.UpdateDatasourceDto;
|
||||
import com.xjrsoft.system.entity.Databaselink;
|
||||
import com.xjrsoft.system.entity.Datasource;
|
||||
import com.xjrsoft.system.service.IDatasourceService;
|
||||
import com.xjrsoft.system.vo.DatasourceListVo;
|
||||
import com.xjrsoft.system.vo.DatasourcePageVo;
|
||||
import com.xjrsoft.system.vo.DatasourceVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据源表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-03-08
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.SYSTEM_MODULE_PREFIX + "/datasource")
|
||||
@Tag(name = GlobalConstant.SYSTEM_MODULE_PREFIX + "/datasource", description = "数据源")
|
||||
@AllArgsConstructor
|
||||
public class DatasourceController {
|
||||
private final IDatasourceService datasourceService;
|
||||
|
||||
@GetMapping(value = "/list")
|
||||
@Operation(summary = "数据源列表(不分页)")
|
||||
public R list() {
|
||||
List<Datasource> list = datasourceService.list(Wrappers.lambdaQuery(Datasource.class)
|
||||
.select(Datasource.class, x -> VoToColumnUtil.fieldsToColumns(DatasourceListVo.class).contains(x.getProperty())));
|
||||
List<DatasourceListVo> datasourceListVos = BeanUtil.copyToList(list, DatasourceListVo.class);
|
||||
return R.ok(datasourceListVos);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "数据源列表(分页)")
|
||||
public R page(@Valid DatasourcePageDto dto) {
|
||||
|
||||
//因为多表关联 会有多个表都使用了id字段, 所以必须专门指定主表的Id
|
||||
IPage<DatasourcePageVo> page = datasourceService.selectJoinListPage(ConventPage.getPage(dto), DatasourcePageVo.class,
|
||||
MPJWrappers.<Datasource>lambdaJoin()
|
||||
.like(StrUtil.isNotBlank(dto.getKeyword()), Datasource::getName, dto.getKeyword())
|
||||
.or()
|
||||
.like(StrUtil.isNotBlank(dto.getKeyword()), Datasource::getCode, dto.getKeyword())
|
||||
.disableSubLogicDel()
|
||||
.select(Datasource::getId)
|
||||
.select(Datasource.class, x -> VoToColumnUtil.fieldsToColumns(DatasourcePageVo.class).contains(x.getProperty()))
|
||||
.selectAs(Databaselink::getDbName, DatasourcePageVo::getDbName)
|
||||
.leftJoin(Databaselink.class, Databaselink::getId, Datasource::getDatabaselinkId));
|
||||
|
||||
PageOutput<DatasourcePageVo> pageOutput = ConventPage.getPageOutput(page);
|
||||
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "根据id查询数据源信息")
|
||||
public R get(Long id) {
|
||||
Datasource datasource = datasourceService.getById(id);
|
||||
if (datasource == null) {
|
||||
R.error("找不到此数据源!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(datasource, DatasourceVo.class));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增数据源")
|
||||
public R add(@Valid @RequestBody AddDatasourceDto dto) {
|
||||
long count = datasourceService.count(Wrappers.<Datasource>query().lambda().eq(Datasource::getName, dto.getName()).or().eq(Datasource::getCode, dto.getCode()));
|
||||
if (count > 0) {
|
||||
return R.error("数据源已经存在!");
|
||||
}
|
||||
Datasource datasource = BeanUtil.toBean(dto, Datasource.class);
|
||||
|
||||
return R.ok(datasourceService.save(datasource));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改数据源")
|
||||
public R update(@Valid @RequestBody UpdateDatasourceDto dto) {
|
||||
long count = datasourceService.count(Wrappers.<Datasource>query().lambda()
|
||||
.eq(Datasource::getCode, dto.getCode())
|
||||
.ne(Datasource::getId, dto.getId()));
|
||||
|
||||
if (count > 0) {
|
||||
return R.error("数据源编码已经存在!");
|
||||
}
|
||||
|
||||
Datasource datasource = BeanUtil.toBean(dto, Datasource.class);
|
||||
|
||||
return R.ok(datasourceService.updateById(datasource));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "批量删除数据源")
|
||||
public R delete(@Valid @RequestBody List<Long> ids) {
|
||||
return R.ok(datasourceService.removeByIds(ids));
|
||||
}
|
||||
|
||||
@GetMapping("/column")
|
||||
@Operation(summary = "根据id获取sql所返回列")
|
||||
private R getColumns(@RequestParam Long id) {
|
||||
return R.ok(datasourceService.getColumns(id));
|
||||
}
|
||||
|
||||
@GetMapping("/data")
|
||||
@Operation(summary = "根据id获取sql返回值 (不分页)")
|
||||
private R getData(@RequestParam Long id) {
|
||||
return R.ok(datasourceService.getData(id));
|
||||
}
|
||||
|
||||
@GetMapping("/data/page")
|
||||
@Operation(summary = "根据id获取sql返回值 (分页)")
|
||||
private R getDataPage(@Valid GetDataPageDto dto) {
|
||||
return R.ok(datasourceService.getDataPage(dto));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,129 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.system.dto.AddDictionaryDetailDto;
|
||||
import com.xjrsoft.system.dto.DictionaryDetailListDto;
|
||||
import com.xjrsoft.system.dto.DictionaryDetailPageDto;
|
||||
import com.xjrsoft.system.dto.UpdateDictionaryDetailDto;
|
||||
import com.xjrsoft.system.entity.DictionaryDetail;
|
||||
import com.xjrsoft.system.service.IDictionarydetailService;
|
||||
import com.xjrsoft.system.vo.DictionaryDetailListVo;
|
||||
import com.xjrsoft.system.vo.DictionaryDetailPageVo;
|
||||
import com.xjrsoft.system.vo.DictionaryDetailVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据字典详情 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-03-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.SYSTEM_MODULE_PREFIX + "/dictionary-detail")
|
||||
@Tag(name = GlobalConstant.SYSTEM_MODULE_PREFIX + "/dictionary-detail",description = "数据字典详情")
|
||||
@AllArgsConstructor
|
||||
public class DictionarydetailController {
|
||||
|
||||
private IDictionarydetailService dictionarydetailService;
|
||||
|
||||
@GetMapping
|
||||
@Operation(summary = "获取当前数据字典详情(不分页)")
|
||||
public R list(DictionaryDetailListDto dto){
|
||||
LambdaQueryWrapper<DictionaryDetail> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(StrUtil.isNotEmpty(dto.getName()),DictionaryDetail::getName,dto.getName());
|
||||
queryWrapper.eq(StrUtil.isNotEmpty(dto.getCode()),DictionaryDetail::getCode,dto.getCode());
|
||||
queryWrapper.eq(ObjectUtil.isNotEmpty(dto.getItemId()) && dto.getItemId() != 0,DictionaryDetail::getItemId,dto.getItemId());
|
||||
queryWrapper.select(DictionaryDetail.class, x -> VoToColumnUtil.fieldsToColumns(DictionaryDetailListVo.class).contains(x.getProperty()));
|
||||
queryWrapper.orderByAsc(DictionaryDetail::getSortCode);
|
||||
List<DictionaryDetail> list = dictionarydetailService.list(queryWrapper);
|
||||
return R.ok(BeanUtil.copyToList(list, DictionaryDetailListVo.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获取当前数据字典详情(分页)")
|
||||
public R page(DictionaryDetailPageDto dto){
|
||||
LambdaQueryWrapper<DictionaryDetail> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(StrUtil.isNotEmpty(dto.getName()),DictionaryDetail::getName,dto.getName())
|
||||
.eq(StrUtil.isNotEmpty(dto.getCode()),DictionaryDetail::getCode,dto.getCode())
|
||||
.and(StrUtil.isNotEmpty(dto.getKeyword()), wrapper -> wrapper.like(DictionaryDetail::getName, dto.getKeyword()).or().like(DictionaryDetail::getCode, dto.getKeyword()))
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getItemId()) && dto.getItemId() != 0,DictionaryDetail::getItemId,dto.getItemId())
|
||||
.select(DictionaryDetail.class, x -> VoToColumnUtil.fieldsToColumns(DictionaryDetailPageVo.class).contains(x.getProperty()))
|
||||
.orderByAsc(DictionaryDetail::getSortCode);
|
||||
|
||||
IPage<DictionaryDetail> page = dictionarydetailService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<DictionaryDetailPageVo> pageOutput = ConventPage.getPageOutput(page, DictionaryDetailPageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping("/info")
|
||||
@Operation(summary = "获取当前数据字典详情的详情")
|
||||
public R info(@RequestParam Long id){
|
||||
DictionaryDetail dictionaryDetail = dictionarydetailService.getById(id);
|
||||
if (dictionaryDetail == null) {
|
||||
R.error("找不到此字典详情!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(dictionaryDetail, DictionaryDetailVo.class));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增数据字典详情")
|
||||
public R add(@Valid @RequestBody AddDictionaryDetailDto dto){
|
||||
|
||||
long count = dictionarydetailService.count(Wrappers.<DictionaryDetail>query().lambda().eq(DictionaryDetail::getItemId, dto.getItemId())
|
||||
.and(wrapper -> wrapper.eq(DictionaryDetail::getName, dto.getName())
|
||||
.or().eq(DictionaryDetail::getValue, dto.getValue())
|
||||
.or().eq(DictionaryDetail::getCode, dto.getCode())));
|
||||
if(count > 0){
|
||||
return R.error("字典名称、编码或值已经存在!");
|
||||
}
|
||||
|
||||
DictionaryDetail dictionaryDetail = BeanUtil.toBean(dto, DictionaryDetail.class);
|
||||
|
||||
boolean isSuccess = dictionarydetailService.save(dictionaryDetail);
|
||||
if (isSuccess) dictionarydetailService.loadCaches();
|
||||
return R.ok(isSuccess);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改数据字典详情")
|
||||
public R update(@Valid @RequestBody UpdateDictionaryDetailDto dto){
|
||||
long count = dictionarydetailService.count(Wrappers.<DictionaryDetail>query().lambda()
|
||||
.eq(DictionaryDetail::getItemId, dto.getItemId())
|
||||
.ne(DictionaryDetail::getId,dto.getId())
|
||||
.and(wrapper -> wrapper.eq(DictionaryDetail::getName, dto.getName())
|
||||
.or().eq(DictionaryDetail::getValue, dto.getValue())
|
||||
.or().eq(DictionaryDetail::getCode, dto.getCode())));
|
||||
if(count > 0){
|
||||
return R.error("字典名称、编码或值已经存在!");
|
||||
}
|
||||
DictionaryDetail dictionaryItem = BeanUtil.toBean(dto, DictionaryDetail.class);
|
||||
|
||||
boolean isSuccess = dictionarydetailService.updateById(dictionaryItem);
|
||||
if (isSuccess) dictionarydetailService.loadCaches();
|
||||
return R.ok(isSuccess);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除数据字典详情")
|
||||
public R delete(@RequestBody List<Long> ids){
|
||||
return R.ok(dictionarydetailService.removeBatchByIds(ids));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,174 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.system.dto.*;
|
||||
import com.xjrsoft.system.entity.DictionaryDetail;
|
||||
import com.xjrsoft.system.entity.DictionaryItem;
|
||||
import com.xjrsoft.system.service.IDictionarydetailService;
|
||||
import com.xjrsoft.system.service.IDictionaryitemService;
|
||||
import com.xjrsoft.system.vo.DictionaryItemDetailVo;
|
||||
import com.xjrsoft.system.vo.DictionaryItemPageVo;
|
||||
import com.xjrsoft.system.vo.DictionaryItemVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据字典项目 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-03-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.SYSTEM_MODULE_PREFIX + "/dictionary-item")
|
||||
@Tag(name = GlobalConstant.SYSTEM_MODULE_PREFIX + "/dictionary-item",description = "数据字典项目")
|
||||
@AllArgsConstructor
|
||||
public class DictionaryitemController {
|
||||
|
||||
private final IDictionaryitemService dictionaryitemService;
|
||||
|
||||
private final IDictionarydetailService dictionarydetailService;
|
||||
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获取 数据字典项目列表(不分页)")
|
||||
public R list(@Valid DictionaryItemPageDto dto){
|
||||
|
||||
LambdaQueryWrapper<DictionaryItem> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(StrUtil.isNotBlank(dto.getName()), DictionaryItem::getName,dto.getName())
|
||||
.like(StrUtil.isNotBlank(dto.getCode()), DictionaryItem::getCode,dto.getCode())
|
||||
.select(DictionaryItem.class, x -> VoToColumnUtil.fieldsToColumns(DictionaryItemPageVo.class).contains(x.getProperty()));
|
||||
|
||||
List<DictionaryItem> list = dictionaryitemService.list(queryWrapper);
|
||||
List<DictionaryItemVo> dictionaryItemVos = BeanUtil.copyToList(list, DictionaryItemVo.class);
|
||||
return R.ok(dictionaryItemVos);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获取所有数据字典项目(分页)")
|
||||
public R page(@Valid DictionaryItemPageDto dto){
|
||||
|
||||
LambdaQueryWrapper<DictionaryItem> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(StrUtil.isNotBlank(dto.getName()), DictionaryItem::getName,dto.getName())
|
||||
.like(StrUtil.isNotBlank(dto.getCode()), DictionaryItem::getCode,dto.getCode())
|
||||
.select(DictionaryItem.class, x -> VoToColumnUtil.fieldsToColumns(DictionaryItemPageVo.class).contains(x.getProperty()))
|
||||
.orderByAsc(DictionaryItem::getSortCode);
|
||||
|
||||
IPage<DictionaryItem> page = dictionaryitemService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<DictionaryItemPageVo> pageOutput = ConventPage.getPageOutput(page, DictionaryItemPageVo.class);
|
||||
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping("/info")
|
||||
@Operation(summary = "根据id获取项目详情")
|
||||
public R info(@RequestParam Long id){
|
||||
DictionaryItem dictionaryItem = dictionaryitemService.getById(id);
|
||||
if (dictionaryItem == null){
|
||||
R.error("找不到此字典项目!");
|
||||
}
|
||||
|
||||
return R.ok(BeanUtil.toBean(dictionaryItem, DictionaryItemVo.class));
|
||||
}
|
||||
|
||||
@GetMapping("/detail")
|
||||
@Operation(summary = "获取当前数据字典项目下所有字典详情")
|
||||
public R detail(@Valid DictionaryItemDetailDto dto){
|
||||
List<String> values = StrUtil.split(dto.getValues(), StringPool.COMMA);
|
||||
LambdaQueryWrapper<DictionaryDetail> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(DictionaryDetail::getItemId,dto.getId())
|
||||
.in(CollectionUtils.isNotEmpty(values), DictionaryDetail::getValue, values)
|
||||
.select(DictionaryDetail.class, x -> VoToColumnUtil.fieldsToColumns(DictionaryItemDetailVo.class).contains(x.getProperty()));
|
||||
|
||||
List<DictionaryDetail> list = dictionarydetailService.list(queryWrapper);
|
||||
|
||||
List<DictionaryItemDetailVo> dictionaryItemDetailVos = BeanUtil.copyToList(list, DictionaryItemDetailVo.class);
|
||||
return R.ok(dictionaryItemDetailVos);
|
||||
}
|
||||
|
||||
@GetMapping("/detail/tree")
|
||||
@Operation(summary = "获取数据字典项目 + 详情 树结构")
|
||||
public R tree(){
|
||||
return R.ok(dictionaryitemService.getTree());
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/detail/page")
|
||||
@Operation(summary = "获取当前数据字典项目下所有字典详情(分页)")
|
||||
public R detail(@Valid DictionaryItemDetailPageDto dto){
|
||||
|
||||
LambdaQueryWrapper<DictionaryDetail> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(DictionaryDetail::getItemId,dto.getId())
|
||||
.select(DictionaryDetail.class, x -> VoToColumnUtil.fieldsToColumns(DictionaryItemDetailVo.class).contains(x.getProperty()));
|
||||
|
||||
IPage<DictionaryDetail> page = dictionarydetailService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<DictionaryItemDetailVo> pageOutput = ConventPage.getPageOutput(page, DictionaryItemDetailVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增数据字典项")
|
||||
public R add(@Valid @RequestBody AddDictionaryItemDto dto){
|
||||
|
||||
long count = dictionaryitemService.count(Wrappers.<DictionaryItem>query().lambda().eq(DictionaryItem::getCode, dto.getCode()).or().eq(DictionaryItem::getName,dto.getName()));
|
||||
if(count > 0){
|
||||
return R.error("项目名或者编码已经存在!");
|
||||
}
|
||||
|
||||
DictionaryItem dictionaryItem = BeanUtil.toBean(dto, DictionaryItem.class);
|
||||
|
||||
boolean isSuccess = dictionaryitemService.save(dictionaryItem);
|
||||
if (isSuccess) dictionaryitemService.loadCaches();
|
||||
return R.ok(isSuccess);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "更新数据字典项")
|
||||
public R update(@Valid @RequestBody UpdateDictionaryItemDto dto){
|
||||
|
||||
long count = dictionaryitemService.count(Wrappers.<DictionaryItem>query().lambda()
|
||||
.eq(DictionaryItem::getCode, dto.getCode())
|
||||
.ne(DictionaryItem::getId,dto.getId())
|
||||
.or()
|
||||
.eq(DictionaryItem::getName, dto.getName())
|
||||
.ne(DictionaryItem::getId,dto.getId()));
|
||||
if(count > 0){
|
||||
return R.error("项目名或者编码已经存在!");
|
||||
}
|
||||
DictionaryItem dictionaryItem = BeanUtil.toBean(dto, DictionaryItem.class);
|
||||
|
||||
boolean isSuccess = dictionaryitemService.updateById(dictionaryItem);
|
||||
if (isSuccess) dictionaryitemService.loadCaches();
|
||||
return R.ok(isSuccess);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除数据字典项")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R delete(@RequestBody List<Long> ids){
|
||||
//删除字典详情
|
||||
dictionaryitemService.removeBatchByIds(ids);
|
||||
//删除字典项
|
||||
dictionarydetailService.remove(Wrappers.lambdaQuery(DictionaryDetail.class).in(DictionaryDetail::getItemId,ids));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,225 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.img.ImgUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.yulichang.toolkit.MPJWrappers;
|
||||
import com.xjrsoft.common.core.config.OSSConfig;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.common.oss.factory.OssFactory;
|
||||
import com.xjrsoft.common.oss.utils.UploadUtil;
|
||||
import com.xjrsoft.organization.entity.User;
|
||||
import com.xjrsoft.system.dto.FileListDto;
|
||||
import com.xjrsoft.system.dto.FilePageDto;
|
||||
import com.xjrsoft.system.entity.File;
|
||||
import com.xjrsoft.system.service.IFileService;
|
||||
import com.xjrsoft.system.vo.FileListVo;
|
||||
import com.xjrsoft.system.vo.FileVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件关联关系表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-03-08
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.SYSTEM_MODULE_PREFIX + "/file")
|
||||
@Tag(name = GlobalConstant.SYSTEM_MODULE_PREFIX + "/file", description = "文件")
|
||||
@AllArgsConstructor
|
||||
public class FileController {
|
||||
private IFileService fileService;
|
||||
|
||||
private OSSConfig ossConfig;
|
||||
|
||||
|
||||
@GetMapping("/info")
|
||||
@Operation(summary = "根据文件Id获取单个文件数据")
|
||||
public R info(@RequestParam String id) {
|
||||
return R.ok(fileService.getById(id));
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Operation(summary = "查询文件列表(不分页)")
|
||||
public R list(@Valid FileListDto dto) {
|
||||
|
||||
List<FileListVo> list = fileService.selectJoinList(FileListVo.class, MPJWrappers.<File>lambdaJoin()
|
||||
.like(StrUtil.isNotBlank(dto.getFileName()), File::getFileName, dto.getFileName())
|
||||
.eq(ObjectUtil.isNotNull(dto.getFolderId()), File::getFolderId, dto.getFolderId())
|
||||
.eq(StrUtil.isNotBlank(dto.getProcessId()), File::getProcessId, dto.getProcessId())
|
||||
.select(File::getId)
|
||||
.select(File.class, x -> VoToColumnUtil.fieldsToColumns(FileListVo.class).contains(x.getProperty()))
|
||||
.selectAs(User::getName, FileListVo::getCreateUserName)
|
||||
.leftJoin(User.class, User::getId, File::getCreateUserId)
|
||||
.last(StrUtil.isNotBlank(dto.getField()), GlobalConstant.ORDER_BY + StringPool.SPACE + StrUtil.toUnderlineCase(dto.getField()) + StringPool.SPACE + ConventPage.getOrder(dto.getOrder())));
|
||||
|
||||
if(list!=null&&StringUtils.isNotBlank(ossConfig.getReplaceEndpoint())){
|
||||
for(FileListVo vo:list){
|
||||
vo.setFileUrl(vo.getFileUrl().replace(ossConfig.getEndpoint(),ossConfig.getReplaceEndpoint()));
|
||||
}
|
||||
}
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "查询文件列表(分页)")
|
||||
public R page(@Valid FilePageDto dto) {
|
||||
LambdaQueryWrapper<File> wrapper = Wrappers.<File>query().lambda()
|
||||
.like(StrUtil.isNotBlank(dto.getFileName()), File::getFileName, dto.getFileName())
|
||||
.eq(ObjectUtil.isNotNull(dto.getFolderId()), File::getFolderId, dto.getFolderId())
|
||||
.eq(StrUtil.isNotBlank(dto.getProcessId()), File::getProcessId, dto.getProcessId());
|
||||
|
||||
IPage<File> page = fileService.page(ConventPage.getPage(dto), wrapper);
|
||||
PageOutput<File> pageOutput = ConventPage.getPageOutput(page, File.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除文件(可批量)")
|
||||
public R delete(@RequestBody List<Long> ids) {
|
||||
|
||||
return R.ok(fileService.removeBatchByIds(ids));
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-single")
|
||||
@Operation(summary = "删除组件 删除单个文件")
|
||||
public R delete(@RequestBody Long id) {
|
||||
|
||||
File deleteFile = fileService.getById(id);
|
||||
//找到没有被删除的文件
|
||||
List<File> list = fileService.list(Wrappers.lambdaQuery(File.class).eq(File::getFolderId, deleteFile.getFolderId()).ne(File::getId, id));
|
||||
|
||||
//如果删除的是最后一个文件 就返回空值
|
||||
if(list.size() > 0){
|
||||
Long newfolderId = IdWorker.getId();
|
||||
|
||||
for (File newFile : list) {
|
||||
newFile.setId(null);
|
||||
newFile.setFolderId(newfolderId);
|
||||
}
|
||||
List<File> insertFile = new ArrayList<>(list);
|
||||
|
||||
fileService.saveBatch(insertFile);
|
||||
|
||||
return R.ok(newfolderId);
|
||||
|
||||
}
|
||||
else {
|
||||
return R.ok(StringPool.EMPTY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "单文件上传")
|
||||
public R uploadFile(@RequestParam(value = "file", required = true) MultipartFile multipartFile) throws Exception {
|
||||
Long folderId = IdWorker.getId();
|
||||
Long fileId = IdWorker.getId();
|
||||
File file = uploadFile(multipartFile, folderId, fileId);
|
||||
return R.ok(file.getFileUrl());
|
||||
}
|
||||
|
||||
@PostMapping("/folder")
|
||||
@Operation(summary = "单文件上传")
|
||||
public R uploadFileToFolder(@RequestParam Long folderId, @RequestParam MultipartFile multipartFile) throws Exception {
|
||||
Long fileId = IdWorker.getId();
|
||||
File file = uploadFile(multipartFile, folderId, fileId);
|
||||
return R.ok(file.getFileUrl());
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/multiple-file-upload")
|
||||
@Operation(summary = "多文件上传")
|
||||
public R uploadFiles(@RequestParam(value = "file") MultipartFile[] multipartFiles ) throws Exception {
|
||||
List<String> urlList = new ArrayList<>();
|
||||
if (multipartFiles != null && multipartFiles.length > 0) {
|
||||
Long folderId = IdWorker.getId();
|
||||
for (MultipartFile multipartFile : multipartFiles) {
|
||||
Long fileId = IdWorker.getId();
|
||||
File file = uploadFile(multipartFile, folderId, fileId);
|
||||
urlList.add(file.getFileUrl());
|
||||
}
|
||||
|
||||
}
|
||||
return R.ok(urlList);
|
||||
}
|
||||
|
||||
@PostMapping("/multiple-file-upload/folder")
|
||||
@Operation(summary = "多文件上传")
|
||||
@Transactional
|
||||
public R uploadFilesToFolder(@RequestParam(required = false) Long folderId, @RequestParam(value = "file") MultipartFile[] multipartFiles) throws Exception {
|
||||
List<FileVo> fileVoList = new ArrayList<>();
|
||||
if (multipartFiles != null && multipartFiles.length > 0) {
|
||||
for (MultipartFile multipartFile : multipartFiles) {
|
||||
Long fileId = IdWorker.getId();
|
||||
if (folderId == null) {
|
||||
folderId = IdWorker.getId();
|
||||
}
|
||||
File file = uploadFile(multipartFile, folderId, fileId);
|
||||
fileVoList.add(BeanUtil.toBean(file, FileVo.class));
|
||||
}
|
||||
}
|
||||
return R.ok(fileVoList);
|
||||
}
|
||||
|
||||
private File uploadFile(MultipartFile file, Long folderId, Long fileId) throws Exception {
|
||||
String filename = file.getOriginalFilename();
|
||||
String suffix = StringUtils.substringAfterLast(filename, StringPool.DOT);
|
||||
//保存到云服务器
|
||||
String filePath = UploadUtil.uploadFile(file);
|
||||
|
||||
File fileEntity = new File();
|
||||
fileEntity.setId(fileId);
|
||||
fileEntity.setFolderId(folderId);
|
||||
fileEntity.setFileName(filename);
|
||||
fileEntity.setFileUrl(filePath);
|
||||
fileEntity.setFileSize(file.getSize());
|
||||
fileEntity.setFileSuffiex(StringPool.DOT + suffix);
|
||||
fileEntity.setFileType(suffix);
|
||||
|
||||
if (GlobalConstant.imageType.contains(StringUtils.lowerCase(suffix.replace(StringPool.DOT, StringPool.EMPTY)))) {
|
||||
|
||||
String thSuffix = StringPool.DOT + ImgUtil.IMAGE_TYPE_JPEG;
|
||||
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
ImgUtil.scale(file.getInputStream(), outputStream,200,200,null);
|
||||
|
||||
byte[] thBytes = outputStream.toByteArray();
|
||||
|
||||
String thUrl = Objects.requireNonNull(OssFactory.build()).uploadSuffix(thBytes,StringPool.DOT + ImgUtil.IMAGE_TYPE_JPEG);
|
||||
outputStream.close();
|
||||
|
||||
fileEntity.setThUrl(thUrl);
|
||||
fileEntity.setThType(thSuffix);
|
||||
fileEntity.setThName(file.getOriginalFilename().replace(suffix,StringPool.EMPTY) + "-缩略图");
|
||||
fileEntity.setThSize(Convert.toLong(thBytes.length));
|
||||
}
|
||||
fileService.save(fileEntity);
|
||||
return fileEntity;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,77 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.system.dto.AddOrUpdateLanguageDto;
|
||||
import com.xjrsoft.system.entity.Language;
|
||||
import com.xjrsoft.system.service.ILanguageService;
|
||||
import com.xjrsoft.system.vo.LanguageVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 语言翻译表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-10-09
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.LANGUAGE_MODULE_PREFIX)
|
||||
@Tag(name = GlobalConstant.LANGUAGE_MODULE_PREFIX, description = "翻译")
|
||||
@AllArgsConstructor
|
||||
public class LanguageController {
|
||||
|
||||
private ILanguageService languageService;
|
||||
|
||||
|
||||
@GetMapping("/info")
|
||||
@Operation(summary = "获取详情")
|
||||
public R info(@RequestParam String id) {
|
||||
|
||||
Language language = languageService.getById(id);
|
||||
return R.ok(BeanUtil.toBean(language, LanguageVo.class));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改翻译")
|
||||
public R update(@Valid @RequestBody List<AddOrUpdateLanguageDto> dto) {
|
||||
return R.ok(languageService.update(dto));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "根据翻译标记新增翻译")
|
||||
public R add(@Valid @RequestBody List<AddOrUpdateLanguageDto> dto) {
|
||||
return R.ok(languageService.add(dto));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获取列表数据,前端分页")
|
||||
public R page(String keyword) {
|
||||
|
||||
return R.ok(languageService.page(keyword));
|
||||
}
|
||||
|
||||
@GetMapping("/main-language-json")
|
||||
@Operation(summary = "获取中文一一对应默认语言")
|
||||
public R main() {
|
||||
return R.ok(languageService.main());
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary ="删除翻译标记")
|
||||
public R delete(@RequestBody List<Long> ids) {
|
||||
|
||||
languageService.remove(Wrappers.lambdaQuery(Language.class).in(Language::getMapId,ids));
|
||||
return R.ok(Boolean.TRUE);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,97 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.system.dto.LanguageTypeListDto;
|
||||
import com.xjrsoft.system.dto.UpdateLanguageTypeDto;
|
||||
import com.xjrsoft.system.entity.LanguageType;
|
||||
import com.xjrsoft.system.service.ILanguageTypeService;
|
||||
import com.xjrsoft.system.vo.LanguageTypeVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 多语言语言类型表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zlf
|
||||
* @since 2022-06-30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.LANGUAGE_MODULE_PREFIX + "/type")
|
||||
@Tag(name = GlobalConstant.LANGUAGE_MODULE_PREFIX + "/type", description = "翻译语言类型")
|
||||
@AllArgsConstructor
|
||||
public class LanguageTypeController {
|
||||
|
||||
private final ILanguageTypeService lgTypeService;
|
||||
|
||||
@GetMapping("/info")
|
||||
@Operation(summary ="获取详情")
|
||||
public R info(@RequestParam String id) {
|
||||
return R.ok(lgTypeService.getById(id));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary ="修改")
|
||||
public R updateLgType(@RequestBody UpdateLanguageTypeDto updateLgTypeDto) {
|
||||
LanguageType lgType = BeanUtil.toBean(updateLgTypeDto, LanguageType.class);
|
||||
return R.ok(lgTypeService.updateById(lgType));
|
||||
}
|
||||
|
||||
@PutMapping("/main")
|
||||
@Operation(summary ="设置为主语言")
|
||||
public R setMainLanguage(@RequestParam Long id) {
|
||||
return R.ok(lgTypeService.setMainLanguage(id));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary ="获取列表数据")
|
||||
public R page(LanguageTypeListDto dto) {
|
||||
return R.ok(lgTypeService.getPageData(dto));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary ="获取列表数据")
|
||||
public R list(@RequestParam(required = false) String keyword) {
|
||||
List<LanguageType> dataList = lgTypeService.getDataList(keyword);
|
||||
return R.ok(BeanUtil.copyToList(dataList, LanguageTypeVo.class));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary ="新增")
|
||||
public R save(@RequestBody UpdateLanguageTypeDto updateLgTypeDto) {
|
||||
long count = lgTypeService.count(Wrappers.lambdaQuery(LanguageType.class).eq(LanguageType::getCode, updateLgTypeDto.getCode()));
|
||||
if(count > 0){
|
||||
return R.error("已经存在此语言编码!");
|
||||
}
|
||||
|
||||
LanguageType lgType = BeanUtil.toBean(updateLgTypeDto, LanguageType.class);
|
||||
return R.ok(lgTypeService.save(lgType));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary ="删除")
|
||||
public R delete(@RequestBody List<Long> ids) {
|
||||
if(ids.contains(GlobalConstant.SUPER_ADMIN_ROLE_ID)){
|
||||
return R.error("不能删除中文!");
|
||||
}
|
||||
return R.ok(lgTypeService.removeByIds(ids));
|
||||
}
|
||||
|
||||
@GetMapping("/main")
|
||||
@Operation(summary ="获取默认主语言")
|
||||
public R getMainLgType() {
|
||||
LanguageType lgType = lgTypeService.getOne(Wrappers.<LanguageType>query().lambda().eq(LanguageType::getIsMain, 1), false);
|
||||
if (lgType == null) {
|
||||
return R.error("当前系统没有设置主语言!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(lgType, LanguageTypeVo.class));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,134 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.xjrsoft.common.core.annotation.XjrLog;
|
||||
import com.xjrsoft.common.core.config.LicenseConfig;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/6/29 17:26
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.SYSTEM_MODULE_PREFIX + "/license")
|
||||
@Tag(name = GlobalConstant.SYSTEM_MODULE_PREFIX + "/license", description = "授权")
|
||||
@AllArgsConstructor
|
||||
public class LicenseController {
|
||||
|
||||
private final LicenseConfig licenseConfig;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "生成licence")
|
||||
@XjrLog(value = "生成licence")
|
||||
public R create() throws IOException {
|
||||
|
||||
final String CREATE_URL = "http://82.157.162.230:8080/api/license/create";
|
||||
|
||||
final String DOWNLOAD_URL = "http://82.157.162.230:8080/api/license/download";
|
||||
|
||||
HttpRequest post = HttpUtil.createPost(CREATE_URL);
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
|
||||
File tempFile = FileUtil.file(getOutputDir() + StringPool.SLASH + "license.properties");
|
||||
|
||||
// File tempFile = File.createTempFile(Objects.requireNonNull(StringUtils.substringBeforeLast(file.getOriginalFilename(), StringPool.COMMA)),
|
||||
// StringUtils.substringAfterLast(file.getOriginalFilename(), StringPool.COMMA));
|
||||
|
||||
// FileUtil.writeBytes(file.getBytes(), tempFile);
|
||||
|
||||
|
||||
String stringBuilder = "companyName = " + licenseConfig.getCompanyName() + "\n" +
|
||||
"contactNumber = " + licenseConfig.getContactNumber() + "\n" +
|
||||
"loginMax = " + StrUtil.toString(licenseConfig.getLoginMax()) + "\n" +
|
||||
"startTime = " + licenseConfig.getStartTime() + "\n" +
|
||||
"endTime = " + licenseConfig.getEndTime() + "\n";
|
||||
|
||||
FileUtil.writeString(stringBuilder, tempFile, StandardCharsets.UTF_8);
|
||||
|
||||
|
||||
param.put("file[0]", tempFile);
|
||||
param.put("name", licenseConfig.getCompanyName());
|
||||
param.put("contactNumber", licenseConfig.getContactNumber());
|
||||
param.put("datetime",licenseConfig.getStartTime()+ StringPool.COMMA +licenseConfig.getEndTime());
|
||||
|
||||
post.contentType("multipart/form-data; boundary=----WebKitFormBoundarygs5FBJFB7SBEhWbX");
|
||||
post.form(param);
|
||||
HttpResponse response = post.execute();
|
||||
String body = response.body();
|
||||
JSONObject json = JSONUtil.parseObj(body);
|
||||
HttpRequest get = HttpUtil.createGet(DOWNLOAD_URL + "?file=" + json.get("data"));
|
||||
HttpResponse execute = get.execute();
|
||||
|
||||
File licenseFile = FileUtil.file(getOutputDir() + StringPool.SLASH + "License.shield");
|
||||
|
||||
FileUtil.writeBytes(execute.bodyBytes(), licenseFile);
|
||||
|
||||
boolean _newFile = licenseFile.createNewFile();
|
||||
|
||||
boolean _delete = tempFile.delete();
|
||||
|
||||
// HttpHeaders headers = new HttpHeaders();
|
||||
// headers.setContentDispositionFormData("attachment", "11111");
|
||||
// headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
||||
|
||||
return R.ok(_newFile && _delete);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取生成目录 默认生成到src/main/java/com/xjrsoft/module
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private String getOutputDir() {
|
||||
return System.getProperty("user.dir") + StringPool.SLASH + "src" + StringPool.SLASH + "main" + StringPool.SLASH + "resources";
|
||||
}
|
||||
|
||||
|
||||
// @PostMapping("/test")
|
||||
// @Operation(summary = "生成licence")
|
||||
// @XjrLog(value = "生成licence")
|
||||
// public ResponseEntity test(@RequestParam MultipartFile file) throws IOException {
|
||||
// HttpRequest post = HttpUtil.createPost("http://82.157.162.230:8080/api/license/create");
|
||||
// Map<String, Object> param = new HashMap<>();
|
||||
// File tempFile = File.createTempFile(Objects.requireNonNull(StringUtils.substringBeforeLast(file.getOriginalFilename(), StringPool.COMMA)),
|
||||
// StringUtils.substringAfterLast(file.getOriginalFilename(), StringPool.COMMA));
|
||||
// FileUtil.writeBytes(file.getBytes(), tempFile);
|
||||
// param.put("file[0]", tempFile);
|
||||
// param.put("name", "11111");
|
||||
// param.put("contactNumber", "1111");
|
||||
// param.put("datetime", "2023-06-29 17:55:29,2024-06-29 17:55:29");
|
||||
//
|
||||
// post.contentType("multipart/form-data; boundary=----WebKitFormBoundarygs5FBJFB7SBEhWbX");
|
||||
// post.form(param);
|
||||
// HttpResponse response = post.execute();
|
||||
// String body = response.body();
|
||||
// JSONObject json = JSONUtil.parseObj(body);
|
||||
// HttpRequest get = HttpUtil.createGet("http://82.157.162.230:8080/api/license/download?file=" + json.get("data"));
|
||||
// HttpResponse execute = get.execute();
|
||||
// HttpHeaders headers = new HttpHeaders();
|
||||
// headers.setContentDispositionFormData("attachment", "11111");
|
||||
// headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
||||
//
|
||||
// return new ResponseEntity<byte[]>(execute.bodyBytes(), headers, HttpStatus.OK);
|
||||
// }
|
||||
}
|
||||
@ -0,0 +1,94 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.system.dto.AddChainDto;
|
||||
import com.xjrsoft.system.dto.ChainPageDto;
|
||||
import com.xjrsoft.system.dto.ExecuteFlowDto;
|
||||
import com.xjrsoft.system.dto.UpdateChainDto;
|
||||
import com.xjrsoft.system.entity.LiteflowChain;
|
||||
import com.xjrsoft.system.service.ILiteflowChainService;
|
||||
import com.xjrsoft.system.vo.ChainPageVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 规则表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-04-06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.LITEFLOW_MODULE_PREFIX + "/chain")
|
||||
@Tag(name = GlobalConstant.LITEFLOW_MODULE_PREFIX + "/chain", description = "规则引擎规则文件模块")
|
||||
@AllArgsConstructor
|
||||
public class LiteflowChainController {
|
||||
|
||||
private ILiteflowChainService chainService;
|
||||
|
||||
@GetMapping(value = "/list")
|
||||
@Operation(summary = "规则文件(不分页)")
|
||||
public R list(){
|
||||
return R.ok(chainService.list());
|
||||
}
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "规则文件(分页)")
|
||||
public R page(@Valid ChainPageDto dto){
|
||||
|
||||
LambdaQueryWrapper<LiteflowChain> queryWrapper = Wrappers.lambdaQuery(LiteflowChain.class)
|
||||
.like(StrUtil.isNotBlank(dto.getKeyword()), LiteflowChain::getChainName, dto.getKeyword())
|
||||
.or()
|
||||
.like(StrUtil.isNotBlank(dto.getKeyword()), LiteflowChain::getChainDesc, dto.getKeyword())
|
||||
.orderByDesc(LiteflowChain::getId)
|
||||
.select(LiteflowChain.class, x -> VoToColumnUtil.fieldsToColumns(ChainPageVo.class).contains(x.getProperty()));
|
||||
IPage<LiteflowChain> page = chainService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<ChainPageVo> pageOutput = ConventPage.getPageOutput(page, ChainPageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "规则文件详情")
|
||||
public R info(@RequestParam Long id) {
|
||||
return R.ok(chainService.getById(id));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增规则")
|
||||
public R add(@Valid @RequestBody AddChainDto dto){
|
||||
return R.ok(chainService.addChain(dto));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改规则")
|
||||
public R update(@Valid @RequestBody UpdateChainDto dto){
|
||||
return R.ok(chainService.updateChain(dto));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
public R delete(@Valid @RequestBody List<Long> ids) {
|
||||
|
||||
return R.ok(chainService.deleteChain(ids));
|
||||
}
|
||||
|
||||
@PostMapping("/execute")
|
||||
@Operation(summary = "执行规则接口")
|
||||
public R execute(@Valid @RequestBody ExecuteFlowDto dto){
|
||||
return R.ok(chainService.execute(dto));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 规则脚本表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-04-06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.LITEFLOW_MODULE_PREFIX + "/script")
|
||||
@Tag(name = GlobalConstant.LITEFLOW_MODULE_PREFIX + "/script", description = "规则引擎脚本文件模块")
|
||||
@AllArgsConstructor
|
||||
public class LiteflowScriptController {
|
||||
|
||||
}
|
||||
@ -0,0 +1,183 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.support.ExcelTypeEnum;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.annotation.XjrLog;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.system.dto.LogExportDto;
|
||||
import com.xjrsoft.system.dto.LogPageDto;
|
||||
import com.xjrsoft.system.entity.Log;
|
||||
import com.xjrsoft.system.service.ILogService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统日志表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-03-04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.SYSTEM_MODULE_PREFIX + "/log")
|
||||
@Tag(name = GlobalConstant.SYSTEM_MODULE_PREFIX + "/log",description = "日志")
|
||||
@AllArgsConstructor
|
||||
public class LogController {
|
||||
|
||||
private final ILogService logService;
|
||||
|
||||
private static final Integer TODAY = 1;
|
||||
|
||||
private static final Integer WEEK = 2;
|
||||
|
||||
private static final Integer MONTH = 3;
|
||||
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary="日志列表(分页)")
|
||||
@XjrLog(value = "日志列表")
|
||||
public R page(@Valid LogPageDto dto){
|
||||
|
||||
LambdaQueryWrapper<Log> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(StrUtil.isNotBlank(dto.getKeyword()),Log::getUsername,dto.getKeyword())
|
||||
.like(StrUtil.isNotBlank(dto.getKeyword()),Log::getIp,dto.getKeyword())
|
||||
.eq(dto.getCategory() > 0, Log::getCategory,dto.getCategory());
|
||||
|
||||
if (ObjectUtil.isNotNull(dto.getCreateTimeStart()) && ObjectUtil.isNotNull(dto.getCreateTimeStart())) {
|
||||
queryWrapper.gt(Log::getCreateTime, LocalDateTimeUtil.beginOfDay(dto.getCreateTimeStart()));
|
||||
queryWrapper.lt(Log::getCreateTime, LocalDateTimeUtil.endOfDay(dto.getCreateTimeEnd()));
|
||||
}
|
||||
|
||||
if(dto.getQueryType().equals(TODAY)){
|
||||
Date start = DateUtil.beginOfDay(new Date());
|
||||
Date end = DateUtil.endOfDay(new Date());
|
||||
queryWrapper.between(Log::getCreateTime, start,end);
|
||||
}
|
||||
|
||||
if(dto.getQueryType().equals(WEEK)){
|
||||
DateTime start = DateUtil.beginOfWeek(new Date());
|
||||
DateTime end = DateUtil.endOfWeek(new Date());
|
||||
queryWrapper.between(Log::getCreateTime, start,end);
|
||||
}
|
||||
|
||||
if(dto.getQueryType().equals(MONTH)){
|
||||
DateTime start = DateUtil.beginOfMonth(new Date());
|
||||
DateTime end = DateUtil.endOfMonth(new Date());
|
||||
queryWrapper.between(Log::getCreateTime, start, end);
|
||||
}
|
||||
|
||||
IPage<Log> page = logService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<Log> pageOutput = ConventPage.getPageOutput(page, Log.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping("/all")
|
||||
@Operation(summary="清除所有日志")
|
||||
@XjrLog(value = "清除所有日志")
|
||||
public R clear(){
|
||||
return R.ok(logService.remove(new LambdaQueryWrapper<>()));
|
||||
}
|
||||
|
||||
@DeleteMapping("/month")
|
||||
@Operation(summary="清除这个月的日志")
|
||||
@XjrLog(value = "清除这个月的日志")
|
||||
public R clearThisMonth(){
|
||||
DateTime start = DateUtil.beginOfMonth(new Date());
|
||||
DateTime end = DateUtil.endOfMonth(new Date());
|
||||
LambdaQueryWrapper<Log> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.between(Log::getCreateTime, start, end);
|
||||
return R.ok(logService.remove(queryWrapper));
|
||||
}
|
||||
|
||||
@DeleteMapping("/week")
|
||||
@Operation(summary="清除这个周的日志")
|
||||
@XjrLog(value = "清除这个周的日志")
|
||||
public R clearThisWeek(){
|
||||
DateTime start = DateUtil.beginOfWeek(new Date());
|
||||
DateTime end = DateUtil.endOfWeek(new Date());
|
||||
LambdaQueryWrapper<Log> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.between(Log::getCreateTime, start, end);
|
||||
return R.ok(logService.remove(queryWrapper));
|
||||
}
|
||||
|
||||
@DeleteMapping("/day")
|
||||
@Operation(summary="清除今天的日志")
|
||||
@XjrLog(value = "清除今天的日志")
|
||||
public R clearThisDay(){
|
||||
Date start = DateUtil.beginOfDay(new Date());
|
||||
Date end = DateUtil.endOfDay(new Date());
|
||||
LambdaQueryWrapper<Log> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.between(Log::getCreateTime, start, end);
|
||||
return R.ok(logService.remove(queryWrapper));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary="批量删除日志")
|
||||
@XjrLog(value = "批量删除日志")
|
||||
public R delete(@RequestBody List<Long> ids) {
|
||||
return R.ok(logService.removeBatchByIds(ids));
|
||||
}
|
||||
|
||||
@DeleteMapping("/from")
|
||||
@Operation(summary="批量删除日志")
|
||||
@Parameter(name = "type", description = "0-保留近一周,1-保留近一个月,2-保留近三个月,3-不保留,全部删除")
|
||||
@XjrLog(value = "批量删除日志")
|
||||
public R deleteBy(@RequestParam Integer type) {
|
||||
LocalDateTime time = LocalDateTime.now();
|
||||
switch (type) {
|
||||
case 0:
|
||||
// 保留近一周
|
||||
time = time.plusWeeks(-1);
|
||||
break;
|
||||
case 1:
|
||||
// 保留近一个月
|
||||
time = time.plusMonths(-1);
|
||||
break;
|
||||
case 2:
|
||||
// 保留近三个月
|
||||
time = time.plusMonths(-3);
|
||||
break;
|
||||
case 3:
|
||||
// 不保留,全部删除
|
||||
break;
|
||||
}
|
||||
Wrapper<Log> wrapper = Wrappers.<Log>query().lambda().lt(time != null, Log::getCreateTime, time);
|
||||
return R.ok(logService.remove(wrapper));
|
||||
}
|
||||
|
||||
@PostMapping("/export")
|
||||
@Operation(summary="批量导出日志")
|
||||
@XjrLog(value = "批量导出日志")
|
||||
public ResponseEntity<byte[]> export(@RequestBody List<Long> ids) {
|
||||
List<Log> logList = logService.list(Wrappers.<Log>query().lambda().in(Log::getId, ids));
|
||||
ByteArrayOutputStream bot = new ByteArrayOutputStream();
|
||||
EasyExcel.write(bot, LogExportDto.class).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(BeanUtil.copyToList(logList, LogExportDto.class));
|
||||
|
||||
return R.fileStream(bot.toByteArray(), "系统日志" + ExcelTypeEnum.XLSX.getValue());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,79 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.dev33.satoken.SaManager;
|
||||
import cn.dev33.satoken.config.SaTokenConfig;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.enums.YesOrNoEnum;
|
||||
import com.xjrsoft.system.dto.UpdateLoginConfigDto;
|
||||
import com.xjrsoft.system.entity.LoginConfig;
|
||||
import com.xjrsoft.system.service.ILoginConfigService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Login登录配置表【xjr_login_config】 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hnyyzy
|
||||
* @since 2023-11-20
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.SYSTEM_MODULE_PREFIX+"/loginConfig")
|
||||
@Tag(name = GlobalConstant.SYSTEM_MODULE_PREFIX + "/logoConfig", description = "Login登录配置")
|
||||
@AllArgsConstructor
|
||||
public class LoginConfigController {
|
||||
|
||||
private final ILoginConfigService loginConfigService;
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "获取Login信息配置")
|
||||
public R info() {
|
||||
List<LoginConfig> list = loginConfigService.list();
|
||||
if (list.size() == 0){//如果没有,则设置为默认配置,并进行保存
|
||||
LoginConfig loginConfig = new LoginConfig();
|
||||
loginConfig.setId(1L);
|
||||
loginConfig.setMulLogin("0,1");
|
||||
loginConfig.setMutualExclusion(YesOrNoEnum.YES.getCode());
|
||||
loginConfig.setWithoutLogin(YesOrNoEnum.YES.getCode());
|
||||
loginConfig.setPasswordStrategy(YesOrNoEnum.YES.getCode());
|
||||
loginConfig.setStrategyMaxNumber(7);
|
||||
list.add(loginConfig);
|
||||
loginConfigService.save(loginConfig);
|
||||
}
|
||||
return R.ok(list.get(0));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改Login信息配置")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R edit(@Valid @RequestBody UpdateLoginConfigDto dto) {
|
||||
LoginConfig loginConfig = BeanUtil.toBean(dto, LoginConfig.class);
|
||||
LoginConfig oldLoginConfig = loginConfigService.getById(loginConfig.getId());
|
||||
loginConfigService.updateById(loginConfig);
|
||||
|
||||
SaTokenConfig oldConfig = SaManager.getConfig();
|
||||
//改完之后,需要判断同端互斥是否有所改动
|
||||
if (oldLoginConfig.getMutualExclusion() != loginConfig.getMutualExclusion()){
|
||||
if (loginConfig.getMutualExclusion() == YesOrNoEnum.NO.getCode()){
|
||||
//不开启同端互斥
|
||||
oldConfig.setIsConcurrent(true);
|
||||
}else {
|
||||
//开启同端互斥
|
||||
oldConfig.setIsConcurrent(false);
|
||||
}
|
||||
// 注入到 SaManager 中
|
||||
SaManager.setConfig(oldConfig);
|
||||
}
|
||||
return R.ok(1);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.system.dto.UpdateLogoDto;
|
||||
import com.xjrsoft.system.entity.LogoConfig;
|
||||
import com.xjrsoft.system.service.ILogoConfigService;
|
||||
import com.xjrsoft.system.vo.LogoInfoVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Logo信息配置表【xjr_logo_config】 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hnyyzy
|
||||
* @since 2023-11-20
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.SYSTEM_MODULE_PREFIX+"/logoConfig")
|
||||
@Tag(name = GlobalConstant.SYSTEM_MODULE_PREFIX + "/logoConfig", description = "Logo信息配置")
|
||||
@AllArgsConstructor
|
||||
public class LogoConfigController {
|
||||
|
||||
private final ILogoConfigService logoConfigService;
|
||||
|
||||
@GetMapping(value = "/logo-info")
|
||||
@Operation(summary = "登录时获取Logo信息配置")
|
||||
public R logoInfo() {
|
||||
LogoInfoVo logoInfoVo = logoConfigService.logoInfo();
|
||||
return R.ok(logoInfoVo);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "Logo配置页获取Logo信息配置")
|
||||
public R info() {
|
||||
List<LogoConfig> list = logoConfigService.list();
|
||||
if (list.size() == 0){//如果没有,则设置为默认配置,并进行保存
|
||||
LogoConfig logoConfig = new LogoConfig();
|
||||
logoConfig.setId(1L);
|
||||
logoConfig.setCompanyName("粤电信息科技有限公司");
|
||||
logoConfig.setShortName("ITC");
|
||||
list.add(logoConfig);
|
||||
logoConfigService.save(logoConfig);
|
||||
}
|
||||
return R.ok(list.get(0));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改Logo信息配置")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R edit(@Valid @RequestBody UpdateLogoDto dto) {
|
||||
LogoConfig logoConfig = BeanUtil.toBean(dto, LogoConfig.class);
|
||||
return R.ok(logoConfigService.updateById(logoConfig));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.system.dto.AddMenuButtonDto;
|
||||
import com.xjrsoft.system.dto.UpdateMenuButtonDto;
|
||||
import com.xjrsoft.system.entity.MenuButton;
|
||||
import com.xjrsoft.system.service.IMenuButtonService;
|
||||
import com.xjrsoft.system.vo.MenuButtonListVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 菜单按钮 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-03-16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.SYSTEM_MODULE_PREFIX + "/menu-button")
|
||||
@Tag(name = GlobalConstant.SYSTEM_MODULE_PREFIX + "/menu-button",description = "菜单按钮")
|
||||
@AllArgsConstructor
|
||||
public class MenuButtonController {
|
||||
|
||||
private final IMenuButtonService menuButtonService;
|
||||
|
||||
@GetMapping(value = "/list")
|
||||
@Operation(summary="根据菜单id查询按钮列表")
|
||||
public R getMenuButtonListByMenuId(@RequestParam(required = false) Long menuId){
|
||||
if (menuId == null) {
|
||||
return R.ok(new ArrayList<>(0));
|
||||
}
|
||||
List<MenuButton> list = menuButtonService.list(Wrappers.<MenuButton>lambdaQuery().eq(menuId != 0, MenuButton::getMenuId, menuId)
|
||||
.select(MenuButton.class, x -> VoToColumnUtil.fieldsToColumns(MenuButtonListVo.class).contains(x.getProperty())));
|
||||
List<MenuButtonListVo> menuButtonListVos = BeanUtil.copyToList(list, MenuButtonListVo.class);
|
||||
return R.ok(menuButtonListVos);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary="根据id查询按钮信息")
|
||||
public R getMenuButtonInfo(@RequestParam Long id){
|
||||
return R.ok(menuButtonService.getById(id));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary="新增按钮")
|
||||
public R add(@Valid @RequestBody AddMenuButtonDto dto){
|
||||
long count = menuButtonService.count(Wrappers.<MenuButton>query().lambda()
|
||||
.eq(MenuButton::getName,dto.getName())
|
||||
.eq(MenuButton::getMenuId,dto.getMenuId())
|
||||
.or()
|
||||
.eq(MenuButton::getCode,dto.getCode())
|
||||
.eq(MenuButton::getMenuId,dto.getMenuId()));
|
||||
|
||||
if(count > 0){
|
||||
return R.error("当前菜单下已经有相同名字或者编码的按钮!");
|
||||
}
|
||||
MenuButton menuButton = BeanUtil.toBean(dto, MenuButton.class);
|
||||
|
||||
return R.ok(menuButtonService.save(menuButton));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary="修改按钮")
|
||||
public R update(@Valid @RequestBody UpdateMenuButtonDto dto){
|
||||
long count = menuButtonService.count(Wrappers.<MenuButton>query().lambda()
|
||||
.eq(MenuButton::getName,dto.getName())
|
||||
.eq(MenuButton::getMenuId,dto.getMenuId())
|
||||
.ne(MenuButton::getId,dto.getId())
|
||||
.or()
|
||||
.eq(MenuButton::getCode,dto.getCode())
|
||||
.eq(MenuButton::getMenuId,dto.getMenuId())
|
||||
.ne(MenuButton::getId,dto.getId()));
|
||||
|
||||
if(count > 0){
|
||||
return R.error("当前菜单下已经有相同名字或者编码的按钮!");
|
||||
}
|
||||
MenuButton menuButton = BeanUtil.toBean(dto, MenuButton.class);
|
||||
|
||||
return R.ok(menuButtonService.updateById(menuButton));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.system.entity.MenuColumn;
|
||||
import com.xjrsoft.system.service.IMenuColumnService;
|
||||
import com.xjrsoft.system.vo.MenuColumnListVo;
|
||||
import com.xjrsoft.system.vo.MenuColumnVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 菜单列表字段 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zlf
|
||||
* @since 2022-07-08
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.SYSTEM_MODULE_PREFIX + "/menu-colum")
|
||||
@Tag(name = GlobalConstant.SYSTEM_MODULE_PREFIX + "/menu-column",description = "菜单字段")
|
||||
@AllArgsConstructor
|
||||
public class MenuColumnController {
|
||||
|
||||
private final IMenuColumnService menuColumnService;
|
||||
|
||||
@GetMapping(value = "/list")
|
||||
@Operation(summary="根据菜单id查询字段列表")
|
||||
public R getMenuColumnListByMenuId(@RequestParam(required = false) Long menuId){
|
||||
if (menuId == null) {
|
||||
return R.ok(new ArrayList<>(0));
|
||||
}
|
||||
List<MenuColumn> list = menuColumnService.list(Wrappers.<MenuColumn>lambdaQuery().eq(menuId != 0, MenuColumn::getMenuId, menuId)
|
||||
.select(MenuColumn.class, x -> VoToColumnUtil.fieldsToColumns(MenuColumnVo.class).contains(x.getProperty())));
|
||||
List<MenuColumnListVo> menuColumnListVos = BeanUtil.copyToList(list, MenuColumnListVo.class);
|
||||
return R.ok(menuColumnListVos);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,410 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.yulichang.toolkit.MPJWrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.enums.AuthorizeType;
|
||||
import com.xjrsoft.common.core.enums.EnabledMark;
|
||||
import com.xjrsoft.common.core.enums.MenuType;
|
||||
import com.xjrsoft.common.core.enums.YesOrNoEnum;
|
||||
import com.xjrsoft.common.core.uitls.TreeUtil;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.system.dto.*;
|
||||
import com.xjrsoft.system.entity.*;
|
||||
import com.xjrsoft.system.service.*;
|
||||
import com.xjrsoft.system.vo.*;
|
||||
import com.xjrsoft.tenant.config.TenantConfig;
|
||||
import com.xjrsoft.tenant.util.SecureUtil;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-03-16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.SYSTEM_MODULE_PREFIX + "/menu")
|
||||
@Tag(name = GlobalConstant.SYSTEM_MODULE_PREFIX + "/menu", description = "菜单模块")
|
||||
@AllArgsConstructor
|
||||
public class MenuController {
|
||||
|
||||
private final IMenuService menuService;
|
||||
|
||||
private final IMenuButtonService menuButtonService;
|
||||
|
||||
private final IMenuColumnService menuColumnService;
|
||||
|
||||
private final IMenuFormService menuFormService;
|
||||
|
||||
private final IAuthorizeService authorizeService;
|
||||
|
||||
private final TenantConfig tenantConfig;
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获取所有菜单(不分页)")
|
||||
public R list() {
|
||||
List<Long> tenantAuthMenuIds = null;
|
||||
boolean isAdminTenant = SecureUtil.isAdminTenant();
|
||||
if (!isAdminTenant) {
|
||||
tenantAuthMenuIds = menuService.getTenantAuthMenuIds(Long.parseLong(SecureUtil.getTenantId()));
|
||||
if (CollectionUtils.isEmpty(tenantAuthMenuIds)) {
|
||||
return R.ok(new ArrayList<>(0));
|
||||
}
|
||||
}
|
||||
List<Menu> list = menuService.list(Wrappers.lambdaQuery(Menu.class)
|
||||
.select(Menu.class, x -> VoToColumnUtil.fieldsToColumns(MenuListVo.class).contains(x.getProperty()))
|
||||
.in(CollectionUtils.isNotEmpty(tenantAuthMenuIds), Menu::getId, tenantAuthMenuIds));
|
||||
List<MenuListVo> menuListVos = BeanUtil.copyToList(list, MenuListVo.class);
|
||||
return R.ok(TreeUtil.build(menuListVos));
|
||||
}
|
||||
|
||||
@GetMapping("/tree")
|
||||
@Operation(summary = "获取所有菜单(树结构)")
|
||||
public R menuTree(@Valid MenuTreeDto dto) {
|
||||
List<MenuVo> list = menuService.getAuthMenuList(dto);
|
||||
List<MenuTreeVo> voList = BeanUtil.copyToList(list, MenuTreeVo.class);
|
||||
List<MenuTreeVo> treeVoList = TreeUtil.build(voList);
|
||||
|
||||
return R.ok(treeVoList);
|
||||
}
|
||||
|
||||
@GetMapping("/all-tree")
|
||||
@Operation(summary = "获取所有菜单(树结构)")
|
||||
public R allMenuTree(@Valid MenuTreeDto dto) {
|
||||
List<Long> tenantAuthMenuIds = null;
|
||||
boolean isAdminTenant = SecureUtil.isAdminTenant();
|
||||
if (!isAdminTenant&&tenantConfig.getEnabled()) {
|
||||
tenantAuthMenuIds = menuService.getTenantAuthMenuIds(Long.parseLong(SecureUtil.getTenantId()));
|
||||
if (CollectionUtils.isEmpty(tenantAuthMenuIds)) {
|
||||
return R.ok(new ArrayList<>(0));
|
||||
}
|
||||
}
|
||||
List<MenuTreeVo> list = menuService.selectJoinList(MenuTreeVo.class,
|
||||
MPJWrappers.<Menu>lambdaJoin()
|
||||
.disableSubLogicDel()
|
||||
.like(StrUtil.isNotEmpty(dto.getTitle()), Menu::getTitle, dto.getTitle())
|
||||
.like(StrUtil.isNotEmpty(dto.getName()), Menu::getName, dto.getName())
|
||||
.select(Menu::getId)
|
||||
.select(Menu.class, x -> VoToColumnUtil.fieldsToColumns(MenuTreeVo.class).contains(x.getProperty()))
|
||||
.selectAs(Subsystem::getName, MenuTreeVo::getSystemName)
|
||||
.eq(ObjectUtils.isNotEmpty(dto.getEnabledMark()), Menu::getEnabledMark, dto.getEnabledMark())
|
||||
.in(CollectionUtils.isNotEmpty(tenantAuthMenuIds), Menu::getId, tenantAuthMenuIds)
|
||||
.leftJoin(Subsystem.class, Subsystem::getId, Menu::getSystemId)
|
||||
.orderByAsc(Menu::getSortCode));
|
||||
List<MenuTreeVo> treeVoList = TreeUtil.build(list);
|
||||
|
||||
return R.ok(treeVoList);
|
||||
}
|
||||
|
||||
@GetMapping("/child-tree")
|
||||
@Operation(summary = "获取所有菜单(树结构,禁用父级)")
|
||||
public R menuChildTree(@Valid MenuTreeDto dto) {
|
||||
List<MenuVo> list = menuService.getAuthMenuList(dto);
|
||||
List<MenuChildTreeVo> voList = BeanUtil.copyToList(list, MenuChildTreeVo.class);
|
||||
List<MenuChildTreeVo> treeVoList = TreeUtil.build(voList);
|
||||
voList.forEach(treeVo -> treeVo.setFullPath(true));
|
||||
return R.ok(treeVoList);
|
||||
}
|
||||
|
||||
@GetMapping("/simple-tree")
|
||||
@Operation(summary = "获取所有菜单(树结构)")
|
||||
public R menuAuthTree(@Valid MenuTreeDto dto) {
|
||||
List<MenuVo> list = menuService.getAuthMenuList(dto);
|
||||
List<MenuSimpleTreeVo> voList = BeanUtil.copyToList(list, MenuSimpleTreeVo.class);
|
||||
List<MenuSimpleTreeVo> treeVoList = TreeUtil.build(voList);
|
||||
return R.ok(treeVoList);
|
||||
}
|
||||
|
||||
@GetMapping("/tenant-auth-tree")
|
||||
@Operation(summary = "获取所有菜单(树结构)")
|
||||
public R tenantMenuAuthTree(@Valid MenuTreeDto dto) {
|
||||
List<MenuVo> list = menuService.getAuthMenuList(dto);
|
||||
List<Long> hiddenSubMenuIds = tenantConfig.getHiddenSubMenuIds();
|
||||
List<MenuVo> filteredList = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(hiddenSubMenuIds)) {
|
||||
for (MenuVo menuVo : list) {
|
||||
if (hiddenSubMenuIds.contains(menuVo.getId())) {
|
||||
continue;
|
||||
}
|
||||
filteredList.add(menuVo);
|
||||
}
|
||||
}
|
||||
List<MenuSimpleTreeVo> voList = BeanUtil.copyToList(filteredList, MenuSimpleTreeVo.class);
|
||||
List<MenuSimpleTreeVo> treeVoList = TreeUtil.build(voList);
|
||||
return R.ok(treeVoList);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "根据id查询菜单信息")
|
||||
public R info(Long id) {
|
||||
Menu menu = menuService.getById(id);
|
||||
if (menu == null) {
|
||||
R.error("找不到此菜单!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(menu, MenuVo.class));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增菜单")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R add(@Valid @RequestBody AddMenuDto dto) {
|
||||
long count = menuService.count(Wrappers.<Menu>query().lambda().eq(Menu::getName, dto.getName()).or().eq(Menu::getCode, dto.getCode()));
|
||||
if (count > 0) {
|
||||
return R.error("菜单名或者菜单编码已经存在!");
|
||||
}
|
||||
Menu menu = BeanUtil.toBean(dto, Menu.class);
|
||||
|
||||
if (ObjectUtil.isEmpty(menu.getSystemId())){
|
||||
menu.setSystemId(1L);
|
||||
}
|
||||
|
||||
//判断是否为菜单
|
||||
if (menu.getMenuType() == YesOrNoEnum.NO.getCode()) {
|
||||
//如果是菜单 需要判断 path 第一个字符 是否为 / 菜单必须要 / 开头
|
||||
if (!menu.getPath().startsWith(StringPool.SLASH)) {
|
||||
menu.setPath(StringPool.SLASH + menu.getPath());
|
||||
}
|
||||
}
|
||||
|
||||
//判断是否为外链
|
||||
if (menu.getOutLink() == YesOrNoEnum.YES.getCode()) {
|
||||
//如果是外链 所有组件地址 改为 IFrame
|
||||
menu.setComponent("IFrame");
|
||||
}
|
||||
|
||||
menu.setAllowDelete(YesOrNoEnum.YES.getCode());
|
||||
menu.setAllowModify(YesOrNoEnum.YES.getCode());
|
||||
|
||||
boolean isSuccess = menuService.save(menu);
|
||||
|
||||
//按钮保存
|
||||
List<MenuButton> menuButtons = BeanUtil.copyToList(dto.getButtonList(), MenuButton.class);
|
||||
menuButtons.forEach(menuButton -> menuButton.setMenuId(menu.getId()));
|
||||
//删除原按钮
|
||||
menuButtonService.remove(Wrappers.<MenuButton>query().lambda().eq(MenuButton::getMenuId, menu.getId()));
|
||||
menuButtonService.saveBatch(menuButtons);
|
||||
|
||||
// 列表字段保存
|
||||
List<MenuColumn> columnList = BeanUtil.copyToList(dto.getColumnList(), MenuColumn.class);
|
||||
columnList.forEach(menuColumn -> menuColumn.setMenuId(menu.getId()));
|
||||
menuColumnService.remove(Wrappers.<MenuColumn>query().lambda().eq(MenuColumn::getMenuId, menu.getId()));
|
||||
menuColumnService.saveBatch(columnList);
|
||||
|
||||
// 表单字段保存
|
||||
List<MenuForm> formList = new ArrayList<>();
|
||||
for (AddMenuFormDto addMenuFormDto : dto.getFormList()) {
|
||||
formList.add(BeanUtil.toBean(addMenuFormDto, MenuForm.class));
|
||||
List<AddMenuFormDto> children = addMenuFormDto.getChildren();
|
||||
if (org.apache.commons.collections.CollectionUtils.isNotEmpty(children)) {
|
||||
formList.addAll(BeanUtil.copyToList(children, MenuForm.class));
|
||||
}
|
||||
}
|
||||
formList.forEach(menuForm -> menuForm.setMenuId(menu.getId()));
|
||||
menuFormService.remove(Wrappers.<MenuForm>query().lambda().eq(MenuForm::getMenuId, menu.getId()));
|
||||
menuFormService.saveBatch(formList);
|
||||
|
||||
|
||||
return R.ok(isSuccess);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改菜单")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R edit(@Valid @RequestBody UpdateMenuDto dto) {
|
||||
long count = menuService.count(Wrappers.<Menu>query().lambda()
|
||||
.ne(Menu::getId, dto.getId()).and(wrapper ->
|
||||
wrapper.eq(Menu::getName, dto.getName())
|
||||
.or()
|
||||
.eq(Menu::getCode, dto.getCode())
|
||||
)
|
||||
);
|
||||
|
||||
if (count > 0) {
|
||||
return R.error("菜单名或者菜单编码已经存在!");
|
||||
}
|
||||
Menu menu = BeanUtil.toBean(dto, Menu.class);
|
||||
|
||||
//判断是否为菜单
|
||||
if (menu.getMenuType() == YesOrNoEnum.NO.getCode()) {
|
||||
//如果是菜单 需要判断 path 第一个字符 是否为 / 菜单必须要 / 开头
|
||||
if (!menu.getPath().startsWith(StringPool.SLASH)) {
|
||||
menu.setPath(StringPool.SLASH + menu.getPath());
|
||||
}
|
||||
}
|
||||
|
||||
//判断是否为外链
|
||||
if (menu.getOutLink() == YesOrNoEnum.YES.getCode()) {
|
||||
//如果是外链 所有组件地址 改为 IFrame
|
||||
menu.setComponent("IFrame");
|
||||
}
|
||||
|
||||
menuService.updateById(menu);
|
||||
|
||||
|
||||
List<MenuButton> menuButtons = BeanUtil.copyToList(dto.getButtonList(), MenuButton.class);
|
||||
menuButtons.forEach(menuButton -> menuButton.setMenuId(menu.getId()));
|
||||
//删除原按钮
|
||||
menuButtonService.remove(Wrappers.<MenuButton>query().lambda().eq(MenuButton::getMenuId, menu.getId()));
|
||||
|
||||
// 列表字段保存
|
||||
List<MenuColumn> columnList = BeanUtil.copyToList(dto.getColumnList(), MenuColumn.class);
|
||||
columnList.forEach(menuColumn -> menuColumn.setMenuId(menu.getId()));
|
||||
menuColumnService.remove(Wrappers.<MenuColumn>query().lambda().eq(MenuColumn::getMenuId, menu.getId()));
|
||||
|
||||
// 表单字段保存
|
||||
List<MenuForm> formList = new ArrayList<>();
|
||||
for (UpdateMenuFormDto updateMenuFormDto : dto.getFormList()) {
|
||||
formList.add(BeanUtil.toBean(updateMenuFormDto, MenuForm.class));
|
||||
List<UpdateMenuFormDto> children = updateMenuFormDto.getChildren();
|
||||
if (org.apache.commons.collections.CollectionUtils.isNotEmpty(children)) {
|
||||
formList.addAll(BeanUtil.copyToList(children, MenuForm.class));
|
||||
}
|
||||
}
|
||||
formList.forEach(menuForm -> menuForm.setMenuId(menu.getId()));
|
||||
menuFormService.remove(Wrappers.<MenuForm>query().lambda().eq(MenuForm::getMenuId, menu.getId()));
|
||||
|
||||
if (CollectionUtils.isNotEmpty(menuButtons)) {
|
||||
menuButtonService.saveBatch(menuButtons);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(columnList)) {
|
||||
menuColumnService.saveBatch(columnList);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(formList)) {
|
||||
menuFormService.saveBatch(formList);
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@GetMapping(value = "/button")
|
||||
@Operation(summary = "根据id查询按钮")
|
||||
public R button(@NotNull @Valid Long id) {
|
||||
List<MenuButton> list = menuButtonService.list(Wrappers.<MenuButton>query().lambda().eq(MenuButton::getMenuId, id));
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "批量删除菜单")
|
||||
public R delete(@Valid @RequestBody List<Long> ids) {
|
||||
return R.ok(menuService.removeByIds(ids));
|
||||
}
|
||||
|
||||
@GetMapping("/auth-tree")
|
||||
@Operation(summary = "获取功能授权页面的菜单树结构")
|
||||
public R fullAuthTree() {
|
||||
List<Long> roleIdList = StpUtil.getTokenSession().get(GlobalConstant.LOGIN_USER_ROLE_ID_KEY, new ArrayList<>());
|
||||
LambdaQueryWrapper<Menu> queryMenuWrapper = Wrappers.<Menu>query().lambda().eq(Menu::getEnabledMark, EnabledMark.ENABLED.getCode());
|
||||
LambdaQueryWrapper<MenuButton> queryBtnWrapper = Wrappers.<MenuButton>query().lambda();
|
||||
LambdaQueryWrapper<MenuColumn> queryColWrapper = Wrappers.<MenuColumn>query().lambda();
|
||||
LambdaQueryWrapper<MenuForm> queryFormWrapper = Wrappers.<MenuForm>query().lambda();
|
||||
boolean isAdmin = roleIdList.contains(GlobalConstant.SUPER_ADMIN_ROLE_ID);
|
||||
// 不是管理员
|
||||
if (!isAdmin) {
|
||||
List<Authorize> authorizeList = authorizeService.list(Wrappers.<Authorize>query().lambda()
|
||||
.select(Authorize::getObjectId, Authorize::getAuthorizeType)
|
||||
.in(Authorize::getAuthorizeType, AuthorizeType.MENU.getCode(), AuthorizeType.BUTTON.getCode(), AuthorizeType.COLUMN.getCode(), AuthorizeType.FORM.getCode())
|
||||
.in(Authorize::getRoleId, roleIdList));
|
||||
if (CollectionUtils.isEmpty(authorizeList)) {
|
||||
return R.ok();
|
||||
}
|
||||
List<Long> authMenuIdList = new ArrayList<>();
|
||||
List<Long> authMenuBtnIdList = new ArrayList<>();
|
||||
List<Long> authMenuIdColList = new ArrayList<>();
|
||||
List<Long> authMenuIdFormList = new ArrayList<>();
|
||||
for (Authorize authorize : authorizeList) {
|
||||
Long id = authorize.getId();
|
||||
switch (authorize.getAuthorizeType()) {
|
||||
case 1:
|
||||
authMenuIdList.add(id);
|
||||
break;
|
||||
case 2:
|
||||
authMenuBtnIdList.add(id);
|
||||
break;
|
||||
case 3:
|
||||
authMenuIdColList.add(id);
|
||||
break;
|
||||
case 4:
|
||||
authMenuIdFormList.add(id);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
queryMenuWrapper.in(Menu::getId, authMenuIdList);
|
||||
queryBtnWrapper.in(MenuButton::getId, authMenuBtnIdList);
|
||||
queryColWrapper.in(MenuColumn::getId, authMenuIdColList);
|
||||
queryFormWrapper.in(MenuForm::getId, authMenuIdFormList);
|
||||
}
|
||||
List<Menu> menuList = menuService.list(queryMenuWrapper);
|
||||
List<MenuButton> menuBtnList = menuButtonService.list(queryBtnWrapper);
|
||||
List<MenuColumn> menuColList = menuColumnService.list(queryColWrapper);
|
||||
List<MenuForm> menuFormList = menuFormService.list(queryFormWrapper);
|
||||
List<MenuListVo> menuVoList = BeanUtil.copyToList(menuList, MenuListVo.class);
|
||||
AuthMenuVo resultVo = new AuthMenuVo();
|
||||
//菜单
|
||||
resultVo.setMenuList(TreeUtil.build(menuVoList));
|
||||
//按钮
|
||||
for (MenuButton menuBtn : menuBtnList) {
|
||||
resultVo.addButton(menuBtn.getMenuId(), BeanUtil.toBean(menuBtn, MenuButtonVo.class));
|
||||
}
|
||||
//列表
|
||||
for (MenuColumn menuColumn : menuColList) {
|
||||
resultVo.addColumn(menuColumn.getMenuId(), BeanUtil.toBean(menuColumn, MenuColumnVo.class));
|
||||
}
|
||||
//表单
|
||||
for (MenuForm menuForm : menuFormList) {
|
||||
resultVo.addForm(menuForm.getMenuId(), BeanUtil.toBean(menuForm, MenuFormVo.class));
|
||||
}
|
||||
return R.ok(resultVo);
|
||||
}
|
||||
|
||||
@GetMapping("/parent-tree")
|
||||
@Operation(summary = "获取菜单树结构, 不包含页面类型的菜单")
|
||||
public R menuTree() {
|
||||
List<Menu> menuList = menuService.list(Wrappers.<Menu>query().lambda()
|
||||
.eq(Menu::getMenuType, MenuType.MENU.getCode())
|
||||
.eq(Menu::getEnabledMark, EnabledMark.ENABLED.getCode())
|
||||
.select(Menu.class, x -> VoToColumnUtil.fieldsToColumns(MenuListVo.class).contains(x.getProperty()))
|
||||
.orderByAsc(Menu::getSortCode));
|
||||
List<MenuListVo> voList = BeanUtil.copyToList(menuList, MenuListVo.class);
|
||||
List<MenuListVo> treeVoList = TreeUtil.build(voList);
|
||||
return R.ok(treeVoList);
|
||||
}
|
||||
|
||||
@GetMapping("/validate-url")
|
||||
@Operation(summary = "验证菜单路由是否存在")
|
||||
public R validateUrl(@RequestParam String outputArea, String className) {
|
||||
String component = StringPool.SLASH + StringUtils.lowerCase(outputArea) + StringPool.SLASH + StringUtils.lowerCase(className) + StringPool.SLASH + "index";
|
||||
long count = menuService.count(Wrappers.lambdaQuery(Menu.class).eq(Menu::getComponent, component));
|
||||
return R.ok(count > 0);
|
||||
}
|
||||
|
||||
@GetMapping("/validate-code")
|
||||
@Operation(summary = "验证菜单编码是否存在")
|
||||
public R validateCode(@RequestParam(required = false) Long id, @RequestParam String code) {
|
||||
long count = menuService.count(Wrappers.lambdaQuery(Menu.class).eq(Menu::getCode, code).ne(id != null, Menu::getId, id));
|
||||
return R.ok(count > 0);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.TreeUtil;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.system.entity.MenuForm;
|
||||
import com.xjrsoft.system.service.IMenuFormService;
|
||||
import com.xjrsoft.system.vo.MenuFormListVo;
|
||||
import com.xjrsoft.system.vo.MenuFormVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 菜单表单字段 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zlf
|
||||
* @since 2022-07-08
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.SYSTEM_MODULE_PREFIX + "/menu-form")
|
||||
@Tag(name = GlobalConstant.SYSTEM_MODULE_PREFIX + "/menu-form",description = "菜单表单")
|
||||
@AllArgsConstructor
|
||||
public class MenuFormController {
|
||||
|
||||
private final IMenuFormService menuFormService;
|
||||
|
||||
@GetMapping(value = "/list")
|
||||
@Operation(summary="根据菜单id查询表单列表")
|
||||
public R getMenuColumnListByMenuId(@RequestParam(required = false) Long menuId){
|
||||
if (menuId == null) {
|
||||
return R.ok(new ArrayList<>(0));
|
||||
}
|
||||
List<MenuForm> list = menuFormService.list(Wrappers.<MenuForm>lambdaQuery().eq(menuId != 0, MenuForm::getMenuId, menuId)
|
||||
.select(MenuForm.class, x -> VoToColumnUtil.fieldsToColumns(MenuFormVo.class).contains(x.getProperty())));
|
||||
List<MenuFormListVo> menuFormListVos = BeanUtil.copyToList(list, MenuFormListVo.class);
|
||||
return R.ok(TreeUtil.build(menuFormListVos));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,145 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.page.PageInput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.enums.IsReadTypeEnum;
|
||||
import com.xjrsoft.common.core.enums.MessageType;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.organization.dto.ResetPasswordDto;
|
||||
import com.xjrsoft.system.dto.MessageListDto;
|
||||
import com.xjrsoft.system.entity.Message;
|
||||
import com.xjrsoft.system.service.IMessageService;
|
||||
import com.xjrsoft.system.vo.MessageListVo;
|
||||
import com.xjrsoft.system.vo.MessageVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 消息状态 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zlf
|
||||
* @since 2022-06-16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.OA_MODULE_PREFIX + "/message")
|
||||
@Tag(name = GlobalConstant.OA_MODULE_PREFIX + "/message", description = "消息")
|
||||
@AllArgsConstructor
|
||||
public class MessageController {
|
||||
|
||||
private IMessageService messageService;
|
||||
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获取消息数据")
|
||||
public R list(MessageListDto dto) {
|
||||
Wrapper<Message> wrapper = Wrappers.<Message>query().lambda()
|
||||
.eq(Message::getUserId, StpUtil.getLoginIdAsLong())
|
||||
// .like(StrUtil.isNotBlank(dto.getKeyword()), Message::getMessageContent, dto.getKeyword())
|
||||
.orderByDesc(Message::getSendTime)
|
||||
.select(Message.class, x -> VoToColumnUtil.fieldsToColumns(MessageListVo.class).contains(x.getProperty()));
|
||||
|
||||
PageInput pageInput = new PageInput();
|
||||
//最新数据
|
||||
pageInput.setLimit(0);
|
||||
//只取5条数据
|
||||
pageInput.setSize(5);
|
||||
IPage<Message> page = messageService.page(ConventPage.getPage(pageInput), wrapper);
|
||||
List<MessageListVo> vos = BeanUtil.copyToList(page.getRecords(), MessageListVo.class);
|
||||
|
||||
for (MessageListVo vo : vos) {
|
||||
|
||||
|
||||
//如果是同一天
|
||||
if (
|
||||
vo.getSendTime().getYear() == LocalDateTime.now().getYear() &&
|
||||
vo.getSendTime().getMonth() == LocalDateTime.now().getMonth() &&
|
||||
vo.getSendTime().getDayOfYear() == LocalDateTime.now().getDayOfYear()
|
||||
) {
|
||||
if (vo.getSendTime().getMinute()>10){
|
||||
vo.setTimeFormat(StrUtil.toString(vo.getSendTime().getHour()) + StringPool.COLON + StrUtil.toString(vo.getSendTime().getMinute()));
|
||||
}
|
||||
else {
|
||||
char zeroChar = '0';
|
||||
vo.setTimeFormat(StrUtil.toString(vo.getSendTime().getHour()) + StringPool.COLON + StrUtil.fillBefore(StrUtil.toString(vo.getSendTime().getMinute()),zeroChar,2));
|
||||
}
|
||||
} else {
|
||||
Duration between = LocalDateTimeUtil.between(vo.getSendTime(), LocalDateTime.now());
|
||||
|
||||
vo.setTimeFormat(StrUtil.toString(between.toDays() == 0 ? 1 : between.toDays()) + "天前");
|
||||
}
|
||||
|
||||
|
||||
// if(between.toDays() < 2){
|
||||
// vo.setTimeFormat(StrUtil.toString(vo.getSendTime().getHour()) + StringPool.COLON + StrUtil.toString(vo.getSendTime().getMinute()));
|
||||
// }
|
||||
// if(between.toDays() >= 2){
|
||||
// vo.setTimeFormat(StrUtil.toString(between.toDays()) + "天前");
|
||||
// }
|
||||
}
|
||||
return R.ok(vos);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "消息详情")
|
||||
public R info(@RequestParam Long id) {
|
||||
Message msg = messageService.getById(id);
|
||||
if (msg == null) {
|
||||
R.error("找不到此消息!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(msg, MessageVo.class));
|
||||
}
|
||||
|
||||
@PutMapping("/read-all-message")
|
||||
@Operation(summary = "将所有工作流未读消息改为已读")
|
||||
public R readAllMessage() {
|
||||
//1、获取用户id
|
||||
Long userId = StpUtil.getLoginIdAsLong();
|
||||
//2、根据用户id和消息类型修改对应的是否已读字段为已读
|
||||
Wrapper<Message> wrapper = Wrappers.<Message>update().lambda().set(Message::getIsRead, IsReadTypeEnum.READ.getCode())
|
||||
.eq(Message::getUserId, userId).eq(Message::getMessageType, MessageType.APPROVE.getCode()).or().eq(Message::getMessageType, MessageType.CIRCULATED.getCode());
|
||||
messageService.update(wrapper);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PutMapping("/read-message")
|
||||
@Operation(summary = "将单条未读消息改为已读")
|
||||
public R readMessage(@RequestBody ResetPasswordDto dto) {
|
||||
Message message = new Message();
|
||||
message.setId(dto.getId());
|
||||
message.setIsRead(IsReadTypeEnum.READ.getCode());
|
||||
//将是否已读类型改为已读
|
||||
messageService.updateById(message);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PutMapping("/read-all-schedule-message")
|
||||
@Operation(summary = "将所有日程未读消息改为已读")
|
||||
public R readAllScheduleMessage() {
|
||||
//1、获取用户id
|
||||
Long userId = StpUtil.getLoginIdAsLong();
|
||||
//2、根据用户id和消息类型修改对应的是否已读字段为已读
|
||||
Wrapper<Message> wrapper = Wrappers.<Message>update().lambda().set(Message::getIsRead, IsReadTypeEnum.READ.getCode())
|
||||
.eq(Message::getUserId, userId).eq(Message::getMessageType, MessageType.SCHEDULE.getCode());
|
||||
messageService.update(wrapper);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,161 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.yulichang.toolkit.MPJWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.enums.EnabledMark;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.system.dto.AddNewsDto;
|
||||
import com.xjrsoft.system.dto.ChangeStatusDto;
|
||||
import com.xjrsoft.system.dto.NewsPageDto;
|
||||
import com.xjrsoft.system.dto.UpdateNewsDto;
|
||||
import com.xjrsoft.system.entity.DictionaryDetail;
|
||||
import com.xjrsoft.system.entity.News;
|
||||
import com.xjrsoft.system.entity.NewsRelation;
|
||||
import com.xjrsoft.system.service.INewsRelationService;
|
||||
import com.xjrsoft.system.service.INewsService;
|
||||
import com.xjrsoft.system.vo.NewsPageVo;
|
||||
import com.xjrsoft.system.vo.NewsVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 新闻中心表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zlf
|
||||
* @since 2022-06-16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.OA_MODULE_PREFIX + "/news")
|
||||
@Tag(name = GlobalConstant.OA_MODULE_PREFIX + "/news", description = "新闻公告")
|
||||
@AllArgsConstructor
|
||||
public class NewsController {
|
||||
|
||||
private INewsService newsService;
|
||||
|
||||
private INewsRelationService newsRelationService;
|
||||
|
||||
|
||||
@GetMapping
|
||||
@Operation(summary = "获取新闻分页")
|
||||
public R page(NewsPageDto dto) {
|
||||
IPage<NewsPageVo> page = newsService.selectJoinListPage(ConventPage.getPage(dto), NewsPageVo.class,
|
||||
MPJWrappers.<News>lambdaJoin()
|
||||
// .distinct() // 达梦数据库报错注释,查询字段包含blob,clob相关类型字段
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getType()),News::getTypeId,dto.getType())
|
||||
.like(StrUtil.isNotBlank(dto.getKeyword()),News::getBriefHead,dto.getKeyword())
|
||||
.selectAs(DictionaryDetail::getName,NewsPageVo::getCategoryName)
|
||||
.select(News::getId)
|
||||
.select(News.class, x -> VoToColumnUtil.fieldsToColumns(NewsPageVo.class).contains(x.getProperty()))
|
||||
.leftJoin(DictionaryDetail.class,DictionaryDetail::getValue,News::getCategory));
|
||||
|
||||
PageOutput<NewsPageVo> pageOutput = ConventPage.getPageOutput(page);
|
||||
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping("/box")
|
||||
@Operation(summary = "获取新闻分页")
|
||||
public R box(NewsPageDto dto) {
|
||||
MPJLambdaWrapper<News> wrapper = MPJWrappers.<News>lambdaJoin()
|
||||
.eq(News::getTypeId, dto.getType())
|
||||
.like(StrUtil.isNotBlank(dto.getKeyword()), News::getBriefHead, dto.getKeyword())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getEnabledMark()),News::getEnabledMark,dto.getEnabledMark())
|
||||
.leftJoin(NewsRelation.class, onWrapper -> onWrapper.eq(NewsRelation::getNewsId, News::getId).eq(NewsRelation::getUserId, StpUtil.getLoginIdAsLong()))
|
||||
.selectAs(NewsRelation::getId, NewsPageVo::getReadId)
|
||||
.selectAs(News::getId, NewsPageVo::getId)
|
||||
.select(News.class, x -> VoToColumnUtil.fieldsToColumns(NewsPageVo.class).contains(x.getProperty()));
|
||||
IPage<NewsPageVo> page = newsService.selectJoinListPage(ConventPage.getPage(dto), NewsPageVo.class, wrapper);
|
||||
PageOutput<NewsPageVo> pageOutput = ConventPage.getPageOutput(page, NewsPageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增新闻")
|
||||
public R add(@RequestBody AddNewsDto addNewsDto) {
|
||||
News news = BeanUtil.toBean(addNewsDto, News.class);
|
||||
news.setEnabledMark(EnabledMark.DISABLED.getCode());
|
||||
return R.ok(newsService.save(news));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "新闻详情")
|
||||
public R info(@RequestParam Long id, @RequestParam(required = false) Boolean isRead) {
|
||||
News news = newsService.getById(id);
|
||||
if (news == null) {
|
||||
R.error("找不到此新闻!");
|
||||
}
|
||||
if (BooleanUtils.isTrue(isRead)) {
|
||||
NewsRelation newsRelation = new NewsRelation();
|
||||
newsRelation.setNewsId(id);
|
||||
newsRelation.setUserId(StpUtil.getLoginIdAsLong());
|
||||
newsRelationService.remove(Wrappers.<NewsRelation>query().lambda()
|
||||
.eq(NewsRelation::getUserId, StpUtil.getLoginIdAsLong())
|
||||
.eq(NewsRelation::getNewsId, id));
|
||||
newsRelationService.save(newsRelation);
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(news, NewsVo.class));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改新闻")
|
||||
public R update(@RequestBody UpdateNewsDto addNewsDto) {
|
||||
News news = BeanUtil.toBean(addNewsDto, News.class);
|
||||
return R.ok(newsService.updateById(news));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除新闻")
|
||||
public R delete(@RequestBody List<Long> ids) {
|
||||
return R.ok(newsService.delete(ids));
|
||||
}
|
||||
|
||||
|
||||
@PutMapping("/change-status")
|
||||
@Operation(summary = "发布或下架新闻")
|
||||
public R changeStatus(@RequestBody ChangeStatusDto dto) throws Exception {
|
||||
News xjrNews = newsService.getById(dto.getId());
|
||||
if (xjrNews == null){
|
||||
throw new Exception("参数异常");
|
||||
}
|
||||
if (xjrNews.getEnabledMark() == EnabledMark.DISABLED.getCode()){
|
||||
xjrNews.setEnabledMark(EnabledMark.ENABLED.getCode());//发布状态
|
||||
}else {
|
||||
xjrNews.setEnabledMark(EnabledMark.DISABLED.getCode());//下架状态
|
||||
}
|
||||
return R.ok(newsService.updateById(xjrNews));
|
||||
}
|
||||
|
||||
@PutMapping("/read")
|
||||
@Operation(summary = "读新闻")
|
||||
public R read(@RequestBody List<Long> ids) {
|
||||
List<NewsRelation> toSaveList = new ArrayList<>();
|
||||
for (Long id : ids) {
|
||||
NewsRelation newsRelation = new NewsRelation();
|
||||
newsRelation.setUserId(StpUtil.getLoginIdAsLong());
|
||||
newsRelation.setNewsId(id);
|
||||
toSaveList.add(newsRelation);
|
||||
}
|
||||
newsRelationService.remove(Wrappers.<NewsRelation>query().lambda()
|
||||
.in(NewsRelation::getNewsId, ids)
|
||||
.eq(NewsRelation::getUserId, StpUtil.getLoginIdAsLong()));
|
||||
return R.ok(newsRelationService.saveBatch(toSaveList));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,209 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.img.ImgUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.annotation.XjrLog;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.exception.MyException;
|
||||
import com.xjrsoft.common.oss.factory.OssFactory;
|
||||
import com.xjrsoft.system.entity.File;
|
||||
import com.xjrsoft.system.service.IFileService;
|
||||
import com.xjrsoft.system.vo.FileVo;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2022/3/8 11:07
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.SYSTEM_MODULE_PREFIX + "/oss")
|
||||
@Tag(name = GlobalConstant.SYSTEM_MODULE_PREFIX + "/oss", description = "对象存储模块")
|
||||
@AllArgsConstructor
|
||||
public class OssController {
|
||||
|
||||
|
||||
private final IFileService fileService;
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*/
|
||||
@PostMapping("/upload")
|
||||
@XjrLog(value = "上传文件")
|
||||
@SneakyThrows
|
||||
public R upload(@RequestParam("file") MultipartFile file, @RequestParam(value = "folderId", required = false) Long folderId,
|
||||
@RequestParam(value = "processId", required = false) String processId) {
|
||||
if (ObjectUtil.isNull(file)) {
|
||||
throw new MyException("上传文件不能为空");
|
||||
}
|
||||
|
||||
//上传文件
|
||||
String suffix = Objects.requireNonNull(file.getOriginalFilename()).substring(file.getOriginalFilename().lastIndexOf(StringPool.DOT));
|
||||
String url = Objects.requireNonNull(OssFactory.build()).uploadSuffix(file.getBytes(), suffix);
|
||||
|
||||
//保存文件信息
|
||||
File fileEntity = new File();
|
||||
|
||||
|
||||
Long newfolderId = IdWorker.getId();
|
||||
|
||||
List<File> insertFile = new ArrayList<>();
|
||||
|
||||
//如果有folder id 默认修改 上一次folderid
|
||||
if (!ObjectUtil.isNull(folderId)) {
|
||||
//找到所有原有文件id
|
||||
List<File> list = fileService.list(Wrappers.lambdaQuery(File.class).eq(File::getFolderId, folderId));
|
||||
|
||||
for (File newFile : list) {
|
||||
newFile.setId(null);
|
||||
newFile.setFolderId(newfolderId);
|
||||
}
|
||||
|
||||
insertFile.addAll(list);
|
||||
|
||||
}
|
||||
|
||||
fileEntity.setFolderId(newfolderId);
|
||||
fileEntity.setFileUrl(url);
|
||||
fileEntity.setFileType(suffix);
|
||||
fileEntity.setFileSuffiex(suffix.replace(StringPool.DOT, StringPool.EMPTY));
|
||||
fileEntity.setFileName(file.getOriginalFilename().replace(suffix, StringPool.EMPTY));
|
||||
fileEntity.setFileSize(file.getSize());
|
||||
|
||||
if (GlobalConstant.imageType.contains(StringUtils.lowerCase(suffix.replace(StringPool.DOT, StringPool.EMPTY)))) {
|
||||
|
||||
String thSuffix = StringPool.DOT + ImgUtil.IMAGE_TYPE_JPEG;
|
||||
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
ImgUtil.scale(file.getInputStream(), outputStream, 200, 200, null);
|
||||
|
||||
|
||||
|
||||
byte[] thBytes = outputStream.toByteArray();
|
||||
|
||||
String thUrl = Objects.requireNonNull(OssFactory.build()).uploadSuffix(thBytes, StringPool.DOT + ImgUtil.IMAGE_TYPE_JPEG);
|
||||
outputStream.close();
|
||||
|
||||
|
||||
fileEntity.setThUrl(thUrl);
|
||||
fileEntity.setThType(thSuffix);
|
||||
fileEntity.setThName(file.getOriginalFilename().replace(suffix, StringPool.EMPTY) + "-缩略图");
|
||||
fileEntity.setThSize(Convert.toLong(thBytes.length));
|
||||
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(processId)) {
|
||||
fileEntity.setProcessId(processId);
|
||||
}
|
||||
|
||||
insertFile.add(fileEntity);
|
||||
fileService.saveBatch(insertFile);
|
||||
|
||||
return R.ok(BeanUtil.toBean(fileEntity, FileVo.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*/
|
||||
@PostMapping("/multi-upload")
|
||||
@XjrLog(value = "上传文件")
|
||||
@SneakyThrows
|
||||
public R multiUpload(@RequestParam("file") MultipartFile[] file, @RequestParam(value = "folderId", required = false) Long folderId,
|
||||
@RequestParam(value = "processId", required = false) String processId) {
|
||||
if (ObjectUtil.isNull(file)) {
|
||||
throw new MyException("上传文件不能为空");
|
||||
}
|
||||
|
||||
Long newfolderId = IdWorker.getId();
|
||||
|
||||
List<File> insertFile = new ArrayList<>();
|
||||
|
||||
//如果有folder id 默认修改 上一次folderid
|
||||
if (!ObjectUtil.isNull(folderId)) {
|
||||
//找到所有原有文件id
|
||||
List<File> list = fileService.list(Wrappers.lambdaQuery(File.class).eq(File::getFolderId, folderId));
|
||||
|
||||
for (File newFile : list) {
|
||||
newFile.setId(null);
|
||||
newFile.setFolderId(newfolderId);
|
||||
}
|
||||
|
||||
insertFile.addAll(list);
|
||||
|
||||
}
|
||||
|
||||
//上传文件
|
||||
List<FileVo> resultList = new ArrayList<>();
|
||||
for (MultipartFile f : file) {
|
||||
String suffix = Objects.requireNonNull(f.getOriginalFilename()).substring(f.getOriginalFilename().lastIndexOf(StringPool.DOT));
|
||||
String url = Objects.requireNonNull(OssFactory.build()).uploadSuffix(f.getBytes(), suffix);
|
||||
|
||||
//保存文件信息
|
||||
Long id = IdWorker.getId();
|
||||
File fileEntity = new File();
|
||||
fileEntity.setId(id);
|
||||
fileEntity.setFolderId(newfolderId);
|
||||
fileEntity.setFileUrl(url);
|
||||
fileEntity.setFileType(suffix);
|
||||
fileEntity.setFileSuffiex(suffix.replace(StringPool.DOT, StringPool.EMPTY));
|
||||
fileEntity.setFileName(f.getOriginalFilename().replace(suffix, StringPool.EMPTY));
|
||||
fileEntity.setFileSize(f.getSize());
|
||||
if (StrUtil.isNotBlank(processId)) {
|
||||
fileEntity.setProcessId(processId);
|
||||
}
|
||||
|
||||
if (GlobalConstant.imageType.contains(suffix.replace(StringPool.DOT, StringPool.EMPTY))) {
|
||||
|
||||
String thSuffix = StringPool.DOT + ImgUtil.IMAGE_TYPE_JPEG;
|
||||
|
||||
FileOutputStream outputStream = new FileOutputStream(Thread.currentThread().getName() + "temp.jpeg");
|
||||
ImgUtil.scale(f.getInputStream(), outputStream, 200, 200, null);
|
||||
|
||||
outputStream.close();
|
||||
|
||||
java.io.File thFile = new java.io.File(Thread.currentThread().getName() + "temp.jpeg");
|
||||
|
||||
byte[] thBytes = FileUtil.readBytes(thFile);
|
||||
|
||||
String thUrl = Objects.requireNonNull(OssFactory.build()).uploadSuffix(FileUtil.readBytes(thFile), StringPool.DOT + ImgUtil.IMAGE_TYPE_JPEG);
|
||||
|
||||
|
||||
fileEntity.setThUrl(thUrl);
|
||||
fileEntity.setThType(thSuffix);
|
||||
fileEntity.setThName(f.getOriginalFilename().replace(suffix, StringPool.EMPTY) + "-缩略图");
|
||||
fileEntity.setThSize(Convert.toLong(thBytes.length));
|
||||
|
||||
boolean delete = thFile.delete();
|
||||
}
|
||||
|
||||
|
||||
insertFile.add(fileEntity);
|
||||
resultList.add(BeanUtil.toBean(fileEntity, FileVo.class));
|
||||
}
|
||||
|
||||
fileService.saveBatch(insertFile);
|
||||
|
||||
return R.ok(resultList);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.system.dto.PrintConfigInfoDto;
|
||||
import com.xjrsoft.system.dto.PrintSetConfigDto;
|
||||
import com.xjrsoft.system.service.IPrintConfigService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-05-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.PRINT_MODULE_PREFIX + "/config")
|
||||
@Tag(name = GlobalConstant.PRINT_MODULE_PREFIX + "/config", description = "打印配置模块")
|
||||
@AllArgsConstructor
|
||||
public class PrintConfigController {
|
||||
|
||||
private final IPrintConfigService printConfigService;
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "设置打印按钮配置")
|
||||
public R set(@Valid @RequestBody PrintSetConfigDto dto){
|
||||
return R.ok(printConfigService.setConfig(dto));
|
||||
}
|
||||
|
||||
@GetMapping("/info")
|
||||
@Operation(summary = "获取打印按钮配置")
|
||||
public R info(@Valid PrintConfigInfoDto dto){
|
||||
return R.ok(printConfigService.getInfo(dto));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,134 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.enums.EnabledMark;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.system.dto.*;
|
||||
import com.xjrsoft.system.entity.Menu;
|
||||
import com.xjrsoft.system.entity.PrintSchema;
|
||||
import com.xjrsoft.system.service.IMenuService;
|
||||
import com.xjrsoft.system.service.IPrintSchemaService;
|
||||
import com.xjrsoft.system.vo.PrintSchemaInfoVo;
|
||||
import com.xjrsoft.system.vo.PrintSchemaListVo;
|
||||
import com.xjrsoft.system.vo.PrintSchemaPageVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 打印模板 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-05-19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.PRINT_MODULE_PREFIX)
|
||||
@Tag(name = GlobalConstant.PRINT_MODULE_PREFIX, description = "打印模块")
|
||||
@AllArgsConstructor
|
||||
public class PrintSchemaController {
|
||||
|
||||
private final IPrintSchemaService printSchemaService;
|
||||
|
||||
private final IMenuService menuService;
|
||||
|
||||
@GetMapping(value = "/list")
|
||||
@Operation(summary = "打印模板不分页")
|
||||
public R list(PrintSchemaListDto dto) {
|
||||
|
||||
LambdaQueryWrapper<PrintSchema> queryWrapper = Wrappers.lambdaQuery(PrintSchema.class)
|
||||
.eq(ObjectUtil.isNotNull(dto.getCategory()), PrintSchema::getCategory, dto.getCategory())
|
||||
.like(StrUtil.isNotBlank(dto.getName()), PrintSchema::getName, dto.getName())
|
||||
.like(StrUtil.isNotBlank(dto.getCode()), PrintSchema::getCode, dto.getCode())
|
||||
.eq(PrintSchema::getEnabledMark, EnabledMark.ENABLED.getCode())
|
||||
.select(PrintSchema.class, x -> VoToColumnUtil.fieldsToColumns(PrintSchemaListVo.class).contains(x.getProperty()));
|
||||
List<PrintSchema> list = printSchemaService.list(queryWrapper);
|
||||
|
||||
List<PrintSchemaListVo> printSchemaListVos = BeanUtil.copyToList(list, PrintSchemaListVo.class);
|
||||
return R.ok(printSchemaListVos);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "打印模板分页")
|
||||
public R page(PrintSchemaPageDto dto) {
|
||||
|
||||
LambdaQueryWrapper<PrintSchema> queryWrapper = Wrappers.lambdaQuery(PrintSchema.class)
|
||||
.eq(ObjectUtil.isNotNull(dto.getCategory()), PrintSchema::getCategory, dto.getCategory())
|
||||
.like(StrUtil.isNotBlank(dto.getName()), PrintSchema::getName, dto.getName())
|
||||
.like(StrUtil.isNotBlank(dto.getCode()), PrintSchema::getCode, dto.getCode())
|
||||
.eq(ObjectUtil.isNotNull(dto.getEnabledMark()), PrintSchema::getEnabledMark, dto.getEnabledMark())
|
||||
.select(PrintSchema.class, x -> VoToColumnUtil.fieldsToColumns(PrintSchemaPageVo.class).contains(x.getProperty()));
|
||||
IPage<PrintSchema> page = printSchemaService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
|
||||
PageOutput<PrintSchemaPageVo> pageOutput = ConventPage.getPageOutput(page, PrintSchemaPageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping("/info")
|
||||
@Operation(summary = "获取详情")
|
||||
public R info(@RequestParam Long id){
|
||||
PrintSchema schema = printSchemaService.getById(id);
|
||||
|
||||
PrintSchemaInfoVo printSchemaInfoVo = BeanUtil.toBean(schema, PrintSchemaInfoVo.class);
|
||||
|
||||
if (ObjectUtil.isNotNull(schema.getIsMenu())) {
|
||||
Menu menu = menuService.getOne(Wrappers.lambdaQuery(Menu.class).eq(Menu::getId,schema.getMenuId()).select(Menu::getIcon,Menu::getParentId));
|
||||
if (ObjectUtil.isNotNull(menu)) {
|
||||
printSchemaInfoVo.setIcon(menu.getIcon());
|
||||
printSchemaInfoVo.setParentId(menu.getParentId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return R.ok(printSchemaInfoVo);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增")
|
||||
public R add(@Valid @RequestBody AddPrintSchemaDto dto){
|
||||
|
||||
return R.ok(printSchemaService.add(dto));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改")
|
||||
public R update(@Valid @RequestBody UpdatePrintSchemaDto dto){
|
||||
|
||||
return R.ok(printSchemaService.updateSchema(dto));
|
||||
}
|
||||
|
||||
@PutMapping("/enabled")
|
||||
@Operation(summary = "启用/禁用")
|
||||
public R enabled(@Valid @RequestBody EnabledPrintSchemaDto dto){
|
||||
PrintSchema schema = new PrintSchema();
|
||||
schema.setId(dto.getId());
|
||||
schema.setEnabledMark(dto.getEnabledMark());
|
||||
|
||||
return R.ok(printSchemaService.updateById(schema));
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
public R delete(@Valid @RequestBody List<Long> ids) {
|
||||
return R.ok(printSchemaService.removeByIds(ids));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,83 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.annotation.XjrLog;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.system.dto.AddProfessionalReportDto;
|
||||
import com.xjrsoft.system.dto.ProfessionalReportPageDto;
|
||||
import com.xjrsoft.system.dto.UpdateProfessionalReportDto;
|
||||
import com.xjrsoft.system.entity.ProfessionalReport;
|
||||
import com.xjrsoft.system.service.IProfessionalReportService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 专业报表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hnyyzy
|
||||
* @since 2023-11-01
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.REPORT_MODULE_PREFIX + "/professionalReport")
|
||||
@Tag(name = GlobalConstant.REPORT_MODULE_PREFIX + "/professionalReport", description = "专业报表模块")
|
||||
@AllArgsConstructor
|
||||
public class ProfessionalReportController {
|
||||
|
||||
private final IProfessionalReportService professionalReportService;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "专业报表page接口")
|
||||
@XjrLog(value = "专业报表树")
|
||||
public R page(ProfessionalReportPageDto dto) {
|
||||
List<ProfessionalReport> list = professionalReportService.list(Wrappers.<ProfessionalReport>query().lambda()
|
||||
.like(StrUtil.isNotBlank(dto.getKeyword()),ProfessionalReport::getName,dto.getKeyword()).orderByAsc(ProfessionalReport::getSortCode));
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增专业报表")
|
||||
public R add(@Valid @RequestBody AddProfessionalReportDto dto) {
|
||||
long count = professionalReportService.count(Wrappers.<ProfessionalReport>query().lambda().eq(ProfessionalReport::getName, dto.getName()));
|
||||
if (count > 0) {
|
||||
return R.error("此专业报表已经存在!");
|
||||
}
|
||||
ProfessionalReport professionalReport = BeanUtil.toBean(dto, ProfessionalReport.class);
|
||||
professionalReportService.save(professionalReport);
|
||||
return R.ok(true);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改专业报表")
|
||||
public R update(@Valid @RequestBody UpdateProfessionalReportDto dto) {
|
||||
ProfessionalReport professionalReport = BeanUtil.toBean(dto, ProfessionalReport.class);
|
||||
professionalReportService.updateById(professionalReport);
|
||||
return R.ok(true);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "根据id查询专业报表信息")
|
||||
public R info(@RequestParam Long id) {
|
||||
ProfessionalReport professionalReport = professionalReportService.getById(id);
|
||||
if (professionalReport == null) {
|
||||
R.error("找不到此报表!");
|
||||
}
|
||||
return R.ok(professionalReport);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除专业报表")
|
||||
@XjrLog(value = "删除专业报表")
|
||||
public R delete(@Valid @RequestBody Long id) {
|
||||
return R.ok(professionalReportService.removeById(id));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,93 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.enums.YesOrNoEnum;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.system.dto.ReportListDto;
|
||||
import com.xjrsoft.system.dto.ReportPageDto;
|
||||
import com.xjrsoft.system.entity.ProfessionalReport;
|
||||
import com.xjrsoft.system.entity.Report;
|
||||
import com.xjrsoft.system.service.IProfessionalReportService;
|
||||
import com.xjrsoft.system.service.IReportService;
|
||||
import com.xjrsoft.system.vo.ReportPageVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-05-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.REPORT_MODULE_PREFIX)
|
||||
@Tag(name = GlobalConstant.REPORT_MODULE_PREFIX,description = "报表模块")
|
||||
@AllArgsConstructor
|
||||
public class ReportController {
|
||||
|
||||
private final IReportService reportService;
|
||||
|
||||
private final IProfessionalReportService professionalReportService;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary="ureport 报表列表(分页)")
|
||||
public R page(@Valid ReportPageDto dto) {
|
||||
LambdaQueryWrapper<Report> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(StrUtil.isNotBlank(dto.getKeyword()), Report::getName,dto.getKeyword())
|
||||
.select(Report.class,x -> VoToColumnUtil.fieldsToColumns(ReportPageVo.class).contains(x.getProperty()))
|
||||
.orderByDesc(StrUtil.isBlank(dto.getField()), Report::getCreateDate);
|
||||
|
||||
IPage<Report> page = reportService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<ReportPageVo> pageOutput = ConventPage.getPageOutput(page, ReportPageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/list")
|
||||
@Operation(summary="ureport 报表列表(不分页)")
|
||||
public R list(@Valid ReportListDto dto) {
|
||||
LambdaQueryWrapper<Report> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(StrUtil.isNotBlank(dto.getKeyword()), Report::getName,dto.getKeyword())
|
||||
.select(Report.class,x -> VoToColumnUtil.fieldsToColumns(ReportPageVo.class).contains(x.getProperty()))
|
||||
.orderByAsc(Report::getSortCode);
|
||||
|
||||
List<Report> list = reportService.list(queryWrapper);
|
||||
List<ReportPageVo> reportPageVos = BeanUtil.copyToList(list, ReportPageVo.class);
|
||||
for (ReportPageVo reportPageVo : reportPageVos) {
|
||||
reportPageVo.setDataType(YesOrNoEnum.NO.getCode());
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<ProfessionalReport> professionalReportLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
professionalReportLambdaQueryWrapper.eq(StrUtil.isNotBlank(dto.getKeyword()), ProfessionalReport::getName,dto.getKeyword())
|
||||
.select(ProfessionalReport.class,x -> VoToColumnUtil.fieldsToColumns(ReportPageVo.class).contains(x.getProperty()));
|
||||
List<ProfessionalReport> professionalReportList = professionalReportService.list(professionalReportLambdaQueryWrapper);
|
||||
List<ReportPageVo> professionalReportVo = BeanUtil.copyToList(professionalReportList, ReportPageVo.class);
|
||||
for (ReportPageVo reportPageVo : professionalReportVo) {
|
||||
reportPageVo.setDataType(YesOrNoEnum.YES.getCode());
|
||||
}
|
||||
reportPageVos.addAll(professionalReportVo);
|
||||
return R.ok(reportPageVos);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
public R delete(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(reportService.removeBatchByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.system.dto.AddReportReleaseDto;
|
||||
import com.xjrsoft.system.dto.ReportReleasePageDto;
|
||||
import com.xjrsoft.system.dto.UpdateReportReleaseDto;
|
||||
import com.xjrsoft.system.service.IReportRelationService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 报表菜单关联关系表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-05-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.REPORT_MODULE_PREFIX + "/release")
|
||||
@Tag(name = GlobalConstant.REPORT_MODULE_PREFIX + "/release",description = "报表发布模块")
|
||||
@AllArgsConstructor
|
||||
public class ReportReleaseController {
|
||||
|
||||
private final IReportRelationService reportRelationService;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary="报表发布列表(分页)")
|
||||
public R page(@Valid ReportReleasePageDto dto) {
|
||||
return R.ok(reportRelationService.releasePage(dto));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary="报表发布详情")
|
||||
public R info(@RequestParam Long id) {
|
||||
return R.ok(reportRelationService.info(id));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary="新增(分页)")
|
||||
public R add(@Valid @RequestBody AddReportReleaseDto dto) {
|
||||
return R.ok(reportRelationService.add(dto));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary="修改(分页)")
|
||||
public R update(@Valid @RequestBody UpdateReportReleaseDto dto) {
|
||||
return R.ok(reportRelationService.update(dto));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
public R delete(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(reportRelationService.removeBatchByIds(ids));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,174 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.page.PageInput;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.enums.YesOrNoEnum;
|
||||
import com.xjrsoft.system.dto.AddScheduleDto;
|
||||
import com.xjrsoft.system.dto.UpdateScheduleDto;
|
||||
import com.xjrsoft.system.entity.Schedule;
|
||||
import com.xjrsoft.system.service.IScheduleService;
|
||||
import com.xjrsoft.system.vo.ScheduleBoxVo;
|
||||
import com.xjrsoft.system.vo.ScheduleListVo;
|
||||
import com.xjrsoft.system.vo.ScheduleVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 日程管理 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zlf
|
||||
* @since 2022-06-16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.OA_MODULE_PREFIX + "/schedule")
|
||||
@Tag(name = GlobalConstant.OA_MODULE_PREFIX + "/schedule", description = "日程管理")
|
||||
@AllArgsConstructor
|
||||
public class ScheduleController {
|
||||
|
||||
private final IScheduleService scheduleService;
|
||||
|
||||
@GetMapping("/box")
|
||||
@Operation(summary = "消息提醒处获取日程")
|
||||
public R box(PageInput dto) {
|
||||
List<Schedule> scheduleList = scheduleService.list(Wrappers.<Schedule>query().lambda()
|
||||
.eq(Schedule::getEnabledMark, 1)
|
||||
.eq(Schedule::getCreateUserId, StpUtil.getLoginIdAsLong())
|
||||
.orderByDesc(Schedule::getCreateDate));
|
||||
List<ScheduleBoxVo> scheduleBoxVoList = new ArrayList<>();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
for (Schedule schedule : scheduleList) {
|
||||
LocalDateTime startDate = schedule.getStartDate();
|
||||
LocalDateTime endDate = schedule.getEndDate();//日程结束时间
|
||||
ScheduleBoxVo scheduleBoxVo = new ScheduleBoxVo();
|
||||
scheduleBoxVo.setId(schedule.getId());
|
||||
scheduleBoxVo.setCreateDate(schedule.getCreateDate());
|
||||
if (ObjectUtil.isNotEmpty(schedule.getScheduleState()) && schedule.getScheduleState() == YesOrNoEnum.YES.getCode()){//已读
|
||||
scheduleBoxVo.setIsRead(true);
|
||||
}else {//默认为未读
|
||||
scheduleBoxVo.setIsRead(false);
|
||||
}
|
||||
if (LocalDateTimeUtil.between(now.minusHours(1),endDate).toMinutes() > 0 && LocalDateTimeUtil.between(now,endDate).toMinutes() <= 60){
|
||||
//相差的时间小于60分钟
|
||||
scheduleBoxVo.setTitle("您的日程在一小时内即将结束,日程内容为:【" + schedule.getScheduleContent()+"】");
|
||||
scheduleBoxVoList.add(scheduleBoxVo);
|
||||
} else if (LocalDateTimeUtil.between(now,startDate).toMinutes() < 0 && LocalDateTimeUtil.between(now,endDate).toMinutes() > 0) {
|
||||
//进行中的,当前时间比开始时间大,比结束时间小
|
||||
scheduleBoxVo.setTitle("您的日程【" + schedule.getScheduleContent() + "】已经开始");
|
||||
scheduleBoxVoList.add(scheduleBoxVo);
|
||||
} else if (LocalDateTimeUtil.between(now.minusDays(1),startDate).toDays() == 1) {
|
||||
//当前时间比开始时间小于一天,但大于开始时间
|
||||
scheduleBoxVo.setId(schedule.getId());
|
||||
scheduleBoxVo.setTitle("您有一项日程在一天后即将开始,日程内容为:【" + schedule.getScheduleContent()+"】");
|
||||
scheduleBoxVoList.add(scheduleBoxVo);
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(dto.getKeyword())){
|
||||
scheduleBoxVoList = scheduleBoxVoList.stream().filter(x -> x.getTitle().contains(dto.getKeyword())).collect(Collectors.toList());
|
||||
}
|
||||
if (scheduleBoxVoList.size() > 0){
|
||||
scheduleBoxVoList.sort((t1,t2)->t2.getCreateDate().compareTo(t1.getCreateDate()));
|
||||
}
|
||||
PageOutput<ScheduleBoxVo> output = new PageOutput<>();
|
||||
output.setCurrentPage(dto.getLimit());
|
||||
output.setPageSize(dto.getSize());
|
||||
output.setTotal(scheduleBoxVoList.size());
|
||||
output.setList(scheduleBoxVoList);
|
||||
|
||||
return R.ok(output);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Operation(summary = "获取日程管理列表")
|
||||
public R list(PageInput dto) {
|
||||
List<Schedule> scheduleList = scheduleService.list(Wrappers.<Schedule>query().lambda()
|
||||
.eq(Schedule::getEnabledMark, 1)
|
||||
.like(StrUtil.isNotBlank(dto.getKeyword()),Schedule::getScheduleContent,dto.getKeyword())
|
||||
.eq(Schedule::getCreateUserId, StpUtil.getLoginIdAsLong())
|
||||
.orderByDesc(Schedule::getCreateDate));
|
||||
List<ScheduleListVo> scheduleListVos = new ArrayList<>(scheduleList.size());
|
||||
for (Schedule schedule : scheduleList) {
|
||||
ScheduleListVo scheduleListVo = new ScheduleListVo();
|
||||
scheduleListVo.setId(schedule.getId());
|
||||
scheduleListVo.setScheduleName(schedule.getScheduleName());
|
||||
scheduleListVo.setScheduleContent(schedule.getScheduleContent());
|
||||
scheduleListVo.setStart(schedule.getStartDate());
|
||||
scheduleListVo.setEnd(schedule.getEndDate());
|
||||
scheduleListVo.setAllDay(false);
|
||||
scheduleListVo.setTitle(schedule.getScheduleContent());
|
||||
scheduleListVos.add(scheduleListVo);
|
||||
}
|
||||
return R.ok(scheduleListVos);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "添加日程管理")
|
||||
public R add(@RequestBody AddScheduleDto scheduleDto) {
|
||||
Schedule schedule = BeanUtil.toBean(scheduleDto, Schedule.class);
|
||||
//添加消息通知
|
||||
boolean save = scheduleService.save(schedule);
|
||||
return R.ok(save);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改日程管理")
|
||||
public R update(@RequestBody UpdateScheduleDto scheduleDto) {
|
||||
Schedule schedule = BeanUtil.toBean(scheduleDto, Schedule.class);
|
||||
return R.ok(scheduleService.updateById(schedule));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除日程管理")
|
||||
public R delete(@RequestBody List<Long> ids) {
|
||||
return R.ok(scheduleService.delete(ids));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "日程详情")
|
||||
public R info(@RequestParam Long id) {
|
||||
Schedule schedule = scheduleService.getById(id);
|
||||
if (schedule == null) {
|
||||
R.error("找不到当前日程!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(schedule, ScheduleVo.class));
|
||||
}
|
||||
|
||||
@PutMapping("/read")
|
||||
@Operation(summary = "日程单个已读")
|
||||
public R read(@RequestBody List<Long> ids) {
|
||||
List<Schedule> scheduleList = new ArrayList<>(ids.size());
|
||||
for (Long id : ids) {
|
||||
Schedule schedule = new Schedule();
|
||||
schedule.setId(id);
|
||||
schedule.setScheduleState(YesOrNoEnum.YES.getCode());
|
||||
scheduleList.add(schedule);
|
||||
}
|
||||
return R.ok(scheduleService.updateBatchById(scheduleList));
|
||||
}
|
||||
|
||||
@PutMapping("/all-read")
|
||||
@Operation(summary = "日程全部已读")
|
||||
public R allRead() {
|
||||
scheduleService.update(Wrappers.<Schedule>lambdaUpdate()
|
||||
.eq(Schedule::getCreateUserId, StpUtil.getLoginIdAsLong())
|
||||
.eq(Schedule::getEnabledMark, 1)
|
||||
.set(Schedule::getScheduleState, YesOrNoEnum.YES.getCode()));
|
||||
return R.ok(true);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,185 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.yulichang.toolkit.MPJWrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.enums.StampEnum;
|
||||
import com.xjrsoft.common.core.enums.YesOrNoEnum;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.system.dto.*;
|
||||
import com.xjrsoft.system.entity.DictionaryDetail;
|
||||
import com.xjrsoft.system.entity.Stamp;
|
||||
import com.xjrsoft.system.service.IStampService;
|
||||
import com.xjrsoft.system.vo.StampListVo;
|
||||
import com.xjrsoft.system.vo.StampPageVo;
|
||||
import com.xjrsoft.system.vo.StampVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 印章表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zjq
|
||||
* @since 2022-10-24
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.SYSTEM_MODULE_PREFIX + "/stamp")
|
||||
@Tag(name = GlobalConstant.SYSTEM_MODULE_PREFIX + "/stamp", description = "签章模块")
|
||||
@AllArgsConstructor
|
||||
public class StampController {
|
||||
|
||||
private final IStampService stampService;
|
||||
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "查询列表数据(不分页)")
|
||||
public R list(@Valid StampListDto dto) {
|
||||
List<StampListVo> stampListVos = stampService.selectJoinList(StampListVo.class, MPJWrappers.<Stamp>lambdaJoin()
|
||||
.disableSubLogicDel()
|
||||
.eq(Stamp::getStampType, dto.getStampType())
|
||||
.eq(dto.getStampType() == StampEnum.PRIVATE.getCode(), Stamp::getCreateUserId, StpUtil.getLoginIdAsLong())
|
||||
.like(StrUtil.isNotBlank(dto.getKeyword()), Stamp::getName, dto.getKeyword())
|
||||
.eq(ObjectUtil.isNotNull(dto.getEnabledMark()), Stamp::getEnabledMark, dto.getEnabledMark())
|
||||
.eq(ObjectUtil.isNotNull(dto.getStampCategory()), Stamp::getStampCategory, dto.getStampCategory())
|
||||
.select(Stamp::getId)
|
||||
.select(Stamp.class, x -> VoToColumnUtil.fieldsToColumns(StampPageVo.class).contains(x.getProperty()))
|
||||
.selectAs(DictionaryDetail::getValue, StampPageVo::getStampCategoryName)
|
||||
.leftJoin(DictionaryDetail.class, DictionaryDetail::getId, Stamp::getStampCategory));
|
||||
|
||||
return R.ok(stampListVos);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "查询列表数据(分页)-所有未禁用签章")
|
||||
public R page(@Valid StampPageDto dto) {
|
||||
IPage<StampPageVo> page = stampService.selectJoinListPage(ConventPage.getPage(dto), StampPageVo.class,
|
||||
MPJWrappers.<Stamp>lambdaJoin()
|
||||
.disableSubLogicDel()
|
||||
// .eq(Stamp::getStampType, dto.getStampType())
|
||||
.eq(Stamp::getEnabledMark, YesOrNoEnum.YES.getCode())
|
||||
.eq(dto.getStampType() == StampEnum.PRIVATE.getCode(), Stamp::getCreateUserId, StpUtil.getLoginIdAsLong())
|
||||
.like(StrUtil.isNotBlank(dto.getKeyword()), Stamp::getName, dto.getKeyword())
|
||||
.eq(ObjectUtil.isNotNull(dto.getEnabledMark()), Stamp::getEnabledMark, dto.getEnabledMark())
|
||||
.eq(ObjectUtil.isNotNull(dto.getStampCategory()), Stamp::getStampCategory, dto.getStampCategory())
|
||||
.select(Stamp::getId)
|
||||
.select(Stamp.class, x -> VoToColumnUtil.fieldsToColumns(StampPageVo.class).contains(x.getProperty()))
|
||||
.selectAs(DictionaryDetail::getName, StampPageVo::getStampCategoryName)
|
||||
.leftJoin(DictionaryDetail.class, DictionaryDetail::getId, Stamp::getStampCategory));
|
||||
PageOutput<StampPageVo> pageOutput = ConventPage.getPageOutput(page, StampPageVo.class);
|
||||
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping("/page-one")
|
||||
@Operation(summary = "查询列表数据(分页)-单独电子签章或公共签章")
|
||||
public R pageOne(@Valid StampPageDto dto) {
|
||||
IPage<StampPageVo> page = stampService.selectJoinListPage(ConventPage.getPage(dto), StampPageVo.class,
|
||||
MPJWrappers.<Stamp>lambdaJoin()
|
||||
.disableSubLogicDel()
|
||||
.eq(Stamp::getStampType, dto.getStampType())
|
||||
.eq(dto.getStampType() == StampEnum.PRIVATE.getCode(), Stamp::getCreateUserId, StpUtil.getLoginIdAsLong())
|
||||
.like(StrUtil.isNotBlank(dto.getKeyword()), Stamp::getName, dto.getKeyword())
|
||||
.eq(ObjectUtil.isNotNull(dto.getEnabledMark()), Stamp::getEnabledMark, dto.getEnabledMark())
|
||||
.eq(ObjectUtil.isNotNull(dto.getStampCategory()), Stamp::getStampCategory, dto.getStampCategory())
|
||||
.orderByAsc(Stamp::getSortCode)
|
||||
.select(Stamp::getId)
|
||||
.select(Stamp.class, x -> VoToColumnUtil.fieldsToColumns(StampPageVo.class).contains(x.getProperty()))
|
||||
.selectAs(DictionaryDetail::getName, StampPageVo::getStampCategoryName)
|
||||
.leftJoin(DictionaryDetail.class, DictionaryDetail::getId, Stamp::getStampCategory));
|
||||
PageOutput<StampPageVo> pageOutput = ConventPage.getPageOutput(page, StampPageVo.class);
|
||||
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "查询签章详情")
|
||||
public R info(@RequestParam Long id) {
|
||||
Stamp stamp = stampService.getById(id);
|
||||
if (stamp == null) {
|
||||
R.error("找不到此用户!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(stamp, StampVo.class));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增")
|
||||
public R add(@Valid @RequestBody AddStampDto dto) {
|
||||
Stamp stamp = BeanUtil.toBean(dto, Stamp.class);
|
||||
stamp.setIsDefault(YesOrNoEnum.NO.getCode());
|
||||
return R.ok(stampService.save(stamp));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改")
|
||||
public R update(@Valid @RequestBody UpdateStampDto dto) {
|
||||
return R.ok(stampService.updateStamp(dto));
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除签章(可批量删除)")
|
||||
public R delete(@Valid @RequestBody List<Long> ids) {
|
||||
return R.ok(stampService.deleteStamp(ids));
|
||||
}
|
||||
|
||||
|
||||
@PutMapping("/enabled")
|
||||
@Operation(summary = "启用/禁用")
|
||||
public R enabled(@Valid @RequestBody StampEnabledDto dto) {
|
||||
return R.ok(stampService.enabled(dto.getId()));
|
||||
|
||||
}
|
||||
|
||||
@PutMapping("/set-default")
|
||||
@Operation(summary = "设定为默认签章")
|
||||
public R setDefault(@Valid @RequestBody SetDefaultStampDto dto) {
|
||||
return R.ok(stampService.setDefaultStamp(dto.getId()));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/member")
|
||||
@Operation(summary = "查询签章成员")
|
||||
public R getMember(Long id) {
|
||||
return R.ok(stampService.selectMember(id));
|
||||
}
|
||||
|
||||
//添加成员
|
||||
@PutMapping("/add-member")
|
||||
@Operation(summary = "添加成员")
|
||||
public R addMember(@Valid @RequestBody AddMemberDto dto) {
|
||||
return R.ok(stampService.addMember(dto));
|
||||
}
|
||||
|
||||
@GetMapping("/maintain")
|
||||
@Operation(summary = "查询维护成员")
|
||||
public R getMaintain(Long id) {
|
||||
return R.ok(stampService.selectMaintain(id));
|
||||
}
|
||||
|
||||
|
||||
@PutMapping("/add-maintain")
|
||||
@Operation(summary = "添加维护成员")
|
||||
public R addMaintain(@Valid @RequestBody AddMemberDto dto) {
|
||||
return R.ok(stampService.addMaintain(dto));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,117 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.system.dto.*;
|
||||
import com.xjrsoft.system.entity.Subsystem;
|
||||
import com.xjrsoft.system.service.IMenuService;
|
||||
import com.xjrsoft.system.service.ISubsystemService;
|
||||
import com.xjrsoft.system.vo.MenuVo;
|
||||
import com.xjrsoft.system.vo.SubsystemListVo;
|
||||
import com.xjrsoft.tenant.util.SecureUtil;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 子系统 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zjq
|
||||
* @since 2022-10-08
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.SYSTEM_MODULE_PREFIX + "/subsystem")
|
||||
@Tag(name = GlobalConstant.SYSTEM_MODULE_PREFIX + "/subsystem", description = "子系统管理")
|
||||
@AllArgsConstructor
|
||||
public class SubsystemController {
|
||||
|
||||
private final ISubsystemService subsystemService;
|
||||
|
||||
private final IMenuService menuService;
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "查询子系统表列表数据(不分页)")
|
||||
public R list(@Valid SubsystemListDto dto) {
|
||||
List<Long> roleIdList = StpUtil.getTokenSession().get(GlobalConstant.LOGIN_USER_ROLE_ID_KEY, new ArrayList<>());
|
||||
boolean isAdmin = SecureUtil.isAdmin(roleIdList);
|
||||
Set<Long> systemIds = null;
|
||||
if (!isAdmin) {
|
||||
List<MenuVo> list = menuService.getAuthMenuList(new MenuTreeDto());
|
||||
systemIds = list.stream().map(menuVo -> menuVo.getSystemId()).collect(Collectors.toSet());
|
||||
}
|
||||
LambdaQueryWrapper<Subsystem> wrapper = Wrappers.<Subsystem>query().lambda()
|
||||
.like(StrUtil.isNotBlank(dto.getKeyword()), Subsystem::getName, dto.getKeyword())
|
||||
.in(!isAdmin, Subsystem::getId, systemIds)
|
||||
.last(StringUtils.isNotEmpty(dto.getField()), GlobalConstant.ORDER_BY + StringPool.SPACE + StrUtil.toUnderlineCase(dto.getField()) + StringPool.SPACE + ConventPage.getOrder(dto.getOrder()))
|
||||
.select(Subsystem.class, x -> VoToColumnUtil.fieldsToColumns(SubsystemListVo.class).contains(x.getProperty()))
|
||||
.orderByAsc(Subsystem::getSortCode);
|
||||
List<SubsystemListVo> subsystemListVos = BeanUtil.copyToList(subsystemService.list(wrapper), SubsystemListVo.class);
|
||||
return R.ok(subsystemListVos);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "查询子系统表列表数据(分页)")
|
||||
public R page(@Valid SubsystemPageDto dto) {
|
||||
LambdaQueryWrapper<Subsystem> wrapper = Wrappers.<Subsystem>query().lambda()
|
||||
.like(StrUtil.isNotBlank(dto.getKeyword()), Subsystem::getName, dto.getKeyword())
|
||||
.last(StringUtils.isNotEmpty(dto.getField()), GlobalConstant.ORDER_BY + StringPool.SPACE + StrUtil.toUnderlineCase(dto.getField()) + StringPool.SPACE + ConventPage.getOrder(dto.getOrder()))
|
||||
.select(Subsystem.class, x -> VoToColumnUtil.fieldsToColumns(SubsystemListVo.class).contains(x.getProperty()))
|
||||
.orderByAsc(Subsystem::getSortCode);
|
||||
IPage<Subsystem> page = subsystemService.page(ConventPage.getPage(dto), wrapper);
|
||||
return R.ok(ConventPage.getPageOutput(page, SubsystemListVo.class));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增子系统")
|
||||
public R add(@Valid @RequestBody AddSubsystemDto dto) {
|
||||
Subsystem subsystem = BeanUtil.toBean(dto, Subsystem.class);
|
||||
return R.ok(subsystemService.save(subsystem));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "更新子系统")
|
||||
public R update(@Valid @RequestBody UpdateSubsystemDto dto){
|
||||
Subsystem subsystem = BeanUtil.toBean(dto, Subsystem.class);
|
||||
return R.ok(subsystemService.updateById(subsystem));
|
||||
}
|
||||
|
||||
//TODo: 用户授权相关表xjr_base_relation xjr_base_Authorize
|
||||
@GetMapping
|
||||
@Operation(summary = "查询当前用户授权的子系统")
|
||||
public R AuthList(){
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
public R delete(@RequestBody List<Long> ids) {
|
||||
if (ids.contains(1L)) {
|
||||
return R.error("不能删除主系统!");
|
||||
}
|
||||
return R.ok(subsystemService.removeBatchByIds(ids));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,126 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.support.ExcelTypeEnum;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.system.dto.AddXjrSystemConfigDto;
|
||||
import com.xjrsoft.system.dto.XjrSystemConfigPageDto;
|
||||
import com.xjrsoft.system.dto.UpdateXjrSystemConfigDto;
|
||||
import com.xjrsoft.system.entity.XjrSystemConfig;
|
||||
import com.xjrsoft.system.service.ISystemConfigService;
|
||||
import com.xjrsoft.system.utils.ExcelUtil;
|
||||
import com.xjrsoft.system.vo.XjrSystemConfigPageVo;
|
||||
import com.xjrsoft.system.vo.XjrSystemConfigVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: 系统配置
|
||||
* @Author 管理员
|
||||
* @Date: 2024-07-29
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system" + "/systemConfig")
|
||||
@Tag(name = "/system" + "/systemConfig",description = "系统配置代码")
|
||||
@AllArgsConstructor
|
||||
public class SystemConfigController {
|
||||
|
||||
|
||||
private final ISystemConfigService systemConfigService;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "XjrSystemConfig列表(分页)")
|
||||
@SaCheckPermission("XjrSystemConfig:detail")
|
||||
public R page(@Valid XjrSystemConfigPageDto dto){
|
||||
|
||||
LambdaQueryWrapper<XjrSystemConfig> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper
|
||||
.like(StrUtil.isNotBlank(dto.getCode()), XjrSystemConfig::getCode,dto.getCode())
|
||||
.like(StrUtil.isNotBlank(dto.getName()), XjrSystemConfig::getName,dto.getName())
|
||||
.like(StrUtil.isNotBlank(dto.getValue()), XjrSystemConfig::getValue,dto.getValue())
|
||||
.like(StrUtil.isNotBlank(dto.getRemark()), XjrSystemConfig::getRemark,dto.getRemark())
|
||||
.orderByDesc(XjrSystemConfig::getId)
|
||||
.select(XjrSystemConfig.class, x -> VoToColumnUtil.fieldsToColumns(XjrSystemConfigPageVo.class).contains(x.getProperty()));
|
||||
IPage<XjrSystemConfig> page = systemConfigService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<XjrSystemConfigPageVo> pageOutput = ConventPage.getPageOutput(page, XjrSystemConfigPageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "根据id查询XjrSystemConfig信息")
|
||||
@SaCheckPermission("XjrSystemConfig:detail")
|
||||
public R info(@RequestParam Long id){
|
||||
XjrSystemConfig xjrSystemConfig = systemConfigService.getById(id);
|
||||
if (xjrSystemConfig == null) {
|
||||
return R.error("找不到此数据!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(xjrSystemConfig, XjrSystemConfigVo.class));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增XjrSystemConfig")
|
||||
@SaCheckPermission("XjrSystemConfig:add")
|
||||
public R add(@Valid @RequestBody AddXjrSystemConfigDto dto){
|
||||
XjrSystemConfig xjrSystemConfig = BeanUtil.toBean(dto, XjrSystemConfig.class);
|
||||
boolean isSuccess = systemConfigService.save(xjrSystemConfig);
|
||||
return R.ok(xjrSystemConfig.getId());
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改XjrSystemConfig")
|
||||
@SaCheckPermission("XjrSystemConfig:edit")
|
||||
public R update(@Valid @RequestBody UpdateXjrSystemConfigDto dto){
|
||||
|
||||
XjrSystemConfig xjrSystemConfig = BeanUtil.toBean(dto, XjrSystemConfig.class);
|
||||
return R.ok(systemConfigService.updateById(xjrSystemConfig));
|
||||
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
@SaCheckPermission("XjrSystemConfig:delete")
|
||||
public R delete(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(systemConfigService.removeBatchByIds(ids));
|
||||
|
||||
}
|
||||
@PostMapping("/import")
|
||||
@Operation(summary = "导入")
|
||||
public R importData(@RequestParam MultipartFile file) throws IOException {
|
||||
List<XjrSystemConfigPageVo> savedDataList = EasyExcel.read(file.getInputStream()).head(XjrSystemConfigPageVo.class).sheet().doReadSync();
|
||||
ExcelUtil.transExcelData(savedDataList, true);
|
||||
systemConfigService.saveBatch(BeanUtil.copyToList(savedDataList, XjrSystemConfig.class));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@GetMapping("/export")
|
||||
@Operation(summary = "导出")
|
||||
public ResponseEntity<byte[]> exportData(@Valid XjrSystemConfigPageDto dto, @RequestParam(defaultValue = "false") Boolean isTemplate) {
|
||||
List<XjrSystemConfigPageVo> customerList = isTemplate != null && isTemplate ? new ArrayList<>() : ((PageOutput<XjrSystemConfigPageVo>) page(dto).getData()).getList();
|
||||
ExcelUtil.transExcelData(customerList, false);
|
||||
ByteArrayOutputStream bot = new ByteArrayOutputStream();
|
||||
EasyExcel.write(bot, XjrSystemConfigPageVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(customerList);
|
||||
ByteArrayOutputStream resultBot = ExcelUtil.renderExportRequiredHead(bot);
|
||||
|
||||
return R.fileStream(resultBot.toByteArray(), "XjrSystemConfig" + ExcelTypeEnum.XLSX.getValue());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,206 @@
|
||||
package com.xjrsoft.system.controller;
|
||||
|
||||
import cn.dev33.satoken.secure.SaSecureUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.io.resource.ResourceUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.enums.EnabledMark;
|
||||
import com.xjrsoft.common.core.exception.MyException;
|
||||
import com.xjrsoft.common.core.uitls.MD5Encrypt;
|
||||
import com.xjrsoft.common.core.uitls.TreeUtil;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.organization.client.*;
|
||||
import com.xjrsoft.organization.entity.*;
|
||||
import com.xjrsoft.organization.model.NewTenantDefaultInfoModel;
|
||||
import com.xjrsoft.system.dto.*;
|
||||
import com.xjrsoft.system.entity.Menu;
|
||||
import com.xjrsoft.system.entity.Tenant;
|
||||
import com.xjrsoft.system.entity.TenantAuthorize;
|
||||
import com.xjrsoft.system.service.IMenuService;
|
||||
import com.xjrsoft.system.service.ITenantAuthorizeService;
|
||||
import com.xjrsoft.system.service.ITenantService;
|
||||
import com.xjrsoft.system.vo.MenuTreeVo;
|
||||
import com.xjrsoft.system.vo.TenantPageVo;
|
||||
import com.xjrsoft.tenant.config.TenantConfig;
|
||||
import com.xjrsoft.tenant.util.SecureUtil;
|
||||
import com.xjrsoft.tenant.util.TenantUtil;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 租户模块
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-08-14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.SYSTEM_MODULE_PREFIX + "/tenant")
|
||||
@Tag(name = GlobalConstant.SYSTEM_MODULE_PREFIX + "/tenant", description = "租户模块")
|
||||
@AllArgsConstructor
|
||||
public class TenantController {
|
||||
|
||||
private final ITenantService tenantService;
|
||||
|
||||
private final ITenantAuthorizeService tenantAuthorizeService;
|
||||
|
||||
private final IUserClient userClient;
|
||||
|
||||
private final IPostClient postClient;
|
||||
|
||||
private final IRoleClient roleClient;
|
||||
|
||||
private final IDepartmentClient departmentClient;
|
||||
|
||||
private final IUserRoleRelationClient userRoleRelationClient;
|
||||
|
||||
private final IUserPostRelationClient userPostRelationClient;
|
||||
|
||||
private final IUserDeptRelationClient userDeptRelationClient;
|
||||
|
||||
private final TenantConfig tenantConfig;
|
||||
|
||||
private final IMenuService menuService;
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获取所有租户(分页)")
|
||||
public R page(TenantPageDto dto) {
|
||||
LambdaQueryWrapper<Tenant> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(StrUtil.isNotBlank(dto.getName()), Tenant::getName, dto.getName())
|
||||
.like(StrUtil.isNotBlank(dto.getCode()), Tenant::getCode, dto.getCode())
|
||||
.eq(dto.getEnabledMark() != null, Tenant::getEnabledMark, dto.getEnabledMark())
|
||||
.orderByDesc(Tenant::getId);
|
||||
|
||||
IPage<Tenant> page = tenantService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<TenantPageVo> pageOutput = ConventPage.getPageOutput(page, TenantPageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增租户")
|
||||
public R add(@Valid @RequestBody AddTenantDto dto) {
|
||||
|
||||
if (tenantService.count(Wrappers.lambdaQuery(Tenant.class).eq(Tenant::getName, dto.getName())) > 0
|
||||
||tenantService.count(Wrappers.lambdaQuery(Tenant.class).eq(Tenant::getCode, dto.getCode())) > 0) {
|
||||
return R.error("当前 租户名称 或者 租户编码 已经存在!");
|
||||
}
|
||||
|
||||
Tenant tenant = BeanUtil.toBean(dto, Tenant.class);
|
||||
tenant.setId(MD5Encrypt.toLong(tenant.getCode()));
|
||||
|
||||
//创建站点管理员角色和员工角色并绑定到当前用户
|
||||
User user= BeanUtil.toBean(SecureUtil.getCurrentUser(), User.class);
|
||||
|
||||
Role siteAdmin=new Role("SITEADMIN","站点管理员");
|
||||
siteAdmin.setTenantId(tenant.getId());
|
||||
roleClient.addRoleFeign(siteAdmin);
|
||||
Role yg=new Role("YG","员工");
|
||||
yg.setTenantId(tenant.getId());
|
||||
roleClient.addRoleFeign(yg);
|
||||
UserRoleRelation siteAdminRelation=new UserRoleRelation(user.getId(),siteAdmin.getId());
|
||||
siteAdminRelation.setTenantId(tenant.getId());
|
||||
userRoleRelationClient.addUserRoleRelationFeign(siteAdminRelation);
|
||||
UserRoleRelation ygRelation=new UserRoleRelation(user.getId(),yg.getId());
|
||||
ygRelation.setTenantId(tenant.getId());
|
||||
userRoleRelationClient.addUserRoleRelationFeign(ygRelation);
|
||||
|
||||
return R.ok(tenantService.save(tenant));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改租户")
|
||||
public R update(@Valid @RequestBody UpdateTenantDto dto) {
|
||||
|
||||
if (tenantService.count(Wrappers.lambdaQuery(Tenant.class).ne(Tenant::getId,dto.getId()).eq(Tenant::getName, dto.getName())) > 0
|
||||
||
|
||||
tenantService.count(Wrappers.lambdaQuery(Tenant.class).ne(Tenant::getId,dto.getId()).eq(Tenant::getCode, dto.getCode())) > 0) {
|
||||
return R.error("当前 租户名称 或者 租户编码 已经存在!");
|
||||
}
|
||||
|
||||
Tenant tenant = BeanUtil.toBean(dto, Tenant.class);
|
||||
|
||||
return R.ok(tenantService.updateById(tenant));
|
||||
}
|
||||
|
||||
@PutMapping("/status")
|
||||
@Operation(summary = "修改租户状态")
|
||||
public R updateEnabled(@Valid @RequestBody UpdateTenantStatusDto dto) {
|
||||
if (SecureUtil.isAdmin(ListUtil.toList(dto.getId()))) {
|
||||
return R.error("租户管理员信息不能修改!");
|
||||
}
|
||||
//根据id修改租户enabledMark
|
||||
return R.ok(tenantService.update(Wrappers.<Tenant>update().lambda().set(Tenant::getEnabledMark, dto.getEnabledMark()).eq(Tenant::getId, dto.getId())));
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除租户")
|
||||
public R delete(@Valid @RequestBody List<Long> ids) {
|
||||
return R.ok(tenantService.removeByIds(ids));
|
||||
}
|
||||
|
||||
@PostMapping("/authorize")
|
||||
@Operation(summary = "租户授权")
|
||||
public R setAuthorize(@RequestBody SetTenantAuthDto dto) {
|
||||
long count = tenantService.count(Wrappers.lambdaQuery(Tenant.class)
|
||||
.eq(Tenant::getId, dto.getId()).eq(Tenant::getCode, tenantConfig.getAdminTenantCode()));
|
||||
if (count > 0) {
|
||||
throw new MyException("主租户");
|
||||
}
|
||||
// 先清除权限,然后重新添加
|
||||
tenantAuthorizeService.remove(Wrappers.lambdaQuery(TenantAuthorize.class).eq(TenantAuthorize::getTenantId, dto.getId()));
|
||||
List<Long> menuIds = dto.getMenuIds();
|
||||
if (CollectionUtils.isNotEmpty(menuIds)) {
|
||||
List<TenantAuthorize> tenantAuthorizeList = new ArrayList<>(menuIds.size());
|
||||
for (Long menuId : menuIds) {
|
||||
TenantAuthorize tenantAuthorize = new TenantAuthorize();
|
||||
tenantAuthorize.setMenuId(menuId);
|
||||
tenantAuthorize.setTenantId(dto.getId());
|
||||
tenantAuthorizeList.add(tenantAuthorize);
|
||||
}
|
||||
tenantAuthorizeService.saveBatch(tenantAuthorizeList);
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@GetMapping("/authorize")
|
||||
@Operation(summary = "获取租户授权的菜单")
|
||||
public R getAuthorize(@RequestParam Long id) {
|
||||
List<TenantAuthorize> tenantAuthorizeList = tenantAuthorizeService.list(Wrappers.lambdaQuery(TenantAuthorize.class)
|
||||
.select(TenantAuthorize::getMenuId).eq(TenantAuthorize::getTenantId, id));
|
||||
List<Long> resultList = new ArrayList<>(tenantAuthorizeList.size());
|
||||
if (CollectionUtils.isNotEmpty(tenantAuthorizeList)) {
|
||||
List<Long> menuIds = tenantAuthorizeList.stream().map(TenantAuthorize::getMenuId).collect(Collectors.toList());
|
||||
// 过滤掉父级菜单id
|
||||
List<Menu> menuList = menuService.list(Wrappers.<Menu>query().lambda()
|
||||
.select(Menu::getParentId, Menu::getId)
|
||||
.in(Menu::getId, menuIds)
|
||||
.eq(Menu::getEnabledMark, EnabledMark.ENABLED.getCode()));
|
||||
List<MenuTreeVo> menuTreeVos = BeanUtil.copyToList(menuList, MenuTreeVo.class);
|
||||
List<MenuTreeVo> menuTreeList = TreeUtil.build(menuTreeVos);
|
||||
TreeUtil.buildLastChildIds(menuTreeList, resultList);
|
||||
}
|
||||
return R.ok(resultList);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,105 @@
|
||||
package com.xjrsoft.system.provide;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.bstek.ureport.provider.report.ReportFile;
|
||||
import com.bstek.ureport.provider.report.ReportProvider;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.xjrsoft.system.entity.Report;
|
||||
import com.xjrsoft.system.service.IReportService;
|
||||
import lombok.Setter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2022/5/23 9:13
|
||||
*/
|
||||
@Setter
|
||||
@Component
|
||||
public class XjrReportProvider implements ReportProvider {
|
||||
|
||||
private final String PREFIX = "xjr:";
|
||||
|
||||
@JsonIgnore
|
||||
@Autowired
|
||||
private IReportService reportService;
|
||||
|
||||
|
||||
@Override
|
||||
public InputStream loadReport(String fileName) {
|
||||
Report report = reportService.getOne(Wrappers.<Report>lambdaQuery().eq(Report::getName, getRealName(fileName)));
|
||||
byte[] content = report.getContent();
|
||||
return new ByteArrayInputStream(content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteReport(String fileName) {
|
||||
reportService.remove(Wrappers.<Report>lambdaQuery().eq(Report::getName, getRealName(fileName)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ReportFile> getReportFiles() {
|
||||
List<Report> list = reportService.list();
|
||||
List<ReportFile> reportList = new ArrayList<>();
|
||||
for (Report report : list) {
|
||||
reportList.add(new ReportFile(report.getName(), Date.from(report.getModifyDate().atZone(ZoneId.systemDefault()).toInstant())));
|
||||
}
|
||||
return reportList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveReport(String fileName, String fileContent) {
|
||||
Report report = reportService.getOne(Wrappers.<Report>lambdaQuery().eq(Report::getName, getRealName(fileName)));
|
||||
if (report == null) {
|
||||
report = new Report();
|
||||
report.setName(getRealName(fileName));
|
||||
report.setContent(fileContent.getBytes(StandardCharsets.UTF_8));
|
||||
report.setModifyDate(LocalDateTime.now());
|
||||
|
||||
reportService.save(report);
|
||||
}
|
||||
else {
|
||||
report.setName(getRealName(fileName));
|
||||
report.setContent(fileContent.getBytes(StandardCharsets.UTF_8));
|
||||
report.setModifyDate(LocalDateTime.now());
|
||||
reportService.updateById(report);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "本地数据库";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean disabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix() {
|
||||
return PREFIX;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取真实名称 无前缀
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
private String getRealName(String name) {
|
||||
if (name.startsWith(PREFIX)) {
|
||||
name = name.substring(PREFIX.length());
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,83 @@
|
||||
package com.xjrsoft.system.runner;
|
||||
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.redis.service.RedisUtil;
|
||||
import com.xjrsoft.system.entity.DataAuth;
|
||||
import com.xjrsoft.system.entity.DataAuthConfig;
|
||||
import com.xjrsoft.system.entity.DataAuthRelation;
|
||||
import com.xjrsoft.system.entity.DataAuthTableRelation;
|
||||
import com.xjrsoft.system.service.IDataAuthConfigService;
|
||||
import com.xjrsoft.system.service.IDataAuthRelationService;
|
||||
import com.xjrsoft.system.service.IDataAuthService;
|
||||
import com.xjrsoft.system.service.IDataAuthTableRelationService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description 加载数据权限 缓存
|
||||
* @Author: tzx
|
||||
* @Date: 2023/2/28 14:49
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
public class DataAuthRunner implements CommandLineRunner {
|
||||
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
private IDataAuthService dataAuthService;
|
||||
|
||||
private IDataAuthRelationService dataAuthRelationService;
|
||||
|
||||
private IDataAuthConfigService dataAuthConfigService;
|
||||
|
||||
private IDataAuthTableRelationService dataAuthTableRelationService;
|
||||
|
||||
|
||||
@Override
|
||||
public void run(String... args) {
|
||||
loadDataAuthCache();
|
||||
loadDataAuthConfigCache();
|
||||
loadDataAuthRelationCache();
|
||||
loadDataAuthTableRelationCache();
|
||||
}
|
||||
|
||||
@Async
|
||||
void loadDataAuthCache() {
|
||||
log.info("ITC-FRAMEWORK: 加载所有数据权限缓存开始");
|
||||
List<DataAuth> list = dataAuthService.list();
|
||||
redisUtil.set(GlobalConstant.DATA_AUTH_CACHE_KEY, list);
|
||||
log.info("ITC-FRAMEWORK: 加载所有数据权限缓存结束");
|
||||
}
|
||||
|
||||
@Async
|
||||
void loadDataAuthConfigCache() {
|
||||
log.info("ITC-FRAMEWORK: 加载所有数据权限配置缓存开始");
|
||||
List<DataAuthConfig> list = dataAuthConfigService.list();
|
||||
redisUtil.set(GlobalConstant.DATA_AUTH_CONFIG_CACHE_KEY, list);
|
||||
log.info("ITC-FRAMEWORK: 加载所有数据权限配置缓存结束");
|
||||
}
|
||||
|
||||
@Async
|
||||
void loadDataAuthRelationCache() {
|
||||
log.info("ITC-FRAMEWORK: 加载所有数据权限关联缓存开始");
|
||||
List<DataAuthRelation> list = dataAuthRelationService.list();
|
||||
redisUtil.set(GlobalConstant.DATA_AUTH_RELATION_CACHE_KEY, list);
|
||||
log.info("ITC-FRAMEWORK: 加载所有数据权限关联缓存结束");
|
||||
}
|
||||
|
||||
@Async
|
||||
void loadDataAuthTableRelationCache() {
|
||||
log.info("ITC-FRAMEWORK: 加载所有数据权限与表关联缓存开始");
|
||||
List<DataAuthTableRelation> list = dataAuthTableRelationService.list();
|
||||
redisUtil.set(GlobalConstant.DATA_AUTH_TABLE_RELATION_CACHE_KEY, list);
|
||||
log.info("ITC-FRAMEWORK: 加载所有数据权限与表关联缓存结束");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package com.xjrsoft.system.runner;
|
||||
|
||||
import com.xjrsoft.system.service.IDictionarydetailService;
|
||||
import com.xjrsoft.system.service.IDictionaryitemService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 默认缓存数据字典
|
||||
*
|
||||
* @Author: tzx
|
||||
* @Date: 2023/1/11 11:14
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
public class DicCacheRunner implements CommandLineRunner {
|
||||
|
||||
private IDictionaryitemService dictionaryitemService;
|
||||
|
||||
private IDictionarydetailService dictionarydetailService;
|
||||
|
||||
|
||||
@Override
|
||||
public void run(String... args) {
|
||||
dictionaryitemService.loadCaches();
|
||||
dictionarydetailService.loadCaches();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package com.xjrsoft.system.runner;
|
||||
|
||||
import com.xjrsoft.system.entity.LiteflowChain;
|
||||
import com.xjrsoft.system.service.ILiteflowChainService;
|
||||
import com.xjrsoft.tenant.util.TenantUtil;
|
||||
import com.yomahub.liteflow.builder.el.LiteFlowChainELBuilder;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/4/7 10:41
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
public class LiteflowRunner implements CommandLineRunner {
|
||||
|
||||
private ILiteflowChainService liteflowChainService;
|
||||
|
||||
@Override
|
||||
public void run(String... args) {
|
||||
log.info("ITC-FRAMEWORK: 加载所有规则开始");
|
||||
TenantUtil.ignore(Boolean.TRUE);
|
||||
List<LiteflowChain> list = liteflowChainService.list();
|
||||
|
||||
for (LiteflowChain liteflowChain : list) {
|
||||
LiteFlowChainELBuilder.createChain().setChainId(liteflowChain.getChainName()).setEL(liteflowChain.getElData()).build();
|
||||
}
|
||||
TenantUtil.clear();
|
||||
log.info("ITC-FRAMEWORK: 加载所有规则结束");
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,59 @@
|
||||
package com.xjrsoft.system.runner;
|
||||
|
||||
import cn.dev33.satoken.SaManager;
|
||||
import cn.dev33.satoken.config.SaTokenConfig;
|
||||
import com.xjrsoft.common.core.enums.YesOrNoEnum;
|
||||
import com.xjrsoft.system.entity.LoginConfig;
|
||||
import com.xjrsoft.system.service.ILoginConfigService;
|
||||
import com.xjrsoft.tenant.util.TenantUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 登录配置获取
|
||||
* @Author: tzx
|
||||
* @Date: 2022/12/6 14:50
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
public class LoginConfigRunner implements CommandLineRunner {
|
||||
|
||||
|
||||
private ILoginConfigService loginConfigService;
|
||||
@Override
|
||||
public void run(String... args) {
|
||||
TenantUtil.ignore(Boolean.TRUE);
|
||||
loadLoginConfig();
|
||||
TenantUtil.clear();
|
||||
}
|
||||
|
||||
@Async
|
||||
void loadLoginConfig(){
|
||||
List<LoginConfig> list = loginConfigService.list();
|
||||
if (list.size() == 0){//如果没有,则设置为默认配置,并进行保存
|
||||
LoginConfig loginConfig = new LoginConfig();
|
||||
loginConfig.setId(1L);
|
||||
loginConfig.setMulLogin("0,1");
|
||||
loginConfig.setMutualExclusion(YesOrNoEnum.NO.getCode());
|
||||
loginConfig.setWithoutLogin(YesOrNoEnum.YES.getCode());
|
||||
loginConfig.setPasswordStrategy(YesOrNoEnum.YES.getCode());
|
||||
loginConfig.setStrategyMaxNumber(7);
|
||||
list.add(loginConfig);
|
||||
loginConfigService.save(loginConfig);
|
||||
}
|
||||
LoginConfig loginConfig = list.get(0);
|
||||
SaTokenConfig oldConfig = SaManager.getConfig();
|
||||
//不开启同端互斥
|
||||
oldConfig.setIsConcurrent(loginConfig.getMutualExclusion() == YesOrNoEnum.NO.getCode());
|
||||
// 注入到 SaManager 中
|
||||
SaManager.setConfig(oldConfig);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.system.entity.Area;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 行政区域表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-06-16
|
||||
*/
|
||||
public interface IAreaService extends IService<Area> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.system.dto.SetRoleAuthDto;
|
||||
import com.xjrsoft.system.entity.Authorize;
|
||||
import com.xjrsoft.system.vo.PermissionVo;
|
||||
import com.xjrsoft.system.vo.RoleAuthVo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-03-16
|
||||
*/
|
||||
public interface IAuthorizeService extends IService<Authorize> {
|
||||
|
||||
/**
|
||||
* 根据登陆人获取 权限
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
PermissionVo getPermissions();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dto 按钮id
|
||||
* @return 是否成功
|
||||
*/
|
||||
Boolean setRoleAuth(SetRoleAuthDto dto);
|
||||
|
||||
|
||||
/**
|
||||
* 获取角色权限
|
||||
*
|
||||
* @param id 角色id
|
||||
* @return 角色权限
|
||||
*/
|
||||
RoleAuthVo getRoleAuth(Long id);
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.system.entity.CodeRuleSeed;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 编号规则种子表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zlf
|
||||
* @since 2022-06-23
|
||||
*/
|
||||
public interface ICodeRuleSeedService extends IService<CodeRuleSeed> {
|
||||
|
||||
CodeRuleSeed getCodeRuleSeedBy(Long ruleId, Long userId);
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.xjrsoft.common.core.domain.page.PageInput;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.system.entity.CodeRule;
|
||||
import com.xjrsoft.system.vo.CodeRuleVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 编号规则表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zlf
|
||||
* @since 2022-06-23
|
||||
*/
|
||||
public interface ICodeRuleService extends MPJBaseService<CodeRule> {
|
||||
|
||||
PageOutput<CodeRuleVo> getCodeRulePageList(PageInput dto);
|
||||
|
||||
String genEncode(String encode);
|
||||
|
||||
boolean useEncode(String encode);
|
||||
|
||||
boolean useEncode(List<String> encodeList);
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.system.dto.CodeSchemaPageDto;
|
||||
import com.xjrsoft.system.entity.CodeSchema;
|
||||
import com.xjrsoft.system.vo.CodeSchemaPageVo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 代码模板 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zlf
|
||||
* @since 2022-09-29
|
||||
*/
|
||||
public interface ICodeSchemaService extends MPJBaseService<CodeSchema> {
|
||||
|
||||
PageOutput<CodeSchemaPageVo> page(CodeSchemaPageDto dto);
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.system.entity.DataAuthConfig;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据权限自定义配置详情表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-02-27
|
||||
*/
|
||||
public interface IDataAuthConfigService extends IService<DataAuthConfig> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.system.entity.DataAuthRelation;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据权限 对象类型关联表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-02-27
|
||||
*/
|
||||
public interface IDataAuthRelationService extends IService<DataAuthRelation> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.xjrsoft.system.dto.AddDataAuthDto;
|
||||
import com.xjrsoft.system.dto.UpdateDataAuthDto;
|
||||
import com.xjrsoft.system.entity.DataAuth;
|
||||
import com.xjrsoft.system.vo.AuthObjectVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据权限表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-02-27
|
||||
*/
|
||||
public interface IDataAuthService extends MPJBaseService<DataAuth> {
|
||||
|
||||
Boolean add(AddDataAuthDto dto);
|
||||
|
||||
Boolean edit(UpdateDataAuthDto dto);
|
||||
|
||||
List<AuthObjectVo> getAuthObjectsInfo(Long id);
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.system.entity.DataAuthTableRelation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据权限 与 表 关联关系表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-02-28
|
||||
*/
|
||||
public interface IDataAuthTableRelationService extends IService<DataAuthTableRelation> {
|
||||
|
||||
Boolean saveDataAuthTableRelations(String tableName, List<Long> dataAuthIdList);
|
||||
}
|
||||
@ -0,0 +1,86 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import cn.hutool.db.Entity;
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.common.core.domain.datasource.MyColumnInfo;
|
||||
import com.xjrsoft.common.core.domain.datasource.MyTableInfo;
|
||||
import com.xjrsoft.system.dto.AddDatabaseLinkDto;
|
||||
import com.xjrsoft.system.dto.UpdateDatabaseLinkDto;
|
||||
import com.xjrsoft.system.entity.Databaselink;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据库连接表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-03-04
|
||||
*/
|
||||
public interface IDatabaselinkService extends IService<Databaselink> {
|
||||
|
||||
|
||||
Boolean add(AddDatabaseLinkDto dto);
|
||||
|
||||
Boolean update(UpdateDatabaseLinkDto dto);
|
||||
|
||||
/**
|
||||
* 测试连接
|
||||
* @param databaselink
|
||||
* @return
|
||||
*/
|
||||
Boolean test(Databaselink databaselink);
|
||||
|
||||
/**
|
||||
* 获取所有表信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<MyTableInfo> getTables(String id, String tableName);
|
||||
|
||||
/**
|
||||
* 获取所有表数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<Entity> getTablesData(String id, String tableName);
|
||||
|
||||
/**
|
||||
* 获取表的所有字段信息
|
||||
* @param id
|
||||
* @param tableName
|
||||
* @return
|
||||
*/
|
||||
List<MyColumnInfo> getTableColumns(String id, String tableName);
|
||||
|
||||
|
||||
/**
|
||||
* 获取表的所有字段信息
|
||||
* @param id
|
||||
* @param tableName
|
||||
* @return
|
||||
*/
|
||||
List<String> getTableColumnName(String id, String tableName);
|
||||
|
||||
/**
|
||||
* 获取多个表的所有字段西悉尼
|
||||
* @param id
|
||||
* @param tableNames
|
||||
* @return
|
||||
*/
|
||||
Map<String, List<MyColumnInfo>> getMultiTableColumns(String id, String tableNames);
|
||||
|
||||
|
||||
/**
|
||||
* 获取多个表的所有字段名
|
||||
* @param id
|
||||
* @param tableNames
|
||||
* @return
|
||||
*/
|
||||
Map<String, List<String>> getMultiTableColumnName(String id, String tableNames);
|
||||
|
||||
DbType getDbType(String id);
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import cn.hutool.db.Entity;
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.xjrsoft.system.dto.GetDataPageDto;
|
||||
import com.xjrsoft.system.entity.Datasource;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据源表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-03-08
|
||||
*/
|
||||
public interface IDatasourceService extends MPJBaseService<Datasource> {
|
||||
|
||||
/**
|
||||
* 根据datasourceid 获取数据源的列
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<String> getColumns(Long id);
|
||||
|
||||
/**
|
||||
* 根据datasourceid 获取数据源的数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<Entity> getData(Long id);
|
||||
|
||||
/**
|
||||
* 获取数据源的数据 分页
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getDataPage(GetDataPageDto dto);
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.system.entity.DictionaryDetail;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据字典详情 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-03-17
|
||||
*/
|
||||
public interface IDictionarydetailService extends IService<DictionaryDetail> {
|
||||
|
||||
void loadCaches();
|
||||
|
||||
void dictionaryDetailCache();
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.system.entity.DictionaryItem;
|
||||
import com.xjrsoft.system.vo.DictionaryItemDetailTreeVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据字典项目 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-03-17
|
||||
*/
|
||||
public interface IDictionaryitemService extends IService<DictionaryItem> {
|
||||
|
||||
List<DictionaryItemDetailTreeVo> getTree();
|
||||
|
||||
void loadCaches();
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.xjrsoft.system.entity.File;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件关联关系表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-03-08
|
||||
*/
|
||||
public interface IFileService extends MPJBaseService<File> {
|
||||
|
||||
boolean deleteFile(String encode);
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.system.entity.InterfaceAuth;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 接口权限表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zlf
|
||||
* @since 2022-11-03
|
||||
*/
|
||||
public interface IInterfaceAuthService extends IService<InterfaceAuth> {
|
||||
|
||||
List<String> loadAuthInterfaceIdsOfUser(Long userId);
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.system.dto.AddOrUpdateLanguageDto;
|
||||
import com.xjrsoft.system.entity.Language;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 语言翻译表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-10-09
|
||||
*/
|
||||
public interface ILanguageService extends IService<Language> {
|
||||
|
||||
boolean add(List<AddOrUpdateLanguageDto> dto);
|
||||
|
||||
boolean update(List<AddOrUpdateLanguageDto> dto);
|
||||
|
||||
List<Map<String,Object>> page(String keywords);
|
||||
|
||||
Map<String, Map<String,String>> main();
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.system.dto.LanguageTypeListDto;
|
||||
import com.xjrsoft.system.entity.LanguageType;
|
||||
import com.xjrsoft.system.vo.LanguageTypeVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 多语言语言类型表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zlf
|
||||
* @since 2022-06-30
|
||||
*/
|
||||
public interface ILanguageTypeService extends IService<LanguageType> {
|
||||
|
||||
boolean setMainLanguage(Long id);
|
||||
|
||||
PageOutput<LanguageTypeVo> getPageData(LanguageTypeListDto dto);
|
||||
|
||||
List<LanguageType> getDataList(String keyword);
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.system.dto.AddChainDto;
|
||||
import com.xjrsoft.system.dto.ExecuteFlowDto;
|
||||
import com.xjrsoft.system.dto.UpdateChainDto;
|
||||
import com.xjrsoft.system.entity.LiteflowChain;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 规则表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-04-06
|
||||
*/
|
||||
public interface ILiteflowChainService extends IService<LiteflowChain> {
|
||||
|
||||
boolean addChain(AddChainDto dto);
|
||||
|
||||
boolean updateChain(UpdateChainDto dto);
|
||||
|
||||
|
||||
boolean deleteChain(List<Long> ids);
|
||||
|
||||
|
||||
boolean execute(ExecuteFlowDto dto);
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.system.entity.LiteflowScript;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 规则脚本表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-04-06
|
||||
*/
|
||||
public interface ILiteflowScriptService extends IService<LiteflowScript> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.system.entity.Log;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统日志表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-03-04
|
||||
*/
|
||||
public interface ILogService extends IService<Log> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.system.entity.LoginConfig;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Login登录配置表【xjr_login_config】 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hnyyzy
|
||||
* @since 2023-11-20
|
||||
*/
|
||||
public interface ILoginConfigService extends IService<LoginConfig> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.system.entity.LogoConfig;
|
||||
import com.xjrsoft.system.vo.LogoInfoVo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Logo信息配置表【xjr_logo_config】 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hnyyzy
|
||||
* @since 2023-11-20
|
||||
*/
|
||||
public interface ILogoConfigService extends IService<LogoConfig> {
|
||||
|
||||
LogoInfoVo logoInfo();
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.system.entity.MenuButton;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 菜单按钮 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-03-16
|
||||
*/
|
||||
public interface IMenuButtonService extends IService<MenuButton> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.system.entity.MenuColumn;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 菜单列表字段 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zlf
|
||||
* @since 2022-07-08
|
||||
*/
|
||||
public interface IMenuColumnService extends IService<MenuColumn> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.system.entity.MenuForm;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 菜单表单字段 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zlf
|
||||
* @since 2022-07-08
|
||||
*/
|
||||
public interface IMenuFormService extends IService<MenuForm> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.xjrsoft.system.dto.MenuTreeDto;
|
||||
import com.xjrsoft.system.entity.Menu;
|
||||
import com.xjrsoft.system.vo.MenuVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-03-16
|
||||
*/
|
||||
public interface IMenuService extends MPJBaseService<Menu> {
|
||||
|
||||
List<MenuVo> getAuthMenuList(MenuTreeDto dto);
|
||||
|
||||
List<Long> getTenantAuthMenuIds(Long tenantId);
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.system.entity.Message;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 消息状态 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zlf
|
||||
* @since 2022-06-16
|
||||
*/
|
||||
public interface IMessageService extends IService<Message> {
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.system.entity.NewsRelation;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author zlf
|
||||
* @since 2023-04-06
|
||||
*/
|
||||
public interface INewsRelationService extends IService<NewsRelation> {
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.xjrsoft.system.entity.News;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 新闻中心表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zlf
|
||||
* @since 2022-06-16
|
||||
*/
|
||||
public interface INewsService extends MPJBaseService<News> {
|
||||
|
||||
/**
|
||||
* 删除新闻 以及 消息推送
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
boolean delete(List<Long> ids);
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.system.dto.PrintConfigInfoDto;
|
||||
import com.xjrsoft.system.dto.PrintSetConfigDto;
|
||||
import com.xjrsoft.system.entity.PrintConfig;
|
||||
import com.xjrsoft.system.vo.PrintConfigInfoVo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-05-23
|
||||
*/
|
||||
public interface IPrintConfigService extends IService<PrintConfig> {
|
||||
|
||||
boolean setConfig(PrintSetConfigDto dto);
|
||||
|
||||
PrintConfigInfoVo getInfo(PrintConfigInfoDto dto);
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.xjrsoft.system.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.xjrsoft.system.dto.AddPrintSchemaDto;
|
||||
import com.xjrsoft.system.dto.UpdatePrintSchemaDto;
|
||||
import com.xjrsoft.system.entity.PrintSchema;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 打印模板 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-05-19
|
||||
*/
|
||||
public interface IPrintSchemaService extends MPJBaseService<PrintSchema> {
|
||||
|
||||
boolean add(AddPrintSchemaDto dto);
|
||||
|
||||
boolean updateSchema(UpdatePrintSchemaDto dto);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user