Browse Source

查询项目下的任务

tall3
ma 4 years ago
parent
commit
f2b37c1110
  1. 50
      common/src/main/java/com/ccsens/common/CommonApplication.java
  2. 208
      common/src/main/java/com/ccsens/common/api/TaskController.java
  3. 10
      common/src/main/java/com/ccsens/common/bean/dto/CTaskDto.java
  4. 9
      common/src/main/java/com/ccsens/common/bean/vo/CTaskVo.java
  5. 44
      common/src/main/java/com/ccsens/common/config/BeanConfig.java
  6. 196
      common/src/main/java/com/ccsens/common/config/SpringConfig.java
  7. 112
      common/src/main/java/com/ccsens/common/config/SwaggerConfigure.java
  8. 7
      common/src/main/java/com/ccsens/common/persist/dao/ProTaskDetailDao.java
  9. 8
      common/src/main/java/com/ccsens/common/service/ITaskService.java
  10. 5
      common/src/main/java/com/ccsens/common/service/TaskService.java
  11. 22
      common/src/main/resources/mapper_dao/ProTaskDetailDao.xml

50
common/src/main/java/com/ccsens/common/CommonApplication.java

@ -1,25 +1,25 @@
package com.ccsens.common;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableAsync;
/**
* @author ma
*/
@MapperScan(basePackages = {"com.ccsens.common.persist.*"})
@ServletComponentScan
@EnableAsync
//开启断路器功能
@EnableCircuitBreaker
@EnableFeignClients(basePackages = "com.ccsens.cloudutil.feign")
@SpringBootApplication(scanBasePackages = "com.ccsens")
public class CommonApplication {
public static void main(String[] args) {
SpringApplication.run(CommonApplication.class,args);
}
}
//package com.ccsens.common;
//
//import org.mybatis.spring.annotation.MapperScan;
//import org.springframework.boot.SpringApplication;
//import org.springframework.boot.autoconfigure.SpringBootApplication;
//import org.springframework.boot.web.servlet.ServletComponentScan;
//import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
//import org.springframework.cloud.openfeign.EnableFeignClients;
//import org.springframework.scheduling.annotation.EnableAsync;
//
///**
// * @author ma
// */
//@MapperScan(basePackages = {"com.ccsens.common.persist.*"})
//@ServletComponentScan
//@EnableAsync
////开启断路器功能
//@EnableCircuitBreaker
//@EnableFeignClients(basePackages = "com.ccsens.cloudutil.feign")
//@SpringBootApplication(scanBasePackages = "com.ccsens")
//public class CommonApplication {
// public static void main(String[] args) {
// SpringApplication.run(CommonApplication.class,args);
// }
//}

208
common/src/main/java/com/ccsens/common/api/TaskController.java

@ -1,104 +1,104 @@
package com.ccsens.common.api;
import com.ccsens.cloudutil.annotation.MustLogin;
import com.ccsens.common.bean.dto.CClockingInDto;
import com.ccsens.common.bean.dto.CTaskDto;
import com.ccsens.common.bean.vo.CClockingInVo;
import com.ccsens.common.bean.vo.CTaskVo;
import com.ccsens.common.service.IClockingInService;
import com.ccsens.common.service.ITaskService;
import com.ccsens.util.JsonResponse;
import com.ccsens.util.bean.dto.QueryDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* @author
*/
@Api(tags = "DEBUG" , description = "DebugController | ")
@RestController
@RequestMapping("/task")
@Slf4j
public class TaskController {
@Resource
private ITaskService taskService;
@Resource
private IClockingInService clockingInService;
@MustLogin
@ApiOperation(value = "查找永久日常任务", notes = "")
@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) {
log.info("查找永久日常任务开始{}",params);
List<CTaskVo.QueryTask> permanentGlobalTaskList = taskService.queryPermanentGlobalTask(params.getParam(),params.getUserId());
log.info("查找永久日常任务结束{}",permanentGlobalTaskList);
return JsonResponse.newInstance().ok(permanentGlobalTaskList);
}
@MustLogin
@ApiOperation(value = "查找带时间的日常任务", notes = "")
@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) {
log.info("查找带时间的日常任务开始{}",params);
List<CTaskVo.QueryTask> globalTask = taskService.queryGlobalTask(params.getParam(),params.getUserId());
log.info("查找带时间的日常任务结束{}",globalTask);
return JsonResponse.newInstance().ok(globalTask);
}
@MustLogin
@ApiOperation(value = "查找带时间的定期任务", notes = "")
@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) {
log.info("查找带时间的定期任务开始{}",params);
List<CTaskVo.QueryTask> regularTask = taskService.queryRegularTask(params.getParam(), params.getUserId());
log.info("查找带时间的定期任务结束{}",regularTask);
return JsonResponse.newInstance().ok(regularTask);
}
@MustLogin
@ApiOperation(value = "查询考勤信息", notes = "")
@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{
List<CClockingInVo.ClockingInInfo> clockingInInfos = clockingInService.queryClockingIn(params.getParam(), params.getUserId());
return JsonResponse.newInstance().ok(clockingInInfos);
}
@MustLogin
@ApiOperation(value = "打卡", notes = "")
@RequestMapping(value = "/punch", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse punchTheClock(@ApiParam @Validated @RequestBody QueryDto<CClockingInDto.PunchTheClock> params) throws Exception{
clockingInService.punchTheClock(params.getParam(), params.getUserId());
return JsonResponse.newInstance().ok();
}
@MustLogin
@ApiOperation(value = "导出考勤excel", notes = "")
@RequestMapping(value = "/export", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse export(@ApiParam @Validated @RequestBody QueryDto<CClockingInDto.QueryClockingIn> params) throws Exception{
clockingInService.exportRecord(params.getParam(), params.getUserId());
return JsonResponse.newInstance().ok();
}
@ApiOperation(value = "添加任务", notes = "")
@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 {
log.info("添加任务开始");
List<CTaskVo.QueryTask> taskList = taskService.saveTask(params.getParam(), params.getUserId());
log.info("添加任务结束{}",taskList);
return JsonResponse.newInstance().ok(taskList);
}
}
//package com.ccsens.common.api;
//
//import com.ccsens.cloudutil.annotation.MustLogin;
//import com.ccsens.common.bean.dto.CClockingInDto;
//import com.ccsens.common.bean.dto.CTaskDto;
//
//import com.ccsens.common.bean.vo.CClockingInVo;
//import com.ccsens.common.bean.vo.CTaskVo;
//
//import com.ccsens.common.service.IClockingInService;
//import com.ccsens.common.service.ITaskService;
//import com.ccsens.util.JsonResponse;
//import com.ccsens.util.bean.dto.QueryDto;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.validation.annotation.Validated;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.annotation.Resource;
//import java.util.List;
//
///**
// * @author 逗
// */
//@Api(tags = "DEBUG" , description = "DebugController | ")
//@RestController
//@RequestMapping("/task")
//@Slf4j
//public class TaskController {
//
// @Resource
// private ITaskService taskService;
// @Resource
// private IClockingInService clockingInService;
//
// @MustLogin
// @ApiOperation(value = "查找永久日常任务", notes = "")
// @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) {
// log.info("查找永久日常任务开始{}",params);
// List<CTaskVo.QueryTask> permanentGlobalTaskList = taskService.queryPermanentGlobalTask(params.getParam(),params.getUserId());
// log.info("查找永久日常任务结束{}",permanentGlobalTaskList);
// return JsonResponse.newInstance().ok(permanentGlobalTaskList);
// }
//
// @MustLogin
// @ApiOperation(value = "查找带时间的日常任务", notes = "")
// @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) {
// log.info("查找带时间的日常任务开始{}",params);
// List<CTaskVo.QueryTask> globalTask = taskService.queryGlobalTask(params.getParam(),params.getUserId());
// log.info("查找带时间的日常任务结束{}",globalTask);
// return JsonResponse.newInstance().ok(globalTask);
// }
//
// @MustLogin
// @ApiOperation(value = "查找带时间的定期任务", notes = "")
// @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) {
// log.info("查找带时间的定期任务开始{}",params);
// List<CTaskVo.QueryTask> regularTask = taskService.queryRegularTask(params.getParam(), params.getUserId());
// log.info("查找带时间的定期任务结束{}",regularTask);
// return JsonResponse.newInstance().ok(regularTask);
// }
//
//
// @MustLogin
// @ApiOperation(value = "查询考勤信息", notes = "")
// @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{
// List<CClockingInVo.ClockingInInfo> clockingInInfos = clockingInService.queryClockingIn(params.getParam(), params.getUserId());
// return JsonResponse.newInstance().ok(clockingInInfos);
// }
//
// @MustLogin
// @ApiOperation(value = "打卡", notes = "")
// @RequestMapping(value = "/punch", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
// public JsonResponse punchTheClock(@ApiParam @Validated @RequestBody QueryDto<CClockingInDto.PunchTheClock> params) throws Exception{
// clockingInService.punchTheClock(params.getParam(), params.getUserId());
// return JsonResponse.newInstance().ok();
// }
//
// @MustLogin
// @ApiOperation(value = "导出考勤excel", notes = "")
// @RequestMapping(value = "/export", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
// public JsonResponse export(@ApiParam @Validated @RequestBody QueryDto<CClockingInDto.QueryClockingIn> params) throws Exception{
// clockingInService.exportRecord(params.getParam(), params.getUserId());
// return JsonResponse.newInstance().ok();
// }
//
// @ApiOperation(value = "添加任务", notes = "")
// @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 {
// log.info("添加任务开始");
// List<CTaskVo.QueryTask> taskList = taskService.saveTask(params.getParam(), params.getUserId());
// log.info("添加任务结束{}",taskList);
// return JsonResponse.newInstance().ok(taskList);
// }
//}

10
common/src/main/java/com/ccsens/common/bean/dto/CTaskDto.java

@ -117,4 +117,14 @@ public class CTaskDto {
@ApiModelProperty("交付物名")
private List<String> deliverList;
}
@Data
@ApiModel("查询项目下的任务")
public static class QueryTaskOfProject{
@NotNull(message = "项目id不能为空")
@ApiModelProperty("项目id")
private Long projectId;
@ApiModelProperty("项目名称")
private String name;
}
}

9
common/src/main/java/com/ccsens/common/bean/vo/CTaskVo.java

@ -132,4 +132,13 @@ public class CTaskVo {
}
@Data
@ApiModel("项目下的任务")
public static class TaskOfProject {
@ApiModelProperty("任务详情id")
private Long detailId;
@ApiModelProperty("任务名称")
private String name;
}
}

44
common/src/main/java/com/ccsens/common/config/BeanConfig.java

@ -1,22 +1,22 @@
package com.ccsens.common.config;
import com.ccsens.common.intercept.MybatisInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @description:
* @author: wuHuiJuan
* @create: 2019/12/11 10:59
*/
@Configuration
public class BeanConfig {
/**
* 注册拦截器
*/
@Bean
public MybatisInterceptor mybatisInterceptor() {
MybatisInterceptor interceptor = new MybatisInterceptor();
return interceptor;
}
}
//package com.ccsens.common.config;
//
//import com.ccsens.common.intercept.MybatisInterceptor;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
///**
// * @description:
// * @author: wuHuiJuan
// * @create: 2019/12/11 10:59
// */
//@Configuration
//public class BeanConfig {
// /**
// * 注册拦截器
// */
// @Bean
// public MybatisInterceptor mybatisInterceptor() {
// MybatisInterceptor interceptor = new MybatisInterceptor();
// return interceptor;
// }
//}

196
common/src/main/java/com/ccsens/common/config/SpringConfig.java

@ -1,98 +1,98 @@
package com.ccsens.common.config;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;
import com.ccsens.util.config.DruidProps;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import javax.sql.DataSource;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
@Configuration
//public class SpringConfig extends WebMvcConfigurationSupport {
public class SpringConfig implements WebMvcConfigurer {
@Autowired
private DruidProps druidPropsUtil;
@Value("${spring.snowflake.workerId}")
private String workerId;
@Value("${spring.snowflake.datacenterId}")
private String datacenterId;
/**
* 配置Converter
* @return
*/
@Bean
public HttpMessageConverter<String> responseStringConverter() {
StringHttpMessageConverter converter = new StringHttpMessageConverter(
Charset.forName("UTF-8"));
return converter;
}
@Bean
public HttpMessageConverter<Object> responseJsonConverter(){
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
List<MediaType> mediaTypeList = new ArrayList<>();
mediaTypeList.add(MediaType.TEXT_HTML);
mediaTypeList.add(MediaType.APPLICATION_JSON_UTF8);
converter.setSupportedMediaTypes(mediaTypeList);
ObjectMapper objectMapper = new ObjectMapper();
SimpleModule simpleModule = new SimpleModule();
simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
objectMapper.registerModule(simpleModule);
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
converter.setObjectMapper(objectMapper);
return converter;
}
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
converters.add(responseStringConverter());
converters.add(responseJsonConverter());
}
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
configurer.favorPathExtension(false);
}
/**
* 配置数据源单数据源
*/
@Bean
public DataSource dataSource(){
return druidPropsUtil.createDruidDataSource();
}
@Bean
public Snowflake snowflake(){
return IdUtil.createSnowflake(Long.valueOf(workerId),Long.valueOf(datacenterId));
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/uploads/**")
.addResourceLocations("file:///home/cloud/ht/uploads/");
}
}
//package com.ccsens.common.config;
//
//
//import cn.hutool.core.lang.Snowflake;
//import cn.hutool.core.util.IdUtil;
//import com.ccsens.util.config.DruidProps;
//import com.fasterxml.jackson.databind.DeserializationFeature;
//import com.fasterxml.jackson.databind.ObjectMapper;
//import com.fasterxml.jackson.databind.module.SimpleModule;
//import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.http.MediaType;
//import org.springframework.http.converter.HttpMessageConverter;
//import org.springframework.http.converter.StringHttpMessageConverter;
//import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
//import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
//import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
//import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//
//import javax.sql.DataSource;
//import java.nio.charset.Charset;
//import java.util.ArrayList;
//import java.util.List;
//
//@Configuration
////public class SpringConfig extends WebMvcConfigurationSupport {
//public class SpringConfig implements WebMvcConfigurer {
// @Autowired
// private DruidProps druidPropsUtil;
// @Value("${spring.snowflake.workerId}")
// private String workerId;
// @Value("${spring.snowflake.datacenterId}")
// private String datacenterId;
//
// /**
// * 配置Converter
// * @return
// */
// @Bean
// public HttpMessageConverter<String> responseStringConverter() {
// StringHttpMessageConverter converter = new StringHttpMessageConverter(
// Charset.forName("UTF-8"));
// return converter;
// }
//
// @Bean
// public HttpMessageConverter<Object> responseJsonConverter(){
// MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
// List<MediaType> mediaTypeList = new ArrayList<>();
// mediaTypeList.add(MediaType.TEXT_HTML);
// mediaTypeList.add(MediaType.APPLICATION_JSON_UTF8);
// converter.setSupportedMediaTypes(mediaTypeList);
//
// ObjectMapper objectMapper = new ObjectMapper();
// SimpleModule simpleModule = new SimpleModule();
// simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
// simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
// objectMapper.registerModule(simpleModule);
// objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// converter.setObjectMapper(objectMapper);
//
// return converter;
// }
//
// @Override
// public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
// converters.add(responseStringConverter());
// converters.add(responseJsonConverter());
// }
//
// @Override
// public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
// configurer.favorPathExtension(false);
// }
//
// /**
// * 配置数据源(单数据源)
// */
// @Bean
// public DataSource dataSource(){
// return druidPropsUtil.createDruidDataSource();
// }
//
// @Bean
// public Snowflake snowflake(){
// return IdUtil.createSnowflake(Long.valueOf(workerId),Long.valueOf(datacenterId));
// }
//
// @Override
// public void addResourceHandlers(ResourceHandlerRegistry registry) {
// registry.addResourceHandler("/uploads/**")
// .addResourceLocations("file:///home/cloud/ht/uploads/");
// }
//}

112
common/src/main/java/com/ccsens/common/config/SwaggerConfigure.java

@ -1,56 +1,56 @@
package com.ccsens.common.config;
import com.ccsens.util.WebConstant;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Parameter;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.ArrayList;
import java.util.List;
@Configuration
@EnableSwagger2
@ConditionalOnExpression("${swagger.enable}")
//public class SwaggerConfigure extends WebMvcConfigurationSupport {
public class SwaggerConfigure /*implements WebMvcConfigurer*/ {
@Bean
public Docket customDocket() {
//
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors
.basePackage("com.ccsens.common.api"))
.build()
.globalOperationParameters(setHeaderToken());
}
private ApiInfo apiInfo() {
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.",//小标题
"1.0.0",//版本
"http://swagger.io/terms/",//termsOfServiceUrl
"zhangsan",//作者
"Apache 2.0",//链接显示文字
"http://www.apache.org/licenses/LICENSE-2.0.html"//网站链接
);
}
private List<Parameter> setHeaderToken() {
ParameterBuilder tokenPar = new ParameterBuilder();
List<Parameter> pars = new ArrayList<>();
tokenPar.name(WebConstant.HEADER_KEY_TOKEN).description("token")
.defaultValue(WebConstant.HEADER_KEY_TOKEN_PREFIX)
.modelRef(new ModelRef("string")).parameterType("header").required(false).build();
pars.add(tokenPar.build());
return pars;
}
}
//package com.ccsens.common.config;
//
//import com.ccsens.util.WebConstant;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import springfox.documentation.builders.ParameterBuilder;
//import springfox.documentation.builders.RequestHandlerSelectors;
//import springfox.documentation.schema.ModelRef;
//import springfox.documentation.service.ApiInfo;
//import springfox.documentation.service.Parameter;
//import springfox.documentation.spi.DocumentationType;
//import springfox.documentation.spring.web.plugins.Docket;
//import springfox.documentation.swagger2.annotations.EnableSwagger2;
//
//import java.util.ArrayList;
//import java.util.List;
//
//@Configuration
//@EnableSwagger2
//@ConditionalOnExpression("${swagger.enable}")
////public class SwaggerConfigure extends WebMvcConfigurationSupport {
//public class SwaggerConfigure /*implements WebMvcConfigurer*/ {
// @Bean
// public Docket customDocket() {
// //
// return new Docket(DocumentationType.SWAGGER_2)
// .apiInfo(apiInfo())
// .select()
// .apis(RequestHandlerSelectors
// .basePackage("com.ccsens.common.api"))
// .build()
// .globalOperationParameters(setHeaderToken());
// }
//
// private ApiInfo apiInfo() {
// 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.",//小标题
// "1.0.0",//版本
// "http://swagger.io/terms/",//termsOfServiceUrl
// "zhangsan",//作者
// "Apache 2.0",//链接显示文字
// "http://www.apache.org/licenses/LICENSE-2.0.html"//网站链接
// );
// }
//
// private List<Parameter> setHeaderToken() {
// ParameterBuilder tokenPar = new ParameterBuilder();
// List<Parameter> pars = new ArrayList<>();
// tokenPar.name(WebConstant.HEADER_KEY_TOKEN).description("token")
// .defaultValue(WebConstant.HEADER_KEY_TOKEN_PREFIX)
// .modelRef(new ModelRef("string")).parameterType("header").required(false).build();
// pars.add(tokenPar.build());
// return pars;
// }
//}

7
common/src/main/java/com/ccsens/common/persist/dao/ProTaskDetailDao.java

@ -86,4 +86,11 @@ public interface ProTaskDetailDao extends ProTaskDetailMapper {
* @return 任务及相关信息
*/
CTaskVo.QueryTask queryTaskById(@Param("taskDetailId") Long id);
/**
* 查询项目下的所有任务
* @param param 项目id 任务名称
* @return 任务列表
*/
List<CTaskVo.TaskOfProject> queryTaskOfProject(CTaskDto.QueryTaskOfProject param);
}

8
common/src/main/java/com/ccsens/common/service/ITaskService.java

@ -64,4 +64,12 @@ public interface ITaskService {
* @return 子项目列表
*/
List<CTaskVo.QueryTask> saveTask(CTaskDto.SaveTask param,Long userId);
/**
* 查询项目下的任务
* @param param 参数
* @param userId 用户id
* @return 项目下的所有任务
*/
List<CTaskVo.TaskOfProject> queryTaskOfProject(CTaskDto.QueryTaskOfProject param,Long userId);
}

5
common/src/main/java/com/ccsens/common/service/TaskService.java

@ -687,4 +687,9 @@ public class TaskService implements ITaskService {
return taskList;
}
@Override
public List<CTaskVo.TaskOfProject> queryTaskOfProject(CTaskDto.QueryTaskOfProject param, Long userId) {
return taskDetailDao.queryTaskOfProject(param);
}
}

22
common/src/main/resources/mapper_dao/ProTaskDetailDao.xml

@ -413,4 +413,26 @@
AND td.id = #{taskDetailId}
</select>
<select id="queryTaskOfProject" resultType="com.ccsens.common.bean.vo.CTaskVo$TaskOfProject">
SELECT
t.id,
t.`name`
FROM
t_pro_parent_task AS p
LEFT JOIN t_pro_task_detail AS t ON t.id = p.task_detail_id
WHERE
p.rec_status = 0
AND t.rec_status = 0
AND p.parent_task_detail_id IN (
SELECT
pp.task_detail_id
FROM
t_pro_parent_task AS pp
WHERE
pp.parent_task_detail_id = #{projectId}
AND pp.rec_status = 0
)
AND t.`name` LIKE CONCAT('%',#{name},'%')
</select>
</mapper>
Loading…
Cancel
Save