11 changed files with 366 additions and 305 deletions
@ -1,25 +1,25 @@ |
|||||
package com.ccsens.common; |
//package com.ccsens.common;
|
||||
|
//
|
||||
import org.mybatis.spring.annotation.MapperScan; |
//import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication; |
//import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
//import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.web.servlet.ServletComponentScan; |
//import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; |
//import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients; |
//import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.scheduling.annotation.EnableAsync; |
//import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
//
|
||||
/** |
///**
|
||||
* @author ma |
// * @author ma
|
||||
*/ |
// */
|
||||
@MapperScan(basePackages = {"com.ccsens.common.persist.*"}) |
//@MapperScan(basePackages = {"com.ccsens.common.persist.*"})
|
||||
@ServletComponentScan |
//@ServletComponentScan
|
||||
@EnableAsync |
//@EnableAsync
|
||||
//开启断路器功能
|
////开启断路器功能
|
||||
@EnableCircuitBreaker |
//@EnableCircuitBreaker
|
||||
@EnableFeignClients(basePackages = "com.ccsens.cloudutil.feign") |
//@EnableFeignClients(basePackages = "com.ccsens.cloudutil.feign")
|
||||
@SpringBootApplication(scanBasePackages = "com.ccsens") |
//@SpringBootApplication(scanBasePackages = "com.ccsens")
|
||||
public class CommonApplication { |
//public class CommonApplication {
|
||||
public static void main(String[] args) { |
// public static void main(String[] args) {
|
||||
SpringApplication.run(CommonApplication.class,args); |
// SpringApplication.run(CommonApplication.class,args);
|
||||
} |
// }
|
||||
} |
//}
|
||||
|
@ -1,104 +1,104 @@ |
|||||
package com.ccsens.common.api; |
//package com.ccsens.common.api;
|
||||
|
//
|
||||
import com.ccsens.cloudutil.annotation.MustLogin; |
//import com.ccsens.cloudutil.annotation.MustLogin;
|
||||
import com.ccsens.common.bean.dto.CClockingInDto; |
//import com.ccsens.common.bean.dto.CClockingInDto;
|
||||
import com.ccsens.common.bean.dto.CTaskDto; |
//import com.ccsens.common.bean.dto.CTaskDto;
|
||||
|
//
|
||||
import com.ccsens.common.bean.vo.CClockingInVo; |
//import com.ccsens.common.bean.vo.CClockingInVo;
|
||||
import com.ccsens.common.bean.vo.CTaskVo; |
//import com.ccsens.common.bean.vo.CTaskVo;
|
||||
|
//
|
||||
import com.ccsens.common.service.IClockingInService; |
//import com.ccsens.common.service.IClockingInService;
|
||||
import com.ccsens.common.service.ITaskService; |
//import com.ccsens.common.service.ITaskService;
|
||||
import com.ccsens.util.JsonResponse; |
//import com.ccsens.util.JsonResponse;
|
||||
import com.ccsens.util.bean.dto.QueryDto; |
//import com.ccsens.util.bean.dto.QueryDto;
|
||||
import io.swagger.annotations.Api; |
//import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation; |
//import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam; |
//import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j; |
//import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated; |
//import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody; |
//import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping; |
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod; |
//import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController; |
//import org.springframework.web.bind.annotation.RestController;
|
||||
|
//
|
||||
import javax.annotation.Resource; |
//import javax.annotation.Resource;
|
||||
import java.util.List; |
//import java.util.List;
|
||||
|
//
|
||||
/** |
///**
|
||||
* @author 逗 |
// * @author 逗
|
||||
*/ |
// */
|
||||
@Api(tags = "DEBUG" , description = "DebugController | ") |
//@Api(tags = "DEBUG" , description = "DebugController | ")
|
||||
@RestController |
//@RestController
|
||||
@RequestMapping("/task") |
//@RequestMapping("/task")
|
||||
@Slf4j |
//@Slf4j
|
||||
public class TaskController { |
//public class TaskController {
|
||||
|
//
|
||||
@Resource |
// @Resource
|
||||
private ITaskService taskService; |
// private ITaskService taskService;
|
||||
@Resource |
// @Resource
|
||||
private IClockingInService clockingInService; |
// private IClockingInService clockingInService;
|
||||
|
//
|
||||
@MustLogin |
// @MustLogin
|
||||
@ApiOperation(value = "查找永久日常任务", notes = "") |
// @ApiOperation(value = "查找永久日常任务", notes = "")
|
||||
@RequestMapping(value = "/permanent", method = RequestMethod.POST, produces = {"application/json;charet=UTF-8"}) |
// @RequestMapping(value = "/permanent", method = RequestMethod.POST, produces = {"application/json;charet=UTF-8"})
|
||||
public JsonResponse<List<CTaskVo.QueryTask>> queryPermanentGlobalTask(@ApiParam @Validated @RequestBody QueryDto<CTaskDto.QueryPermanentGlobalTask> params) { |
// public JsonResponse<List<CTaskVo.QueryTask>> queryPermanentGlobalTask(@ApiParam @Validated @RequestBody QueryDto<CTaskDto.QueryPermanentGlobalTask> params) {
|
||||
log.info("查找永久日常任务开始{}",params); |
// log.info("查找永久日常任务开始{}",params);
|
||||
List<CTaskVo.QueryTask> permanentGlobalTaskList = taskService.queryPermanentGlobalTask(params.getParam(),params.getUserId()); |
// List<CTaskVo.QueryTask> permanentGlobalTaskList = taskService.queryPermanentGlobalTask(params.getParam(),params.getUserId());
|
||||
log.info("查找永久日常任务结束{}",permanentGlobalTaskList); |
// log.info("查找永久日常任务结束{}",permanentGlobalTaskList);
|
||||
return JsonResponse.newInstance().ok(permanentGlobalTaskList); |
// return JsonResponse.newInstance().ok(permanentGlobalTaskList);
|
||||
} |
// }
|
||||
|
//
|
||||
@MustLogin |
// @MustLogin
|
||||
@ApiOperation(value = "查找带时间的日常任务", notes = "") |
// @ApiOperation(value = "查找带时间的日常任务", notes = "")
|
||||
@RequestMapping(value = "/global", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
// @RequestMapping(value = "/global", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
||||
public JsonResponse<List<CTaskVo.QueryTask>> queryGlobalTask(@ApiParam @Validated @RequestBody QueryDto<CTaskDto.QueryGlobalTask> params) { |
// public JsonResponse<List<CTaskVo.QueryTask>> queryGlobalTask(@ApiParam @Validated @RequestBody QueryDto<CTaskDto.QueryGlobalTask> params) {
|
||||
log.info("查找带时间的日常任务开始{}",params); |
// log.info("查找带时间的日常任务开始{}",params);
|
||||
List<CTaskVo.QueryTask> globalTask = taskService.queryGlobalTask(params.getParam(),params.getUserId()); |
// List<CTaskVo.QueryTask> globalTask = taskService.queryGlobalTask(params.getParam(),params.getUserId());
|
||||
log.info("查找带时间的日常任务结束{}",globalTask); |
// log.info("查找带时间的日常任务结束{}",globalTask);
|
||||
return JsonResponse.newInstance().ok(globalTask); |
// return JsonResponse.newInstance().ok(globalTask);
|
||||
} |
// }
|
||||
|
//
|
||||
@MustLogin |
// @MustLogin
|
||||
@ApiOperation(value = "查找带时间的定期任务", notes = "") |
// @ApiOperation(value = "查找带时间的定期任务", notes = "")
|
||||
@RequestMapping(value = "/regular", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
// @RequestMapping(value = "/regular", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
||||
public JsonResponse<List<CTaskVo.QueryTask>> queryRegularTask(@ApiParam @Validated @RequestBody QueryDto<CTaskDto.QueryRegularTask> params) { |
// public JsonResponse<List<CTaskVo.QueryTask>> queryRegularTask(@ApiParam @Validated @RequestBody QueryDto<CTaskDto.QueryRegularTask> params) {
|
||||
log.info("查找带时间的定期任务开始{}",params); |
// log.info("查找带时间的定期任务开始{}",params);
|
||||
List<CTaskVo.QueryTask> regularTask = taskService.queryRegularTask(params.getParam(), params.getUserId()); |
// List<CTaskVo.QueryTask> regularTask = taskService.queryRegularTask(params.getParam(), params.getUserId());
|
||||
log.info("查找带时间的定期任务结束{}",regularTask); |
// log.info("查找带时间的定期任务结束{}",regularTask);
|
||||
return JsonResponse.newInstance().ok(regularTask); |
// return JsonResponse.newInstance().ok(regularTask);
|
||||
} |
// }
|
||||
|
//
|
||||
|
//
|
||||
@MustLogin |
// @MustLogin
|
||||
@ApiOperation(value = "查询考勤信息", notes = "") |
// @ApiOperation(value = "查询考勤信息", notes = "")
|
||||
@RequestMapping(value = "/query", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
// @RequestMapping(value = "/query", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
||||
public JsonResponse<List<CClockingInVo.ClockingInInfo>> queryDeliverOfTask(@ApiParam @Validated @RequestBody QueryDto<CClockingInDto.QueryClockingIn> params) throws Exception{ |
// public JsonResponse<List<CClockingInVo.ClockingInInfo>> queryDeliverOfTask(@ApiParam @Validated @RequestBody QueryDto<CClockingInDto.QueryClockingIn> params) throws Exception{
|
||||
List<CClockingInVo.ClockingInInfo> clockingInInfos = clockingInService.queryClockingIn(params.getParam(), params.getUserId()); |
// List<CClockingInVo.ClockingInInfo> clockingInInfos = clockingInService.queryClockingIn(params.getParam(), params.getUserId());
|
||||
return JsonResponse.newInstance().ok(clockingInInfos); |
// return JsonResponse.newInstance().ok(clockingInInfos);
|
||||
} |
// }
|
||||
|
//
|
||||
@MustLogin |
// @MustLogin
|
||||
@ApiOperation(value = "打卡", notes = "") |
// @ApiOperation(value = "打卡", notes = "")
|
||||
@RequestMapping(value = "/punch", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
// @RequestMapping(value = "/punch", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
||||
public JsonResponse punchTheClock(@ApiParam @Validated @RequestBody QueryDto<CClockingInDto.PunchTheClock> params) throws Exception{ |
// public JsonResponse punchTheClock(@ApiParam @Validated @RequestBody QueryDto<CClockingInDto.PunchTheClock> params) throws Exception{
|
||||
clockingInService.punchTheClock(params.getParam(), params.getUserId()); |
// clockingInService.punchTheClock(params.getParam(), params.getUserId());
|
||||
return JsonResponse.newInstance().ok(); |
// return JsonResponse.newInstance().ok();
|
||||
} |
// }
|
||||
|
//
|
||||
@MustLogin |
// @MustLogin
|
||||
@ApiOperation(value = "导出考勤excel", notes = "") |
// @ApiOperation(value = "导出考勤excel", notes = "")
|
||||
@RequestMapping(value = "/export", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
// @RequestMapping(value = "/export", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
||||
public JsonResponse export(@ApiParam @Validated @RequestBody QueryDto<CClockingInDto.QueryClockingIn> params) throws Exception{ |
// public JsonResponse export(@ApiParam @Validated @RequestBody QueryDto<CClockingInDto.QueryClockingIn> params) throws Exception{
|
||||
clockingInService.exportRecord(params.getParam(), params.getUserId()); |
// clockingInService.exportRecord(params.getParam(), params.getUserId());
|
||||
return JsonResponse.newInstance().ok(); |
// return JsonResponse.newInstance().ok();
|
||||
} |
// }
|
||||
|
//
|
||||
@ApiOperation(value = "添加任务", notes = "") |
// @ApiOperation(value = "添加任务", notes = "")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
// @RequestMapping(value = "/save", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
||||
public JsonResponse<List<CTaskVo.QueryTask>> saveTask(@ApiParam @Validated @RequestBody QueryDto<CTaskDto.SaveTask> params) throws Exception { |
// public JsonResponse<List<CTaskVo.QueryTask>> saveTask(@ApiParam @Validated @RequestBody QueryDto<CTaskDto.SaveTask> params) throws Exception {
|
||||
log.info("添加任务开始"); |
// log.info("添加任务开始");
|
||||
List<CTaskVo.QueryTask> taskList = taskService.saveTask(params.getParam(), params.getUserId()); |
// List<CTaskVo.QueryTask> taskList = taskService.saveTask(params.getParam(), params.getUserId());
|
||||
log.info("添加任务结束{}",taskList); |
// log.info("添加任务结束{}",taskList);
|
||||
return JsonResponse.newInstance().ok(taskList); |
// return JsonResponse.newInstance().ok(taskList);
|
||||
} |
// }
|
||||
} |
//}
|
||||
|
@ -1,22 +1,22 @@ |
|||||
package com.ccsens.common.config; |
//package com.ccsens.common.config;
|
||||
|
//
|
||||
import com.ccsens.common.intercept.MybatisInterceptor; |
//import com.ccsens.common.intercept.MybatisInterceptor;
|
||||
import org.springframework.context.annotation.Bean; |
//import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration; |
//import org.springframework.context.annotation.Configuration;
|
||||
|
//
|
||||
/** |
///**
|
||||
* @description: |
// * @description:
|
||||
* @author: wuHuiJuan |
// * @author: wuHuiJuan
|
||||
* @create: 2019/12/11 10:59 |
// * @create: 2019/12/11 10:59
|
||||
*/ |
// */
|
||||
@Configuration |
//@Configuration
|
||||
public class BeanConfig { |
//public class BeanConfig {
|
||||
/** |
// /**
|
||||
* 注册拦截器 |
// * 注册拦截器
|
||||
*/ |
// */
|
||||
@Bean |
// @Bean
|
||||
public MybatisInterceptor mybatisInterceptor() { |
// public MybatisInterceptor mybatisInterceptor() {
|
||||
MybatisInterceptor interceptor = new MybatisInterceptor(); |
// MybatisInterceptor interceptor = new MybatisInterceptor();
|
||||
return interceptor; |
// return interceptor;
|
||||
} |
// }
|
||||
} |
//}
|
||||
|
@ -1,98 +1,98 @@ |
|||||
package com.ccsens.common.config; |
//package com.ccsens.common.config;
|
||||
|
//
|
||||
|
//
|
||||
import cn.hutool.core.lang.Snowflake; |
//import cn.hutool.core.lang.Snowflake;
|
||||
import cn.hutool.core.util.IdUtil; |
//import cn.hutool.core.util.IdUtil;
|
||||
import com.ccsens.util.config.DruidProps; |
//import com.ccsens.util.config.DruidProps;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature; |
//import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper; |
//import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule; |
//import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
//import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import org.springframework.beans.factory.annotation.Autowired; |
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value; |
//import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean; |
//import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration; |
//import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.MediaType; |
//import org.springframework.http.MediaType;
|
||||
import org.springframework.http.converter.HttpMessageConverter; |
//import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.StringHttpMessageConverter; |
//import org.springframework.http.converter.StringHttpMessageConverter;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; |
//import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; |
//import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; |
//import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; |
//import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
//
|
||||
import javax.sql.DataSource; |
//import javax.sql.DataSource;
|
||||
import java.nio.charset.Charset; |
//import java.nio.charset.Charset;
|
||||
import java.util.ArrayList; |
//import java.util.ArrayList;
|
||||
import java.util.List; |
//import java.util.List;
|
||||
|
//
|
||||
@Configuration |
//@Configuration
|
||||
//public class SpringConfig extends WebMvcConfigurationSupport {
|
////public class SpringConfig extends WebMvcConfigurationSupport {
|
||||
public class SpringConfig implements WebMvcConfigurer { |
//public class SpringConfig implements WebMvcConfigurer {
|
||||
@Autowired |
// @Autowired
|
||||
private DruidProps druidPropsUtil; |
// private DruidProps druidPropsUtil;
|
||||
@Value("${spring.snowflake.workerId}") |
// @Value("${spring.snowflake.workerId}")
|
||||
private String workerId; |
// private String workerId;
|
||||
@Value("${spring.snowflake.datacenterId}") |
// @Value("${spring.snowflake.datacenterId}")
|
||||
private String datacenterId; |
// private String datacenterId;
|
||||
|
//
|
||||
/** |
// /**
|
||||
* 配置Converter |
// * 配置Converter
|
||||
* @return |
// * @return
|
||||
*/ |
// */
|
||||
@Bean |
// @Bean
|
||||
public HttpMessageConverter<String> responseStringConverter() { |
// public HttpMessageConverter<String> responseStringConverter() {
|
||||
StringHttpMessageConverter converter = new StringHttpMessageConverter( |
// StringHttpMessageConverter converter = new StringHttpMessageConverter(
|
||||
Charset.forName("UTF-8")); |
// Charset.forName("UTF-8"));
|
||||
return converter; |
// return converter;
|
||||
} |
// }
|
||||
|
//
|
||||
@Bean |
// @Bean
|
||||
public HttpMessageConverter<Object> responseJsonConverter(){ |
// public HttpMessageConverter<Object> responseJsonConverter(){
|
||||
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); |
// MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
|
||||
List<MediaType> mediaTypeList = new ArrayList<>(); |
// List<MediaType> mediaTypeList = new ArrayList<>();
|
||||
mediaTypeList.add(MediaType.TEXT_HTML); |
// mediaTypeList.add(MediaType.TEXT_HTML);
|
||||
mediaTypeList.add(MediaType.APPLICATION_JSON_UTF8); |
// mediaTypeList.add(MediaType.APPLICATION_JSON_UTF8);
|
||||
converter.setSupportedMediaTypes(mediaTypeList); |
// converter.setSupportedMediaTypes(mediaTypeList);
|
||||
|
//
|
||||
ObjectMapper objectMapper = new ObjectMapper(); |
// ObjectMapper objectMapper = new ObjectMapper();
|
||||
SimpleModule simpleModule = new SimpleModule(); |
// SimpleModule simpleModule = new SimpleModule();
|
||||
simpleModule.addSerializer(Long.class, ToStringSerializer.instance); |
// simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
|
||||
simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance); |
// simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
|
||||
objectMapper.registerModule(simpleModule); |
// objectMapper.registerModule(simpleModule);
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); |
// objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
converter.setObjectMapper(objectMapper); |
// converter.setObjectMapper(objectMapper);
|
||||
|
//
|
||||
return converter; |
// return converter;
|
||||
} |
// }
|
||||
|
//
|
||||
@Override |
// @Override
|
||||
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { |
// public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||
converters.add(responseStringConverter()); |
// converters.add(responseStringConverter());
|
||||
converters.add(responseJsonConverter()); |
// converters.add(responseJsonConverter());
|
||||
} |
// }
|
||||
|
//
|
||||
@Override |
// @Override
|
||||
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { |
// public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
|
||||
configurer.favorPathExtension(false); |
// configurer.favorPathExtension(false);
|
||||
} |
// }
|
||||
|
//
|
||||
/** |
// /**
|
||||
* 配置数据源(单数据源) |
// * 配置数据源(单数据源)
|
||||
*/ |
// */
|
||||
@Bean |
// @Bean
|
||||
public DataSource dataSource(){ |
// public DataSource dataSource(){
|
||||
return druidPropsUtil.createDruidDataSource(); |
// return druidPropsUtil.createDruidDataSource();
|
||||
} |
// }
|
||||
|
//
|
||||
@Bean |
// @Bean
|
||||
public Snowflake snowflake(){ |
// public Snowflake snowflake(){
|
||||
return IdUtil.createSnowflake(Long.valueOf(workerId),Long.valueOf(datacenterId)); |
// return IdUtil.createSnowflake(Long.valueOf(workerId),Long.valueOf(datacenterId));
|
||||
} |
// }
|
||||
|
//
|
||||
@Override |
// @Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) { |
// public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/uploads/**") |
// registry.addResourceHandler("/uploads/**")
|
||||
.addResourceLocations("file:///home/cloud/ht/uploads/"); |
// .addResourceLocations("file:///home/cloud/ht/uploads/");
|
||||
} |
// }
|
||||
} |
//}
|
@ -1,56 +1,56 @@ |
|||||
package com.ccsens.common.config; |
//package com.ccsens.common.config;
|
||||
|
//
|
||||
import com.ccsens.util.WebConstant; |
//import com.ccsens.util.WebConstant;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; |
//import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||
import org.springframework.context.annotation.Bean; |
//import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration; |
//import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ParameterBuilder; |
//import springfox.documentation.builders.ParameterBuilder;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors; |
//import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.schema.ModelRef; |
//import springfox.documentation.schema.ModelRef;
|
||||
import springfox.documentation.service.ApiInfo; |
//import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.service.Parameter; |
//import springfox.documentation.service.Parameter;
|
||||
import springfox.documentation.spi.DocumentationType; |
//import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket; |
//import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2; |
//import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
//
|
||||
import java.util.ArrayList; |
//import java.util.ArrayList;
|
||||
import java.util.List; |
//import java.util.List;
|
||||
|
//
|
||||
@Configuration |
//@Configuration
|
||||
@EnableSwagger2 |
//@EnableSwagger2
|
||||
@ConditionalOnExpression("${swagger.enable}") |
//@ConditionalOnExpression("${swagger.enable}")
|
||||
//public class SwaggerConfigure extends WebMvcConfigurationSupport {
|
////public class SwaggerConfigure extends WebMvcConfigurationSupport {
|
||||
public class SwaggerConfigure /*implements WebMvcConfigurer*/ { |
//public class SwaggerConfigure /*implements WebMvcConfigurer*/ {
|
||||
@Bean |
// @Bean
|
||||
public Docket customDocket() { |
// public Docket customDocket() {
|
||||
//
|
// //
|
||||
return new Docket(DocumentationType.SWAGGER_2) |
// return new Docket(DocumentationType.SWAGGER_2)
|
||||
.apiInfo(apiInfo()) |
// .apiInfo(apiInfo())
|
||||
.select() |
// .select()
|
||||
.apis(RequestHandlerSelectors |
// .apis(RequestHandlerSelectors
|
||||
.basePackage("com.ccsens.common.api")) |
// .basePackage("com.ccsens.common.api"))
|
||||
.build() |
// .build()
|
||||
.globalOperationParameters(setHeaderToken()); |
// .globalOperationParameters(setHeaderToken());
|
||||
} |
// }
|
||||
|
//
|
||||
private ApiInfo apiInfo() { |
// private ApiInfo apiInfo() {
|
||||
return new ApiInfo("Swagger Tall-ptpro",//大标题 title
|
// return new ApiInfo("Swagger Tall-ptpro",//大标题 title
|
||||
"This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",//小标题
|
// "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",//小标题
|
||||
"1.0.0",//版本
|
// "1.0.0",//版本
|
||||
"http://swagger.io/terms/",//termsOfServiceUrl
|
// "http://swagger.io/terms/",//termsOfServiceUrl
|
||||
"zhangsan",//作者
|
// "zhangsan",//作者
|
||||
"Apache 2.0",//链接显示文字
|
// "Apache 2.0",//链接显示文字
|
||||
"http://www.apache.org/licenses/LICENSE-2.0.html"//网站链接
|
// "http://www.apache.org/licenses/LICENSE-2.0.html"//网站链接
|
||||
); |
// );
|
||||
} |
// }
|
||||
|
//
|
||||
private List<Parameter> setHeaderToken() { |
// private List<Parameter> setHeaderToken() {
|
||||
ParameterBuilder tokenPar = new ParameterBuilder(); |
// ParameterBuilder tokenPar = new ParameterBuilder();
|
||||
List<Parameter> pars = new ArrayList<>(); |
// List<Parameter> pars = new ArrayList<>();
|
||||
tokenPar.name(WebConstant.HEADER_KEY_TOKEN).description("token") |
// tokenPar.name(WebConstant.HEADER_KEY_TOKEN).description("token")
|
||||
.defaultValue(WebConstant.HEADER_KEY_TOKEN_PREFIX) |
// .defaultValue(WebConstant.HEADER_KEY_TOKEN_PREFIX)
|
||||
.modelRef(new ModelRef("string")).parameterType("header").required(false).build(); |
// .modelRef(new ModelRef("string")).parameterType("header").required(false).build();
|
||||
pars.add(tokenPar.build()); |
// pars.add(tokenPar.build());
|
||||
return pars; |
// return pars;
|
||||
} |
// }
|
||||
} |
//}
|
||||
|
Loading…
Reference in new issue