Commit 35ceab385c7a942a4c8f22484d674e525676db7b

Authored by 肖超群
1 parent c43e3d7d

优化界面

增加Swagger3Config 配置
ant-design-vue-jeecg/src/views/system/monitor/locationStatus.vue
@@ -7,7 +7,6 @@ @@ -7,7 +7,6 @@
7 <ul id="select_info"> 7 <ul id="select_info">
8 8
9 <li> 9 <li>
10 - 货主  
11 <a-select 10 <a-select
12 show-search 11 show-search
13 placeholder="请选择库位类型" 12 placeholder="请选择库位类型"
ant-design-vue-jeecg/src/views/system/task/CircleTaskHeaderList.vue
@@ -109,11 +109,11 @@ @@ -109,11 +109,11 @@
109 109
110 <!-- table区域-begin --> 110 <!-- table区域-begin -->
111 <div> 111 <div>
112 - <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">  
113 - <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a  
114 - style="font-weight: 600">{{ selectedRowKeys.length }}</a>项  
115 - <a style="margin-left: 24px" @click="onClearSelected">清空</a>  
116 - </div> 112 +<!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">-->
  113 +<!-- <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a-->
  114 +<!-- style="font-weight: 600">{{ selectedRowKeys.length }}</a>项-->
  115 +<!-- <a style="margin-left: 24px" @click="onClearSelected">清空</a>-->
  116 +<!-- </div>-->
117 117
118 <a-table 118 <a-table
119 ref="table" 119 ref="table"
ant-design-vue-jeecg/src/views/system/task/ShipmentTaskHeaderList.vue
@@ -104,11 +104,11 @@ @@ -104,11 +104,11 @@
104 104
105 <!-- table区域-begin --> 105 <!-- table区域-begin -->
106 <div> 106 <div>
107 - <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">  
108 - <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a  
109 - style="font-weight: 600">{{ selectedRowKeys.length }}</a>项  
110 - <a style="margin-left: 24px" @click="onClearSelected">清空</a>  
111 - </div> 107 +<!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">-->
  108 +<!-- <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a-->
  109 +<!-- style="font-weight: 600">{{ selectedRowKeys.length }}</a>项-->
  110 +<!-- <a style="margin-left: 24px" @click="onClearSelected">清空</a>-->
  111 +<!-- </div>-->
112 112
113 <a-table 113 <a-table
114 ref="table" 114 ref="table"
ant-design-vue-jeecg/src/views/system/task/TransferTaskHeaderList.vue
@@ -110,11 +110,11 @@ @@ -110,11 +110,11 @@
110 110
111 <!-- table区域-begin --> 111 <!-- table区域-begin -->
112 <div> 112 <div>
113 - <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">  
114 - <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a  
115 - style="font-weight: 600">{{ selectedRowKeys.length }}</a>项  
116 - <a style="margin-left: 24px" @click="onClearSelected">清空</a>  
117 - </div> 113 +<!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">-->
  114 +<!-- <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a-->
  115 +<!-- style="font-weight: 600">{{ selectedRowKeys.length }}</a>项-->
  116 +<!-- <a style="margin-left: 24px" @click="onClearSelected">清空</a>-->
  117 +<!-- </div>-->
118 118
119 <a-table 119 <a-table
120 ref="table" 120 ref="table"
huaheng-wms-core/pom.xml
@@ -85,6 +85,28 @@ @@ -85,6 +85,28 @@
85 <artifactId>spring-boot-starter-validation</artifactId> 85 <artifactId>spring-boot-starter-validation</artifactId>
86 </dependency> 86 </dependency>
87 87
  88 + <!--swagger-->
  89 + <dependency>
  90 + <groupId>io.springfox</groupId>
  91 + <artifactId>springfox-swagger2</artifactId>
  92 + <version>3.0.0</version>
  93 + </dependency>
  94 + <dependency>
  95 + <groupId>io.springfox</groupId>
  96 + <artifactId>springfox-swagger-ui</artifactId>
  97 + <version>3.0.0</version>
  98 + </dependency>
  99 + <dependency>
  100 + <groupId>io.swagger</groupId>
  101 + <artifactId>swagger-annotations</artifactId>
  102 + <version>1.5.22</version>
  103 + </dependency>
  104 + <dependency>
  105 + <groupId>com.github.xiaoymin</groupId>
  106 + <artifactId>swagger-bootstrap-ui</artifactId>
  107 + <version>1.8.7</version>
  108 + </dependency>
  109 +
88 </dependencies> 110 </dependencies>
89 111
90 <build> 112 <build>
huaheng-wms-core/src/main/java/org/jeecg/JeecgSystemApplication.java
@@ -28,7 +28,7 @@ import lombok.extern.slf4j.Slf4j; @@ -28,7 +28,7 @@ import lombok.extern.slf4j.Slf4j;
28 @EnableCaching 28 @EnableCaching
29 @SpringBootApplication 29 @SpringBootApplication
30 @EnableAutoConfiguration(exclude = {MongoAutoConfiguration.class}) 30 @EnableAutoConfiguration(exclude = {MongoAutoConfiguration.class})
31 -@ComponentScan(excludeFilters = {@Filter(type = FilterType.REGEX, pattern = {"org.jeecg.config.mybatis.MybatisInterceptor"})}) 31 +@ComponentScan(excludeFilters = {@Filter(type = FilterType.REGEX, pattern = {"org.jeecg.config.mybatis.MybatisInterceptor", "org.jeecg.config.Swagger2Config"})})
32 public class JeecgSystemApplication extends SpringBootServletInitializer { 32 public class JeecgSystemApplication extends SpringBootServletInitializer {
33 33
34 @Override 34 @Override
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/material/service/impl/MaterialServiceImpl.java
@@ -28,7 +28,7 @@ public class MaterialServiceImpl extends ServiceImpl&lt;MaterialMapper, Material&gt; i @@ -28,7 +28,7 @@ public class MaterialServiceImpl extends ServiceImpl&lt;MaterialMapper, Material&gt; i
28 return null; 28 return null;
29 } 29 }
30 LambdaQueryWrapper<Material> materialLambdaQueryWrapper = Wrappers.lambdaQuery(); 30 LambdaQueryWrapper<Material> materialLambdaQueryWrapper = Wrappers.lambdaQuery();
31 - materialLambdaQueryWrapper.eq(Material::getCode, code).eq(Material::getEnable, QuantityConstant.STATUS_DISABLE); 31 + materialLambdaQueryWrapper.eq(Material::getCode, code).eq(Material::getEnable, QuantityConstant.STATUS_ENABLE);
32 Material material = this.getOne(materialLambdaQueryWrapper); 32 Material material = this.getOne(materialLambdaQueryWrapper);
33 return material; 33 return material;
34 } 34 }
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptHeader/service/impl/ReceiptDetailServiceImpl.java
1 package org.jeecg.modules.wms.receipt.receiptHeader.service.impl; 1 package org.jeecg.modules.wms.receipt.receiptHeader.service.impl;
2 2
3 import java.math.BigDecimal; 3 import java.math.BigDecimal;
4 -import java.util.ArrayList; 4 +import java.util.Collections;
5 import java.util.List; 5 import java.util.List;
6 6
7 import javax.annotation.Resource; 7 import javax.annotation.Resource;
@@ -14,19 +14,12 @@ import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; @@ -14,19 +14,12 @@ import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader;
14 import org.jeecg.modules.wms.receipt.receiptHeader.mapper.ReceiptDetailMapper; 14 import org.jeecg.modules.wms.receipt.receiptHeader.mapper.ReceiptDetailMapper;
15 import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptDetailService; 15 import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptDetailService;
16 import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptHeaderService; 16 import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptHeaderService;
17 -import org.jeecg.utils.HuahengJwtUtil;  
18 import org.jeecg.utils.StringUtils; 17 import org.jeecg.utils.StringUtils;
19 import org.jeecg.utils.constant.QuantityConstant; 18 import org.jeecg.utils.constant.QuantityConstant;
20 import org.springframework.beans.factory.annotation.Autowired; 19 import org.springframework.beans.factory.annotation.Autowired;
21 import org.springframework.stereotype.Service; 20 import org.springframework.stereotype.Service;
22 import org.springframework.transaction.annotation.Transactional; 21 import org.springframework.transaction.annotation.Transactional;
23 22
24 -import java.util.ArrayList;  
25 -import java.util.List;  
26 -import java.util.ArrayList;  
27 -import java.util.Collections;  
28 -import java.util.List;  
29 -  
30 import com.alibaba.fastjson.JSON; 23 import com.alibaba.fastjson.JSON;
31 import com.aliyun.oss.ServiceException; 24 import com.aliyun.oss.ServiceException;
32 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 25 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -57,16 +50,18 @@ public class ReceiptDetailServiceImpl extends ServiceImpl&lt;ReceiptDetailMapper, R @@ -57,16 +50,18 @@ public class ReceiptDetailServiceImpl extends ServiceImpl&lt;ReceiptDetailMapper, R
57 return receiptDetailMapper.selectByMainId(mainId); 50 return receiptDetailMapper.selectByMainId(mainId);
58 } 51 }
59 52
60 - @Override  
61 - public boolean save(ReceiptDetail entity) { 53 + @Override
  54 + public boolean save(ReceiptDetail entity) {
62 BigDecimal qty = entity.getQty(); 55 BigDecimal qty = entity.getQty();
63 if (qty.compareTo(BigDecimal.ZERO) < 0) { 56 if (qty.compareTo(BigDecimal.ZERO) < 0) {
64 throw new ServiceException("单据数量不能小于0"); 57 throw new ServiceException("单据数量不能小于0");
65 } 58 }
66 return super.save(entity); 59 return super.save(entity);
67 } 60 }
  61 +
68 @Override 62 @Override
69 - @OperationLog(bizId = "''", bizType = "'入库单追踪'", tag = "'入库详情添加'", extra = "#extraJsonString", msg = "''", operatorId = "#username", recordReturnValue = true) public Result saveReceiptDetail(ReceiptDetail receiptDetail) { 63 + @OperationLog(bizId = "''", bizType = "'入库单追踪'", tag = "'入库详情添加'", extra = "#extraJsonString", msg = "''", operatorId = "#username", recordReturnValue = true)
  64 + public Result saveReceiptDetail(ReceiptDetail receiptDetail) {
70 ReceiptHeader receiptHeader = receiptHeaderService.getById(receiptDetail.getReceiptId()); 65 ReceiptHeader receiptHeader = receiptHeaderService.getById(receiptDetail.getReceiptId());
71 if (receiptHeader == null) { 66 if (receiptHeader == null) {
72 return Result.error("添加失败,没有找到入库单头"); 67 return Result.error("添加失败,没有找到入库单头");
huaheng-wms-core/src/main/java/org/jeecg/utils/Swagger3Config.java 0 → 100644
  1 +package org.jeecg.utils;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.Collections;
  5 +import java.util.List;
  6 +
  7 +import org.jeecg.common.constant.CommonConstant;
  8 +import org.jeecg.config.Swagger2Config;
  9 +import org.springframework.context.annotation.Bean;
  10 +import org.springframework.context.annotation.Configuration;
  11 +import org.springframework.context.annotation.Import;
  12 +import org.springframework.web.bind.annotation.RestController;
  13 +
  14 +import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
  15 +
  16 +import io.swagger.annotations.ApiOperation;
  17 +import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration;
  18 +import springfox.documentation.builders.ApiInfoBuilder;
  19 +import springfox.documentation.builders.PathSelectors;
  20 +import springfox.documentation.builders.RequestHandlerSelectors;
  21 +import springfox.documentation.service.*;
  22 +import springfox.documentation.spi.DocumentationType;
  23 +import springfox.documentation.spi.service.contexts.SecurityContext;
  24 +import springfox.documentation.spring.web.plugins.Docket;
  25 +import springfox.documentation.swagger2.annotations.EnableSwagger2;
  26 +
  27 +@Configuration
  28 +@EnableSwagger2
  29 +@EnableKnife4j
  30 +@Import(BeanValidatorPluginsConfiguration.class)
  31 +public class Swagger3Config extends Swagger2Config {
  32 +
  33 + /**
  34 + * swagger2的配置文件,这里可以配置swagger2的一些基本的内容,比如扫描的包等等
  35 + * @return Docket
  36 + */
  37 + @Override
  38 + @Bean(value = "defaultApi2")
  39 + public Docket defaultApi2() {
  40 + return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select()
  41 + // 此包路径下的类,才生成接口文档
  42 + .apis(RequestHandlerSelectors.basePackage("org.jeecg"))
  43 + // 加了ApiOperation注解的类,才生成接口文档
  44 + .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class)).apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
  45 + .paths(PathSelectors.any()).build().securitySchemes(Collections.singletonList(securityScheme())).securityContexts(securityContexts());
  46 + // .globalOperationParameters(setHeaderToken());
  47 + }
  48 +
  49 + /***
  50 + * oauth2配置
  51 + * 需要增加swagger授权回调地址
  52 + * http://localhost:8888/webjars/springfox-swagger-ui/o2c.html
  53 + * @return
  54 + */
  55 + @Bean
  56 + SecurityScheme securityScheme() {
  57 + return new ApiKey(CommonConstant.X_ACCESS_TOKEN, CommonConstant.X_ACCESS_TOKEN, "header");
  58 + }
  59 +
  60 + /**
  61 + * 新增 securityContexts 保持登录状态
  62 + */
  63 + private List<SecurityContext> securityContexts() {
  64 + return new ArrayList(
  65 + Collections.singleton(SecurityContext.builder().securityReferences(defaultAuth()).forPaths(PathSelectors.regex("^(?!auth).*$")).build()));
  66 + }
  67 +
  68 + /**
  69 + * api文档的详细信息函数,注意这里的注解引用的是哪个
  70 + * @return
  71 + */
  72 + private ApiInfo apiInfo() {
  73 + return new ApiInfoBuilder()
  74 + // //大标题
  75 + .title("华恒仓储管理系统API接口文档")
  76 + // 版本号
  77 + .version("1.0")
  78 +// .termsOfServiceUrl("NO terms of service")
  79 + // 描述
  80 + .description("后台API接口").license("The Apache License, Version 2.0").licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html").build();
  81 + }
  82 +
  83 + private List<SecurityReference> defaultAuth() {
  84 + AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
  85 + AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
  86 + authorizationScopes[0] = authorizationScope;
  87 + return new ArrayList(Collections.singleton(new SecurityReference(CommonConstant.X_ACCESS_TOKEN, authorizationScopes)));
  88 + }
  89 +
  90 +}