diff --git a/README-zh_CN.md b/README-zh_CN.md index 19d331a..f198909 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -50,7 +50,7 @@ ty-common: 统一依赖,统一配置管理,feign接口整合等 本架构的微服务有: ty-gateway:网关微服务。使用的是spring-cloud-starter-gateway,先对于zull网关来说性能更好。主要实现了,权限控制和拦截,jwt token解析和校验,swagger文件整合,使用令牌技术请求限流等 ty-auth:权限服务。jwt token生成,解析,校验等,默认配置3天有效期,少于一天自动续约(此处感兴趣的可以查看下源码) -ty-user:用户服务。用户的登录,注册,查看用户信息等一系列功能 +integration-front:用户服务。用户的登录,注册,查看用户信息等一系列功能 ty-excel:excel文件的读取和导出 ty-upload:文件上传服务。使用的技术为fastDFS技术,此服务主要用于文件的上传和下载 ``` diff --git a/README.md b/README.md index 2c5c8cc..1eae783 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ mybatis-plus: 3.3.2 rabbitmq:3.7-management redis: 3.2.9 mysql:5.7 +seata:1.4.2 +cancel ``` @@ -51,9 +53,8 @@ ty-common: 统一依赖,统一配置管理,feign接口整合等 本架构的微服务有: ty-gateway:网关微服务。使用的是spring-cloud-starter-gateway,先对于zull网关来说性能更好。主要实现了,权限控制和拦截,jwt token解析和校验,swagger文件整合,使用令牌技术请求限流等 ty-auth:权限服务。jwt token生成,解析,校验等,默认配置3天有效期,少于一天自动续约(此处感兴趣的可以查看下源码) -ty-user:用户服务。用户的登录,注册,查看用户信息等一系列功能 -ty-excel:excel文件的读取和导出 -ty-upload:文件上传服务。使用的技术为fastDFS技术,此服务主要用于文件的上传和下载 +integration-front:前端实例数据。用户的登录,注册,查看用户信息等一系列功能 +ty-example:全分布式事务seata,rabbitmq延时队列,短信发送,email发送,canal等功能实例 ``` diff --git a/ty-user/pom.xml b/integration-front/pom.xml similarity index 97% rename from ty-user/pom.xml rename to integration-front/pom.xml index cb45de4..8fea0ed 100644 --- a/ty-user/pom.xml +++ b/integration-front/pom.xml @@ -9,7 +9,7 @@ 4.0.0 - ty-user + integration-front diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/UserApplication.java b/integration-front/src/main/java/top/kuanghua/integrationfront/IntegrationFrontApplication.java similarity index 72% rename from ty-user/src/main/java/top/kuanghua/tyuser/UserApplication.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/IntegrationFrontApplication.java index 836265c..ac8b53d 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/UserApplication.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/IntegrationFrontApplication.java @@ -1,19 +1,19 @@ -package top.kuanghua.tyuser; - -import io.seata.spring.annotation.datasource.EnableAutoDataSourceProxy; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -/** - * @Title: UserApplication - * @Description: - * @Auther: kuanghua - * @create 2020/11/7 20:07 - */ -@SpringBootApplication -@EnableAutoDataSourceProxy -public class UserApplication { - public static void main(String[] args) { - SpringApplication.run(UserApplication.class, args); - } -} +package top.kuanghua.integrationfront; + +import io.seata.spring.annotation.datasource.EnableAutoDataSourceProxy; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * @Title: UserApplication + * @Description: + * @Auther: kuanghua + * @create 2020/11/7 20:07 + */ +@SpringBootApplication +@EnableAutoDataSourceProxy +public class IntegrationFrontApplication { + public static void main(String[] args) { + SpringApplication.run(IntegrationFrontApplication.class, args); + } +} diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/config/BaseConfig.java b/integration-front/src/main/java/top/kuanghua/integrationfront/config/BaseConfig.java similarity index 67% rename from ty-user/src/main/java/top/kuanghua/tyuser/config/BaseConfig.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/config/BaseConfig.java index b9b4cf5..6d960e2 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/config/BaseConfig.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/config/BaseConfig.java @@ -1,27 +1,27 @@ -package top.kuanghua.tyuser.config; - -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.cloud.openfeign.EnableFeignClients; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; - -/** - * @Title: BaseConfig - * @Description: - * @Auther: kuanghua - * @create 2020/8/23 21:52 - */ -/* - * 总结:1.@Configuration 下的@ComponentScan回将包下带有@Component扫描变成配置类, - * 而@SpringBootApplication扫描的只会变成普通类 - * */ -@Configuration -//扫描公用包的配置和自身的配置类 -@ComponentScan(basePackages = {"top.kuanghua.khcomomon","top.kuanghua.tyuser"}) -//feign扫描 -@EnableFeignClients(basePackages = {"top.kuanghua.feign.tyexecl","top.kuanghua.feign.tyauth"}) -//mapper包扫描 -@MapperScan(basePackages = {"top.kuanghua.tyuser.mapper"}) -public class BaseConfig { - -} +package top.kuanghua.integrationfront.config; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +/** + * @Title: BaseConfig + * @Description: + * @Auther: kuanghua + * @create 2020/8/23 21:52 + */ +/* + * 总结:1.@Configuration 下的@ComponentScan回将包下带有@Component扫描变成配置类, + * 而@SpringBootApplication扫描的只会变成普通类 + * */ +@Configuration +//扫描公用包的配置和自身的配置类 +@ComponentScan(basePackages = {"top.kuanghua.khcomomon", "top.kuanghua.integrationfront"}) +//feign扫描 +@EnableFeignClients(basePackages = {"top.kuanghua.feign.tyauth"}) +//mapper包扫描 +@MapperScan(basePackages = {"top.kuanghua.integrationfront.mapper"}) +public class BaseConfig { + +} diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/config/Swagger2Config.java b/integration-front/src/main/java/top/kuanghua/integrationfront/config/Swagger2Config.java similarity index 95% rename from ty-user/src/main/java/top/kuanghua/tyuser/config/Swagger2Config.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/config/Swagger2Config.java index 934deb1..0f38531 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/config/Swagger2Config.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/config/Swagger2Config.java @@ -1,56 +1,56 @@ -package top.kuanghua.tyuser.config; - -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.stereotype.Component; -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; -import springfox.documentation.swagger2.annotations.EnableSwagger2; - -@Component -@EnableSwagger2 //开启在线接口文档 -//配置包扫描 -public class Swagger2Config { - private boolean swagger_is_enable = true; -// @Value("${.ipAddr}") -// private String ipAddr; - @Value("${server.port}") - private String port; - - @Bean - public Docket api() { - return new Docket(DocumentationType.SWAGGER_2) - .enable(swagger_is_enable) - //.host(this.ipAddr + ":" + this.port) - .apiInfo(apiInfo()) - .select() - .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) - //.apis(basePackage("top.kuanghua.swagger.controller")) - .paths(PathSelectors.any()) - .build(); - } - - /** - * 构建 api文档的详细信息函数 - * - * @return - */ - private ApiInfo apiInfo() { - return new ApiInfoBuilder() - .title("标题:swagger文档") - .description("描述:新一代的微服务架构") - .contact(new Contact("jzfai", null, "869653722@qq.com")) - .version("版本号:2.8") - .build(); - } - - /** - * http://localhost:8080/swagger-ui.html - */ -} +package top.kuanghua.integrationfront.config; + +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.stereotype.Component; +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; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +@Component +@EnableSwagger2 //开启在线接口文档 +//配置包扫描 +public class Swagger2Config { + private boolean swagger_is_enable = true; +// @Value("${.ipAddr}") +// private String ipAddr; + @Value("${server.port}") + private String port; + + @Bean + public Docket api() { + return new Docket(DocumentationType.SWAGGER_2) + .enable(swagger_is_enable) + //.host(this.ipAddr + ":" + this.port) + .apiInfo(apiInfo()) + .select() + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) + //.apis(basePackage("top.kuanghua.swagger.controller")) + .paths(PathSelectors.any()) + .build(); + } + + /** + * 构建 api文档的详细信息函数 + * + * @return + */ + private ApiInfo apiInfo() { + return new ApiInfoBuilder() + .title("标题:swagger文档") + .description("描述:新一代的微服务架构") + .contact(new Contact("jzfai", null, "869653722@qq.com")) + .version("版本号:2.8") + .build(); + } + + /** + * http://localhost:8080/swagger-ui.html + */ +} diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/controller/BrandController.java b/integration-front/src/main/java/top/kuanghua/integrationfront/controller/BrandController.java similarity index 94% rename from ty-user/src/main/java/top/kuanghua/tyuser/controller/BrandController.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/controller/BrandController.java index c171fa4..1a43e45 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/controller/BrandController.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/controller/BrandController.java @@ -1,127 +1,127 @@ -package top.kuanghua.tyuser.controller; - - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.apache.commons.lang3.StringUtils; -import org.springframework.web.bind.annotation.*; -import top.kuanghua.khcomomon.entity.KHCommonParams; -import top.kuanghua.khcomomon.entity.ResResult; -import top.kuanghua.tyuser.entity.Brand; -import top.kuanghua.tyuser.service.BrandService; - -import javax.annotation.Resource; -import java.util.List; - -@Api(tags = "品牌表(Brand)") -@RestController -@RequestMapping("brand") -public class BrandController { - - @Resource - private BrandService brandService; - - /** - * 分页查询所有数据 - * - * @param brand 查询实体 - * @return 所有数据 - */ - @GetMapping("selectPage") - @ApiOperation(value = "分页查询所有数据") - public ResResult selectPage(Brand brand, KHCommonParams commonParams) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - if (ObjectUtils.isNotEmpty(brand.getId())) { - queryWrapper.like("id", brand.getId()); - } - if (ObjectUtils.isNotEmpty(brand.getName())) { - queryWrapper.like("name", brand.getName()); - } - if (ObjectUtils.isNotEmpty(brand.getImage())) { - queryWrapper.like("image", brand.getImage()); - } - - if (ObjectUtils.isNotEmpty(brand.getLetter())) { - queryWrapper.like("letter", brand.getLetter()); - } - if (ObjectUtils.isNotEmpty(brand.getSeq())) { - queryWrapper.like("seq", brand.getSeq()); - } - queryWrapper.orderByDesc("create_time"); - if (StringUtils.isNotEmpty(commonParams.getStartTime())) { - queryWrapper.between("create_time", commonParams.getStartTime(), commonParams.getEndTime()); - } - queryWrapper.select("id,name,image,letter,seq,create_time,update_time"); - Page brandPage = this.brandService.selectPage(commonParams.getPageNum(), commonParams.getPageSize(), queryWrapper); - return new ResResult().success(brandPage); - } - - /** - * 通过主键查询单条数据 - * - * @param id 主键 - * @return 单条数据 - */ - @GetMapping("selectById") - @ApiOperation(value = "通过id主键查询单条数据") - public ResResult selectById(@RequestParam("id") Integer id) { - return new ResResult().success(this.brandService.selectById(id)); - } - - /** - * @Description: 根据id数组查询品牌列表 - * @Param: idList id数组 - * @return: ids列表数据 - */ - @ApiOperation(value = "根据id数组查询品牌列表") - @PostMapping("selectBatchIds") - public ResResult selectBatchIds(@RequestParam("idList") List idList) { - return new ResResult().success(this.brandService.selectBatchIds(idList)); - } - - - /** - * 新增数据 - * - * @param brand 实体对象 - * @return 新增结果 - */ - @ApiOperation(value = "新增数据") - @PostMapping("insert") - public ResResult insert(@RequestBody Brand brand) { - return new ResResult().success(this.brandService.insert(brand)); - } - - /** - * 修改数据 - * - * @param brand 实体对象 - * @return 修改结果 - */ - @ApiOperation(value = "根据id修改数据") - @PutMapping("updateById") - public ResResult updateById(@RequestBody Brand brand) { - return new ResResult().success(this.brandService.updateById(brand)); - } - - /** - * 删除数据 - * - * @param idList 主键结合 - * @return 删除结果 - */ - @ApiOperation(value = "根据id数组删除数据") - @DeleteMapping("deleteBatchIds") - public ResResult deleteBatchIds(@RequestBody List idList) { - return new ResResult().success(this.brandService.deleteBatchIds(idList)); - } - - @DeleteMapping("deleteById") - @ApiOperation(value = "根据id数组删除数据") - public ResResult deleteById(@RequestParam("id") Integer id) { - return new ResResult().success(this.brandService.deleteById(id)); - } -} +package top.kuanghua.integrationfront.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.springframework.web.bind.annotation.*; +import top.kuanghua.khcomomon.entity.KHCommonParams; +import top.kuanghua.khcomomon.entity.ResResult; +import top.kuanghua.integrationfront.entity.Brand; +import top.kuanghua.integrationfront.service.BrandService; + +import javax.annotation.Resource; +import java.util.List; + +@Api(tags = "品牌表(Brand)") +@RestController +@RequestMapping("brand") +public class BrandController { + + @Resource + private BrandService brandService; + + /** + * 分页查询所有数据 + * + * @param brand 查询实体 + * @return 所有数据 + */ + @GetMapping("selectPage") + @ApiOperation(value = "分页查询所有数据") + public ResResult selectPage(Brand brand, KHCommonParams commonParams) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (ObjectUtils.isNotEmpty(brand.getId())) { + queryWrapper.like("id", brand.getId()); + } + if (ObjectUtils.isNotEmpty(brand.getName())) { + queryWrapper.like("name", brand.getName()); + } + if (ObjectUtils.isNotEmpty(brand.getImage())) { + queryWrapper.like("image", brand.getImage()); + } + + if (ObjectUtils.isNotEmpty(brand.getLetter())) { + queryWrapper.like("letter", brand.getLetter()); + } + if (ObjectUtils.isNotEmpty(brand.getSeq())) { + queryWrapper.like("seq", brand.getSeq()); + } + queryWrapper.orderByDesc("create_time"); + if (StringUtils.isNotEmpty(commonParams.getStartTime())) { + queryWrapper.between("create_time", commonParams.getStartTime(), commonParams.getEndTime()); + } + queryWrapper.select("id,name,image,letter,seq,create_time,update_time"); + Page brandPage = this.brandService.selectPage(commonParams.getPageNum(), commonParams.getPageSize(), queryWrapper); + return new ResResult().success(brandPage); + } + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @GetMapping("selectById") + @ApiOperation(value = "通过id主键查询单条数据") + public ResResult selectById(@RequestParam("id") Integer id) { + return new ResResult().success(this.brandService.selectById(id)); + } + + /** + * @Description: 根据id数组查询品牌列表 + * @Param: idList id数组 + * @return: ids列表数据 + */ + @ApiOperation(value = "根据id数组查询品牌列表") + @PostMapping("selectBatchIds") + public ResResult selectBatchIds(@RequestParam("idList") List idList) { + return new ResResult().success(this.brandService.selectBatchIds(idList)); + } + + + /** + * 新增数据 + * + * @param brand 实体对象 + * @return 新增结果 + */ + @ApiOperation(value = "新增数据") + @PostMapping("insert") + public ResResult insert(@RequestBody Brand brand) { + return new ResResult().success(this.brandService.insert(brand)); + } + + /** + * 修改数据 + * + * @param brand 实体对象 + * @return 修改结果 + */ + @ApiOperation(value = "根据id修改数据") + @PutMapping("updateById") + public ResResult updateById(@RequestBody Brand brand) { + return new ResResult().success(this.brandService.updateById(brand)); + } + + /** + * 删除数据 + * + * @param idList 主键结合 + * @return 删除结果 + */ + @ApiOperation(value = "根据id数组删除数据") + @DeleteMapping("deleteBatchIds") + public ResResult deleteBatchIds(@RequestBody List idList) { + return new ResResult().success(this.brandService.deleteBatchIds(idList)); + } + + @DeleteMapping("deleteById") + @ApiOperation(value = "根据id数组删除数据") + public ResResult deleteById(@RequestParam("id") Integer id) { + return new ResResult().success(this.brandService.deleteById(id)); + } +} diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/controller/ErrorCollectionController.java b/integration-front/src/main/java/top/kuanghua/integrationfront/controller/ErrorCollectionController.java similarity index 94% rename from ty-user/src/main/java/top/kuanghua/tyuser/controller/ErrorCollectionController.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/controller/ErrorCollectionController.java index dcae33f..e474129 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/controller/ErrorCollectionController.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/controller/ErrorCollectionController.java @@ -1,123 +1,123 @@ -package top.kuanghua.tyuser.controller; - - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.apache.commons.lang3.StringUtils; -import org.springframework.web.bind.annotation.*; -import top.kuanghua.khcomomon.entity.KHCommonParams; -import top.kuanghua.khcomomon.entity.ResResult; -import top.kuanghua.tyuser.entity.ErrorCollection; -import top.kuanghua.tyuser.service.ErrorCollectionService; - -import javax.annotation.Resource; -import java.util.List; - -@Api(tags = "日志相关") -@RestController -@RequestMapping("errorCollection") -public class ErrorCollectionController { - - @Resource - private ErrorCollectionService errorCollectionService; - - /** - * 分页查询所有数据 - * - * @param errorCollection 查询实体 - * @return 所有数据 - */ - @GetMapping("selectPage") - @ApiOperation(value = "分页查询所有数据") - public ResResult selectPage(ErrorCollection errorCollection, KHCommonParams khCommonParams) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - if (ObjectUtils.isNotEmpty(errorCollection.getErrorLog())) { - queryWrapper.like("error_log", errorCollection.getErrorLog()); - } - if (ObjectUtils.isNotEmpty(errorCollection.getPageUrl())) { - queryWrapper.like("page_url", errorCollection.getPageUrl()); - } - if (ObjectUtils.isNotEmpty(errorCollection.getVersion())) { - queryWrapper.like("version", errorCollection.getVersion()); - } - if (ObjectUtils.isNotEmpty(errorCollection.getCreateTime())) { - queryWrapper.like("create_time", errorCollection.getCreateTime()); - } - - if (StringUtils.isNotEmpty(khCommonParams.getStartTime())) { - queryWrapper.between("create_time", khCommonParams.getStartTime(), khCommonParams.getEndTime()); - } - queryWrapper.orderByDesc("create_time"); - Page errorCollectionPage = this.errorCollectionService.selectPage(khCommonParams.getPageNum(), khCommonParams.getPageSize(), queryWrapper); - return new ResResult().success(errorCollectionPage); - } - - /** - * 通过主键查询单条数据 - * - * @param id 主键 - * @return 单条数据 - */ - @GetMapping("selectById") - @ApiOperation(value = "通过id主键查询单条数据") - public ResResult selectById(@RequestParam("id") Integer id) { - return new ResResult().success(this.errorCollectionService.selectById(id)); - } - - /** - * @Description: 根据id数组查询品牌列表 - * @Param: idList id数组 - * @return: ids列表数据 - */ - @ApiOperation(value = "根据id数组查询品牌列表") - @PostMapping("selectBatchIds") - public ResResult selectBatchIds(@RequestParam("idList") List idList) { - return new ResResult().success(this.errorCollectionService.selectBatchIds(idList)); - } - - - /** - * 新增数据 - * - * @param errorCollection 实体对象 - * @return 新增结果 - */ - @ApiOperation(value = "新增数据") - @PostMapping("insert") - public ResResult insert(@RequestBody ErrorCollection errorCollection) { - return new ResResult().success(this.errorCollectionService.insert(errorCollection)); - } - - /** - * 修改数据 - * - * @param errorCollection 实体对象 - * @return 修改结果 - */ - @ApiOperation(value = "根据id修改数据") - @PutMapping("updateById") - public ResResult updateById(@RequestBody ErrorCollection errorCollection) { - return new ResResult().success(this.errorCollectionService.updateById(errorCollection)); - } - - /** - * 删除数据 - * - * @param idList 主键结合 - * @return 删除结果 - */ - @ApiOperation(value = "根据id数组删除数据") - @DeleteMapping("deleteBatchIds") - public ResResult deleteBatchIds(@RequestBody List idList) { - return new ResResult().success(this.errorCollectionService.deleteBatchIds(idList)); - } - - @DeleteMapping("deleteById") - @ApiOperation(value = "根据id数组删除数据") - public ResResult deleteById(@RequestParam("id") Integer id) { - return new ResResult().success(this.errorCollectionService.deleteById(id)); - } -} +package top.kuanghua.integrationfront.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.springframework.web.bind.annotation.*; +import top.kuanghua.khcomomon.entity.KHCommonParams; +import top.kuanghua.khcomomon.entity.ResResult; +import top.kuanghua.integrationfront.entity.ErrorCollection; +import top.kuanghua.integrationfront.service.ErrorCollectionService; + +import javax.annotation.Resource; +import java.util.List; + +@Api(tags = "日志相关") +@RestController +@RequestMapping("errorCollection") +public class ErrorCollectionController { + + @Resource + private ErrorCollectionService errorCollectionService; + + /** + * 分页查询所有数据 + * + * @param errorCollection 查询实体 + * @return 所有数据 + */ + @GetMapping("selectPage") + @ApiOperation(value = "分页查询所有数据") + public ResResult selectPage(ErrorCollection errorCollection, KHCommonParams khCommonParams) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (ObjectUtils.isNotEmpty(errorCollection.getErrorLog())) { + queryWrapper.like("error_log", errorCollection.getErrorLog()); + } + if (ObjectUtils.isNotEmpty(errorCollection.getPageUrl())) { + queryWrapper.like("page_url", errorCollection.getPageUrl()); + } + if (ObjectUtils.isNotEmpty(errorCollection.getVersion())) { + queryWrapper.like("version", errorCollection.getVersion()); + } + if (ObjectUtils.isNotEmpty(errorCollection.getCreateTime())) { + queryWrapper.like("create_time", errorCollection.getCreateTime()); + } + + if (StringUtils.isNotEmpty(khCommonParams.getStartTime())) { + queryWrapper.between("create_time", khCommonParams.getStartTime(), khCommonParams.getEndTime()); + } + queryWrapper.orderByDesc("create_time"); + Page errorCollectionPage = this.errorCollectionService.selectPage(khCommonParams.getPageNum(), khCommonParams.getPageSize(), queryWrapper); + return new ResResult().success(errorCollectionPage); + } + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @GetMapping("selectById") + @ApiOperation(value = "通过id主键查询单条数据") + public ResResult selectById(@RequestParam("id") Integer id) { + return new ResResult().success(this.errorCollectionService.selectById(id)); + } + + /** + * @Description: 根据id数组查询品牌列表 + * @Param: idList id数组 + * @return: ids列表数据 + */ + @ApiOperation(value = "根据id数组查询品牌列表") + @PostMapping("selectBatchIds") + public ResResult selectBatchIds(@RequestParam("idList") List idList) { + return new ResResult().success(this.errorCollectionService.selectBatchIds(idList)); + } + + + /** + * 新增数据 + * + * @param errorCollection 实体对象 + * @return 新增结果 + */ + @ApiOperation(value = "新增数据") + @PostMapping("insert") + public ResResult insert(@RequestBody ErrorCollection errorCollection) { + return new ResResult().success(this.errorCollectionService.insert(errorCollection)); + } + + /** + * 修改数据 + * + * @param errorCollection 实体对象 + * @return 修改结果 + */ + @ApiOperation(value = "根据id修改数据") + @PutMapping("updateById") + public ResResult updateById(@RequestBody ErrorCollection errorCollection) { + return new ResResult().success(this.errorCollectionService.updateById(errorCollection)); + } + + /** + * 删除数据 + * + * @param idList 主键结合 + * @return 删除结果 + */ + @ApiOperation(value = "根据id数组删除数据") + @DeleteMapping("deleteBatchIds") + public ResResult deleteBatchIds(@RequestBody List idList) { + return new ResResult().success(this.errorCollectionService.deleteBatchIds(idList)); + } + + @DeleteMapping("deleteById") + @ApiOperation(value = "根据id数组删除数据") + public ResResult deleteById(@RequestParam("id") Integer id) { + return new ResResult().success(this.errorCollectionService.deleteById(id)); + } +} diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/controller/UserController.java b/integration-front/src/main/java/top/kuanghua/integrationfront/controller/UserController.java similarity index 89% rename from ty-user/src/main/java/top/kuanghua/tyuser/controller/UserController.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/controller/UserController.java index 123f073..a082535 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/controller/UserController.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/controller/UserController.java @@ -1,204 +1,202 @@ -package top.kuanghua.tyuser.controller; - - -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.*; -import springfox.documentation.annotations.ApiIgnore; -import top.kuanghua.feign.tyauth.feign.TokenFeign; -import top.kuanghua.khcomomon.entity.KHCommonParams; -import top.kuanghua.khcomomon.entity.ResResult; -import top.kuanghua.tyuser.entity.User; -import top.kuanghua.tyuser.mapper.MultiPageMapper; -import top.kuanghua.tyuser.mapper.UserMapper; -import top.kuanghua.tyuser.service.UserService; - -import javax.annotation.Resource; -import javax.validation.Valid; -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Api(tags = "用户相关") -@RestController -@RequestMapping("user") -@Transactional -public class UserController { - @Resource - private UserService userService; - @Resource - private UserMapper userMapper; - - @Resource - private MultiPageMapper multiPageMapper; - - - @Autowired - private TokenFeign tokenFeign; - /** - * 分页查询所有数据 - * @param user 查询实体 - * @return 所有数据 - */ - @GetMapping("selectPage") - @ApiOperation(value = "分页查询数据") - public ResResult selectPage(User user, KHCommonParams commonParams) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - if(StringUtils.isNotEmpty(user.getUsername())) { - queryWrapper.like("username",user.getUsername()); - } - if(StringUtils.isNotEmpty(user.getPhone())) { - queryWrapper.like("phone",user.getPhone()); - } - if(StringUtils.isNotEmpty(commonParams.getStartTime())) { - queryWrapper.between("create_time",commonParams.getStartTime(),commonParams.getEndTime()); - } - queryWrapper.select("username","phone","create_time"); - Page userPage = this.userMapper.selectPage(new Page<>(commonParams.getPageNum(), commonParams.getPageSize()), queryWrapper); - return new ResResult().success(userPage); - } - - /** - * 通过主键查询单条数据 - * - * @param id 主键 - * @return 单条数据 - */ - @GetMapping("selectById") - @ApiOperation(value = "通过id主键查询单条数据") - public ResResult selectById(@RequestParam("id") Integer id) { - return new ResResult().success(this.userMapper.selectById(id)); - } -// -// /** -// * @Description: 根据id数组查询品牌列表 -// * @Param: idList id数组 -// * @return: ids列表数据 -// */ -// @ApiOperation(value = "根据id数组查询品牌列表") -// @PostMapping("selectBatchIds") -// public ResResult selectBatchIds(@RequestParam("idList") List idList) { -// return new ResResult().success(this.userMapper.selectBatchIds(idList)); -// } - - /** - * 新增数据 - * - * @param user 实体对象 - * @return 新增结果 - */ - @ApiOperation(value = "新增数据") - @PostMapping("insert") - - public ResResult insert(@Valid @RequestBody User user) { - //List userInfos = userInfoMapper.selectList(new EntityWrapper<>(userInfo).like("firstname", name) - // .like("lastname", name));52 - return new ResResult().success(this.userService.insert(user)); - } - /** - * 修改数据 - * - * @param user 实体对象 - * @return 修改结果 - */ - -// @ApiOperation(value = "根据id修改数据") -// @PutMapping("updateById") -// public ResResult updateById(@RequestBody User user) { -// return new ResResult().success(this.userService.updateById(user)); -// } -// /** -// * 删除数据 -// * -// * @param idList 主键结合 -// * @return 删除结果 -// */ - @ApiOperation(value = "根据id数组删除数据") - @DeleteMapping("deleteBatchIds") - public ResResult deleteBatchIds(@RequestBody List idList) { - return new ResResult().success(this.userMapper.deleteBatchIds(idList)); - } - @DeleteMapping("deleteById") - @ApiOperation(value = "根据id删除数据") - public ResResult deleteById(@RequestParam("id") Integer id) { - return new ResResult().success(this.userMapper.deleteById(id)); - } - - @PostMapping("registry") - @ApiOperation(value = "用户注册") - public ResResult registry(User user,String code,String password) throws Exception { - this.userService.registry(user,code); - return new ResResult().success(); - } - - @PostMapping("loginValid") - @ApiOperation(value = "登录校验") - public ResResult loginValid(User user) throws Exception { - HashMap hm = this.userService.loginValid(user); - return new ResResult().success(hm); - } - - @PostMapping("loginOut") - @ApiOperation(value = "退出登录") - - public ResResult loginOut() { - this.userService.loginOut(); - return new ResResult().success(); - } - @PostMapping("multiPageTest") - @ApiOperation(value = "多分页测试") - public Page> multiPageTest() { - Page> mapPage = multiPageMapper.queryAllUsers(new Page<>(1, 5)); - return mapPage; - } - - @PostMapping("userRegister") - @ApiOperation(value = "用户注册") - public ResResult userRegister(String email,String code,String username,String password){ - this.userService.userRegister(email,code,username,password); - return new ResResult().success(); - } - - @PostMapping("changePassword") - @ApiOperation(value = "修改密码") - public ResResult changePassword( - @ApiIgnore @RequestHeader("TOKEN_INFO") String TOKEN_INFO, - String oldPassword,String newPassword) throws UnsupportedEncodingException { - Map tokenInfo = JSON.parseObject(URLDecoder.decode(TOKEN_INFO, "utf-8")); - this.userService.changePassword(tokenInfo.get("username").toString(),oldPassword,newPassword); - return new ResResult().success(); - } - @PostMapping("getUserInfo") - @ApiOperation(value = "获取用户信息") - public ResResult changePassword(@ApiIgnore @RequestHeader("TOKEN_INFO") String TOKEN_INFO) throws UnsupportedEncodingException { - Map tokenInfo = JSON.parseObject(URLDecoder.decode(TOKEN_INFO, "utf-8")); - return new ResResult().success(tokenInfo); - } - - - @PostMapping("insertUser") - @ApiOperation(value = "插入用户") - public ResResult insertUser(String username){ - this.userService.insertUser(username); - return new ResResult().success(); - } - - - /** - * 重置用用户名:如果用用户存在先删除原有用户在新增一个用户,没有则新建用户 - */ - @PostMapping("resetUser") - @ApiOperation(value = "重置用户(有则删除在新增)") - public ResResult resetUser(String username) { - this.userService.resetUser(username); - return new ResResult().success(); - } +package top.kuanghua.integrationfront.controller; + + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; +import top.kuanghua.feign.tyauth.feign.TokenFeign; +import top.kuanghua.khcomomon.entity.KHCommonParams; +import top.kuanghua.khcomomon.entity.ResResult; +import top.kuanghua.integrationfront.entity.User; +import top.kuanghua.integrationfront.mapper.MultiPageMapper; +import top.kuanghua.integrationfront.mapper.UserMapper; +import top.kuanghua.integrationfront.service.UserService; + +import javax.annotation.Resource; +import javax.validation.Valid; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Api(tags = "用户相关") +@RestController +@RequestMapping("user") +@Transactional +public class UserController { + @Resource + private UserService userService; + @Resource + private UserMapper userMapper; + + @Resource + private MultiPageMapper multiPageMapper; + + + @Resource + private TokenFeign tokenFeign; + /** + * 分页查询所有数据 + * @param user 查询实体 + * @return 所有数据 + */ + @GetMapping("selectPage") + @ApiOperation(value = "分页查询数据") + public ResResult selectPage(User user, KHCommonParams commonParams) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + if(StringUtils.isNotEmpty(user.getUsername())) { + queryWrapper.like("username",user.getUsername()); + } + if(StringUtils.isNotEmpty(user.getPhone())) { + queryWrapper.like("phone",user.getPhone()); + } + if(StringUtils.isNotEmpty(commonParams.getStartTime())) { + queryWrapper.between("create_time",commonParams.getStartTime(),commonParams.getEndTime()); + } + queryWrapper.select("username","phone","create_time"); + Page userPage = this.userMapper.selectPage(new Page<>(commonParams.getPageNum(), commonParams.getPageSize()), queryWrapper); + return new ResResult().success(userPage); + } + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @GetMapping("selectById") + @ApiOperation(value = "通过id主键查询单条数据") + public ResResult selectById(@RequestParam("id") Integer id) { + return new ResResult().success(this.userMapper.selectById(id)); + } +// +// /** +// * @Description: 根据id数组查询品牌列表 +// * @Param: idList id数组 +// * @return: ids列表数据 +// */ +// @ApiOperation(value = "根据id数组查询品牌列表") +// @PostMapping("selectBatchIds") +// public ResResult selectBatchIds(@RequestParam("idList") List idList) { +// return new ResResult().success(this.userMapper.selectBatchIds(idList)); +// } + + /** + * 新增数据 + * + * @param user 实体对象 + * @return 新增结果 + */ + @ApiOperation(value = "新增数据") + @PostMapping("insert") + + public ResResult insert(@Valid @RequestBody User user) { + //List userInfos = userInfoMapper.selectList(new EntityWrapper<>(userInfo).like("firstname", name) + // .like("lastname", name));52 + return new ResResult().success(this.userService.insert(user)); + } + /** + * 修改数据 + * + * @return 修改结果 + */ + +// @ApiOperation(value = "根据id修改数据") +// @PutMapping("updateById") +// public ResResult updateById(@RequestBody User user) { +// return new ResResult().success(this.userService.updateById(user)); +// } +// /** +// * 删除数据 +// * +// * @param idList 主键结合 +// * @return 删除结果 +// */ + @ApiOperation(value = "根据id数组删除数据") + @DeleteMapping("deleteBatchIds") + public ResResult deleteBatchIds(@RequestBody List idList) { + return new ResResult().success(this.userMapper.deleteBatchIds(idList)); + } + @DeleteMapping("deleteById") + @ApiOperation(value = "根据id删除数据") + public ResResult deleteById(@RequestParam("id") Integer id) { + return new ResResult().success(this.userMapper.deleteById(id)); + } + + @PostMapping("registry") + @ApiOperation(value = "用户注册") + public ResResult registry(User user,String code,String password) throws Exception { + this.userService.registry(user,code); + return new ResResult().success(); + } + + @PostMapping("loginValid") + @ApiOperation(value = "登录校验") + public ResResult loginValid(User user) throws Exception { + HashMap hm = this.userService.loginValid(user); + return new ResResult().success(hm); + } + + @PostMapping("loginOut") + @ApiOperation(value = "退出登录") + + public ResResult loginOut() { + this.userService.loginOut(); + return new ResResult().success(); + } + @PostMapping("multiPageTest") + @ApiOperation(value = "多分页测试") + public Page> multiPageTest() { + Page> mapPage = multiPageMapper.queryAllUsers(new Page<>(1, 5)); + return mapPage; + } +// +// @PostMapping("userRegister") +// @ApiOperation(value = "用户注册") +// public ResResult userRegister(String email,String code,String username,String password){ +// this.userService.userRegister(email,code,username,password); +// return new ResResult().success(); +// } + + @PostMapping("changePassword") + @ApiOperation(value = "修改密码") + public ResResult changePassword( + @ApiIgnore @RequestHeader("TOKEN_INFO") String TOKEN_INFO, + String oldPassword,String newPassword) throws UnsupportedEncodingException { + Map tokenInfo = JSON.parseObject(URLDecoder.decode(TOKEN_INFO, "utf-8")); + this.userService.changePassword(tokenInfo.get("username").toString(),oldPassword,newPassword); + return new ResResult().success(); + } + @PostMapping("getUserInfo") + @ApiOperation(value = "获取用户信息") + public ResResult changePassword(@ApiIgnore @RequestHeader("TOKEN_INFO") String TOKEN_INFO) throws UnsupportedEncodingException { + Map tokenInfo = JSON.parseObject(URLDecoder.decode(TOKEN_INFO, "utf-8")); + return new ResResult().success(tokenInfo); + } + + + @PostMapping("insertUser") + @ApiOperation(value = "插入用户") + public ResResult insertUser(String username){ + this.userService.insertUser(username); + return new ResResult().success(); + } + + + /** + * 重置用用户名:如果用用户存在先删除原有用户在新增一个用户,没有则新建用户 + */ + @PostMapping("resetUser") + @ApiOperation(value = "重置用户(有则删除在新增)") + public ResResult resetUser(String username) { + this.userService.resetUser(username); + return new ResResult().success(); + } } \ No newline at end of file diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/controller/VciController.java b/integration-front/src/main/java/top/kuanghua/integrationfront/controller/VciController.java similarity index 93% rename from ty-user/src/main/java/top/kuanghua/tyuser/controller/VciController.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/controller/VciController.java index 93a0285..3b57601 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/controller/VciController.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/controller/VciController.java @@ -1,171 +1,170 @@ -package top.kuanghua.tyuser.controller; - - -import com.alibaba.excel.EasyExcel; -import com.alibaba.nacos.api.naming.CommonParams; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.apache.commons.lang3.StringUtils; -import org.springframework.web.multipart.MultipartFile; -import top.kuanghua.khcomomon.entity.CommonParamsSelf; -import top.kuanghua.khcomomon.entity.ResResult; -import top.kuanghua.khcomomon.utils.ObjectUtilsSelf; -import top.kuanghua.tyuser.entity.Vci; -import top.kuanghua.tyuser.excel.imp.VciExcelImp; -import top.kuanghua.tyuser.service.VciService; -import org.springframework.web.bind.annotation.*; -import top.kuanghua.tyuser.vo.ExcelCheckResult; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.net.URLEncoder; -import java.util.*; - - -@Api(tags = "VCI设备表(Vci)") -@RestController -@RequestMapping("vci") -public class VciController { - - @Resource - private VciService vciService; - - /** - * 分页查询所有数据 - * @param vci 查询实体 - * @return 所有数据 - */ - @GetMapping("selectPage") - @ApiOperation(value = "分页查询所有数据") - public ResResult selectPage(Vci vci, CommonParamsSelf commonParams) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - if (ObjectUtils.isNotEmpty(vci.getSn())) { - queryWrapper.like("sn", vci.getSn()); - } - if (ObjectUtils.isNotEmpty(vci.getHardVersion())) { - queryWrapper.like("hard_version", vci.getHardVersion()); - } - if (ObjectUtils.isNotEmpty(vci.getStatus())) { - queryWrapper.like("status", vci.getStatus()); - } - //根据创建时间查询 - queryWrapper.orderByDesc("create_time"); - if(StringUtils.isNotEmpty(commonParams.getStartTime())) { - queryWrapper.between("create_time",commonParams.getStartTime(),commonParams.getEndTime()); - } - - queryWrapper.select("id,sn,hard_version,create_time,status,supplier,receipt_no,product_spec"); - Page vciPage = this.vciService.selectPage(commonParams.getPageNum(), commonParams.getPageSize(), queryWrapper); - return new ResResult().success(vciPage); - } - - /** - * 通过主键查询单条数据 - * - * @param id 主键 - * @return 单条数据 - */ - @GetMapping("selectById") - @ApiOperation(value = "通过id主键查询单条数据") - public ResResult selectById(@RequestParam("id") Integer id) { - return new ResResult().success(this.vciService.selectById(id)); - } - /** - * @Description: 根据id数组查询品牌列表 - * @Param: idList id数组 - * @return: ids列表数据 - */ - @ApiOperation(value = "根据id数组查询品牌列表") - @PostMapping("selectBatchIds") - public ResResult selectBatchIds(@RequestParam("idList") List idList) { - return new ResResult().success(this.vciService.selectBatchIds(idList)); - } - /** - * 新增数据 - * @param vci 实体对象 - * @return 新增结果 - */ - @ApiOperation(value = "新增数据") - @PostMapping("insert") - public ResResult insert(@RequestBody Vci vci) { - return new ResResult().success(this.vciService.insert(vci)); - } - - /** - * 修改数据 - * @param vci 实体对象 - * @return 修改结果 - */ - @ApiOperation(value = "根据id修改数据") - @PutMapping("updateById") - public ResResult updateById(@RequestBody Vci vci) { - return new ResResult().success(this.vciService.updateById(vci)); - } - - /** - * 删除数据 - * @param idList 主键结合 - * @return 删除结果 - */ - @ApiOperation(value = "根据id数组删除数据") - @DeleteMapping("deleteBatchIds") - public ResResult deleteBatchIds(@RequestBody List idList) { - return new ResResult().success(this.vciService.deleteBatchIds(idList)); - } - - @DeleteMapping("deleteById") - @ApiOperation(value = "根据id数组删除数据") - public ResResult deleteById(@RequestParam("id") Integer id) { - return new ResResult().success(this.vciService.deleteById(id)); - } - - @ApiOperation("检查excel") - @PostMapping("validExcel") - public ResResult validExcel(@RequestParam("file") MultipartFile file) throws IOException { - ExcelCheckResult checkResult = vciService.validExcel(file.getInputStream()); - return new ResResult().success(checkResult); - } - - @ApiOperation("导入excel") - @PostMapping("importExcel") - public ResResult importExcel(@RequestBody List vciExcelBo) { - vciService.importExcel(vciExcelBo); - return new ResResult().success(); - } - - @ApiOperation("导出excel") - @GetMapping("exportExcel") - public void exportExcel(HttpServletResponse response,Vci vci, CommonParamsSelf commonParams) throws IOException { - QueryWrapper queryWrapper = new QueryWrapper<>(); - if (ObjectUtils.isNotEmpty(vci.getSn())) { - queryWrapper.like("sn", vci.getSn()); - } - if (ObjectUtils.isNotEmpty(vci.getHardVersion())) { - queryWrapper.like("hard_version", vci.getHardVersion()); - } - if (ObjectUtils.isNotEmpty(vci.getStatus())) { - queryWrapper.like("status", vci.getStatus()); - } - //根据创建时间查询 - queryWrapper.orderByDesc("create_time"); - if(StringUtils.isNotEmpty(commonParams.getStartTime())) { - queryWrapper.between("create_time",commonParams.getStartTime(),commonParams.getEndTime()); - } - - queryWrapper.select("sn,hard_version,create_time,status,supplier,receipt_no,product_spec"); - Page vciPage = this.vciService.selectPage(commonParams.getPageNum(), commonParams.getPageSize(), queryWrapper); - // 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setCharacterEncoding("utf-8"); - - String fileName = URLEncoder.encode("Vci导出数据", "UTF-8")+"-"+ ObjectUtilsSelf.getCurrentDateTime(); - response.setHeader("Access-Control-Expose-Headers", "exportFileName"); - response.setHeader("exportFileName", fileName + ".xlsx" ); - EasyExcel.write(response.getOutputStream(), VciExcelImp.class).sheet("模板").doWrite(vciPage.getRecords()); - } - -} +package top.kuanghua.integrationfront.controller; + + +import com.alibaba.excel.EasyExcel; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.springframework.web.multipart.MultipartFile; +import top.kuanghua.khcomomon.entity.CommonParamsSelf; +import top.kuanghua.khcomomon.entity.ResResult; +import top.kuanghua.khcomomon.utils.ObjectUtilsSelf; +import top.kuanghua.integrationfront.entity.Vci; +import top.kuanghua.integrationfront.excel.imp.VciExcelImp; +import top.kuanghua.integrationfront.service.VciService; +import org.springframework.web.bind.annotation.*; +import top.kuanghua.integrationfront.vo.ExcelCheckResult; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.net.URLEncoder; +import java.util.*; + + +@Api(tags = "VCI设备表(Vci)") +@RestController +@RequestMapping("vci") +public class VciController { + + @Resource + private VciService vciService; + + /** + * 分页查询所有数据 + * @param vci 查询实体 + * @return 所有数据 + */ + @GetMapping("selectPage") + @ApiOperation(value = "分页查询所有数据") + public ResResult selectPage(Vci vci, CommonParamsSelf commonParams) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (ObjectUtils.isNotEmpty(vci.getSn())) { + queryWrapper.like("sn", vci.getSn()); + } + if (ObjectUtils.isNotEmpty(vci.getHardVersion())) { + queryWrapper.like("hard_version", vci.getHardVersion()); + } + if (ObjectUtils.isNotEmpty(vci.getStatus())) { + queryWrapper.like("status", vci.getStatus()); + } + //根据创建时间查询 + queryWrapper.orderByDesc("create_time"); + if(StringUtils.isNotEmpty(commonParams.getStartTime())) { + queryWrapper.between("create_time",commonParams.getStartTime(),commonParams.getEndTime()); + } + + queryWrapper.select("id,sn,hard_version,create_time,status,supplier,receipt_no,product_spec"); + Page vciPage = this.vciService.selectPage(commonParams.getPageNum(), commonParams.getPageSize(), queryWrapper); + return new ResResult().success(vciPage); + } + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @GetMapping("selectById") + @ApiOperation(value = "通过id主键查询单条数据") + public ResResult selectById(@RequestParam("id") Integer id) { + return new ResResult().success(this.vciService.selectById(id)); + } + /** + * @Description: 根据id数组查询品牌列表 + * @Param: idList id数组 + * @return: ids列表数据 + */ + @ApiOperation(value = "根据id数组查询品牌列表") + @PostMapping("selectBatchIds") + public ResResult selectBatchIds(@RequestParam("idList") List idList) { + return new ResResult().success(this.vciService.selectBatchIds(idList)); + } + /** + * 新增数据 + * @param vci 实体对象 + * @return 新增结果 + */ + @ApiOperation(value = "新增数据") + @PostMapping("insert") + public ResResult insert(@RequestBody Vci vci) { + return new ResResult().success(this.vciService.insert(vci)); + } + + /** + * 修改数据 + * @param vci 实体对象 + * @return 修改结果 + */ + @ApiOperation(value = "根据id修改数据") + @PutMapping("updateById") + public ResResult updateById(@RequestBody Vci vci) { + return new ResResult().success(this.vciService.updateById(vci)); + } + + /** + * 删除数据 + * @param idList 主键结合 + * @return 删除结果 + */ + @ApiOperation(value = "根据id数组删除数据") + @DeleteMapping("deleteBatchIds") + public ResResult deleteBatchIds(@RequestBody List idList) { + return new ResResult().success(this.vciService.deleteBatchIds(idList)); + } + + @DeleteMapping("deleteById") + @ApiOperation(value = "根据id数组删除数据") + public ResResult deleteById(@RequestParam("id") Integer id) { + return new ResResult().success(this.vciService.deleteById(id)); + } + + @ApiOperation("检查excel") + @PostMapping("validExcel") + public ResResult validExcel(@RequestParam("file") MultipartFile file) throws IOException { + ExcelCheckResult checkResult = vciService.validExcel(file.getInputStream()); + return new ResResult().success(checkResult); + } + + @ApiOperation("导入excel") + @PostMapping("importExcel") + public ResResult importExcel(@RequestBody List vciExcelBo) { + vciService.importExcel(vciExcelBo); + return new ResResult().success(); + } + + @ApiOperation("导出excel") + @GetMapping("exportExcel") + public void exportExcel(HttpServletResponse response,Vci vci, CommonParamsSelf commonParams) throws IOException { + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (ObjectUtils.isNotEmpty(vci.getSn())) { + queryWrapper.like("sn", vci.getSn()); + } + if (ObjectUtils.isNotEmpty(vci.getHardVersion())) { + queryWrapper.like("hard_version", vci.getHardVersion()); + } + if (ObjectUtils.isNotEmpty(vci.getStatus())) { + queryWrapper.like("status", vci.getStatus()); + } + //根据创建时间查询 + queryWrapper.orderByDesc("create_time"); + if(StringUtils.isNotEmpty(commonParams.getStartTime())) { + queryWrapper.between("create_time",commonParams.getStartTime(),commonParams.getEndTime()); + } + + queryWrapper.select("sn,hard_version,create_time,status,supplier,receipt_no,product_spec"); + Page vciPage = this.vciService.selectPage(commonParams.getPageNum(), commonParams.getPageSize(), queryWrapper); + // 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setCharacterEncoding("utf-8"); + + String fileName = URLEncoder.encode("Vci导出数据", "UTF-8")+"-"+ ObjectUtilsSelf.getCurrentDateTime(); + response.setHeader("Access-Control-Expose-Headers", "exportFileName"); + response.setHeader("exportFileName", fileName + ".xlsx" ); + EasyExcel.write(response.getOutputStream(), VciExcelImp.class).sheet("模板").doWrite(vciPage.getRecords()); + } + +} diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/entity/Access.java b/integration-front/src/main/java/top/kuanghua/integrationfront/entity/Access.java similarity index 93% rename from ty-user/src/main/java/top/kuanghua/tyuser/entity/Access.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/entity/Access.java index 125e0f0..912a12c 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/entity/Access.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/entity/Access.java @@ -1,45 +1,45 @@ -package top.kuanghua.tyuser.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.activerecord.Model; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.util.Date; - -/** - * 权限表(Access)表实体类 - * - * @author kuanghua - * @since 2021-03-23 11:03:45 - */ -@Data -@ApiModel("权限表") -@TableName(value = "tb_access") -public class Access extends Model { - @ApiModelProperty(value = "主键id") - private Integer id; - @ApiModelProperty(value = "权限名称") - private String name; - @ApiModelProperty(value = "是否删除") - private String isDelete; - @ApiModelProperty(value = "更新时间") - private Date updatedTime; - @ApiModelProperty(value = "创建时间") - private Date createdTime; - @ApiModelProperty(value = "父id") - private Integer parentId; - @ApiModelProperty(value = "是否是父类") - private String isParent; - /** - * 获取主键值 - * - * @return 主键值 - */ - @Override - protected Serializable pkVal() { - return this.id; - } -} +package top.kuanghua.integrationfront.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 权限表(Access)表实体类 + * + * @author kuanghua + * @since 2021-03-23 11:03:45 + */ +@Data +@ApiModel("权限表") +@TableName(value = "tb_access") +public class Access extends Model { + @ApiModelProperty(value = "主键id") + private Integer id; + @ApiModelProperty(value = "权限名称") + private String name; + @ApiModelProperty(value = "是否删除") + private String isDelete; + @ApiModelProperty(value = "更新时间") + private Date updatedTime; + @ApiModelProperty(value = "创建时间") + private Date createdTime; + @ApiModelProperty(value = "父id") + private Integer parentId; + @ApiModelProperty(value = "是否是父类") + private String isParent; + /** + * 获取主键值 + * + * @return 主键值 + */ + @Override + protected Serializable pkVal() { + return this.id; + } +} diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/entity/Admin.java b/integration-front/src/main/java/top/kuanghua/integrationfront/entity/Admin.java similarity index 93% rename from ty-user/src/main/java/top/kuanghua/tyuser/entity/Admin.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/entity/Admin.java index 3ec4619..3afb60b 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/entity/Admin.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/entity/Admin.java @@ -1,49 +1,49 @@ -package top.kuanghua.tyuser.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.activerecord.Model; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.util.Date; - -/** - * 用户列表(Admin)表实体类 - * - * @author kuanghua - * @since 2021-03-19 10:45:42 - */ -@Data -@ApiModel("用户列表") -@TableName(value = "tb_admin") -public class Admin extends Model { - private Integer id; - private String status; - private Date addTime; - @ApiModelProperty(value = "超级管理员(0.不是,1.是)") - private String isSuper; - @ApiModelProperty(value = "用户名") - private String username; - @ApiModelProperty(value = "密码") - private String password; - @ApiModelProperty(value = "是否删除") - private String isDelete; - @ApiModelProperty(value = "手机号") - private String mobile; - @ApiModelProperty(value = "邮箱") - private String email; - @ApiModelProperty(value = "角色id") - private Integer roleId; - - /** - * 获取主键值 - * - * @return 主键值 - */ - @Override - protected Serializable pkVal() { - return this.id; - } -} +package top.kuanghua.integrationfront.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 用户列表(Admin)表实体类 + * + * @author kuanghua + * @since 2021-03-19 10:45:42 + */ +@Data +@ApiModel("用户列表") +@TableName(value = "tb_admin") +public class Admin extends Model { + private Integer id; + private String status; + private Date addTime; + @ApiModelProperty(value = "超级管理员(0.不是,1.是)") + private String isSuper; + @ApiModelProperty(value = "用户名") + private String username; + @ApiModelProperty(value = "密码") + private String password; + @ApiModelProperty(value = "是否删除") + private String isDelete; + @ApiModelProperty(value = "手机号") + private String mobile; + @ApiModelProperty(value = "邮箱") + private String email; + @ApiModelProperty(value = "角色id") + private Integer roleId; + + /** + * 获取主键值 + * + * @return 主键值 + */ + @Override + protected Serializable pkVal() { + return this.id; + } +} diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/entity/Brand.java b/integration-front/src/main/java/top/kuanghua/integrationfront/entity/Brand.java similarity index 94% rename from ty-user/src/main/java/top/kuanghua/tyuser/entity/Brand.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/entity/Brand.java index 272face..95f7886 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/entity/Brand.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/entity/Brand.java @@ -1,50 +1,50 @@ -package top.kuanghua.tyuser.entity; - -import java.util.Date; - -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.activerecord.Model; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; - -/** - * 品牌表(Brand)表实体类 - * - * @author kuanghua - * @since 2021-09-15 11:54:49 - */ -@Data -@ApiModel("品牌表") -@TableName(value = "tb_brand") -public class Brand extends Model { - @ApiModelProperty(value = "品牌id") - private Integer id; - @ApiModelProperty(value = "品牌名称") - private String name; - @ApiModelProperty(value = "品牌图片地址") - private String image; - @ApiModelProperty(value = "品牌的首字母") - private String letter; - @ApiModelProperty(value = "排序") - private Integer seq; - @ApiModelProperty(value = "创建时间",hidden = true) - @TableField(fill = FieldFill.INSERT) - private Date createTime; - @ApiModelProperty(value = "更新时间",hidden = true) - @TableField(fill = FieldFill.UPDATE) - private Date updateTime; - /** - * 获取主键值 - * - * @return 主键值 - */ - @Override - protected Serializable pkVal() { - return this.id; - } -} +package top.kuanghua.integrationfront.entity; + +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * 品牌表(Brand)表实体类 + * + * @author kuanghua + * @since 2021-09-15 11:54:49 + */ +@Data +@ApiModel("品牌表") +@TableName(value = "tb_brand") +public class Brand extends Model { + @ApiModelProperty(value = "品牌id") + private Integer id; + @ApiModelProperty(value = "品牌名称") + private String name; + @ApiModelProperty(value = "品牌图片地址") + private String image; + @ApiModelProperty(value = "品牌的首字母") + private String letter; + @ApiModelProperty(value = "排序") + private Integer seq; + @ApiModelProperty(value = "创建时间",hidden = true) + @TableField(fill = FieldFill.INSERT) + private Date createTime; + @ApiModelProperty(value = "更新时间",hidden = true) + @TableField(fill = FieldFill.UPDATE) + private Date updateTime; + /** + * 获取主键值 + * + * @return 主键值 + */ + @Override + protected Serializable pkVal() { + return this.id; + } +} diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/entity/ErrorCollection.java b/integration-front/src/main/java/top/kuanghua/integrationfront/entity/ErrorCollection.java similarity index 91% rename from ty-user/src/main/java/top/kuanghua/tyuser/entity/ErrorCollection.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/entity/ErrorCollection.java index 3372821..ec1827a 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/entity/ErrorCollection.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/entity/ErrorCollection.java @@ -1,37 +1,35 @@ -package top.kuanghua.tyuser.entity; - -import java.util.Date; - -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.activerecord.Model; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; - -/** - * error_log_collection(ErrorCollection)表实体类 - * @author kuanghua - * @since 2021-10-08 11:37:25 - */ -@Data -@ApiModel("错误日志相关") -@TableName(value = "tb_error_collection") -public class ErrorCollection extends Model { - @ApiModelProperty(value = "id主键") - private Long id; - @ApiModelProperty(value = "错误日志") - private String errorLog; - @ApiModelProperty(value = "页面路径") - private String pageUrl; - @ApiModelProperty(value = "当前版本") - private String version; - @ApiModelProperty(value = "浏览器类型",hidden = true) - private String browserType; - @TableField(fill = FieldFill.INSERT) - @ApiModelProperty(value = "创建时间",hidden = true) - private Date createTime; -} +package top.kuanghua.integrationfront.entity; + +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * error_log_collection(ErrorCollection)表实体类 + * @author kuanghua + * @since 2021-10-08 11:37:25 + */ +@Data +@ApiModel("错误日志相关") +@TableName(value = "tb_error_collection") +public class ErrorCollection extends Model { + @ApiModelProperty(value = "id主键") + private Long id; + @ApiModelProperty(value = "错误日志") + private String errorLog; + @ApiModelProperty(value = "页面路径") + private String pageUrl; + @ApiModelProperty(value = "当前版本") + private String version; + @ApiModelProperty(value = "浏览器类型",hidden = true) + private String browserType; + @TableField(fill = FieldFill.INSERT) + @ApiModelProperty(value = "创建时间",hidden = true) + private Date createTime; +} diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/entity/Role.java b/integration-front/src/main/java/top/kuanghua/integrationfront/entity/Role.java similarity index 93% rename from ty-user/src/main/java/top/kuanghua/tyuser/entity/Role.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/entity/Role.java index 6718ccc..cdf87aa 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/entity/Role.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/entity/Role.java @@ -1,42 +1,42 @@ -package top.kuanghua.tyuser.entity; - -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.activerecord.Model; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import java.io.Serializable; -import java.util.Date; - -/** - * 角色表(Role)表实体类 - * - * @author kuanghua - * @since 2021-01-18 12:12:37 - */ -@Data -@ApiModel("角色表") -@TableName(value = "tb_role") -public class Role extends Model { - @ApiModelProperty(value = "角色id") - private Integer id; - @ApiModelProperty(value = "角色名称") - private String name; - @ApiModelProperty(value = "更新时间") - @TableField(fill = FieldFill.UPDATE) - private Date updateTime; - @ApiModelProperty(value = "创建时间") - @TableField(fill = FieldFill.INSERT) - private Date createdTime; - /** - * 获取主键值 - * - * @return 主键值 - */ - @Override - protected Serializable pkVal() { - return this.id; - } +package top.kuanghua.integrationfront.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; +import java.util.Date; + +/** + * 角色表(Role)表实体类 + * + * @author kuanghua + * @since 2021-01-18 12:12:37 + */ +@Data +@ApiModel("角色表") +@TableName(value = "tb_role") +public class Role extends Model { + @ApiModelProperty(value = "角色id") + private Integer id; + @ApiModelProperty(value = "角色名称") + private String name; + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.UPDATE) + private Date updateTime; + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createdTime; + /** + * 获取主键值 + * + * @return 主键值 + */ + @Override + protected Serializable pkVal() { + return this.id; + } } \ No newline at end of file diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/entity/RoleAccess.java b/integration-front/src/main/java/top/kuanghua/integrationfront/entity/RoleAccess.java similarity index 94% rename from ty-user/src/main/java/top/kuanghua/tyuser/entity/RoleAccess.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/entity/RoleAccess.java index 0a034be..2bccc92 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/entity/RoleAccess.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/entity/RoleAccess.java @@ -1,47 +1,47 @@ -package top.kuanghua.tyuser.entity; - -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.activerecord.Model; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.util.Date; - -/** - * 角色权限表(RoleAccess)表实体类 - * - * @author kuanghua - * @since 2021-01-18 12:12:38 - */ -@Data -@ApiModel("角色权限表") -@TableName(value = "tb_role_access") -public class RoleAccess extends Model { - @ApiModelProperty(value = "主键id") - private Integer id; - @ApiModelProperty(value = "角色id") - private Integer roleId; - @ApiModelProperty(value = "权限id") - private Integer accessId; - @ApiModelProperty(value = "更新时间") - @TableField(fill = FieldFill.UPDATE) - private Date updateTime; - @ApiModelProperty(value = "创建时间") - @TableField(fill = FieldFill.INSERT) - private Date createdTime; - @ApiModelProperty(value = "父id:(0,顶级父类") - private Integer parentId; - /** - * 获取主键值 - * - * @return 主键值 - */ - @Override - protected Serializable pkVal() { - return this.id; - } +package top.kuanghua.integrationfront.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 角色权限表(RoleAccess)表实体类 + * + * @author kuanghua + * @since 2021-01-18 12:12:38 + */ +@Data +@ApiModel("角色权限表") +@TableName(value = "tb_role_access") +public class RoleAccess extends Model { + @ApiModelProperty(value = "主键id") + private Integer id; + @ApiModelProperty(value = "角色id") + private Integer roleId; + @ApiModelProperty(value = "权限id") + private Integer accessId; + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.UPDATE) + private Date updateTime; + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createdTime; + @ApiModelProperty(value = "父id:(0,顶级父类") + private Integer parentId; + /** + * 获取主键值 + * + * @return 主键值 + */ + @Override + protected Serializable pkVal() { + return this.id; + } } \ No newline at end of file diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/entity/User.java b/integration-front/src/main/java/top/kuanghua/integrationfront/entity/User.java similarity index 95% rename from ty-user/src/main/java/top/kuanghua/tyuser/entity/User.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/entity/User.java index 386717d..afaf636 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/entity/User.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/entity/User.java @@ -1,66 +1,66 @@ -package top.kuanghua.tyuser.entity; - -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.activerecord.Model; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Size; -import java.io.Serializable; -import java.util.Date; - -/** - * 用户表;uploadFileBtn;downloadFilebtn(User)表实体类 - * - * @author kuanghua - * @since 2020-12-13 16:59:51 - */ -@Data -@ApiModel("用户表") -@TableName(value = "tb_user") -//https://www.cnblogs.com/Nickc/p/12001764.html -public class User extends Model { - @ApiModelProperty(value = "id",hidden = false) - private Integer id; - @ApiModelProperty(value = "用户名") - @Size(max = 20,min = 5,message = "创建人姓名长度需要在2-20字符长度之间") - private String username; - @ApiModelProperty(value = "密码") - @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) - private String password; - @NotBlank(message = "电话不能为空") - @ApiModelProperty(value = "电话") - private String phone; - @NotBlank(message = "邮箱不能为空") - @ApiModelProperty(value = "邮箱") - private String email; - @ApiModelProperty(value = "创建时间",hidden = true) - @TableField(fill = FieldFill.INSERT) - private Date createTime; - @ApiModelProperty(value = "更新时间",hidden = true) - @TableField(fill = FieldFill.UPDATE) - private Date updateTime; - @ApiModelProperty(value = "是否删除",hidden = true) - @TableLogic - @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) - private String deleted; - @ApiModelProperty(value = "加密的盐",hidden = true) - @TableField() - @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) - private String salt; - /** - * 获取主键值 - * - * @return 主键值 - */ - @Override - protected Serializable pkVal() { - return this.id; - } +package top.kuanghua.integrationfront.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.util.Date; + +/** + * 用户表;uploadFileBtn;downloadFilebtn(User)表实体类 + * + * @author kuanghua + * @since 2020-12-13 16:59:51 + */ +@Data +@ApiModel("用户表") +@TableName(value = "tb_user") +//https://www.cnblogs.com/Nickc/p/12001764.html +public class User extends Model { + @ApiModelProperty(value = "id",hidden = false) + private Integer id; + @ApiModelProperty(value = "用户名") + @Size(max = 20,min = 5,message = "创建人姓名长度需要在2-20字符长度之间") + private String username; + @ApiModelProperty(value = "密码") + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private String password; + @NotBlank(message = "电话不能为空") + @ApiModelProperty(value = "电话") + private String phone; + @NotBlank(message = "邮箱不能为空") + @ApiModelProperty(value = "邮箱") + private String email; + @ApiModelProperty(value = "创建时间",hidden = true) + @TableField(fill = FieldFill.INSERT) + private Date createTime; + @ApiModelProperty(value = "更新时间",hidden = true) + @TableField(fill = FieldFill.UPDATE) + private Date updateTime; + @ApiModelProperty(value = "是否删除",hidden = true) + @TableLogic + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private String deleted; + @ApiModelProperty(value = "加密的盐",hidden = true) + @TableField() + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private String salt; + /** + * 获取主键值 + * + * @return 主键值 + */ + @Override + protected Serializable pkVal() { + return this.id; + } } \ No newline at end of file diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/entity/UserRole.java b/integration-front/src/main/java/top/kuanghua/integrationfront/entity/UserRole.java similarity index 93% rename from ty-user/src/main/java/top/kuanghua/tyuser/entity/UserRole.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/entity/UserRole.java index 8891008..2959f0a 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/entity/UserRole.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/entity/UserRole.java @@ -1,46 +1,46 @@ -package top.kuanghua.tyuser.entity; - -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.activerecord.Model; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.util.Date; - -/** - * 用户角色表(UserRole)表实体类 - * - * @author kuanghua - * @since 2021-01-18 12:12:37 - */ -@Data -@ApiModel("用户角色表") -@TableName(value = "tb_user_role") -public class UserRole extends Model { - @ApiModelProperty(value = "主键id") - private Integer id; - @ApiModelProperty(value = "用户id") - private Integer uid; - @ApiModelProperty(value = "角色id") - private Integer roleId; - @ApiModelProperty(value = "更新时间") - @TableField(fill = FieldFill.UPDATE) - private Date updateTime; - @ApiModelProperty(value = "创建时间") - @TableField(fill = FieldFill.INSERT) - private Date createdTime; - - /** - * 获取主键值 - * - * @return 主键值 - */ - @Override - protected Serializable pkVal() { - return this.id; - } +package top.kuanghua.integrationfront.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 用户角色表(UserRole)表实体类 + * + * @author kuanghua + * @since 2021-01-18 12:12:37 + */ +@Data +@ApiModel("用户角色表") +@TableName(value = "tb_user_role") +public class UserRole extends Model { + @ApiModelProperty(value = "主键id") + private Integer id; + @ApiModelProperty(value = "用户id") + private Integer uid; + @ApiModelProperty(value = "角色id") + private Integer roleId; + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.UPDATE) + private Date updateTime; + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createdTime; + + /** + * 获取主键值 + * + * @return 主键值 + */ + @Override + protected Serializable pkVal() { + return this.id; + } } \ No newline at end of file diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/entity/Vci.java b/integration-front/src/main/java/top/kuanghua/integrationfront/entity/Vci.java similarity index 94% rename from ty-user/src/main/java/top/kuanghua/tyuser/entity/Vci.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/entity/Vci.java index b06117f..d93c11f 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/entity/Vci.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/entity/Vci.java @@ -1,51 +1,51 @@ -package top.kuanghua.tyuser.entity; - -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.activerecord.Model; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.util.Date; - -/** - * VCI设备表(Vci)表实体类 - * - * @author kuanghua - * @since 2021-10-22 10:34:43 - */ -@Data -@ApiModel("VCI设备表") -@TableName(value = "tb_vci") -public class Vci extends Model { - @ApiModelProperty(value = "ID") - private Integer id; - @ApiModelProperty(value = "序列号,唯一") - private String sn; - @ApiModelProperty(value = "硬件版本") - private String hardVersion; - @ApiModelProperty(value = "状态:0:未出库、1:已入库") - private Integer status; - @ApiModelProperty(value = "供应商") - private String supplier; - @ApiModelProperty(value = "商品规格") - private String productSpec; - @ApiModelProperty(value = "入库单号") - private String receiptNo; - @ApiModelProperty(value = "入库时间") - @TableField(fill = FieldFill.INSERT) - private Date createTime; - /** - * 获取主键值 - * - * @return 主键值 - */ - @Override - protected Serializable pkVal() { - return this.id; - } -} - +package top.kuanghua.integrationfront.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * VCI设备表(Vci)表实体类 + * + * @author kuanghua + * @since 2021-10-22 10:34:43 + */ +@Data +@ApiModel("VCI设备表") +@TableName(value = "tb_vci") +public class Vci extends Model { + @ApiModelProperty(value = "ID") + private Integer id; + @ApiModelProperty(value = "序列号,唯一") + private String sn; + @ApiModelProperty(value = "硬件版本") + private String hardVersion; + @ApiModelProperty(value = "状态:0:未出库、1:已入库") + private Integer status; + @ApiModelProperty(value = "供应商") + private String supplier; + @ApiModelProperty(value = "商品规格") + private String productSpec; + @ApiModelProperty(value = "入库单号") + private String receiptNo; + @ApiModelProperty(value = "入库时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + /** + * 获取主键值 + * + * @return 主键值 + */ + @Override + protected Serializable pkVal() { + return this.id; + } +} + diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/excel/cv/VciStatusImpCv.java b/integration-front/src/main/java/top/kuanghua/integrationfront/excel/cv/VciStatusImpCv.java similarity index 94% rename from ty-user/src/main/java/top/kuanghua/tyuser/excel/cv/VciStatusImpCv.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/excel/cv/VciStatusImpCv.java index 309d6fb..08810c3 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/excel/cv/VciStatusImpCv.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/excel/cv/VciStatusImpCv.java @@ -1,35 +1,35 @@ -package top.kuanghua.tyuser.excel.cv; - -import com.alibaba.excel.converters.Converter; -import com.alibaba.excel.metadata.GlobalConfiguration; -import com.alibaba.excel.metadata.data.ReadCellData; -import com.alibaba.excel.metadata.data.WriteCellData; -import com.alibaba.excel.metadata.property.ExcelContentProperty; - -public class VciStatusImpCv implements Converter { - @Override - public Integer convertToJavaData(ReadCellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { - String stringValue = cellData.getStringValue(); - int csId; - if("未入库".equals(stringValue)){ - csId=0; - }else if("已入库".equals(stringValue)){ - csId=1; - }else{ - csId=2; - } - return csId; - } - - //将java的数据类型转为excel数据类型 - @Override - public WriteCellData convertToExcelData(Integer value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { - String cv=""; - if(0==value){ - cv="未入库"; - }else{ - cv="已入库"; - } - return new WriteCellData<>(cv); - } +package top.kuanghua.integrationfront.excel.cv; + +import com.alibaba.excel.converters.Converter; +import com.alibaba.excel.metadata.GlobalConfiguration; +import com.alibaba.excel.metadata.data.ReadCellData; +import com.alibaba.excel.metadata.data.WriteCellData; +import com.alibaba.excel.metadata.property.ExcelContentProperty; + +public class VciStatusImpCv implements Converter { + @Override + public Integer convertToJavaData(ReadCellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { + String stringValue = cellData.getStringValue(); + int csId; + if("未入库".equals(stringValue)){ + csId=0; + }else if("已入库".equals(stringValue)){ + csId=1; + }else{ + csId=2; + } + return csId; + } + + //将java的数据类型转为excel数据类型 + @Override + public WriteCellData convertToExcelData(Integer value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { + String cv=""; + if(0==value){ + cv="未入库"; + }else{ + cv="已入库"; + } + return new WriteCellData<>(cv); + } } \ No newline at end of file diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/excel/cv/VciTimeCv.java b/integration-front/src/main/java/top/kuanghua/integrationfront/excel/cv/VciTimeCv.java similarity index 94% rename from ty-user/src/main/java/top/kuanghua/tyuser/excel/cv/VciTimeCv.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/excel/cv/VciTimeCv.java index e11f0ff..c8d5e54 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/excel/cv/VciTimeCv.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/excel/cv/VciTimeCv.java @@ -1,28 +1,28 @@ -package top.kuanghua.tyuser.excel.cv; - -import com.alibaba.excel.converters.Converter; -import com.alibaba.excel.metadata.GlobalConfiguration; -import com.alibaba.excel.metadata.data.ReadCellData; -import com.alibaba.excel.metadata.data.WriteCellData; -import com.alibaba.excel.metadata.property.ExcelContentProperty; -import top.kuanghua.khcomomon.utils.ObjectUtilsSelf; - -import java.text.SimpleDateFormat; -import java.util.Date; - -public class VciTimeCv implements Converter { - @Override - public Date convertToJavaData(ReadCellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { - String stringValue = cellData.getNumberValue().toString() ; - String DATE_FORMAT = "yyyyMMdd"; - SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_FORMAT); - Date parse = simpleDateFormat.parse(stringValue); - return parse; - } - - @Override - public WriteCellData convertToExcelData(Date value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { - return new WriteCellData<>(ObjectUtilsSelf.formatDateTime(value)); - } - +package top.kuanghua.integrationfront.excel.cv; + +import com.alibaba.excel.converters.Converter; +import com.alibaba.excel.metadata.GlobalConfiguration; +import com.alibaba.excel.metadata.data.ReadCellData; +import com.alibaba.excel.metadata.data.WriteCellData; +import com.alibaba.excel.metadata.property.ExcelContentProperty; +import top.kuanghua.khcomomon.utils.ObjectUtilsSelf; + +import java.text.SimpleDateFormat; +import java.util.Date; + +public class VciTimeCv implements Converter { + @Override + public Date convertToJavaData(ReadCellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { + String stringValue = cellData.getNumberValue().toString() ; + String DATE_FORMAT = "yyyyMMdd"; + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_FORMAT); + Date parse = simpleDateFormat.parse(stringValue); + return parse; + } + + @Override + public WriteCellData convertToExcelData(Date value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { + return new WriteCellData<>(ObjectUtilsSelf.formatDateTime(value)); + } + } \ No newline at end of file diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/excel/imp/VciExcelImp.java b/integration-front/src/main/java/top/kuanghua/integrationfront/excel/imp/VciExcelImp.java similarity index 84% rename from ty-user/src/main/java/top/kuanghua/tyuser/excel/imp/VciExcelImp.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/excel/imp/VciExcelImp.java index 9fd85f9..578b9c3 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/excel/imp/VciExcelImp.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/excel/imp/VciExcelImp.java @@ -1,40 +1,40 @@ -package top.kuanghua.tyuser.excel.imp; - -import com.alibaba.excel.annotation.ExcelProperty; -import lombok.Data; -import top.kuanghua.tyuser.excel.cv.VciStatusImpCv; -import top.kuanghua.tyuser.excel.cv.VciTimeCv; - -import java.util.Date; - -/** - * VCI设备表(Vci)表实体类 - * @author kuanghua - * @since 2021-10-22 10:34:43 - */ -@Data -public class VciExcelImp{ - //供应商 - @ExcelProperty(value = "供应商") - private String supplier; - // 商品名称 - // 设备号 - @ExcelProperty(value = "设备号") - private String sn; - // 硬件版本 - @ExcelProperty(value = "硬件版本") - private String hardVersion; - // 商品规格 - @ExcelProperty(value = "商品规格") - private String productSpec; - // 入库单号(批次号) - @ExcelProperty(value = "入库单号(批次号)") - private String receiptNo; - // 入库状态 - @ExcelProperty(value = "入库状态",converter = VciStatusImpCv.class) - private Integer status; - // 入库时间 - @ExcelProperty(value = "入库时间",converter = VciTimeCv.class) - private Date createTime; -} - +package top.kuanghua.integrationfront.excel.imp; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; +import top.kuanghua.integrationfront.excel.cv.VciStatusImpCv; +import top.kuanghua.integrationfront.excel.cv.VciTimeCv; + +import java.util.Date; + +/** + * VCI设备表(Vci)表实体类 + * @author kuanghua + * @since 2021-10-22 10:34:43 + */ +@Data +public class VciExcelImp{ + //供应商 + @ExcelProperty(value = "供应商") + private String supplier; + // 商品名称 + // 设备号 + @ExcelProperty(value = "设备号") + private String sn; + // 硬件版本 + @ExcelProperty(value = "硬件版本") + private String hardVersion; + // 商品规格 + @ExcelProperty(value = "商品规格") + private String productSpec; + // 入库单号(批次号) + @ExcelProperty(value = "入库单号(批次号)") + private String receiptNo; + // 入库状态 + @ExcelProperty(value = "入库状态",converter = VciStatusImpCv.class) + private Integer status; + // 入库时间 + @ExcelProperty(value = "入库时间",converter = VciTimeCv.class) + private Date createTime; +} + diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/mapper/AccessMapper.java b/integration-front/src/main/java/top/kuanghua/integrationfront/mapper/AccessMapper.java similarity index 69% rename from ty-user/src/main/java/top/kuanghua/tyuser/mapper/AccessMapper.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/mapper/AccessMapper.java index 24012ff..e491c13 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/mapper/AccessMapper.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/mapper/AccessMapper.java @@ -1,14 +1,14 @@ -package top.kuanghua.tyuser.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import top.kuanghua.tyuser.entity.Access; - -/** - * 权限表(Access)表数据库访问层 - * - * @author kuanghua - * @since 2021-01-18 12:12:37 - */ -public interface AccessMapper extends BaseMapper { - +package top.kuanghua.integrationfront.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import top.kuanghua.integrationfront.entity.Access; + +/** + * 权限表(Access)表数据库访问层 + * + * @author kuanghua + * @since 2021-01-18 12:12:37 + */ +public interface AccessMapper extends BaseMapper { + } \ No newline at end of file diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/mapper/AdminMapper.java b/integration-front/src/main/java/top/kuanghua/integrationfront/mapper/AdminMapper.java similarity index 84% rename from ty-user/src/main/java/top/kuanghua/tyuser/mapper/AdminMapper.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/mapper/AdminMapper.java index dc802f5..952659d 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/mapper/AdminMapper.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/mapper/AdminMapper.java @@ -1,21 +1,21 @@ -package top.kuanghua.tyuser.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.apache.ibatis.annotations.Param; -import top.kuanghua.tyuser.entity.Admin; - -import java.util.Map; - -/** - * 用户列表(Admin)表数据库访问层 - * - * @author kuanghua - * @since 2021-03-19 10:45:42 - */ -public interface AdminMapper extends BaseMapper { - -// List selectListAdmin(Admin admin); - Page> selectListAdmin(Page> pagination, @Param("admin") Admin admin); - -} +package top.kuanghua.integrationfront.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import top.kuanghua.integrationfront.entity.Admin; + +import java.util.Map; + +/** + * 用户列表(Admin)表数据库访问层 + * + * @author kuanghua + * @since 2021-03-19 10:45:42 + */ +public interface AdminMapper extends BaseMapper { + +// List selectListAdmin(Admin admin); + Page> selectListAdmin(Page> pagination, @Param("admin") Admin admin); + +} diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/mapper/BrandMapper.java b/integration-front/src/main/java/top/kuanghua/integrationfront/mapper/BrandMapper.java similarity index 54% rename from ty-user/src/main/java/top/kuanghua/tyuser/mapper/BrandMapper.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/mapper/BrandMapper.java index 71a79d2..1802051 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/mapper/BrandMapper.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/mapper/BrandMapper.java @@ -1,8 +1,8 @@ -package top.kuanghua.tyuser.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import top.kuanghua.tyuser.entity.Brand; - -public interface BrandMapper extends BaseMapper { - -} +package top.kuanghua.integrationfront.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import top.kuanghua.integrationfront.entity.Brand; + +public interface BrandMapper extends BaseMapper { + +} diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/mapper/ErrorCollectionMapper.java b/integration-front/src/main/java/top/kuanghua/integrationfront/mapper/ErrorCollectionMapper.java similarity index 56% rename from ty-user/src/main/java/top/kuanghua/tyuser/mapper/ErrorCollectionMapper.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/mapper/ErrorCollectionMapper.java index 0038cef..2502d46 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/mapper/ErrorCollectionMapper.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/mapper/ErrorCollectionMapper.java @@ -1,8 +1,8 @@ -package top.kuanghua.tyuser.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import top.kuanghua.tyuser.entity.ErrorCollection; - -public interface ErrorCollectionMapper extends BaseMapper { - -} +package top.kuanghua.integrationfront.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import top.kuanghua.integrationfront.entity.ErrorCollection; + +public interface ErrorCollectionMapper extends BaseMapper { + +} diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/mapper/MultiPageMapper.java b/integration-front/src/main/java/top/kuanghua/integrationfront/mapper/MultiPageMapper.java similarity index 88% rename from ty-user/src/main/java/top/kuanghua/tyuser/mapper/MultiPageMapper.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/mapper/MultiPageMapper.java index af9268b..042d753 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/mapper/MultiPageMapper.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/mapper/MultiPageMapper.java @@ -1,16 +1,16 @@ -package top.kuanghua.tyuser.mapper; - -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.apache.ibatis.annotations.Select; - -import java.util.Map; -/** - * @Title: MultiPageMapper - * @Description: - * @Auther: kuanghua - * @create 2020/12/15 19:34 - */ -public interface MultiPageMapper { - @Select("select phone,username,create_time from user") - Page> queryAllUsers(Page> pagination); -} +package top.kuanghua.integrationfront.mapper; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Select; + +import java.util.Map; +/** + * @Title: MultiPageMapper + * @Description: + * @Auther: kuanghua + * @create 2020/12/15 19:34 + */ +public interface MultiPageMapper { + @Select("select phone,username,create_time from user") + Page> queryAllUsers(Page> pagination); +} diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/mapper/RoleAccessMapper.java b/integration-front/src/main/java/top/kuanghua/integrationfront/mapper/RoleAccessMapper.java similarity index 70% rename from ty-user/src/main/java/top/kuanghua/tyuser/mapper/RoleAccessMapper.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/mapper/RoleAccessMapper.java index f3b2136..9ecc334 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/mapper/RoleAccessMapper.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/mapper/RoleAccessMapper.java @@ -1,14 +1,14 @@ -package top.kuanghua.tyuser.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import top.kuanghua.tyuser.entity.RoleAccess; - -/** - * 角色权限表(RoleAccess)表数据库访问层 - * - * @author kuanghua - * @since 2021-01-18 12:12:38 - */ -public interface RoleAccessMapper extends BaseMapper { - +package top.kuanghua.integrationfront.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import top.kuanghua.integrationfront.entity.RoleAccess; + +/** + * 角色权限表(RoleAccess)表数据库访问层 + * + * @author kuanghua + * @since 2021-01-18 12:12:38 + */ +public interface RoleAccessMapper extends BaseMapper { + } \ No newline at end of file diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/mapper/RoleMapper.java b/integration-front/src/main/java/top/kuanghua/integrationfront/mapper/RoleMapper.java similarity index 69% rename from ty-user/src/main/java/top/kuanghua/tyuser/mapper/RoleMapper.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/mapper/RoleMapper.java index 9e088e9..3e09425 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/mapper/RoleMapper.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/mapper/RoleMapper.java @@ -1,14 +1,14 @@ -package top.kuanghua.tyuser.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import top.kuanghua.tyuser.entity.Role; - -/** - * 角色表(Role)表数据库访问层 - * - * @author kuanghua - * @since 2021-01-18 12:12:38 - */ -public interface RoleMapper extends BaseMapper { - +package top.kuanghua.integrationfront.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import top.kuanghua.integrationfront.entity.Role; + +/** + * 角色表(Role)表数据库访问层 + * + * @author kuanghua + * @since 2021-01-18 12:12:38 + */ +public interface RoleMapper extends BaseMapper { + } \ No newline at end of file diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/mapper/UserMapper.java b/integration-front/src/main/java/top/kuanghua/integrationfront/mapper/UserMapper.java similarity index 72% rename from ty-user/src/main/java/top/kuanghua/tyuser/mapper/UserMapper.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/mapper/UserMapper.java index a56cd03..b96a25f 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/mapper/UserMapper.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/mapper/UserMapper.java @@ -1,15 +1,15 @@ -package top.kuanghua.tyuser.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import top.kuanghua.tyuser.entity.User; - - -/** - * 用户表;uploadFileBtn;downloadFilebtn(User)表数据库访问层 - * - * @author kuanghua - * @since 2020-12-13 16:13:15 - */ -public interface UserMapper extends BaseMapper { - +package top.kuanghua.integrationfront.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import top.kuanghua.integrationfront.entity.User; + + +/** + * 用户表;uploadFileBtn;downloadFilebtn(User)表数据库访问层 + * + * @author kuanghua + * @since 2020-12-13 16:13:15 + */ +public interface UserMapper extends BaseMapper { + } \ No newline at end of file diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/mapper/UserRoleMapper.java b/integration-front/src/main/java/top/kuanghua/integrationfront/mapper/UserRoleMapper.java similarity index 70% rename from ty-user/src/main/java/top/kuanghua/tyuser/mapper/UserRoleMapper.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/mapper/UserRoleMapper.java index d776d97..24eccec 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/mapper/UserRoleMapper.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/mapper/UserRoleMapper.java @@ -1,14 +1,14 @@ -package top.kuanghua.tyuser.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import top.kuanghua.tyuser.entity.UserRole; - -/** - * 用户角色表(UserRole)表数据库访问层 - * - * @author kuanghua - * @since 2021-01-18 12:12:37 - */ -public interface UserRoleMapper extends BaseMapper { - +package top.kuanghua.integrationfront.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import top.kuanghua.integrationfront.entity.UserRole; + +/** + * 用户角色表(UserRole)表数据库访问层 + * + * @author kuanghua + * @since 2021-01-18 12:12:37 + */ +public interface UserRoleMapper extends BaseMapper { + } \ No newline at end of file diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/mapper/VciMapper.java b/integration-front/src/main/java/top/kuanghua/integrationfront/mapper/VciMapper.java similarity index 54% rename from ty-user/src/main/java/top/kuanghua/tyuser/mapper/VciMapper.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/mapper/VciMapper.java index 7f1e3c9..e059109 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/mapper/VciMapper.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/mapper/VciMapper.java @@ -1,8 +1,8 @@ -package top.kuanghua.tyuser.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import top.kuanghua.tyuser.entity.Vci; - -public interface VciMapper extends BaseMapper { - -} +package top.kuanghua.integrationfront.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import top.kuanghua.integrationfront.entity.Vci; + +public interface VciMapper extends BaseMapper { + +} diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/service/AccessService.java b/integration-front/src/main/java/top/kuanghua/integrationfront/service/AccessService.java similarity index 90% rename from ty-user/src/main/java/top/kuanghua/tyuser/service/AccessService.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/service/AccessService.java index a93213c..b034640 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/service/AccessService.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/service/AccessService.java @@ -1,49 +1,49 @@ -package top.kuanghua.tyuser.service; - -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.springframework.stereotype.Service; -import top.kuanghua.tyuser.entity.Access; -import top.kuanghua.tyuser.mapper.AccessMapper; - -import javax.annotation.Resource; -import java.util.*; -import java.util.stream.Collectors; - -/** - * @author kuanghua - * @since 2020-10-27 20:54:24 - */ -@Service -public class AccessService { - - @Resource - private AccessMapper accessMapper; - - public Page selectPage(Integer pageNum, Integer pageSize, - Access access) { - QueryWrapper queryWrapper = new QueryWrapper<>(access); - return this.accessMapper.selectPage(new Page(pageNum, pageSize), queryWrapper); - } - - public int insert(Access access) { - return this.accessMapper.insert(access); - } - - public int updateById(Access access) { - return this.accessMapper.updateById(access); - } - /*查询权限树*/ - public List selectAccessTree(){ - /*根据id查询parent_id为0的父元素在查询下面的子元素*/ - List accessList = this.accessMapper.selectList(new QueryWrapper().eq("parent_id", 0)); - List listStreamMap = accessList.stream().map(mItem -> { - Map coversMap = JSON.parseObject(JSON.toJSONString(mItem), Map.class); - List selectList = this.accessMapper.selectList(new QueryWrapper().eq("parent_id", mItem.getId())); - coversMap.put("children",selectList); - return coversMap; - }).collect(Collectors.toList()); - return listStreamMap; - } +package top.kuanghua.integrationfront.service; + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.stereotype.Service; +import top.kuanghua.integrationfront.entity.Access; +import top.kuanghua.integrationfront.mapper.AccessMapper; + +import javax.annotation.Resource; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author kuanghua + * @since 2020-10-27 20:54:24 + */ +@Service +public class AccessService { + + @Resource + private AccessMapper accessMapper; + + public Page selectPage(Integer pageNum, Integer pageSize, + Access access) { + QueryWrapper queryWrapper = new QueryWrapper<>(access); + return this.accessMapper.selectPage(new Page(pageNum, pageSize), queryWrapper); + } + + public int insert(Access access) { + return this.accessMapper.insert(access); + } + + public int updateById(Access access) { + return this.accessMapper.updateById(access); + } + /*查询权限树*/ + public List selectAccessTree(){ + /*根据id查询parent_id为0的父元素在查询下面的子元素*/ + List accessList = this.accessMapper.selectList(new QueryWrapper().eq("parent_id", 0)); + List listStreamMap = accessList.stream().map(mItem -> { + Map coversMap = JSON.parseObject(JSON.toJSONString(mItem), Map.class); + List selectList = this.accessMapper.selectList(new QueryWrapper().eq("parent_id", mItem.getId())); + coversMap.put("children",selectList); + return coversMap; + }).collect(Collectors.toList()); + return listStreamMap; + } } \ No newline at end of file diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/service/AdminService.java b/integration-front/src/main/java/top/kuanghua/integrationfront/service/AdminService.java similarity index 83% rename from ty-user/src/main/java/top/kuanghua/tyuser/service/AdminService.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/service/AdminService.java index 1ce4297..516747a 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/service/AdminService.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/service/AdminService.java @@ -1,41 +1,41 @@ -package top.kuanghua.tyuser.service; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.springframework.stereotype.Service; -import top.kuanghua.tyuser.entity.Admin; -import top.kuanghua.tyuser.mapper.AdminMapper; - -import javax.annotation.Resource; - -/** - * (Admin) - * - * @author kuanghua - * @since 2020-10-27 20:54:24 - */ -@Service -public class AdminService { - - @Resource - private AdminMapper adminMapper; - - public Page selectPage(Integer pageNum, Integer pageSize, - Admin admin) { - QueryWrapper queryWrapper = new QueryWrapper<>(admin); - return this.adminMapper.selectPage(new Page(pageNum, pageSize), queryWrapper); - } - - public int insert(Admin admin) { - return this.adminMapper.insert(admin); - } - - public int updateById(Admin admin) { - return this.adminMapper.updateById(admin); - } - - - // - - -} +package top.kuanghua.integrationfront.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.stereotype.Service; +import top.kuanghua.integrationfront.entity.Admin; +import top.kuanghua.integrationfront.mapper.AdminMapper; + +import javax.annotation.Resource; + +/** + * (Admin) + * + * @author kuanghua + * @since 2020-10-27 20:54:24 + */ +@Service +public class AdminService { + + @Resource + private AdminMapper adminMapper; + + public Page selectPage(Integer pageNum, Integer pageSize, + Admin admin) { + QueryWrapper queryWrapper = new QueryWrapper<>(admin); + return this.adminMapper.selectPage(new Page(pageNum, pageSize), queryWrapper); + } + + public int insert(Admin admin) { + return this.adminMapper.insert(admin); + } + + public int updateById(Admin admin) { + return this.adminMapper.updateById(admin); + } + + + // + + +} diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/service/BrandService.java b/integration-front/src/main/java/top/kuanghua/integrationfront/service/BrandService.java similarity index 87% rename from ty-user/src/main/java/top/kuanghua/tyuser/service/BrandService.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/service/BrandService.java index 8a0a519..a5578db 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/service/BrandService.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/service/BrandService.java @@ -1,51 +1,51 @@ -package top.kuanghua.tyuser.service; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.springframework.stereotype.Service; -import top.kuanghua.tyuser.entity.Brand; -import top.kuanghua.tyuser.mapper.BrandMapper; - -import javax.annotation.Resource; -import java.util.List; - -/** - * (Brand) - * - * @author kuanghua - * @since 2021-09-15 11:54:48 - */ -@Service -public class BrandService { - - @Resource - private BrandMapper brandMapper; - - public Page selectPage(Integer pageNum, Integer pageSize, QueryWrapper queryWrapper) { - return this.brandMapper.selectPage(new Page(pageNum, pageSize), queryWrapper); - } - - public Brand selectById(Integer id) { - return this.brandMapper.selectById(id); - } - - public List selectBatchIds(List idList) { - return this.brandMapper.selectBatchIds(idList); - } - - public int insert(Brand brand) { - return this.brandMapper.insert(brand); - } - - public int updateById(Brand brand) { - return this.brandMapper.updateById(brand); - } - - public int deleteById(Integer id) { - return this.brandMapper.deleteById(id); - } - - public int deleteBatchIds(List idList) { - return this.brandMapper.deleteBatchIds(idList); - } -} +package top.kuanghua.integrationfront.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.stereotype.Service; +import top.kuanghua.integrationfront.entity.Brand; +import top.kuanghua.integrationfront.mapper.BrandMapper; + +import javax.annotation.Resource; +import java.util.List; + +/** + * (Brand) + * + * @author kuanghua + * @since 2021-09-15 11:54:48 + */ +@Service +public class BrandService { + + @Resource + private BrandMapper brandMapper; + + public Page selectPage(Integer pageNum, Integer pageSize, QueryWrapper queryWrapper) { + return this.brandMapper.selectPage(new Page(pageNum, pageSize), queryWrapper); + } + + public Brand selectById(Integer id) { + return this.brandMapper.selectById(id); + } + + public List selectBatchIds(List idList) { + return this.brandMapper.selectBatchIds(idList); + } + + public int insert(Brand brand) { + return this.brandMapper.insert(brand); + } + + public int updateById(Brand brand) { + return this.brandMapper.updateById(brand); + } + + public int deleteById(Integer id) { + return this.brandMapper.deleteById(id); + } + + public int deleteBatchIds(List idList) { + return this.brandMapper.deleteBatchIds(idList); + } +} diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/service/ErrorCollectionService.java b/integration-front/src/main/java/top/kuanghua/integrationfront/service/ErrorCollectionService.java similarity index 88% rename from ty-user/src/main/java/top/kuanghua/tyuser/service/ErrorCollectionService.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/service/ErrorCollectionService.java index 8e6ae57..b773558 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/service/ErrorCollectionService.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/service/ErrorCollectionService.java @@ -1,51 +1,51 @@ -package top.kuanghua.tyuser.service; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.springframework.stereotype.Service; -import top.kuanghua.tyuser.entity.ErrorCollection; -import top.kuanghua.tyuser.mapper.ErrorCollectionMapper; - -import javax.annotation.Resource; -import java.util.List; - -/** - * (ErrorCollection) - * - * @author kuanghua - * @since 2021-10-08 11:37:24 - */ -@Service -public class ErrorCollectionService { - - @Resource - private ErrorCollectionMapper errorCollectionMapper; - - public Page selectPage(Integer pageNum, Integer pageSize, QueryWrapper queryWrapper) { - return this.errorCollectionMapper.selectPage(new Page(pageNum, pageSize), queryWrapper); - } - - public ErrorCollection selectById(Integer id) { - return this.errorCollectionMapper.selectById(id); - } - - public List selectBatchIds(List idList) { - return this.errorCollectionMapper.selectBatchIds(idList); - } - - public int insert(ErrorCollection errorCollection) { - return this.errorCollectionMapper.insert(errorCollection); - } - - public int updateById(ErrorCollection errorCollection) { - return this.errorCollectionMapper.updateById(errorCollection); - } - - public int deleteById(Integer id) { - return this.errorCollectionMapper.deleteById(id); - } - - public int deleteBatchIds(List idList) { - return this.errorCollectionMapper.deleteBatchIds(idList); - } -} +package top.kuanghua.integrationfront.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.stereotype.Service; +import top.kuanghua.integrationfront.entity.ErrorCollection; +import top.kuanghua.integrationfront.mapper.ErrorCollectionMapper; + +import javax.annotation.Resource; +import java.util.List; + +/** + * (ErrorCollection) + * + * @author kuanghua + * @since 2021-10-08 11:37:24 + */ +@Service +public class ErrorCollectionService { + + @Resource + private ErrorCollectionMapper errorCollectionMapper; + + public Page selectPage(Integer pageNum, Integer pageSize, QueryWrapper queryWrapper) { + return this.errorCollectionMapper.selectPage(new Page(pageNum, pageSize), queryWrapper); + } + + public ErrorCollection selectById(Integer id) { + return this.errorCollectionMapper.selectById(id); + } + + public List selectBatchIds(List idList) { + return this.errorCollectionMapper.selectBatchIds(idList); + } + + public int insert(ErrorCollection errorCollection) { + return this.errorCollectionMapper.insert(errorCollection); + } + + public int updateById(ErrorCollection errorCollection) { + return this.errorCollectionMapper.updateById(errorCollection); + } + + public int deleteById(Integer id) { + return this.errorCollectionMapper.deleteById(id); + } + + public int deleteBatchIds(List idList) { + return this.errorCollectionMapper.deleteBatchIds(idList); + } +} diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/service/RoleAccessService.java b/integration-front/src/main/java/top/kuanghua/integrationfront/service/RoleAccessService.java similarity index 84% rename from ty-user/src/main/java/top/kuanghua/tyuser/service/RoleAccessService.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/service/RoleAccessService.java index cdb6eec..5c44564 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/service/RoleAccessService.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/service/RoleAccessService.java @@ -1,37 +1,37 @@ -package top.kuanghua.tyuser.service; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.springframework.stereotype.Service; -import top.kuanghua.tyuser.entity.RoleAccess; -import top.kuanghua.tyuser.mapper.RoleAccessMapper; - -import javax.annotation.Resource; - -/** - * (RoleAccess) - * - * @author kuanghua - * @since 2020-10-27 20:54:24 - */ -@Service -public class RoleAccessService { - - @Resource - private RoleAccessMapper roleAccessMapper; - - public Page selectPage(Integer pageNum, Integer pageSize, - RoleAccess roleAccess) { - QueryWrapper queryWrapper = new QueryWrapper<>(roleAccess); - return this.roleAccessMapper.selectPage(new Page(pageNum, pageSize), queryWrapper); - } - - public int insert(RoleAccess roleAccess) { - return this.roleAccessMapper.insert(roleAccess); - } - - public int updateById(RoleAccess roleAccess) { - return this.roleAccessMapper.updateById(roleAccess); - } - +package top.kuanghua.integrationfront.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.stereotype.Service; +import top.kuanghua.integrationfront.entity.RoleAccess; +import top.kuanghua.integrationfront.mapper.RoleAccessMapper; + +import javax.annotation.Resource; + +/** + * (RoleAccess) + * + * @author kuanghua + * @since 2020-10-27 20:54:24 + */ +@Service +public class RoleAccessService { + + @Resource + private RoleAccessMapper roleAccessMapper; + + public Page selectPage(Integer pageNum, Integer pageSize, + RoleAccess roleAccess) { + QueryWrapper queryWrapper = new QueryWrapper<>(roleAccess); + return this.roleAccessMapper.selectPage(new Page(pageNum, pageSize), queryWrapper); + } + + public int insert(RoleAccess roleAccess) { + return this.roleAccessMapper.insert(roleAccess); + } + + public int updateById(RoleAccess roleAccess) { + return this.roleAccessMapper.updateById(roleAccess); + } + } \ No newline at end of file diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/service/RoleService.java b/integration-front/src/main/java/top/kuanghua/integrationfront/service/RoleService.java similarity index 83% rename from ty-user/src/main/java/top/kuanghua/tyuser/service/RoleService.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/service/RoleService.java index 48ab56d..4bdf8e4 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/service/RoleService.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/service/RoleService.java @@ -1,37 +1,37 @@ -package top.kuanghua.tyuser.service; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.springframework.stereotype.Service; -import top.kuanghua.tyuser.entity.Role; -import top.kuanghua.tyuser.mapper.RoleMapper; - -import javax.annotation.Resource; - -/** - * (Role) - * - * @author kuanghua - * @since 2020-10-27 20:54:24 - */ -@Service -public class RoleService { - - @Resource - private RoleMapper roleMapper; - - public Page selectPage(Integer pageNum, Integer pageSize, - Role role) { - QueryWrapper queryWrapper = new QueryWrapper<>(role); - return this.roleMapper.selectPage(new Page(pageNum, pageSize), queryWrapper); - } - - public int insert(Role role) { - return this.roleMapper.insert(role); - } - - public int updateById(Role role) { - return this.roleMapper.updateById(role); - } - +package top.kuanghua.integrationfront.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.stereotype.Service; +import top.kuanghua.integrationfront.entity.Role; +import top.kuanghua.integrationfront.mapper.RoleMapper; + +import javax.annotation.Resource; + +/** + * (Role) + * + * @author kuanghua + * @since 2020-10-27 20:54:24 + */ +@Service +public class RoleService { + + @Resource + private RoleMapper roleMapper; + + public Page selectPage(Integer pageNum, Integer pageSize, + Role role) { + QueryWrapper queryWrapper = new QueryWrapper<>(role); + return this.roleMapper.selectPage(new Page(pageNum, pageSize), queryWrapper); + } + + public int insert(Role role) { + return this.roleMapper.insert(role); + } + + public int updateById(Role role) { + return this.roleMapper.updateById(role); + } + } \ No newline at end of file diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/service/UserRoleService.java b/integration-front/src/main/java/top/kuanghua/integrationfront/service/UserRoleService.java similarity index 84% rename from ty-user/src/main/java/top/kuanghua/tyuser/service/UserRoleService.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/service/UserRoleService.java index 3d6da4c..827312b 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/service/UserRoleService.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/service/UserRoleService.java @@ -1,37 +1,37 @@ -package top.kuanghua.tyuser.service; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.springframework.stereotype.Service; -import top.kuanghua.tyuser.entity.UserRole; -import top.kuanghua.tyuser.mapper.UserRoleMapper; - -import javax.annotation.Resource; - -/** - * (UserRole) - * - * @author kuanghua - * @since 2020-10-27 20:54:24 - */ -@Service -public class UserRoleService { - - @Resource - private UserRoleMapper userRoleMapper; - - public Page selectPage(Integer pageNum, Integer pageSize, - UserRole userRole) { - QueryWrapper queryWrapper = new QueryWrapper<>(userRole); - return this.userRoleMapper.selectPage(new Page(pageNum, pageSize), queryWrapper); - } - - public int insert(UserRole userRole) { - return this.userRoleMapper.insert(userRole); - } - - public int updateById(UserRole userRole) { - return this.userRoleMapper.updateById(userRole); - } - +package top.kuanghua.integrationfront.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.stereotype.Service; +import top.kuanghua.integrationfront.entity.UserRole; +import top.kuanghua.integrationfront.mapper.UserRoleMapper; + +import javax.annotation.Resource; + +/** + * (UserRole) + * + * @author kuanghua + * @since 2020-10-27 20:54:24 + */ +@Service +public class UserRoleService { + + @Resource + private UserRoleMapper userRoleMapper; + + public Page selectPage(Integer pageNum, Integer pageSize, + UserRole userRole) { + QueryWrapper queryWrapper = new QueryWrapper<>(userRole); + return this.userRoleMapper.selectPage(new Page(pageNum, pageSize), queryWrapper); + } + + public int insert(UserRole userRole) { + return this.userRoleMapper.insert(userRole); + } + + public int updateById(UserRole userRole) { + return this.userRoleMapper.updateById(userRole); + } + } \ No newline at end of file diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/service/UserService.java b/integration-front/src/main/java/top/kuanghua/integrationfront/service/UserService.java similarity index 70% rename from ty-user/src/main/java/top/kuanghua/tyuser/service/UserService.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/service/UserService.java index df5a045..96abf0d 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/service/UserService.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/service/UserService.java @@ -1,232 +1,228 @@ -package top.kuanghua.tyuser.service; - -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.redis.core.StringRedisTemplate; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.ObjectUtils; -import top.kuanghua.feign.tyauth.feign.TokenFeign; -import top.kuanghua.feign.tyexecl.feign.ExcelFeign; -import top.kuanghua.khcomomon.entity.ResResult; -import top.kuanghua.khcomomon.utils.CodecUtils; -import top.kuanghua.khcomomon.utils.ObjectUtilsSelf; -import top.kuanghua.tyuser.entity.User; -import top.kuanghua.tyuser.mapper.UserMapper; - -import javax.annotation.Resource; -import java.text.MessageFormat; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * (User) - * - * @author kuanghua - * @since 2020-10-27 20:54:24 - */ -@Service -@Slf4j -public class UserService { - @Resource - private UserMapper userMapper; - - @Resource - private ExcelFeign excelFeign; - - @Resource - private TokenFeign tokenFeign; - @Autowired - private StringRedisTemplate stringRedisTemplate; - - public void registry(User user, String code) throws Exception { - QueryWrapper queryWrapper = new QueryWrapper() - .select("phone") - .eq("phone", user.getPhone()); - Boolean bl = this.userMapper.selectCount(queryWrapper) == 1; - if (bl) { - throw new Exception("手机号已存在"); - } - String codeStr = stringRedisTemplate.opsForValue().get("user:code:phone:" + user.getPhone()); - if (StringUtils.isEmpty(codeStr)) { - throw new Exception("验证码失效,请重新获取"); - } - if (!Objects.equals(codeStr, code)) { - throw new Exception("验证码输入错误"); - } - String salt = CodecUtils.generateSalt(); - user.setSalt(salt); - user.setPassword(CodecUtils.md5Hex(user.getPassword(), salt)); - boolean insertBl = this.userMapper.insert(user) == 1; - if (insertBl) { - //删除redis中的code - this.stringRedisTemplate.delete("user:code:phone:" + user.getPhone()); - } else { - throw new Exception("用户注册失败"); - } - } - - @Transactional(rollbackFor = Exception.class) - public Object insert(User user) { - return this.userMapper.insert(user); - } - - - @Transactional(rollbackFor = Exception.class) - public Object updateById(User user) { - int updateById = this.userMapper.updateById(user); - int i = 10 / 0; - return updateById; - } - - /** - * 登出 - */ - public void loginOut() { - return; - } - - /** - * 用户注册 - * - * @param code - * @param username - * @param password - */ - public void userRegister(String email, String code, String username, String password) { - - //user表中查询用户是否重复 - QueryWrapper queryWrapper = new QueryWrapper() - .eq("username", username); - if (this.userMapper.selectCount(queryWrapper) == 1) { - throw new RuntimeException(MessageFormat.format("账号【{0}】已存在,请误重复注册", username)); - } - - //去ty-execl中查询用户名是否存在 - ResResult resResult = excelFeign.selectExcelByUser(username); - List list = ObjectUtilsSelf.parseResToList(resResult); - if (list.size() == 0) { - throw new RuntimeException(MessageFormat.format("考勤表中不存在用户名【{0}】", username)); - } - - //校验验证码 - String codeInfo = stringRedisTemplate.opsForValue().get("email.code.routing.name" + email); - Map map = JSON.parseObject(codeInfo); - if (ObjectUtilsSelf.isEmpty(map)) { - throw new RuntimeException("验证码失效,请重新获取"); - } - if (!Objects.equals(map.get("code"), code)) { - throw new RuntimeException("验证码不正确"); - } - //插入数据,用户添加成功 - User userEt = new User(); - userEt.setPassword(password); - userEt.setEmail(email); - userEt.setUsername(username); - //添加盐设置密码为md5 - String salt = CodecUtils.generateSalt(); - userEt.setSalt(salt); - userEt.setPassword(CodecUtils.md5Hex(userEt.getPassword(), salt)); - boolean inResult = userMapper.insert(userEt) == 1; - if (!inResult) { - throw new RuntimeException("插入失败"); - } - } - - /** - * 用户登录 - * - * @param user - * @return - * @throws Exception - */ - public HashMap loginValid(User user) { - QueryWrapper phoneQW = new QueryWrapper().like("email", user.getEmail()) - .or().eq("username", user.getUsername()); - User resUser = this.userMapper.selectOne(phoneQW); - if (ObjectUtils.isEmpty(resUser)) { - throw new RuntimeException("用户不存在"); - } - - if (!resUser.getPassword().equals(CodecUtils.md5Hex(user.getPassword(), resUser.getSalt()))) { - throw new RuntimeException("用户名或密码错误"); - } - //生成jwt token - HashMap hm = new HashMap<>(); - hm.put("username", resUser.getUsername()); - hm.put("email", resUser.getEmail()); - ResResult resResult = tokenFeign.generateToken(hm); - - hm.put("jwtToken", resResult.getData()); - return hm; - } - - /*修改用户密码*/ - public void changePassword(String username, String oldPassword, String newPassword) { - //校验oldPassword是否正确 - QueryWrapper qw = new QueryWrapper() - .eq("username", username); - - User resUser = this.userMapper.selectOne(qw); - if (ObjectUtilsSelf.isEmpty(resUser)) { - throw new RuntimeException("用户不存在"); - } - if (!resUser.getPassword().equals(CodecUtils.md5Hex(oldPassword, resUser.getSalt()))) { - throw new RuntimeException("密码错误"); - } - - //设置新的密码 - String salt = CodecUtils.generateSalt(); - resUser.setSalt(salt); - resUser.setPassword(CodecUtils.md5Hex(newPassword, salt)); - boolean insertBl = this.userMapper.updateById(resUser) == 1; - if (!insertBl) { - throw new RuntimeException("修改密码失败"); - } - } - - - /** - * 插入用户 - * - * @param username 用户名 - */ - public void insertUser(String username) { - //先查询当前用户是否存在不存在则导入 - QueryWrapper qw = new QueryWrapper() - .eq("username", username); - - User resUser = this.userMapper.selectOne(qw); - if (ObjectUtilsSelf.isEmpty(resUser)) { - //添加盐设置密码为md5 - User user = new User(); - user.setPassword("123456"); - user.setUsername(username); - String salt = CodecUtils.generateSalt(); - user.setSalt(salt); - user.setPassword(CodecUtils.md5Hex(user.getPassword(), salt)); - userMapper.insert(user); - } - } - - - /** - * 重置用用户名:如果用用户存在先删除原有用户在新增一个用户,没有则新建用户 - */ - public void resetUser(String username) { - QueryWrapper userWrap = new QueryWrapper().eq("username", username); - List users = userMapper.selectList(userWrap); - //用户存在,先删除用户 - if (users.size() == 1) { - userMapper.delete(userWrap); - } else { - //新增用户 - this.insertUser(username); - } - } +package top.kuanghua.integrationfront.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.ObjectUtils; +import top.kuanghua.feign.tyauth.feign.TokenFeign; +import top.kuanghua.khcomomon.entity.ResResult; +import top.kuanghua.khcomomon.utils.CodecUtils; +import top.kuanghua.khcomomon.utils.ObjectUtilsSelf; +import top.kuanghua.integrationfront.entity.User; +import top.kuanghua.integrationfront.mapper.UserMapper; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Objects; + +/** + * (User) + * + * @author kuanghua + * @since 2020-10-27 20:54:24 + */ +@Service +@Slf4j +public class UserService { + @Resource + private UserMapper userMapper; + +// @Resource +// private ExcelFeign excelFeign; + + @Resource + private TokenFeign tokenFeign; + @Autowired + private StringRedisTemplate stringRedisTemplate; + + public void registry(User user, String code) throws Exception { + QueryWrapper queryWrapper = new QueryWrapper() + .select("phone") + .eq("phone", user.getPhone()); + Boolean bl = this.userMapper.selectCount(queryWrapper) == 1; + if (bl) { + throw new Exception("手机号已存在"); + } + String codeStr = stringRedisTemplate.opsForValue().get("user:code:phone:" + user.getPhone()); + if (StringUtils.isEmpty(codeStr)) { + throw new Exception("验证码失效,请重新获取"); + } + if (!Objects.equals(codeStr, code)) { + throw new Exception("验证码输入错误"); + } + String salt = CodecUtils.generateSalt(); + user.setSalt(salt); + user.setPassword(CodecUtils.md5Hex(user.getPassword(), salt)); + boolean insertBl = this.userMapper.insert(user) == 1; + if (insertBl) { + //删除redis中的code + this.stringRedisTemplate.delete("user:code:phone:" + user.getPhone()); + } else { + throw new Exception("用户注册失败"); + } + } + + @Transactional(rollbackFor = Exception.class) + public Object insert(User user) { + return this.userMapper.insert(user); + } + + + @Transactional(rollbackFor = Exception.class) + public Object updateById(User user) { + int updateById = this.userMapper.updateById(user); + int i = 10 / 0; + return updateById; + } + + /** + * 登出 + */ + public void loginOut() { + return; + } +// +// /** +// * 用户注册 +// * +// * @param code +// * @param username +// * @param password +// */ +// public void userRegister(String email, String code, String username, String password) { +// +// //user表中查询用户是否重复 +// QueryWrapper queryWrapper = new QueryWrapper() +// .eq("username", username); +// if (this.userMapper.selectCount(queryWrapper) == 1) { +// throw new RuntimeException(MessageFormat.format("账号【{0}】已存在,请误重复注册", username)); +// } +// +// //去ty-execl中查询用户名是否存在 +// ResResult resResult = excelFeign.selectExcelByUser(username); +// List list = ObjectUtilsSelf.parseResToList(resResult); +// if (list.size() == 0) { +// throw new RuntimeException(MessageFormat.format("考勤表中不存在用户名【{0}】", username)); +// } +// +// //校验验证码 +// String codeInfo = stringRedisTemplate.opsForValue().get("email.code.routing.name" + email); +// Map map = JSON.parseObject(codeInfo); +// if (ObjectUtilsSelf.isEmpty(map)) { +// throw new RuntimeException("验证码失效,请重新获取"); +// } +// if (!Objects.equals(map.get("code"), code)) { +// throw new RuntimeException("验证码不正确"); +// } +// //插入数据,用户添加成功 +// User userEt = new User(); +// userEt.setPassword(password); +// userEt.setEmail(email); +// userEt.setUsername(username); +// //添加盐设置密码为md5 +// String salt = CodecUtils.generateSalt(); +// userEt.setSalt(salt); +// userEt.setPassword(CodecUtils.md5Hex(userEt.getPassword(), salt)); +// boolean inResult = userMapper.insert(userEt) == 1; +// if (!inResult) { +// throw new RuntimeException("插入失败"); +// } +// } + + /** + * 用户登录 + * + * @param user + * @return + * @throws Exception + */ + public HashMap loginValid(User user) { + QueryWrapper phoneQW = new QueryWrapper().like("email", user.getEmail()) + .or().eq("username", user.getUsername()); + User resUser = this.userMapper.selectOne(phoneQW); + if (ObjectUtils.isEmpty(resUser)) { + throw new RuntimeException("用户不存在"); + } + + if (!resUser.getPassword().equals(CodecUtils.md5Hex(user.getPassword(), resUser.getSalt()))) { + throw new RuntimeException("用户名或密码错误"); + } + //生成jwt token + HashMap hm = new HashMap<>(); + hm.put("username", resUser.getUsername()); + hm.put("email", resUser.getEmail()); + ResResult resResult = tokenFeign.generateToken(hm); + + hm.put("jwtToken", resResult.getData()); + return hm; + } + + /*修改用户密码*/ + public void changePassword(String username, String oldPassword, String newPassword) { + //校验oldPassword是否正确 + QueryWrapper qw = new QueryWrapper() + .eq("username", username); + + User resUser = this.userMapper.selectOne(qw); + if (ObjectUtilsSelf.isEmpty(resUser)) { + throw new RuntimeException("用户不存在"); + } + if (!resUser.getPassword().equals(CodecUtils.md5Hex(oldPassword, resUser.getSalt()))) { + throw new RuntimeException("密码错误"); + } + + //设置新的密码 + String salt = CodecUtils.generateSalt(); + resUser.setSalt(salt); + resUser.setPassword(CodecUtils.md5Hex(newPassword, salt)); + boolean insertBl = this.userMapper.updateById(resUser) == 1; + if (!insertBl) { + throw new RuntimeException("修改密码失败"); + } + } + + + /** + * 插入用户 + * + * @param username 用户名 + */ + public void insertUser(String username) { + //先查询当前用户是否存在不存在则导入 + QueryWrapper qw = new QueryWrapper() + .eq("username", username); + + User resUser = this.userMapper.selectOne(qw); + if (ObjectUtilsSelf.isEmpty(resUser)) { + //添加盐设置密码为md5 + User user = new User(); + user.setPassword("123456"); + user.setUsername(username); + String salt = CodecUtils.generateSalt(); + user.setSalt(salt); + user.setPassword(CodecUtils.md5Hex(user.getPassword(), salt)); + userMapper.insert(user); + } + } + + + /** + * 重置用用户名:如果用用户存在先删除原有用户在新增一个用户,没有则新建用户 + */ + public void resetUser(String username) { + QueryWrapper userWrap = new QueryWrapper().eq("username", username); + List users = userMapper.selectList(userWrap); + //用户存在,先删除用户 + if (users.size() == 1) { + userMapper.delete(userWrap); + } else { + //新增用户 + this.insertUser(username); + } + } } \ No newline at end of file diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/service/VciService.java b/integration-front/src/main/java/top/kuanghua/integrationfront/service/VciService.java similarity index 91% rename from ty-user/src/main/java/top/kuanghua/tyuser/service/VciService.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/service/VciService.java index 80ba931..10280f1 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/service/VciService.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/service/VciService.java @@ -1,133 +1,133 @@ -package top.kuanghua.tyuser.service; - -import com.alibaba.excel.EasyExcel; -import com.alibaba.excel.context.AnalysisContext; -import com.alibaba.excel.exception.ExcelDataConvertException; -import com.alibaba.excel.read.listener.ReadListener; -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.springframework.stereotype.Service; -import top.kuanghua.tyuser.entity.Vci; -import top.kuanghua.tyuser.excel.imp.VciExcelImp; -import top.kuanghua.tyuser.mapper.VciMapper; -import top.kuanghua.tyuser.vo.ExcelCheckResult; - -import javax.annotation.Resource; -import java.io.InputStream; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; - -/** - * (Vci) - * - * @author kuanghua - * @since 2021-10-20 16:14:17 - */ -@Service -public class VciService { - - @Resource - private VciMapper vciMapper; - - public Page selectPage(Integer pageNum, Integer pageSize, QueryWrapper queryWrapper) { - return this.vciMapper.selectPage(new Page(pageNum, pageSize), queryWrapper); - } - - public Vci selectById(Integer id) { - return this.vciMapper.selectById(id); - } - - public List selectBatchIds(List idList) { - return this.vciMapper.selectBatchIds(idList); - } - - public int insert(Vci vci) { - return this.vciMapper.insert(vci); - } - - public int updateById(Vci vci) { - return this.vciMapper.updateById(vci); - } - - public int deleteById(Integer id) { - return this.vciMapper.deleteById(id); - } - - public int deleteBatchIds(List idList) { - return this.vciMapper.deleteBatchIds(idList); - } - - /** - * 导入文件校验 - * @param fileName - * @return - */ - public ExcelCheckResult validExcel(InputStream fileName) { - List errLogList = new ArrayList<>(); - List successList = new ArrayList<>(); - EasyExcel.read(fileName, VciExcelImp.class, new ReadListener() { - /** - * 单次缓存的数据量 - */ - static final int BATCH_COUNT = 3000; - /** - * 临时存储 - */ - private List cachedData = new ArrayList<>(BATCH_COUNT); - - @Override - public void onException(Exception exception, AnalysisContext context) throws Exception { - // 如果是某一个单元格的转换异常 能获取到具体行号 - // 如果要获取头的信息 配合invokeHeadMap使用 - if (exception instanceof ExcelDataConvertException) { - ExcelDataConvertException excelDataConvertException = (ExcelDataConvertException) exception; - - String formatString = MessageFormat.format("第{0}行,第{1}列解析异常", - excelDataConvertException.getRowIndex(), excelDataConvertException.getColumnIndex()); - - errLogList.add(formatString); - - } - } - - @Override - public void invoke(VciExcelImp data, AnalysisContext context) { - successList.add(data); - cachedData.add(data); - if (cachedData.size() >= BATCH_COUNT) { - saveData(); - // 存储完成清理 list - cachedData = new ArrayList<>(BATCH_COUNT); - } - } - - @Override - public void doAfterAllAnalysed(AnalysisContext context) { - - } - - /** - * 加上存储数据库 - */ - private void saveData() { - - - } - }).sheet().headRowNumber(1).doRead(); - return new ExcelCheckResult<>(errLogList, successList); - } - - /** - * 导入 - * @param listData - */ - public void importExcel(List listData){ - listData.forEach((item) -> { - //售后维修表 - Vci vci = JSON.parseObject(JSON.toJSONString(item), Vci.class); - vciMapper.insert(vci); - }); - } -} +package top.kuanghua.integrationfront.service; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.exception.ExcelDataConvertException; +import com.alibaba.excel.read.listener.ReadListener; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.stereotype.Service; +import top.kuanghua.integrationfront.entity.Vci; +import top.kuanghua.integrationfront.excel.imp.VciExcelImp; +import top.kuanghua.integrationfront.mapper.VciMapper; +import top.kuanghua.integrationfront.vo.ExcelCheckResult; + +import javax.annotation.Resource; +import java.io.InputStream; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; + +/** + * (Vci) + * + * @author kuanghua + * @since 2021-10-20 16:14:17 + */ +@Service +public class VciService { + + @Resource + private VciMapper vciMapper; + + public Page selectPage(Integer pageNum, Integer pageSize, QueryWrapper queryWrapper) { + return this.vciMapper.selectPage(new Page(pageNum, pageSize), queryWrapper); + } + + public Vci selectById(Integer id) { + return this.vciMapper.selectById(id); + } + + public List selectBatchIds(List idList) { + return this.vciMapper.selectBatchIds(idList); + } + + public int insert(Vci vci) { + return this.vciMapper.insert(vci); + } + + public int updateById(Vci vci) { + return this.vciMapper.updateById(vci); + } + + public int deleteById(Integer id) { + return this.vciMapper.deleteById(id); + } + + public int deleteBatchIds(List idList) { + return this.vciMapper.deleteBatchIds(idList); + } + + /** + * 导入文件校验 + * @param fileName + * @return + */ + public ExcelCheckResult validExcel(InputStream fileName) { + List errLogList = new ArrayList<>(); + List successList = new ArrayList<>(); + EasyExcel.read(fileName, VciExcelImp.class, new ReadListener() { + /** + * 单次缓存的数据量 + */ + static final int BATCH_COUNT = 3000; + /** + * 临时存储 + */ + private List cachedData = new ArrayList<>(BATCH_COUNT); + + @Override + public void onException(Exception exception, AnalysisContext context) throws Exception { + // 如果是某一个单元格的转换异常 能获取到具体行号 + // 如果要获取头的信息 配合invokeHeadMap使用 + if (exception instanceof ExcelDataConvertException) { + ExcelDataConvertException excelDataConvertException = (ExcelDataConvertException) exception; + + String formatString = MessageFormat.format("第{0}行,第{1}列解析异常", + excelDataConvertException.getRowIndex(), excelDataConvertException.getColumnIndex()); + + errLogList.add(formatString); + + } + } + + @Override + public void invoke(VciExcelImp data, AnalysisContext context) { + successList.add(data); + cachedData.add(data); + if (cachedData.size() >= BATCH_COUNT) { + saveData(); + // 存储完成清理 list + cachedData = new ArrayList<>(BATCH_COUNT); + } + } + + @Override + public void doAfterAllAnalysed(AnalysisContext context) { + + } + + /** + * 加上存储数据库 + */ + private void saveData() { + + + } + }).sheet().headRowNumber(1).doRead(); + return new ExcelCheckResult<>(errLogList, successList); + } + + /** + * 导入 + * @param listData + */ + public void importExcel(List listData){ + listData.forEach((item) -> { + //售后维修表 + Vci vci = JSON.parseObject(JSON.toJSONString(item), Vci.class); + vciMapper.insert(vci); + }); + } +} diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/vo/ExcelCheckResult.java b/integration-front/src/main/java/top/kuanghua/integrationfront/vo/ExcelCheckResult.java similarity index 91% rename from ty-user/src/main/java/top/kuanghua/tyuser/vo/ExcelCheckResult.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/vo/ExcelCheckResult.java index 483ecb6..a7b0a5d 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/vo/ExcelCheckResult.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/vo/ExcelCheckResult.java @@ -1,29 +1,29 @@ -package top.kuanghua.tyuser.vo; - -import lombok.Data; - -import java.util.List; - -/** - * @Title: ExcelCheckResult - * @Description: - * @Auther: kuanghua - * @create 2021-11-02 11:33 - */ - -@Data -public class ExcelCheckResult { - private int errNum; - private int successNum; - private boolean checkResult; - private List errList; - private List successList; - - public ExcelCheckResult(List errList, List successList) { - this.errList = errList; - this.successList = successList; - this.errNum=errList.size(); - this.successNum=successList.size(); - this.checkResult=errList.size()==0; - } -} +package top.kuanghua.integrationfront.vo; + +import lombok.Data; + +import java.util.List; + +/** + * @Title: ExcelCheckResult + * @Description: + * @Auther: kuanghua + * @create 2021-11-02 11:33 + */ + +@Data +public class ExcelCheckResult { + private int errNum; + private int successNum; + private boolean checkResult; + private List errList; + private List successList; + + public ExcelCheckResult(List errList, List successList) { + this.errList = errList; + this.successList = successList; + this.errNum=errList.size(); + this.successNum=successList.size(); + this.checkResult=errList.size()==0; + } +} diff --git a/ty-user/src/main/java/top/kuanghua/tyuser/vo/UserVo.java b/integration-front/src/main/java/top/kuanghua/integrationfront/vo/UserVo.java similarity index 89% rename from ty-user/src/main/java/top/kuanghua/tyuser/vo/UserVo.java rename to integration-front/src/main/java/top/kuanghua/integrationfront/vo/UserVo.java index ecf4fe9..909798b 100644 --- a/ty-user/src/main/java/top/kuanghua/tyuser/vo/UserVo.java +++ b/integration-front/src/main/java/top/kuanghua/integrationfront/vo/UserVo.java @@ -1,36 +1,36 @@ -package top.kuanghua.tyuser.vo; - -import io.swagger.annotations.ApiModel; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.util.Date; - -/** - * @Title: UserVo - * @Description: - * @Auther: kuanghua - * @create 2020/12/15 19:32 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Accessors(chain = true) -@ApiModel(value="多表分页测试") -public class UserVo { - private Integer id; - - private String username; - - private String password; - - private String phone; - - private Date createTime; - - private Date updateTime; - - private String deleted; - - private String salt; -} +package top.kuanghua.integrationfront.vo; + +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.util.Date; + +/** + * @Title: UserVo + * @Description: + * @Auther: kuanghua + * @create 2020/12/15 19:32 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="多表分页测试") +public class UserVo { + private Integer id; + + private String username; + + private String password; + + private String phone; + + private Date createTime; + + private Date updateTime; + + private String deleted; + + private String salt; +} diff --git a/ty-user/src/main/resources/application.yml b/integration-front/src/main/resources/application.yml similarity index 100% rename from ty-user/src/main/resources/application.yml rename to integration-front/src/main/resources/application.yml diff --git a/ty-user/src/main/resources/bootstrap.yml b/integration-front/src/main/resources/bootstrap.yml similarity index 100% rename from ty-user/src/main/resources/bootstrap.yml rename to integration-front/src/main/resources/bootstrap.yml diff --git a/ty-user/src/main/resources/mapper/AdminMapper.xml b/integration-front/src/main/resources/mapper/AdminMapper.xml similarity index 91% rename from ty-user/src/main/resources/mapper/AdminMapper.xml rename to integration-front/src/main/resources/mapper/AdminMapper.xml index b250fab..e0c5a4e 100644 --- a/ty-user/src/main/resources/mapper/AdminMapper.xml +++ b/integration-front/src/main/resources/mapper/AdminMapper.xml @@ -1,110 +1,110 @@ - - - - - - - - - - - - - - - - - - id, - status, - add_time, - is_super, - username, - password, - is_delete, - mobile, - email, - role_id - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + id, + status, + add_time, + is_super, + username, + password, + is_delete, + mobile, + email, + role_id + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index 5166516..6da9d61 100644 --- a/pom.xml +++ b/pom.xml @@ -12,10 +12,10 @@ ty-common ty-gateway ty-auth - ty-user - ty-upload - ty-excel + integration-front ty-example + + @@ -120,20 +120,17 @@ - - - - - - - - - - - - - - + + + + + + + + + + + diff --git a/ty-auth/src/main/java/top/kuanghua/tyauth/config/Swagger2Config.java b/ty-auth/src/main/java/top/kuanghua/tyauth/config/Swagger2Config.java index fc50e49..78010c8 100644 --- a/ty-auth/src/main/java/top/kuanghua/tyauth/config/Swagger2Config.java +++ b/ty-auth/src/main/java/top/kuanghua/tyauth/config/Swagger2Config.java @@ -42,7 +42,7 @@ public Docket api() { */ private ApiInfo apiInfo() { return new ApiInfoBuilder() - .title("标题:kuanghua") + .title("title:micro-service-plus") .description("描述:新一代的微服务架构") .contact(new Contact("jzfai", null, "869653722@qq.com")) .version("版本号:2.9") diff --git a/ty-common/pom.xml b/ty-common/pom.xml index 1a35ee8..e94f862 100644 --- a/ty-common/pom.xml +++ b/ty-common/pom.xml @@ -136,7 +136,7 @@ io.seata seata-spring-boot-starter - 1.4.0 + 1.4.2 \ No newline at end of file diff --git a/ty-gateway/ty-gateway-one/src/main/java/top/kuanghua/gatewaytwo/controller/HstrixController.java b/ty-common/src/main/java/top/kuanghua/controller/HstrixController.java similarity index 83% rename from ty-gateway/ty-gateway-one/src/main/java/top/kuanghua/gatewaytwo/controller/HstrixController.java rename to ty-common/src/main/java/top/kuanghua/controller/HstrixController.java index 9138091..8762eaf 100644 --- a/ty-gateway/ty-gateway-one/src/main/java/top/kuanghua/gatewaytwo/controller/HstrixController.java +++ b/ty-common/src/main/java/top/kuanghua/controller/HstrixController.java @@ -1,7 +1,8 @@ -package top.kuanghua.gatewaytwo.controller; +package top.kuanghua.controller; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import top.kuanghua.khcomomon.entity.ResResult; @@ -14,7 +15,7 @@ @RestController public class HstrixController { @ApiOperation(value = "") - @GetMapping("fallback") + @RequestMapping("/fallback") public ResResult fallback() { ResResult resResult = new ResResult(); //设置20010为熔断状态吗 diff --git a/ty-common/src/main/java/top/kuanghua/feign/tyuser/feign/UserFeign.java b/ty-common/src/main/java/top/kuanghua/feign/integrationfront/feign/UserFeign.java similarity index 72% rename from ty-common/src/main/java/top/kuanghua/feign/tyuser/feign/UserFeign.java rename to ty-common/src/main/java/top/kuanghua/feign/integrationfront/feign/UserFeign.java index 79c0c79..e2a6fc8 100644 --- a/ty-common/src/main/java/top/kuanghua/feign/tyuser/feign/UserFeign.java +++ b/ty-common/src/main/java/top/kuanghua/feign/integrationfront/feign/UserFeign.java @@ -1,17 +1,15 @@ -package top.kuanghua.feign.tyuser.feign; - -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import top.kuanghua.feign.config.FeignConfiguration; -import top.kuanghua.khcomomon.entity.ResResult; - -@FeignClient(name="ty-user",configuration = FeignConfiguration.class) -@RequestMapping("user") -public interface UserFeign { - - @PostMapping("insertUser") - ResResult insertUser(@RequestParam("username") String username); -} +package top.kuanghua.feign.integrationfront.feign; + +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import top.kuanghua.feign.config.FeignConfiguration; +import top.kuanghua.khcomomon.entity.ResResult; + +@FeignClient(name="integration-front",configuration = FeignConfiguration.class) +@RequestMapping("user") +public interface UserFeign { + @PostMapping("insertUser") + ResResult insertUser(@RequestParam("username") String username); +} diff --git a/ty-common/src/main/java/top/kuanghua/feign/tyexecl/feign/ExcelFeign.java b/ty-common/src/main/java/top/kuanghua/feign/tyexecl/feign/ExcelFeign.java deleted file mode 100644 index 93cb15e..0000000 --- a/ty-common/src/main/java/top/kuanghua/feign/tyexecl/feign/ExcelFeign.java +++ /dev/null @@ -1,22 +0,0 @@ -package top.kuanghua.feign.tyexecl.feign; - -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import top.kuanghua.feign.config.FeignConfiguration; -import top.kuanghua.khcomomon.entity.ResResult; - -/** - * @Title: ExcelFeign - * @Description: - * @Auther: kuanghua - * @create 2021/7/12 10:09 - */ -@FeignClient(name="ty-excel",configuration = FeignConfiguration.class) -@RequestMapping("excel") -public interface ExcelFeign { - /*查询execl表中的用户*/ - @GetMapping("selectExcelByUser") - public ResResult selectExcelByUser(@RequestParam("username") String username); -} diff --git a/ty-example/src/main/java/top/kuanghua/tyexample/ExampleApplication.java b/ty-example/src/main/java/top/kuanghua/tyexample/ExampleApplication.java index eb9767a..4d0b9d6 100644 --- a/ty-example/src/main/java/top/kuanghua/tyexample/ExampleApplication.java +++ b/ty-example/src/main/java/top/kuanghua/tyexample/ExampleApplication.java @@ -10,7 +10,7 @@ @SpringBootApplication @EnableScheduling @EnableAsync -//@EnableCanalClient +@EnableCanalClient @EnableAutoDataSourceProxy public class ExampleApplication { public static void main(String[] args) { diff --git a/ty-example/src/main/java/top/kuanghua/tyexample/config/BaseConfig.java b/ty-example/src/main/java/top/kuanghua/tyexample/config/BaseConfig.java index 809d29d..4403c0f 100644 --- a/ty-example/src/main/java/top/kuanghua/tyexample/config/BaseConfig.java +++ b/ty-example/src/main/java/top/kuanghua/tyexample/config/BaseConfig.java @@ -18,10 +18,10 @@ @Configuration //扫描公用包的配置和自身的配置类 @ComponentScan(basePackages = {"top.kuanghua.khcomomon"}) -//mapper包扫描 +//mapper scanning @MapperScan(basePackages = {"top.kuanghua.tyexample.mapper"}) -//feign扫描 -@EnableFeignClients(basePackages = {"top.kuanghua.feign.tyuser"}) +//feign scanning +@EnableFeignClients(basePackages = {"top.kuanghua.feign"}) public class BaseConfig { } diff --git a/ty-example/src/main/java/top/kuanghua/tyexample/config/Swagger2Config.java b/ty-example/src/main/java/top/kuanghua/tyexample/config/Swagger2Config.java index 4e14a84..e1e8d54 100644 --- a/ty-example/src/main/java/top/kuanghua/tyexample/config/Swagger2Config.java +++ b/ty-example/src/main/java/top/kuanghua/tyexample/config/Swagger2Config.java @@ -41,7 +41,7 @@ public Docket api() { */ private ApiInfo apiInfo() { return new ApiInfoBuilder() - .title("标题:kuanghua") + .title("title:micro-service-plus") .description("描述:新一代的微服务架构") .contact(new Contact("jzfai", null, "869653722@qq.com")) .version("版本号:2.9") diff --git a/ty-example/src/main/java/top/kuanghua/tyexample/listener/CanalDataEventListener.java b/ty-example/src/main/java/top/kuanghua/tyexample/listener/CanalDataEventListener.java index 5e45cc6..5bef611 100644 --- a/ty-example/src/main/java/top/kuanghua/tyexample/listener/CanalDataEventListener.java +++ b/ty-example/src/main/java/top/kuanghua/tyexample/listener/CanalDataEventListener.java @@ -11,35 +11,35 @@ */ @CanalEventListener public class CanalDataEventListener { - @InsertListenPoint - public void onEventInsert(CanalEntry.EventType eventType, CanalEntry.RowData rowData) { - for (CanalEntry.Column column : rowData.getAfterColumnsList()) { - System.out.println("新增" + column.getName() + ":获取的数据" + column.getValue()); - } - } - - @UpdateListenPoint - public void onEventUpdate(CanalEntry.EventType eventType, CanalEntry.RowData rowData) { - for (CanalEntry.Column column : rowData.getBeforeColumnsList()) { - System.out.println("修改前" + column.getName() + ":获取的数据" + column.getValue()); - } - for (CanalEntry.Column column : rowData.getAfterColumnsList()) { - System.out.println("修改后" + column.getName() + ":获取的数据" + column.getValue()); - } - } - - @DeleteListenPoint - public void onEventDelete(CanalEntry.EventType eventType, CanalEntry.RowData rowData) { - for (CanalEntry.Column column : rowData.getBeforeColumnsList()) { - System.out.println("删除前" + column.getName() + ":获取的数据" + column.getValue()); - } - } +// @InsertListenPoint +// public void onEventInsert(CanalEntry.EventType eventType, CanalEntry.RowData rowData) { +// for (CanalEntry.Column column : rowData.getAfterColumnsList()) { +// System.out.println("新增" + column.getName() + ":获取的数据" + column.getValue()); +// } +// } +// +// @UpdateListenPoint +// public void onEventUpdate(CanalEntry.EventType eventType, CanalEntry.RowData rowData) { +// for (CanalEntry.Column column : rowData.getBeforeColumnsList()) { +// System.out.println("修改前" + column.getName() + ":获取的数据" + column.getValue()); +// } +// for (CanalEntry.Column column : rowData.getAfterColumnsList()) { +// System.out.println("修改后" + column.getName() + ":获取的数据" + column.getValue()); +// } +// } +// +// @DeleteListenPoint +// public void onEventDelete(CanalEntry.EventType eventType, CanalEntry.RowData rowData) { +// for (CanalEntry.Column column : rowData.getBeforeColumnsList()) { +// System.out.println("删除前" + column.getName() + ":获取的数据" + column.getValue()); +// } +// } //自定义监听 @ListenPoint( - eventType = {CanalEntry.EventType.DELETE, CanalEntry.EventType.UPDATE}, //监听类型 - schema = {"changgou_content"}, - table = {"tb_content"}, //指定监控的表 + eventType = {CanalEntry.EventType.DELETE, CanalEntry.EventType.UPDATE,CanalEntry.EventType.UPDATE}, //监听类型 + schema = {"micro-service-plus"},//Library + table = {"tb_error_collection"}, //table destination = "example" //指定实例的地址 ) public void onEventCustomUpdate(CanalEntry.EventType eventType, CanalEntry.RowData rowData) { diff --git a/ty-example/src/main/java/top/kuanghua/tyexample/service/SeataTestService.java b/ty-example/src/main/java/top/kuanghua/tyexample/service/SeataTestService.java index 3b733e7..5040928 100644 --- a/ty-example/src/main/java/top/kuanghua/tyexample/service/SeataTestService.java +++ b/ty-example/src/main/java/top/kuanghua/tyexample/service/SeataTestService.java @@ -1,8 +1,8 @@ package top.kuanghua.tyexample.service; +import io.seata.spring.annotation.GlobalTransactional; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import top.kuanghua.feign.tyuser.feign.UserFeign; +import top.kuanghua.feign.integrationfront.feign.UserFeign; import javax.annotation.Resource; @@ -18,7 +18,7 @@ public class SeataTestService { @Resource private UserFeign userFeign; - @Transactional(rollbackFor = Exception.class) + @GlobalTransactional(rollbackFor = Exception.class) public void testSeataRollback(){ userFeign.insertUser("jzfai"); int i=10/0; diff --git a/ty-example/src/main/java/top/kuanghua/tyexample/service/UploadService.java b/ty-example/src/main/java/top/kuanghua/tyexample/service/UploadService.java index eb5317b..6c04b9a 100644 --- a/ty-example/src/main/java/top/kuanghua/tyexample/service/UploadService.java +++ b/ty-example/src/main/java/top/kuanghua/tyexample/service/UploadService.java @@ -30,17 +30,17 @@ public class UploadService { @Resource private FastFileStorageClient storageClient; - private static final List CONTENT_TYPES = Arrays.asList("image/jpeg", "image/gif"); + //private static final List CONTENT_TYPES = Arrays.asList("image/jpeg", "image/gif"); public String upload(MultipartFile file) throws IOException { String originalFilename = file.getOriginalFilename(); //检验文件类型 - String contentType = file.getContentType(); - if (!CONTENT_TYPES.contains(contentType)) { - //文件类型不合法 - log.info("文件类型不合法:{}", originalFilename); - throw new RuntimeException("文件内容不合法"); - } +// String contentType = file.getContentType(); +// if (!CONTENT_TYPES.contains(contentType)) { +// //文件类型不合法 +// log.info("文件类型不合法:{}", originalFilename); +// throw new RuntimeException("文件内容不合法"); +// } //检验文件内容 BufferedImage bufferedImage = ImageIO.read(file.getInputStream()); if (bufferedImage == null) { @@ -62,10 +62,10 @@ public Map uploadGetMetaData(MultipartFile file) throws IOExcept String originalFilename = file.getOriginalFilename(); //检验文件类型 String contentType = file.getContentType(); - if (!CONTENT_TYPES.contains(contentType)) { - //文件类型不合法 - log.info("文件类型不合法:{}", originalFilename); - } +// if (!CONTENT_TYPES.contains(contentType)) { +// //文件类型不合法 +// log.info("文件类型不合法:{}", originalFilename); +// } //检验文件内容 BufferedImage bufferedImage = ImageIO.read(file.getInputStream()); if (bufferedImage == null) { diff --git a/ty-example/src/main/resources/application.yml b/ty-example/src/main/resources/application.yml index 5d95712..e69de29 100644 --- a/ty-example/src/main/resources/application.yml +++ b/ty-example/src/main/resources/application.yml @@ -1,33 +0,0 @@ -#msg config, place change to you sms config -kuanghua: - sms: - accessKeyId: LTAI4FrD2voTK2wTgRCPwT6d - accessKeySecret: Zj07thnb2jiBkl4wtqgvPeuSzkJRJ3 - signName: 品优商城 # 签名名称 - verifyCodeTemplate: SMS_189216068 # 模板名称 - - - -#email config, place change to you email -spring: - mail: - username: 869653722@qq.com - password: xbthzedhnxatbcab - host: smtp.qq.com - properties: - mail.smtp.starttls.enable: true - - - -server: - port: ${envpt.tomcatPortPre}0121 - - - -#canal配置 -canal: - client: - instances: - example: - host: 8.135.1.141 - port: 11111 diff --git a/ty-excel/src/main/java/top/kuanghua/tyexcel/service/ExcelService.java b/ty-excel/src/main/java/top/kuanghua/tyexcel/service/ExcelService.java index 82ec61b..acfbf48 100644 --- a/ty-excel/src/main/java/top/kuanghua/tyexcel/service/ExcelService.java +++ b/ty-excel/src/main/java/top/kuanghua/tyexcel/service/ExcelService.java @@ -131,8 +131,6 @@ private void saveData() { } - - //注:headRowNumber(1)如果不写会自动匹配 })// 需要读取批注 默认不读取 .extraRead(CellExtraTypeEnum.COMMENT) diff --git a/ty-gateway/ty-gateway-one/src/main/java/top/kuanghua/gatewaytwo/config/SpecialHystrixGatewayFilterFactory.java b/ty-gateway/ty-gateway-one/src/main/java/top/kuanghua/gatewaytwo/config/SpecialHystrixGatewayFilterFactory.java index a206eeb..440d247 100644 --- a/ty-gateway/ty-gateway-one/src/main/java/top/kuanghua/gatewaytwo/config/SpecialHystrixGatewayFilterFactory.java +++ b/ty-gateway/ty-gateway-one/src/main/java/top/kuanghua/gatewaytwo/config/SpecialHystrixGatewayFilterFactory.java @@ -82,7 +82,7 @@ public GatewayFilter apply(Config config) { HystrixRuntimeException.FailureType failureType = e.getFailureType(); switch (failureType) { case TIMEOUT: - return Mono.error(new TimeoutException()); + return Mono.error(new TimeoutException("接口请求超时了")); case COMMAND_EXCEPTION: { Throwable cause = e.getCause(); if (cause instanceof ResponseStatusException || AnnotatedElementUtils diff --git a/ty-gateway/ty-gateway-one/src/main/resources/application.yml b/ty-gateway/ty-gateway-one/src/main/resources/application.yml index b77388d..678e70c 100644 --- a/ty-gateway/ty-gateway-one/src/main/resources/application.yml +++ b/ty-gateway/ty-gateway-one/src/main/resources/application.yml @@ -4,24 +4,24 @@ server: spring: cloud: gateway: - globalcors: - corsConfigurations: - '[/**]': - # 允许携带认证信息 - # 允许跨域的源(网站域名/ip),设置*为全部 - # 允许跨域请求里的head字段,设置*为全部 - # 允许跨域的method, 默认为GET和OPTIONS,设置*为全部 - # 跨域允许的有效期 - allow-credentials: true - allowed-origins: "*" - allowed-headers: "*" - allowed-methods: - - OPTIONS - - GET - - POST - - PUT - - DELETE - #max-age: 3600 +# globalcors: +# corsConfigurations: +# '[/**]': +# # 允许携带认证信息 +# # 允许跨域的源(网站域名/ip),设置*为全部 +# # 允许跨域请求里的head字段,设置*为全部 +# # 允许跨域的method, 默认为GET和OPTIONS,设置*为全部 +# # 跨域允许的有效期 +# allow-credentials: true +# allowed-origins: "*" +# allowed-headers: "*" +# allowed-methods: +# - OPTIONS +# - GET +# - POST +# - PUT +# - DELETE +# #max-age: 3600 routes: - id: ty-auth uri: lb://ty-auth @@ -61,14 +61,13 @@ spring: #指定接口超时处理 hystrixRibbon -> @RequestMapping("hystrixRibbon") #timeoutTest-> @GetMapping("timeoutTest") , - > / hystrixRibbon-timeoutTest: 11000 - #file-upload-: 20000 - #file-download-: 20000 - #course-file-upload-local-: 20000 + upload-image: 2000 + upload-file: 30000 - - id: ty-user - uri: lb://ty-user + - id: integration-front + uri: lb://integration-front predicates: - - Path=/api/ty-user/** + - Path=/api/integration-front/** filters: - StripPrefix=2 @@ -90,20 +89,20 @@ management: #白名单过滤 filter: - allowPaths: / + #not filter , you can config it when dev + #allowPaths: / + allowPaths: swagger,docs,userRegister,userLogin,sendEmailCode,registry,login,loginOut,insertUser,example notValidExpList: export,excel - token-properties: renewTokenMinute: 1440 #默认1天时间告知前端刷新token - #config the visit service of gateway swagger swagger-doc: serviceMap: { - ty-user: "用户模块", + integration-front: "前端数据整合", ty-upload: "文件上传", ty-example: "使用例子" } \ No newline at end of file