初始化提交
This commit is contained in:
159
cooperop-app-base/pom.xml
Normal file
159
cooperop-app-base/pom.xml
Normal file
@ -0,0 +1,159 @@
|
||||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>business.chaoran</groupId>
|
||||
<artifactId>cooperop-app</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>business.chaoran</groupId>
|
||||
<artifactId>cooperop-app-base</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>cooperop-app-base</name>
|
||||
<description>Demo project for Spring Boot</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!--app-common-->
|
||||
<dependency>
|
||||
<groupId>business.chaoran</groupId>
|
||||
<artifactId>cooperop-app-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>business.chaoran</groupId>
|
||||
<artifactId>web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--base-message-->
|
||||
<dependency>
|
||||
<groupId>business.chaoran</groupId>
|
||||
<artifactId>cooperop-base-message</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--spring-boot-starter-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--spring-boot-starter-web-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--nacos-discovery-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--nacos-config-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--rabbitmq-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--lombok-->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--mysql-connector-->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- mybatis-plus -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--druid-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- fastjson -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--swagger-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--test-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.junit.vintage</groupId>
|
||||
<artifactId>junit-vintage-engine</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.mybatis.generator</groupId>
|
||||
<artifactId>mybatis-generator-maven-plugin</artifactId>
|
||||
<version>1.3.2</version>
|
||||
<configuration>
|
||||
<configurationFile>src/main/resources/mybatis-generator/generatorConfig.xml</configurationFile>
|
||||
<verbose>true</verbose>
|
||||
<overwrite>true</overwrite>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>Generate MyBatis Artifacts</id>
|
||||
<phase>deploy</phase>
|
||||
<goals>
|
||||
<goal>generate</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.mybatis.generator</groupId>
|
||||
<artifactId>mybatis-generator-core</artifactId>
|
||||
<version>1.3.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.20</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>cooperop-app-base-${project.version}</finalName>
|
||||
</build>
|
||||
</project>
|
||||
@ -0,0 +1,19 @@
|
||||
package business.cooperop.base;
|
||||
|
||||
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 springfox.documentation.oas.annotations.EnableOpenApi;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableOpenApi
|
||||
@EnableDiscoveryClient
|
||||
@MapperScan("business.cooperop.base.mapper")
|
||||
public class CooperopAppBaseApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CooperopAppBaseApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
package business.cooperop.base.config;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.Binding;
|
||||
import org.springframework.amqp.core.BindingBuilder;
|
||||
import org.springframework.amqp.core.Queue;
|
||||
import org.springframework.amqp.core.TopicExchange;
|
||||
import org.springframework.amqp.support.converter.ContentTypeDelegatingMessageConverter;
|
||||
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
|
||||
import org.springframework.amqp.support.converter.MessageConverter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 消息设置
|
||||
* 监听 company_application_popedom表的操作
|
||||
*/
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class BusConfig {
|
||||
|
||||
public static final String QUEUE_NAME = "event-organization";
|
||||
public static final String EXCHANGE_NAME = "spring-boot-exchange";
|
||||
public static final String ROUTING_KEY = "organization-popedom";
|
||||
|
||||
/**
|
||||
* 设置消息队列
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
Queue queue() {
|
||||
log.info("queue name:{}", QUEUE_NAME);
|
||||
return new Queue(QUEUE_NAME, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置主题交换机
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
TopicExchange exchange() {
|
||||
log.info("exchange:{}", EXCHANGE_NAME);
|
||||
return new TopicExchange(EXCHANGE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定队列到主题交换机,并设置关联键
|
||||
*
|
||||
* @param queue
|
||||
* @param exchange
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
Binding binding(Queue queue, TopicExchange exchange) {
|
||||
log.info("binding {} to {} with {}", queue, exchange, ROUTING_KEY);
|
||||
return BindingBuilder.bind(queue).to(exchange).with(ROUTING_KEY);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置消息体用jackson序列化
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public MessageConverter messageConverter() {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
|
||||
return new ContentTypeDelegatingMessageConverter(new Jackson2JsonMessageConverter(objectMapper));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package business.cooperop.base.config;
|
||||
|
||||
import business.cooperop.base.message.InternalMessage;
|
||||
import business.cooperop.base.message.InternalMessageImpl;
|
||||
import business.cooperop.base.message.email.service.EmailService;
|
||||
import business.cooperop.base.message.email.service.impl.EmailServiceImpl;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 天下风云出我辈, 一入代码岁月催
|
||||
*
|
||||
* @Author: deadline
|
||||
* @Date: 2020-12-22 16:13
|
||||
*/
|
||||
@Configuration
|
||||
public class EmailConfig {
|
||||
|
||||
@Bean
|
||||
public EmailService emailService() {
|
||||
return new EmailServiceImpl();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public InternalMessage internalMessage(){
|
||||
return new InternalMessageImpl();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package business.cooperop.base.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
|
||||
|
||||
/**
|
||||
* 全局跨域配置
|
||||
* @Author: deadline
|
||||
* @Date: 2020-12-30 11:01
|
||||
*/
|
||||
@Configuration
|
||||
public class GlobalCorsConfig {
|
||||
|
||||
/**
|
||||
* 允许跨域调用的过滤器
|
||||
*/
|
||||
@Bean
|
||||
public CorsFilter corsFilter() {
|
||||
CorsConfiguration config = new CorsConfiguration();
|
||||
//允许所有域名进行跨域调用
|
||||
config.addAllowedOrigin("*");
|
||||
//允许跨越发送cookie
|
||||
config.setAllowCredentials(true);
|
||||
//放行全部原始头信息
|
||||
config.addAllowedHeader("*");
|
||||
//允许所有请求方法跨域调用
|
||||
config.addAllowedMethod("*");
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
source.registerCorsConfiguration("/**", config);
|
||||
return new CorsFilter(source);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package business.cooperop.base.config;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
/**
|
||||
* mybatis配置类, 指定扫描位置, 并开启事务
|
||||
*
|
||||
* @Author: deadline
|
||||
* @Date: 2020-12-29 14:09
|
||||
*/
|
||||
@Configuration
|
||||
public class MybatisConfig {
|
||||
|
||||
// mybatis分页插件
|
||||
@Bean
|
||||
public PaginationInterceptor paginationInterceptor() {
|
||||
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
|
||||
//你的最大单页限制数量,默认 500 条,小于 0 如 -1 不受限制
|
||||
paginationInterceptor.setLimit(10); //设置每次查询10条数据
|
||||
return paginationInterceptor;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
package business.cooperop.base.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.service.Contact;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
|
||||
/**
|
||||
* swagger配置类
|
||||
* @Author: deadline
|
||||
* @Date: 2021-01-04 20:55
|
||||
*/
|
||||
@Configuration
|
||||
public class SwaggerConfig {
|
||||
Boolean swaggerEnabled = true;
|
||||
|
||||
@Bean
|
||||
public Docket createRestApi() {
|
||||
return new Docket(DocumentationType.OAS_30).apiInfo(apiInfo())
|
||||
// 是否开启
|
||||
.enable(swaggerEnabled).select()
|
||||
// 扫描的路径包
|
||||
.apis(RequestHandlerSelectors.basePackage("business.cooperop.base"))
|
||||
// 指定路径处理PathSelectors.any()代表所有的路径
|
||||
.paths(PathSelectors.any()).build().pathMapping("/");
|
||||
}
|
||||
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.title("连锁ERP管理端API")
|
||||
.description("springboot | swagger")
|
||||
// 作者信息
|
||||
.contact(new Contact("成都超然祥润科技有电公司", "chaoran.crtech.cn:8848/nacos", "crtech.163.com"))
|
||||
.version("1.0.0")
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,145 @@
|
||||
package business.cooperop.base.controller;
|
||||
|
||||
import business.cooperop.base.dto.AuthNodeDto;
|
||||
import business.cooperop.base.entity.ApplicationGrade;
|
||||
import business.cooperop.base.entity.ApplicationPopedom;
|
||||
import business.cooperop.base.entity.base.ResultPage;
|
||||
import business.cooperop.base.service.IProductService;
|
||||
import business.cooperop.base.vo.PopedomVo;
|
||||
import business.cooperop.common.constant.ResultCode;
|
||||
import business.cooperop.common.result.Result;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: deadline
|
||||
* @Date: 2020-12-29 12:01
|
||||
*/
|
||||
@Api(tags = {"应用管理API"})
|
||||
@RestController
|
||||
@RequestMapping("/app_manager")
|
||||
public class ApplicationController {
|
||||
|
||||
@Autowired
|
||||
IProductService applicationService;
|
||||
|
||||
@ApiOperation("获取权限树")
|
||||
@PostMapping("/getTree")
|
||||
public Result getTree() {
|
||||
List<AuthNodeDto> result = applicationService.getTree();
|
||||
return Result.success(result);
|
||||
}
|
||||
|
||||
@ApiOperation("添加应用或节点, 若添加应用会同时添加该应用的根节点")
|
||||
@PostMapping("/addAppChildren")
|
||||
public Result addAppChildren(@RequestBody PopedomVo popedomVo) {
|
||||
boolean isSuccess = applicationService.addAppChildren(popedomVo);
|
||||
if (isSuccess) {
|
||||
return Result.success();
|
||||
}
|
||||
return Result.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("更新应用信息或子节点信息")
|
||||
@PostMapping("/updateAppChildren")
|
||||
public Result updateAppChildren(@RequestBody PopedomVo popedomVo) {
|
||||
boolean isSuccess = applicationService.updateAppChildren(popedomVo);
|
||||
if (isSuccess) {
|
||||
return Result.success();
|
||||
}
|
||||
return Result.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("删除应用, 会删除该应用所有子节点")
|
||||
@PostMapping("/delApplication")
|
||||
public Result delApplication(@RequestParam("applicationCode") String applicationCode) {
|
||||
boolean isSuccess = applicationService.delApplication(applicationCode);
|
||||
if (isSuccess) {
|
||||
return Result.success();
|
||||
}
|
||||
return Result.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("根据传入节点id, 查询应用或权限节点信息")
|
||||
@PostMapping("/getAppChildrenInfo")
|
||||
public Result getAppChildrenInfo(@RequestParam("popedomId") String popedomId) {
|
||||
ApplicationPopedom popedom = applicationService.getAppChildrenInfo(popedomId);
|
||||
return Result.success(popedom);
|
||||
}
|
||||
|
||||
@ApiOperation("删除应用子节点")
|
||||
@PostMapping("/delAppChildren")
|
||||
public Result delAppChildren(@RequestParam("id") String id) {
|
||||
boolean isSuccess = applicationService.delAppChildren(null, id);
|
||||
if (isSuccess) {
|
||||
return Result.success();
|
||||
}
|
||||
return Result.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("添加应用权限节点时, 获取下一个节点的id")
|
||||
@PostMapping("/getNextNodeId")
|
||||
public Result getNextNodeId(@RequestParam(name = "parentId", defaultValue = "") String parentId) {
|
||||
AuthNodeDto nextNode = applicationService.getNextNodeId(parentId);
|
||||
if (nextNode == null) {
|
||||
return Result.failed();
|
||||
}
|
||||
return Result.success(nextNode);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("添加应用等级")
|
||||
@PostMapping("/addAppGrade")
|
||||
public Result addAppGrade(@RequestBody ApplicationGrade applicationGrade) {
|
||||
int i = applicationService.addAppGrade(applicationGrade);
|
||||
if (i > 0) {
|
||||
return Result.success();
|
||||
}
|
||||
return Result.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("根据应用code查询应用所有等级")
|
||||
@GetMapping("/appGradeList")
|
||||
public Result appGradeList(@RequestParam("applicationCode") String applicationCode,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "25") int pageSize) {
|
||||
IPage<ApplicationGrade> pageInfo = applicationService.appGradeList(applicationCode, pageNum, pageSize);
|
||||
if (pageInfo != null) {
|
||||
return new ResultPage(ResultCode.SUCCESS, pageInfo, pageInfo.getRecords());
|
||||
}
|
||||
return Result.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("根据传入参数获取单个应用等级信息")
|
||||
@GetMapping("/getAppGrade")
|
||||
public Result getAppGrade(@RequestParam("applicationCode") String applicationCode,
|
||||
@RequestParam("grade") int grade) {
|
||||
ApplicationGrade appGrade = applicationService.getAppGrade(applicationCode, grade);
|
||||
if (appGrade != null) {
|
||||
return Result.success(appGrade);
|
||||
}
|
||||
return Result.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("更新应用等级信息")
|
||||
@PutMapping("/updateAppGrade")
|
||||
public Result updateAppGrade(@RequestBody ApplicationGrade applicationGrade) {
|
||||
int i = applicationService.updateAppGrade(applicationGrade);
|
||||
if (i > 0) {
|
||||
return Result.success();
|
||||
}
|
||||
return Result.failed();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package business.cooperop.base.controller;
|
||||
|
||||
/*
|
||||
**********************************************
|
||||
* DATE PERSON REASON
|
||||
* 2021-01-13 FXY Created
|
||||
**********************************************
|
||||
*/
|
||||
|
||||
import business.cooperop.base.entity.Company;
|
||||
import business.cooperop.base.service.ICompanyService;
|
||||
import business.cooperop.common.result.Result;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/company")
|
||||
public class CompanyController{
|
||||
|
||||
@Autowired
|
||||
ICompanyService iCompanyService;
|
||||
|
||||
@GetMapping("/getCompanyList")
|
||||
public Result getCompanyList(){
|
||||
return Result.success(iCompanyService.getAllCompany());
|
||||
}
|
||||
|
||||
@GetMapping("/getCompanyInfo")
|
||||
public Result getCompanyInfo(@RequestParam("companyId")String companyId){
|
||||
return Result.success(iCompanyService.getCompany(companyId));
|
||||
}
|
||||
|
||||
@GetMapping("/saveCompany")
|
||||
public Result insertCompany(@RequestBody Company company){
|
||||
Optional.ofNullable(company).orElseThrow()
|
||||
return Result.success(iCompanyService.saveCompany(company));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package business.cooperop.base.controller;
|
||||
|
||||
/*
|
||||
**********************************************
|
||||
* DATE PERSON REASON
|
||||
* 2021-01-12 FXY Created
|
||||
**********************************************
|
||||
*/
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Optional;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public abstract class PageRequest {
|
||||
|
||||
private Integer page = null;
|
||||
|
||||
private Integer size = null;
|
||||
|
||||
private static final String PAGE = "page";
|
||||
|
||||
private static final String SIZE = "size";
|
||||
|
||||
//计算分页参数和数据库类型
|
||||
protected void calcRequestParams(HttpServletRequest request) {
|
||||
this.page = Integer.parseInt(Optional.ofNullable(request.getParameter(PAGE)).orElseGet(() -> "1"));
|
||||
this.size = Integer.parseInt(Optional.ofNullable(request.getParameter(SIZE)).orElseGet(() -> "10"));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package business.cooperop.base.controller;
|
||||
|
||||
import business.cooperop.base.entity.User;
|
||||
import business.cooperop.base.service.IUserService;
|
||||
import business.cooperop.common.constant.ResultCode;
|
||||
import business.cooperop.common.exception.DefaultException;
|
||||
import business.cooperop.common.result.Result;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @Author: deadline
|
||||
* @Date: 2021-01-05 10:12
|
||||
*/
|
||||
@Api(tags = {"用户管理"})
|
||||
@RestController
|
||||
@RequestMapping("/user_manager")
|
||||
public class UserController {
|
||||
|
||||
@Autowired
|
||||
IUserService userService;
|
||||
|
||||
@ApiOperation("获取用户信息")
|
||||
@PostMapping("/getUserInfo")
|
||||
public Result getUserInfo(@RequestParam(name = "userId") String userId) {
|
||||
User user = userService.getUserInfo(userId);
|
||||
if (user == null) {
|
||||
return Result.failed("用户不存在");
|
||||
}
|
||||
return Result.success(user);
|
||||
}
|
||||
|
||||
@ApiOperation("根据账号获取用户信息")
|
||||
@GetMapping("/getUser")
|
||||
public Result getUser(@RequestParam(name = "username") String username) {
|
||||
Optional.ofNullable(username).orElseThrow(() -> DefaultException.simple(ResultCode.PARAM_IS_INVALID));
|
||||
return Result.success(userService.getUserByUsername(username));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package business.cooperop.base.controller.advice;
|
||||
|
||||
import business.cooperop.common.result.Result;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
/**
|
||||
* @Author: deadline
|
||||
* @Date: 2021-01-04 15:39
|
||||
*/
|
||||
@Slf4j
|
||||
@RestControllerAdvice
|
||||
public class AdviceController {
|
||||
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
@ExceptionHandler(Exception.class)
|
||||
public Result exceptionHandler(Exception exception) {
|
||||
log.error("发生异常: {}", exception);
|
||||
return Result.failed(exception.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package business.cooperop.base.dto;
|
||||
|
||||
import business.cooperop.base.entity.ApplicationPopedom;
|
||||
import business.cooperop.common.utils.BeanUtilsV2;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 权限节点, 用于构建前端展示应用权限树
|
||||
*
|
||||
* @Author: deadline
|
||||
* @Date: 2020-12-29 15:08
|
||||
*/
|
||||
@Data
|
||||
public class AuthNodeDto {
|
||||
|
||||
private String applicationCode;
|
||||
private String id;
|
||||
private String name;
|
||||
private String title;
|
||||
private String parentId;
|
||||
private String url;
|
||||
private String icon;
|
||||
private Integer isMenu;
|
||||
private Integer orderNo;
|
||||
private String description;
|
||||
|
||||
public AuthNodeDto(ApplicationPopedom popedom) {
|
||||
BeanUtilsV2.copyProperties(popedom, this);
|
||||
}
|
||||
|
||||
// 存放节点下的节点
|
||||
private List<AuthNodeDto> children;
|
||||
|
||||
public AuthNodeDto() {
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package business.cooperop.base.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class Application {
|
||||
|
||||
@TableId
|
||||
private String code;
|
||||
|
||||
private String name;
|
||||
|
||||
private Integer type;
|
||||
|
||||
private Date deployedTime;
|
||||
|
||||
private Integer orderNo;
|
||||
|
||||
private String description;
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package business.cooperop.base.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApplicationGrade {
|
||||
private Boolean isFree;
|
||||
|
||||
private String applicationCode;
|
||||
|
||||
private Integer grade;
|
||||
|
||||
private String description;
|
||||
|
||||
private String name;
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package business.cooperop.base.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApplicationGradePopedom {
|
||||
private String applicationCode;
|
||||
|
||||
private Short grade;
|
||||
|
||||
private String popedomId;
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package business.cooperop.base.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApplicationPopedom {
|
||||
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
private String applicationCode;
|
||||
|
||||
private String name;
|
||||
|
||||
private String parentId;
|
||||
|
||||
private String url;
|
||||
|
||||
private String icon;
|
||||
|
||||
private Integer isMenu;
|
||||
|
||||
private Integer orderNo;
|
||||
|
||||
private String path;
|
||||
|
||||
private String redirect;
|
||||
|
||||
private String component;
|
||||
|
||||
private String title;
|
||||
|
||||
private Boolean alwaysShow;
|
||||
|
||||
private Boolean hidden;
|
||||
|
||||
private String description;
|
||||
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
package business.cooperop.base.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class Company {
|
||||
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String registerId;
|
||||
|
||||
private String ownerId;
|
||||
|
||||
private Date registryTime;
|
||||
|
||||
private String businessLicense;
|
||||
|
||||
private String lastModifier;
|
||||
|
||||
private Date lastModifyTime;
|
||||
|
||||
private String province;
|
||||
|
||||
private String city;
|
||||
|
||||
private String county;
|
||||
|
||||
private String street;
|
||||
|
||||
private BigDecimal longitude;
|
||||
|
||||
private BigDecimal latitude;
|
||||
|
||||
private Byte state;
|
||||
|
||||
private String grade;
|
||||
|
||||
private String contacter;
|
||||
|
||||
private String mobile;
|
||||
|
||||
private String tel;
|
||||
|
||||
private String email;
|
||||
|
||||
private String weixin;
|
||||
|
||||
private Boolean isFranchiser;
|
||||
|
||||
private Boolean isIsv;
|
||||
|
||||
private String serviceTime;
|
||||
|
||||
private String hotlinePhone;
|
||||
|
||||
private String logo;
|
||||
|
||||
private String logoW;
|
||||
|
||||
private String icpNo;
|
||||
|
||||
private String shortName;
|
||||
|
||||
private String address;
|
||||
|
||||
private String description;
|
||||
|
||||
private String photo;
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package business.cooperop.base.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class CompanyApplicationLicense{
|
||||
private String franchiserId;
|
||||
|
||||
private Date expireDate;
|
||||
|
||||
private Boolean isForever;
|
||||
|
||||
private String state;
|
||||
|
||||
private String companyId;
|
||||
|
||||
private String applicationCode;
|
||||
|
||||
private Integer grade;
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package business.cooperop.base.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CompanyApplicationPopedom {
|
||||
private String applicationCode;
|
||||
|
||||
private String companyId;
|
||||
|
||||
private String popedomId;
|
||||
|
||||
public CompanyApplicationPopedom(ApplicationPopedom applicationPopedom) {
|
||||
this.applicationCode=applicationPopedom.getApplicationCode();
|
||||
this.popedomId=applicationPopedom.getId();
|
||||
}
|
||||
|
||||
public CompanyApplicationPopedom() {
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package business.cooperop.base.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CompanyRole {
|
||||
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
private String companyId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String remark;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package business.cooperop.base.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CompanyRolePopedom {
|
||||
private String companyId;
|
||||
|
||||
private String roleId;
|
||||
|
||||
private String applicationCode;
|
||||
|
||||
private String popedomId;
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package business.cooperop.base.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CompanyRoleUser{
|
||||
private Boolean isDefault;
|
||||
private String roleId;
|
||||
private String userId;
|
||||
private String companyId;
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package business.cooperop.base.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CompanyUser {
|
||||
private String companyId;
|
||||
|
||||
private String userId;
|
||||
|
||||
private String organizationId;
|
||||
|
||||
private String empNo;
|
||||
|
||||
private String position;
|
||||
|
||||
private Boolean isDefault;
|
||||
|
||||
private Boolean state;
|
||||
|
||||
private String mobile;
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package business.cooperop.base.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class User {
|
||||
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String mobile;
|
||||
|
||||
private String email;
|
||||
|
||||
private String nickName;
|
||||
|
||||
private String photo;
|
||||
|
||||
@JsonIgnore
|
||||
private String lastModifier;
|
||||
|
||||
@JsonIgnore
|
||||
private Date lastModifyTime;
|
||||
|
||||
@JsonIgnore
|
||||
private Byte state;
|
||||
|
||||
@JsonIgnore
|
||||
private String identity;
|
||||
|
||||
private String avatar;
|
||||
|
||||
private String signature;
|
||||
|
||||
@JsonIgnore
|
||||
private String password;
|
||||
|
||||
private String username;
|
||||
|
||||
private Date registryTime;
|
||||
|
||||
private String introduce;
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
package business.cooperop.base.entity.base;
|
||||
|
||||
/*
|
||||
**********************************************
|
||||
* DATE PERSON REASON
|
||||
* 2021-01-12 FXY Created
|
||||
**********************************************
|
||||
*/
|
||||
|
||||
|
||||
import business.cooperop.common.constant.ResultCode;
|
||||
import business.cooperop.common.result.Result;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class ResultPage extends Result {
|
||||
|
||||
//总的数据条数
|
||||
private long totalElements;
|
||||
|
||||
//总页数
|
||||
private long totalPages;
|
||||
|
||||
//当前页数
|
||||
private long number;
|
||||
|
||||
//每页大小
|
||||
private long size;
|
||||
|
||||
//当前页查询出的数据条数
|
||||
private long numberOfElements;
|
||||
|
||||
//是否是第一页数据
|
||||
private boolean first;
|
||||
|
||||
//是否是最后一页数据
|
||||
private boolean last;
|
||||
|
||||
//是否有上一页数据
|
||||
private boolean previous;
|
||||
|
||||
//是否有下一页数据
|
||||
private boolean next;
|
||||
|
||||
|
||||
public ResultPage(IPage iPage) {
|
||||
this.first = iPage.getCurrent() == 1;
|
||||
this.number = iPage.getCurrent();
|
||||
this.totalElements = iPage.getTotal();
|
||||
//每页条数*当前页==总条数,则表示是最后一页
|
||||
this.last = iPage.getCurrent() == iPage.getPages();
|
||||
this.previous = iPage.getCurrent() != 1;
|
||||
this.next = iPage.getCurrent() != iPage.getPages();
|
||||
this.totalPages = iPage.getPages();
|
||||
this.numberOfElements = iPage.getRecords().size();
|
||||
this.size = iPage.getSize();
|
||||
}
|
||||
|
||||
public ResultPage(ResultCode resultCode, IPage iPage) {
|
||||
this(iPage);
|
||||
this.setResultCode(resultCode);
|
||||
}
|
||||
|
||||
public ResultPage(ResultCode resultCode, IPage iPage, Object data) {
|
||||
this(resultCode, iPage);
|
||||
this.setData(data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
package business.cooperop.base.events;
|
||||
|
||||
import business.cooperop.base.config.BusConfig;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.amqp.support.converter.MessageConverter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class EventSender {
|
||||
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Autowired
|
||||
private MessageConverter messageConverter;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
rabbitTemplate.setMessageConverter(messageConverter);
|
||||
}
|
||||
|
||||
public void send(String routingKey, Object object) {
|
||||
log.info("routingKey:{}=>message:{}", routingKey, object);
|
||||
rabbitTemplate.convertAndSend(BusConfig.EXCHANGE_NAME, routingKey, object);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
package business.cooperop.base.filter;
|
||||
|
||||
/*
|
||||
**********************************************
|
||||
* DATE PERSON REASON
|
||||
* 2020-12-24 FXY Created
|
||||
**********************************************
|
||||
*/
|
||||
|
||||
import com.alibaba.cloud.nacos.registry.NacosAutoServiceRegistration;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.management.MBeanServer;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.Query;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.util.Set;
|
||||
|
||||
//@Configuration
|
||||
@Slf4j
|
||||
public class NacosRegisterConfig implements ApplicationRunner {
|
||||
|
||||
@Autowired(required = false)
|
||||
private NacosAutoServiceRegistration registration;
|
||||
|
||||
private Integer port;
|
||||
|
||||
public NacosRegisterConfig() {
|
||||
try {
|
||||
this.port = Integer.parseInt(getTomcatPort());
|
||||
} catch (Exception e) {
|
||||
log.error("获取tomcat端口出错了,原因:{}", e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) {
|
||||
if (registration != null && port != null) {
|
||||
registration.setPort(port);
|
||||
registration.start();
|
||||
}
|
||||
}
|
||||
|
||||
//获取tomcat端口
|
||||
private String getTomcatPort() throws Exception {
|
||||
MBeanServer beanServer = ManagementFactory.getPlatformMBeanServer();
|
||||
Set<ObjectName> objectNames = beanServer.queryNames(new ObjectName("*:type=Connector,*"), Query.match(Query.attr("protocol"), Query.value("HTTP/1.1")));
|
||||
String port = objectNames.iterator().next().getKeyProperty("port");
|
||||
return port;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package business.cooperop.base.filter;
|
||||
|
||||
import com.springboot.cloud.common.web.interceptor.UserInterceptor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
|
||||
/**
|
||||
* 正式环境运行去掉注释
|
||||
*/
|
||||
//@Configuration
|
||||
public class WebServerMvcConfigurerAdapter implements WebMvcConfigurer {
|
||||
|
||||
// @Bean
|
||||
public HandlerInterceptor userInterceptor() {
|
||||
return new UserInterceptor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(userInterceptor());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package business.cooperop.base.mapper;
|
||||
|
||||
import business.cooperop.base.entity.ApplicationGrade;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ApplicationGradeMapper extends BaseMapper<ApplicationGrade> {
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package business.cooperop.base.mapper;
|
||||
|
||||
import business.cooperop.base.entity.ApplicationGradePopedom;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ApplicationGradePopedomMapper extends BaseMapper<ApplicationGradePopedom> {
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package business.cooperop.base.mapper;
|
||||
|
||||
import business.cooperop.base.entity.Application;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ApplicationMapper extends BaseMapper<Application> {
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package business.cooperop.base.mapper;
|
||||
|
||||
import business.cooperop.base.entity.ApplicationPopedom;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ApplicationPopedomMapper extends BaseMapper<ApplicationPopedom> {
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package business.cooperop.base.mapper;
|
||||
|
||||
import business.cooperop.base.entity.CompanyApplicationLicense;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface CompanyApplicationLicenseMapper extends BaseMapper<CompanyApplicationLicense> {
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package business.cooperop.base.mapper;
|
||||
|
||||
import business.cooperop.base.entity.CompanyApplicationPopedom;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
public interface CompanyApplicationPopedomMapper extends BaseMapper<CompanyApplicationPopedom> {
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package business.cooperop.base.mapper;
|
||||
|
||||
import business.cooperop.base.entity.Company;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface CompanyMapper extends BaseMapper<Company> {
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package business.cooperop.base.mapper;
|
||||
|
||||
import business.cooperop.base.entity.CompanyRole;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface CompanyRoleMapper extends BaseMapper<CompanyRole> {
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package business.cooperop.base.mapper;
|
||||
|
||||
import business.cooperop.base.entity.CompanyRolePopedom;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface CompanyRolePopedomMapper extends BaseMapper<CompanyRolePopedom> {
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package business.cooperop.base.mapper;
|
||||
|
||||
import business.cooperop.base.entity.CompanyRole;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface CompanyRoleUserMapper extends BaseMapper<CompanyRole> {
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package business.cooperop.base.mapper;
|
||||
|
||||
import business.cooperop.base.entity.CompanyUser;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface CompanyUserMapper extends BaseMapper<CompanyUser> {
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package business.cooperop.base.mapper;
|
||||
|
||||
import business.cooperop.base.entity.User;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface UserMapper extends BaseMapper<User> {
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package business.cooperop.base.message;
|
||||
|
||||
//import business.cooperop.base.entity.Message;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 内部消息接口
|
||||
* @author inaisen
|
||||
*/
|
||||
public interface InternalMessage {
|
||||
|
||||
/**
|
||||
* 设置内部消息接口
|
||||
*/
|
||||
// void settingInternalMessage(Message message);
|
||||
/**
|
||||
* 查询内部消息接口
|
||||
*/
|
||||
void queryInternalMessage();
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package business.cooperop.base.message;
|
||||
|
||||
/*import business.cooperop.base.entity.Message;
|
||||
import business.cooperop.base.mapper.InrernalMessageMapper;*/
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* 内部消息接口实现
|
||||
* @author inaisen
|
||||
*/
|
||||
public class InternalMessageImpl implements InternalMessage {
|
||||
|
||||
@Autowired
|
||||
// private InrernalMessageMapper inrernalMessageMapper;
|
||||
|
||||
/**
|
||||
* 设置内部消息
|
||||
*/
|
||||
/*@Override
|
||||
public void settingInternalMessage(Message message) {
|
||||
inrernalMessageMapper.settingInternalMessage(message);
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 查询内部消息
|
||||
*/
|
||||
@Override
|
||||
public void queryInternalMessage() {
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package business.cooperop.base.service;
|
||||
|
||||
/*
|
||||
**********************************************
|
||||
* DATE PERSON REASON
|
||||
* 2021-01-13 FXY Created
|
||||
**********************************************
|
||||
*/
|
||||
|
||||
|
||||
import business.cooperop.base.entity.Company;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ICompanyService {
|
||||
|
||||
/**
|
||||
* 获取所有公司列表
|
||||
* @return
|
||||
*/
|
||||
List<Company> getAllCompany();
|
||||
|
||||
/**
|
||||
* 获取指定公司信息
|
||||
* @param companyId
|
||||
* @return
|
||||
*/
|
||||
Company getCompany(String companyId);
|
||||
|
||||
/**
|
||||
* 保存公司信息
|
||||
* @param company
|
||||
* @return
|
||||
*/
|
||||
boolean saveCompany(Company company);
|
||||
|
||||
|
||||
/**
|
||||
* 保存公司许可证
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
boolean addCompanyLicense(Map<String, Object> params);
|
||||
|
||||
}
|
||||
@ -0,0 +1,109 @@
|
||||
package business.cooperop.base.service;
|
||||
|
||||
import business.cooperop.base.dto.AuthNodeDto;
|
||||
import business.cooperop.base.entity.ApplicationGrade;
|
||||
import business.cooperop.base.entity.ApplicationPopedom;
|
||||
import business.cooperop.base.vo.PopedomVo;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 应用管理service
|
||||
*
|
||||
* @Author: deadline
|
||||
* @Date: 2020-12-29 12:02
|
||||
*/
|
||||
public interface IProductService {
|
||||
|
||||
/**
|
||||
* 获取应用权限树
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<AuthNodeDto> getTree();
|
||||
|
||||
/**
|
||||
* 新增应用或应用子权限节点
|
||||
*
|
||||
* @param popedomVo
|
||||
* @return
|
||||
*/
|
||||
boolean addAppChildren(PopedomVo popedomVo);
|
||||
|
||||
/**
|
||||
* 更新应用或子节点信息
|
||||
*
|
||||
* @param popedomVo
|
||||
* @return
|
||||
*/
|
||||
boolean updateAppChildren(PopedomVo popedomVo);
|
||||
|
||||
/**
|
||||
* 删除应用, 会同时删除所有子节点
|
||||
*
|
||||
* @param applicationCode
|
||||
* @return
|
||||
*/
|
||||
boolean delApplication(String applicationCode);
|
||||
|
||||
/**
|
||||
* 查询应用权限信息
|
||||
*
|
||||
* @param popedomId
|
||||
* @return
|
||||
*/
|
||||
ApplicationPopedom getAppChildrenInfo(String popedomId);
|
||||
|
||||
/**
|
||||
* 删除应用下的子权限
|
||||
*
|
||||
* @param applicationCode
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
boolean delAppChildren(String applicationCode, String id);
|
||||
|
||||
/**
|
||||
* 根据传入父id, 获取下一个子节点id
|
||||
*
|
||||
* @param parentId
|
||||
* @return
|
||||
*/
|
||||
AuthNodeDto getNextNodeId(String parentId);
|
||||
|
||||
|
||||
/**
|
||||
* 添加应用等级
|
||||
*
|
||||
* @param applicationGrade
|
||||
* @return
|
||||
*/
|
||||
int addAppGrade(ApplicationGrade applicationGrade);
|
||||
|
||||
/**
|
||||
* 根据应用code查询应用所有等级
|
||||
*
|
||||
* @param applicationCode
|
||||
* @return
|
||||
*/
|
||||
IPage<ApplicationGrade> appGradeList(String applicationCode, int pageNum, int pageSize);
|
||||
|
||||
/**
|
||||
* 根据传入参数获取单个应用等级信息
|
||||
*
|
||||
* @param applicationCode
|
||||
* @param grade
|
||||
* @return
|
||||
*/
|
||||
ApplicationGrade getAppGrade(String applicationCode, int grade);
|
||||
|
||||
/**
|
||||
* 更新应用等级信息
|
||||
*
|
||||
* @param applicationGrade
|
||||
* @return
|
||||
*/
|
||||
int updateAppGrade(ApplicationGrade applicationGrade);
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package business.cooperop.base.service;
|
||||
|
||||
|
||||
import business.cooperop.base.entity.User;
|
||||
|
||||
/**
|
||||
* 用户管理service
|
||||
* @Author: deadline
|
||||
* @Date: 2021-01-05 10:14
|
||||
*/
|
||||
public interface IUserService {
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
User getUserInfo(String userId);
|
||||
|
||||
/**
|
||||
* 根据账号获取用户信息
|
||||
* @param username
|
||||
* @return
|
||||
*/
|
||||
User getUserByUsername(String username);
|
||||
|
||||
}
|
||||
@ -0,0 +1,102 @@
|
||||
package business.cooperop.base.service.impl;
|
||||
|
||||
/*
|
||||
**********************************************
|
||||
* DATE PERSON REASON
|
||||
* 2021-01-13 FXY Created
|
||||
**********************************************
|
||||
*/
|
||||
|
||||
import business.cooperop.base.config.BusConfig;
|
||||
import business.cooperop.base.entity.*;
|
||||
import business.cooperop.base.events.EventSender;
|
||||
import business.cooperop.base.mapper.*;
|
||||
import business.cooperop.base.service.ICompanyService;
|
||||
import business.cooperop.common.constant.ResultCode;
|
||||
import business.cooperop.common.exception.DefaultException;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> implements ICompanyService {
|
||||
|
||||
@Autowired
|
||||
CompanyApplicationPopedomMapper companyApplicationPopedomMapper;
|
||||
|
||||
@Autowired
|
||||
ApplicationPopedomMapper applicationPopedomMapper;
|
||||
|
||||
@Autowired
|
||||
ApplicationGradePopedomMapper applicationGradePopedomMapper;
|
||||
|
||||
@Autowired
|
||||
CompanyApplicationLicenseMapper companyApplicationLicenseMapper;
|
||||
|
||||
@Autowired
|
||||
EventSender eventSender;
|
||||
|
||||
@Override
|
||||
public List<Company> getAllCompany() {
|
||||
return list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Company getCompany(String companyId) {
|
||||
QueryWrapper<Company> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("id", companyId);
|
||||
return getOne(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean saveCompany(Company company) {
|
||||
return saveOrUpdate(company);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean addCompanyLicense(Map<String, Object> params) {
|
||||
Optional.ofNullable(params).orElseThrow(() -> DefaultException.simple(ResultCode.PARAM_NOT_COMPLETE));
|
||||
String companyId = (String) Optional.ofNullable(params.get("companyId")).orElseGet(String::new);
|
||||
String applicationCode = (String) Optional.ofNullable(params.get("applicationCode")).orElseGet(String::new);
|
||||
Integer grade = (Integer) Optional.ofNullable(params.get("grade")).orElseGet(() -> -Integer.MAX_VALUE);
|
||||
Date expireDate = (Date) Optional.ofNullable(params.get("expireDate")).orElseGet(Date::new);
|
||||
List<String> selectedPopedomIds = (List<String>) Optional.ofNullable(params.get("selectedPopedomId")).orElseGet(ArrayList<String>::new);
|
||||
|
||||
//添加许可证信息
|
||||
CompanyApplicationLicense companyApplicationLicense = new CompanyApplicationLicense();
|
||||
companyApplicationLicense.setApplicationCode(applicationCode);
|
||||
companyApplicationLicense.setCompanyId(companyId);
|
||||
companyApplicationLicense.setExpireDate(expireDate);
|
||||
companyApplicationLicense.setIsForever(false);
|
||||
companyApplicationLicense.setState("1");
|
||||
companyApplicationLicense.setGrade(grade);
|
||||
companyApplicationLicenseMapper.insert(companyApplicationLicense);
|
||||
|
||||
//-1表示自定义功能
|
||||
if (grade == -1) {
|
||||
List<ApplicationPopedom> applicationPopedoms = applicationPopedomMapper.selectBatchIds(selectedPopedomIds);
|
||||
List<CompanyApplicationPopedom> companyApplicationPopedoms = applicationPopedoms.stream().map(a -> new CompanyApplicationPopedom(a)).collect(Collectors.toList());
|
||||
companyApplicationPopedoms.stream().forEach(a -> companyApplicationPopedomMapper.insert(a));
|
||||
eventSender.send(BusConfig.ROUTING_KEY,companyApplicationPopedoms);
|
||||
} else {
|
||||
QueryWrapper<ApplicationGradePopedom> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("grade", grade).eq("application_code", applicationCode);
|
||||
List<ApplicationGradePopedom> applicationGradePopedoms = applicationGradePopedomMapper.selectList(wrapper);
|
||||
List<ApplicationPopedom> applicationPopedoms = applicationPopedomMapper.selectBatchIds(applicationGradePopedoms.stream().map(a -> a.getPopedomId()).collect(Collectors.toList()));
|
||||
List<CompanyApplicationPopedom> companyApplicationPopedoms = applicationPopedoms.stream().map(a -> new CompanyApplicationPopedom(a)).collect(Collectors.toList());
|
||||
companyApplicationPopedoms.stream().forEach(a -> companyApplicationPopedomMapper.insert(a));
|
||||
//发送消息
|
||||
eventSender.send(BusConfig.ROUTING_KEY,companyApplicationPopedoms);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,296 @@
|
||||
package business.cooperop.base.service.impl;
|
||||
|
||||
import business.cooperop.base.dto.AuthNodeDto;
|
||||
import business.cooperop.base.entity.Application;
|
||||
import business.cooperop.base.entity.ApplicationGrade;
|
||||
import business.cooperop.base.entity.ApplicationPopedom;
|
||||
import business.cooperop.base.mapper.ApplicationGradeMapper;
|
||||
import business.cooperop.base.mapper.ApplicationMapper;
|
||||
import business.cooperop.base.mapper.ApplicationPopedomMapper;
|
||||
import business.cooperop.base.service.IProductService;
|
||||
import business.cooperop.base.vo.PopedomVo;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: deadline
|
||||
* @Date: 2020-12-29 14:08
|
||||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
public class ProductServiceImpl extends ServiceImpl<ApplicationPopedomMapper, ApplicationPopedom> implements IProductService {
|
||||
|
||||
|
||||
@Autowired
|
||||
ApplicationMapper applicationMapper;
|
||||
|
||||
@Autowired
|
||||
ApplicationGradeMapper applicationGradeMapper;
|
||||
|
||||
/**
|
||||
* 获取应用权限树
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<AuthNodeDto> getTree() {
|
||||
// 取得所有权限列表
|
||||
List<AuthNodeDto> nodeAll = list().stream().map(a -> new AuthNodeDto(a)).collect(Collectors.toList());
|
||||
|
||||
// 存放去除顶级节点之后的所有节点
|
||||
List<AuthNodeDto> newNodesAll = new ArrayList<>();
|
||||
|
||||
// 找出所有父节点
|
||||
List<AuthNodeDto> topNodes = new ArrayList<>();
|
||||
nodeAll.stream().forEach(node -> {
|
||||
if (StringUtils.isEmpty(node.getParentId())) {
|
||||
topNodes.add(node);
|
||||
} else {
|
||||
newNodesAll.add(node);
|
||||
}
|
||||
});
|
||||
|
||||
// 循环递归找出所有子节点
|
||||
for (AuthNodeDto node : topNodes) {
|
||||
List<AuthNodeDto> child = findChildrenNode(newNodesAll, node.getId());
|
||||
node.setChildren(child);
|
||||
}
|
||||
|
||||
// 节点排序
|
||||
nodeSort(topNodes);
|
||||
return topNodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据传入参数, 找到父节点的所有子节点
|
||||
*
|
||||
* @param resource 全量节点
|
||||
* @param parent_id 父节点id
|
||||
* @return
|
||||
*/
|
||||
private List<AuthNodeDto> findChildrenNode(List<AuthNodeDto> resource, String parent_id) {
|
||||
// 子节点
|
||||
List<AuthNodeDto> childList = new ArrayList<>();
|
||||
|
||||
// 找出传入parent_id的所有子节点
|
||||
resource.stream().forEach(node -> {
|
||||
if (parent_id.equals(node.getParentId())) {
|
||||
childList.add(node);
|
||||
}
|
||||
});
|
||||
|
||||
// 没有子节点直接返回
|
||||
if (childList.isEmpty()) {
|
||||
return childList;
|
||||
}
|
||||
|
||||
// 子节点排序
|
||||
nodeSort(childList);
|
||||
|
||||
// 循环递归找出子节点中所有的子节点
|
||||
for (AuthNodeDto node : childList) {
|
||||
List<AuthNodeDto> child = findChildrenNode(resource, node.getId());
|
||||
node.setChildren(child);
|
||||
}
|
||||
return childList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 节点排序, 根据order_no
|
||||
*
|
||||
* @param nodes
|
||||
*/
|
||||
private void nodeSort(List<AuthNodeDto> nodes) {
|
||||
nodes.sort((n1, n2) -> {
|
||||
Integer orderN1 = n1.getOrderNo();
|
||||
Integer orderN2 = n2.getOrderNo();
|
||||
if (orderN1 == null || orderN2 == null) {
|
||||
return 0;
|
||||
}
|
||||
return orderN1.compareTo(orderN2);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增应用或应用子权限节点
|
||||
*
|
||||
* @param popedomVo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean addAppChildren(PopedomVo popedomVo) {
|
||||
ApplicationPopedom applicationPopedom = popedomVo.convertApplicationPopedom();
|
||||
|
||||
// 添加节点
|
||||
if (popedomVo.getType() == null) {
|
||||
return save(applicationPopedom);
|
||||
}
|
||||
|
||||
// 添加应用
|
||||
Application application = popedomVo.convertApplication();
|
||||
applicationMapper.insert(application);
|
||||
// 同时添加应用根节点
|
||||
return save(applicationPopedom);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改应用或子权限节点信息
|
||||
*
|
||||
* @param popedomVo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean updateAppChildren(PopedomVo popedomVo) {
|
||||
ApplicationPopedom applicationPopedom = popedomVo.convertApplicationPopedom();
|
||||
|
||||
// 更新节点
|
||||
if (popedomVo.getType() == null) {
|
||||
return updateById(applicationPopedom);
|
||||
}
|
||||
|
||||
// 更新应用信息
|
||||
Application application = popedomVo.convertApplication();
|
||||
applicationMapper.updateById(application);
|
||||
return updateById(applicationPopedom);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除应用, 会同时删除所有子节点
|
||||
*
|
||||
* @param applicationCode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean delApplication(String applicationCode) {
|
||||
// 删除应用
|
||||
applicationMapper.deleteById(applicationCode);
|
||||
// 删除子节点
|
||||
return delAppChildren(applicationCode, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询应用权限信息
|
||||
*
|
||||
* @param popedomId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ApplicationPopedom getAppChildrenInfo(String popedomId) {
|
||||
QueryWrapper<ApplicationPopedom> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("id", popedomId);
|
||||
return getOne(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除应用下的子权限
|
||||
*
|
||||
* @param applicationCode
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean delAppChildren(String applicationCode, String id) {
|
||||
QueryWrapper<ApplicationPopedom> wrapper = new QueryWrapper<>();
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
wrapper.eq("application_code", applicationCode);
|
||||
} else {
|
||||
wrapper.eq("application_code", applicationCode).eq("id", id);
|
||||
}
|
||||
return remove(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据传入父id, 获取下一个子节点id
|
||||
*
|
||||
* @param parentId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AuthNodeDto getNextNodeId(String parentId) {
|
||||
QueryWrapper<ApplicationPopedom> wrapper = new QueryWrapper<>();
|
||||
if (StringUtils.isEmpty(parentId)) {
|
||||
wrapper.eq("parent_id", null).or().eq("parent_id", "");
|
||||
} else {
|
||||
wrapper.eq("parent_id", parentId);
|
||||
}
|
||||
wrapper.orderByDesc("id");
|
||||
|
||||
AuthNodeDto authNodeDto = new AuthNodeDto(getOne(wrapper));
|
||||
|
||||
// 如果获取到的最大id节点为空, 说名下一个添加的节点为第一个节点
|
||||
if (authNodeDto == null || StringUtils.isEmpty(authNodeDto.getId())) {
|
||||
authNodeDto = new AuthNodeDto();
|
||||
authNodeDto.setId(parentId + "01");
|
||||
authNodeDto.setOrderNo(1);
|
||||
return authNodeDto;
|
||||
}
|
||||
Integer id = Integer.valueOf(authNodeDto.getId()) + 1;
|
||||
authNodeDto.setId("0" + id);
|
||||
return authNodeDto;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加应用等级
|
||||
*
|
||||
* @param applicationGrade
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int addAppGrade(ApplicationGrade applicationGrade) {
|
||||
return applicationGradeMapper.insert(applicationGrade);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据应用code查询应用所有等级
|
||||
*
|
||||
* @param applicationCode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage<ApplicationGrade> appGradeList(String applicationCode, int pageNum, int pageSize) {
|
||||
IPage<ApplicationGrade> page = new Page<>(pageNum, pageSize);
|
||||
QueryWrapper<ApplicationGrade> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("application_code", applicationCode);
|
||||
IPage<ApplicationGrade> pageInfo = applicationGradeMapper.selectPage(page, wrapper);
|
||||
return pageInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据传入参数获取单个应用等级信息
|
||||
*
|
||||
* @param applicationCode
|
||||
* @param grade
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ApplicationGrade getAppGrade(String applicationCode, int grade) {
|
||||
QueryWrapper<ApplicationGrade> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("application_code", applicationCode).eq("grade", grade);
|
||||
return applicationGradeMapper.selectOne(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新应用等级信息
|
||||
*
|
||||
* @param applicationGrade
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int updateAppGrade(ApplicationGrade applicationGrade) {
|
||||
QueryWrapper<ApplicationGrade> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("application_code", applicationGrade.getApplicationCode()).eq("grade", applicationGrade.getGrade());
|
||||
return applicationGradeMapper.update(applicationGrade, wrapper);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
package business.cooperop.base.service.impl;
|
||||
|
||||
import business.cooperop.base.entity.User;
|
||||
import business.cooperop.base.mapper.UserMapper;
|
||||
import business.cooperop.base.service.IUserService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 用户管理service实现类
|
||||
*
|
||||
* @Author: deadline
|
||||
* @Date: 2021-01-05 10:14
|
||||
*/
|
||||
@Service
|
||||
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public User getUserInfo(String userId) {
|
||||
QueryWrapper<User> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("id", userId);
|
||||
return getOne(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getUserByUsername(String username) {
|
||||
QueryWrapper<User> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("username", username);
|
||||
return getOne(wrapper);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package business.cooperop.base.vo;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author china
|
||||
*/
|
||||
@Data
|
||||
public class CompanyVO {
|
||||
private int limit;
|
||||
private int start;
|
||||
private String name;
|
||||
private String businessLicense;
|
||||
private String address;
|
||||
private String mobile;
|
||||
private String tel;
|
||||
private String icpNo;
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
package business.cooperop.base.vo;
|
||||
|
||||
import business.cooperop.base.entity.Application;
|
||||
import business.cooperop.base.entity.ApplicationPopedom;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 节点实体类, 用于接收传入参数
|
||||
* @Author: deadline
|
||||
* @Date: 2021-01-04 20:04
|
||||
*/
|
||||
@Data
|
||||
public class PopedomVo {
|
||||
private String applicationCode;
|
||||
private String id;
|
||||
private String name;
|
||||
private String parentId;
|
||||
private Integer type;
|
||||
private String url;
|
||||
private String icon;
|
||||
private Integer isMenu;
|
||||
private Integer orderNo;
|
||||
private String description;
|
||||
private String path;
|
||||
private String redirect;
|
||||
private String component;
|
||||
private String title;
|
||||
private Boolean alwaysShow;
|
||||
private Boolean hidden;
|
||||
|
||||
/**
|
||||
* 将popedom vo转换为application po
|
||||
* @return
|
||||
*/
|
||||
public Application convertApplication() {
|
||||
Application application = new Application();
|
||||
application.setCode(this.applicationCode);
|
||||
application.setName(this.name);
|
||||
application.setType(this.type);
|
||||
application.setDescription(this.description);
|
||||
application.setDeployedTime(new Date());
|
||||
application.setOrderNo(this.orderNo);
|
||||
return application;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将popedom vo转换为applicationPopedom po
|
||||
* @return
|
||||
*/
|
||||
public ApplicationPopedom convertApplicationPopedom() {
|
||||
ApplicationPopedom applicationPopedom = new ApplicationPopedom();
|
||||
applicationPopedom.setApplicationCode(this.applicationCode);
|
||||
applicationPopedom.setId(this.id);
|
||||
applicationPopedom.setName(this.name);
|
||||
applicationPopedom.setParentId(this.parentId);
|
||||
applicationPopedom.setUrl(this.url);
|
||||
applicationPopedom.setIcon(this.icon);
|
||||
applicationPopedom.setIsMenu(this.isMenu);
|
||||
applicationPopedom.setOrderNo(this.orderNo);
|
||||
applicationPopedom.setDescription(this.description);
|
||||
applicationPopedom.setPath(this.path);
|
||||
applicationPopedom.setRedirect(this.redirect);
|
||||
applicationPopedom.setComponent(this.component);
|
||||
applicationPopedom.setTitle(this.title);
|
||||
applicationPopedom.setAlwaysShow(this.alwaysShow);
|
||||
applicationPopedom.setHidden(this.hidden);
|
||||
return applicationPopedom;
|
||||
}
|
||||
|
||||
}
|
||||
88
cooperop-app-base/src/main/resources/application.yml
Normal file
88
cooperop-app-base/src/main/resources/application.yml
Normal file
@ -0,0 +1,88 @@
|
||||
server:
|
||||
port: 8088
|
||||
|
||||
# QQ邮箱
|
||||
spring:
|
||||
mail:
|
||||
host: smtp.qq.com #发送邮件服务器
|
||||
username: 943359729@qq.com #发送邮件的邮箱地址
|
||||
password: gemhokyelabnbfdb #客户端授权码,不是邮箱密码,这个在qq邮箱设置里面自动生成的
|
||||
properties.mail.smtp.port: 465 #端口号465或587
|
||||
from: 943359729@qq.com # 发送邮件的地址,和上面username一致
|
||||
properties.mail.smtp.starttls.enable: true
|
||||
properties.mail.smtp.starttls.required: true
|
||||
properties.mail.smtp.ssl.enable: true
|
||||
default-encoding: utf-8
|
||||
# 网易邮箱
|
||||
#spring:
|
||||
# mail:
|
||||
# host: smtp.163.com #发送邮件服务器
|
||||
# username: imayfly1997@163.com #发送邮件的邮箱地址
|
||||
# password: GLMMWPUOLRFOWYBU #客户端授权码,不是邮箱密码,网易的是自己设置的
|
||||
# properties.mail.smtp.port: 994 #465或者994
|
||||
# from: imayfly1997@163.com # 发送邮件的地址,和上面username一致
|
||||
# properties.mail.smtp.starttls.enable: true
|
||||
# properties.mail.smtp.starttls.required: true
|
||||
# properties.mail.smtp.ssl.enable: true
|
||||
# default-encoding: utf-8
|
||||
|
||||
# 连接池
|
||||
datasource:
|
||||
# 填写你数据库的url、登录名、密码和数据库名
|
||||
url: jdbc:mysql://chaoran.crtech.cn:3506/xin_cloudauth?useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=CTT&allowPublicKeyRetrieval=true
|
||||
username: root
|
||||
password: www.Crtech2018.cn
|
||||
druid:
|
||||
# 连接池的配置信息
|
||||
# 初始化大小,最小,最大
|
||||
initial-size: 5
|
||||
min-idle: 5
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
validationQuery: SELECT 1
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
# 打开PSCache,并且指定每个连接上PSCache的大小
|
||||
poolPreparedStatements: true
|
||||
maxPoolPreparedStatementPerConnectionSize: 20
|
||||
# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
|
||||
filters: stat,wall,slf4j
|
||||
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
|
||||
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
|
||||
# 配置DruidStatFilter
|
||||
web-stat-filter:
|
||||
enabled: true
|
||||
url-pattern: "/*"
|
||||
exclusions: "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*"
|
||||
# 配置DruidStatViewServlet
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
url-pattern: "/druid/*"
|
||||
# IP白名单(没有配置或者为空,则允许所有访问)
|
||||
allow: 127.0.0.1
|
||||
# IP黑名单 (存在共同时,deny优先于allow)
|
||||
deny: all
|
||||
# 禁用HTML页面上的“Reset All”功能
|
||||
reset-enable: false
|
||||
# 登录名
|
||||
login-username: crtech
|
||||
# 登录密码
|
||||
login-password: Crtech@2020
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
|
||||
# pagehelper
|
||||
#pagehelper:
|
||||
# helperDialect: mysql
|
||||
# reasonable: true
|
||||
# supportMethodsArguments: true
|
||||
# params: count=countSql
|
||||
|
||||
logging:
|
||||
level:
|
||||
bussiness.cooperop.base.mapper: debug
|
||||
10
cooperop-app-base/src/main/resources/bootstrap.yml
Normal file
10
cooperop-app-base/src/main/resources/bootstrap.yml
Normal file
@ -0,0 +1,10 @@
|
||||
spring:
|
||||
application:
|
||||
name: app-base
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: ${REGISTER_HOST:localhost}:${REGISTER_PORT:8848}
|
||||
config:
|
||||
server-addr: ${REGISTER_HOST:localhost}:${REGISTER_PORT:8848}
|
||||
file-extension: yml
|
||||
51
cooperop-app-base/src/main/resources/logback-spring.xml
Normal file
51
cooperop-app-base/src/main/resources/logback-spring.xml
Normal file
@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<contextName>logback-spring</contextName>
|
||||
<!--输出格式-->
|
||||
<property name="pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg %n"/>
|
||||
<property name="pattern-color" value="%yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) [%thread] %highlight(%-5level) %green(%logger{50}) - %highlight(%msg) %n"/>
|
||||
<!--日志文件夹及路径-->
|
||||
<property name="LOG_HOME" value="logs"/>
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>${pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 控制台输出-带颜色 -->
|
||||
<appender name="CONSOLE-WITH-COLOR" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>${pattern-color}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 文件输出 -->
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_HOME}/all.%d.%i.log</fileNamePattern>
|
||||
<!--文件最大容量-->
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>10MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
<!--文件保存时间-->
|
||||
<maxHistory>1</maxHistory>
|
||||
</rollingPolicy>
|
||||
|
||||
<encoder>
|
||||
<pattern>${pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE-WITH-COLOR"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
</root>
|
||||
|
||||
<logger name="com.example.logbackdemo.IndexAction" level="info" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
|
||||
</configuration>
|
||||
@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
|
||||
|
||||
<generatorConfiguration>
|
||||
<!--mysql 连接数据库jar 这里选择自己本地位置;
|
||||
如果不知道maven本地仓库地址,可以使用EveryThing工具全局搜索mysql-connector-java,找到jar包位置;
|
||||
也可以手动下载一个jar放在指定位置,进行引用。
|
||||
-->
|
||||
<!--
|
||||
<classPathEntry location="E:/mvnRespo/mysql/mysql-connector-java/5.1.47/mysql-connector-java-5.1.47.jar"/>
|
||||
-->
|
||||
|
||||
<context id="xin_cloudauth" targetRuntime="MyBatis3">
|
||||
|
||||
|
||||
<property name="autoDelimitKeywords" value="true"/>
|
||||
<property name="beginningDelimiter" value="`"/>
|
||||
<property name="endingDelimiter" value="`"/>
|
||||
|
||||
<commentGenerator>
|
||||
<property name="suppressDate" value="true"/>
|
||||
<property name="javaFileEncoding" value="UTF-8"/>
|
||||
<!-- 是否去除自动生成的注释,true:是,false:否 -->
|
||||
<property name="suppressAllComments" value="true"/>
|
||||
</commentGenerator>
|
||||
|
||||
<!--数据库连接的信息:驱动类、连接地址、用户名、密码 -->
|
||||
<jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
|
||||
connectionURL="jdbc:mysql://chaoran.crtech.cn:3506/xin_cloudauth?characterEncoding=utf8" userId="root"
|
||||
password="www.Crtech2018.cn">
|
||||
<!--如果链接里边的其他数据库有同名字的表名,必须加此参数-->
|
||||
<property name="nullCatalogMeansCurrent" value="true"/>
|
||||
</jdbcConnection>
|
||||
|
||||
<!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为 true时把JDBC DECIMAL 和
|
||||
NUMERIC 类型解析为java.math.BigDecimal -->
|
||||
<javaTypeResolver>
|
||||
<property name="forceBigDecimals" value="false"/>
|
||||
</javaTypeResolver>
|
||||
|
||||
<!-- 指定javaBean生成的位置
|
||||
targetPackage:生成的类要放的包,真实的包受enableSubPackages属性控制;
|
||||
targetProject:目标项目,指定一个存在的目录下,生成的内容会放到指定目录中,如果目录不存在,MBG不会自动建目录
|
||||
-->
|
||||
<javaModelGenerator targetPackage="business.cooperop.base.entity" targetProject="src/main/java">
|
||||
<!-- 在targetPackage的基础上,根据数据库的schema再生成一层package,最终生成的类放在这个package下,默认为false;如果多个数据库改为true分目录 -->
|
||||
<property name="enableSubPackages" value="false"/>
|
||||
<!-- 设置是否在getter方法中,对String类型字段调用trim()方法 -->
|
||||
<property name="trimStrings" value="true"/>
|
||||
</javaModelGenerator>
|
||||
|
||||
<!-- 指定mapper映射文件生成的位置
|
||||
targetPackage、targetProject同javaModelGenerator中作用一样-->
|
||||
<sqlMapGenerator targetPackage="mapper1" targetProject="src/main/resources">
|
||||
<property name="enableSubPackages" value="false"/>
|
||||
</sqlMapGenerator>
|
||||
|
||||
<!-- 指定mapper接口生成的位置
|
||||
targetPackage、targetProject同javaModelGenerator中作用一样
|
||||
-->
|
||||
<javaClientGenerator type="XMLMAPPER" targetPackage="business.cooperop.base.mapper" targetProject="src/main/java">
|
||||
<property name="enableSubPackages" value="false"/>
|
||||
</javaClientGenerator>
|
||||
|
||||
<!-- 指定数据库表
|
||||
domainObjectName:生成的domain类的名字,当表名和domain类的名字有差异时一定要设置,如果不设置,直接使用表名作为domain类的名字;
|
||||
可以设置为somepck.domainName,那么会自动把domainName类再放到somepck包里面;
|
||||
|
||||
<table tableName="tb_user" domainObjectName="Company" ></table>
|
||||
不生成Example类
|
||||
enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
|
||||
enableSelectByExample="false" selectByExampleQueryId="false" domainObjectName="Company"
|
||||
-->
|
||||
|
||||
<!-- <table tableName="application" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"-->
|
||||
<!-- enableSelectByExample="false" selectByExampleQueryId="false">-->
|
||||
<!-- </table>-->
|
||||
<!-- <table tableName="application_grade" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"-->
|
||||
<!-- enableSelectByExample="false" selectByExampleQueryId="false">-->
|
||||
<!-- </table>-->
|
||||
<!-- <table tableName="application_grade_popedom" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"-->
|
||||
<!-- enableSelectByExample="false" selectByExampleQueryId="false">-->
|
||||
<!-- </table>-->
|
||||
<!-- <table tableName="application_popedom" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"-->
|
||||
<!-- enableSelectByExample="false" selectByExampleQueryId="false">-->
|
||||
<!-- </table>-->
|
||||
<!-- <table tableName="company" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"-->
|
||||
<!-- enableSelectByExample="false" selectByExampleQueryId="false">-->
|
||||
<!-- </table>-->
|
||||
<!-- <table tableName="company_application_license" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"-->
|
||||
<!-- enableSelectByExample="false" selectByExampleQueryId="false">-->
|
||||
<!-- </table>-->
|
||||
<!-- <table tableName="company_application_popedom" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"-->
|
||||
<!-- enableSelectByExample="false" selectByExampleQueryId="false">-->
|
||||
<!-- </table>-->
|
||||
<!-- <table tableName="company_role" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"-->
|
||||
<!-- enableSelectByExample="false" selectByExampleQueryId="false">-->
|
||||
<!-- </table>-->
|
||||
<!-- <table tableName="company_role_popedom" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"-->
|
||||
<!-- enableSelectByExample="false" selectByExampleQueryId="false">-->
|
||||
<!-- </table>-->
|
||||
<!-- <table tableName="company_role_user" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"-->
|
||||
<!-- enableSelectByExample="false" selectByExampleQueryId="false">-->
|
||||
<!-- </table>-->
|
||||
<!-- <table tableName="company_user" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"-->
|
||||
<!-- enableSelectByExample="false" selectByExampleQueryId="false">-->
|
||||
<!-- </table>-->
|
||||
<!-- <table tableName="user" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"-->
|
||||
<!-- enableSelectByExample="false" selectByExampleQueryId="false">-->
|
||||
<!-- </table>-->
|
||||
<table tableName="organization" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
|
||||
enableSelectByExample="false" selectByExampleQueryId="false">
|
||||
</table>
|
||||
</context>
|
||||
</generatorConfiguration>
|
||||
@ -0,0 +1,31 @@
|
||||
package business.cooperop.base;
|
||||
|
||||
import business.cooperop.base.controller.ApplicationController;
|
||||
import business.cooperop.base.service.IUserService;
|
||||
import business.cooperop.common.result.Result;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
/**
|
||||
* @Author: deadline
|
||||
* @Date: 2020-12-29 17:00
|
||||
*/
|
||||
@SpringBootTest
|
||||
public class AuthTests {
|
||||
|
||||
@Autowired
|
||||
ApplicationController authController;
|
||||
|
||||
@Autowired
|
||||
IUserService iUserService;
|
||||
|
||||
@Test
|
||||
public void getTreeTest() {
|
||||
Result result = authController.getTree();
|
||||
String json = JSONArray.toJSONString(result);
|
||||
System.out.println(json);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
package business.cooperop.base;
|
||||
|
||||
//import business.cooperop.base.entity.Message;
|
||||
import business.cooperop.base.message.InternalMessage;
|
||||
import business.cooperop.base.message.InternalMessageImpl;
|
||||
import business.cooperop.base.message.email.service.EmailService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.*;
|
||||
|
||||
//@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
class CooperopAppBaseApplicationTests {
|
||||
|
||||
@Autowired
|
||||
private EmailService emailService;
|
||||
@Autowired
|
||||
private InternalMessage InternalMessage;
|
||||
|
||||
private static String to = "943359729@qq.com";
|
||||
|
||||
@Test
|
||||
public void sendSimpleEmail(){
|
||||
String content = "你好,恭喜你...";
|
||||
emailService.sendSimpleMail(new String[]{to},"祝福邮件",content);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sendMimeEmail(){
|
||||
String content = "<a href='https://blog.csdn.net/'>你好,欢迎注册网站,请点击链接激活</a>";
|
||||
emailService.sendHtmlMail(new String[]{to},"激活邮件",content);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sendAttachment(){
|
||||
emailService.sendAttachmentsMail(new String[]{to},"关于java体系图","你好, 这是Java体系图","G:\\测试图片\\01.jpg", "G:\\测试图片\\02.jpg");
|
||||
}
|
||||
@Test
|
||||
public void sendInternalMessage(){
|
||||
/*Message message = new Message();
|
||||
message.setTitle("系统通知");
|
||||
message.setType("T");
|
||||
message.setTarget("A");
|
||||
message.setContent("系统通知");
|
||||
message.setState(1);
|
||||
message.setCreate_time(new Date());
|
||||
message.setCreate_user("admin");
|
||||
message.setStart_time(new Date());
|
||||
Calendar curr = Calendar.getInstance();
|
||||
curr.set(Calendar.MONTH,curr.get(Calendar.MONTH)+1); //增加一月
|
||||
Date date=curr.getTime();
|
||||
message.setEnd_time(date);
|
||||
InternalMessage.settingInternalMessage(message);*/
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user