Browse Source

Merge branch 'zyh' into zyj

# Conflicts:
#	zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/vo/TaskBaseVO.java
#	zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/task/TaskDO.java
zyh
小久哥 3 years ago
parent
commit
8105b62737
  1. 1
      yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/config/YudaoMybatisAutoConfiguration.java
  2. 4
      yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/jackson/config/YudaoJacksonAutoConfiguration.java
  3. 2
      yudao-server/src/main/resources/application-dev.yaml
  4. 10
      zsw-farm/zsw-farm-api/pom.xml
  5. 31
      zsw-farm/zsw-farm-api/src/main/java/cn/iocoder/yudao/module/farm/enums/TaskStatus.java
  6. 4
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/dto/DiscussDto.java
  7. 5
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussBaseVO.java
  8. 8
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussExcelVO.java
  9. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/ProjectController.java
  10. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/TaskController.java
  11. 4
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/vo/TaskBaseVO.java
  12. 6
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourBaseVO.java
  13. 12
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/discuss/DiscussDO.java
  14. 3
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/task/TaskDO.java
  15. 6
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/workHour/WorkHourDO.java
  16. 30
      zsw-farm/zsw-farm-impl/src/test/java/cn/iocoder/yudao/module/farm/service/task/TaskServiceImplTest.java

1
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/config/YudaoMybatisAutoConfiguration.java

@ -60,6 +60,7 @@ public class YudaoMybatisAutoConfiguration {
public SqlSessionFactory sqlSessionFactoryMaster(DynamicDataSourceProvider dynamicDataSourceProvider) throws Exception { public SqlSessionFactory sqlSessionFactoryMaster(DynamicDataSourceProvider dynamicDataSourceProvider) throws Exception {
//手动处理下原来的sqlsessionfactory //手动处理下原来的sqlsessionfactory
MybatisSqlSessionFactoryBean factory = new MybatisSqlSessionFactoryBean(); MybatisSqlSessionFactoryBean factory = new MybatisSqlSessionFactoryBean();
factory.setTypeEnumsPackage("cn.iocoder.yudao.module.farm.enums");
Map<String, DataSource> map = dynamicDataSourceProvider.loadDataSources(); Map<String, DataSource> map = dynamicDataSourceProvider.loadDataSources();
factory.setDataSource(map.get("master")); factory.setDataSource(map.get("master"));
return getSqlSessionFactory(factory); return getSqlSessionFactory(factory);

4
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/jackson/config/YudaoJacksonAutoConfiguration.java

@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.jackson.core.databind.LocalDateTimeDeserialize
import cn.iocoder.yudao.framework.jackson.core.databind.LocalDateTimeSerializer; import cn.iocoder.yudao.framework.jackson.core.databind.LocalDateTimeSerializer;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.databind.module.SimpleModule;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
@ -38,7 +39,8 @@ public class YudaoJacksonAutoConfiguration {
.addDeserializer(LocalDateTime.class, LocalDateTimeDeserializer.INSTANCE); .addDeserializer(LocalDateTime.class, LocalDateTimeDeserializer.INSTANCE);
objectMapper.registerModules(simpleModule); objectMapper.registerModules(simpleModule);
// 序列化枚举
objectMapper.configure(SerializationFeature.WRITE_ENUMS_USING_TO_STRING,true);
JsonUtils.init(objectMapper); JsonUtils.init(objectMapper);
log.info("初始化 jackson 自动配置"); log.info("初始化 jackson 自动配置");
return bean; return bean;

2
yudao-server/src/main/resources/application-dev.yaml

@ -66,7 +66,7 @@ spring:
# Quartz 配置项,对应 QuartzProperties 配置类 # Quartz 配置项,对应 QuartzProperties 配置类
spring: spring:
quartz: quartz:
auto-startup: true # 测试环境,需要开启 Job auto-startup: false # 测试环境,需要开启 Job
scheduler-name: schedulerName # Scheduler 名字。默认为 schedulerName scheduler-name: schedulerName # Scheduler 名字。默认为 schedulerName
job-store-type: jdbc # Job 存储器类型。默认为 memory 表示内存,可选 jdbc 使用数据库。 job-store-type: jdbc # Job 存储器类型。默认为 memory 表示内存,可选 jdbc 使用数据库。
wait-for-jobs-to-complete-on-shutdown: true # 应用关闭时,是否等待定时任务执行完成。默认为 false ,建议设置为 true wait-for-jobs-to-complete-on-shutdown: true # 应用关闭时,是否等待定时任务执行完成。默认为 false ,建议设置为 true

10
zsw-farm/zsw-farm-api/pom.xml

@ -17,6 +17,16 @@
<groupId>cn.iocoder.boot</groupId> <groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-common</artifactId> <artifactId>yudao-common</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-mybatis</artifactId>
</dependency>
</dependencies> </dependencies>

31
zsw-farm/zsw-farm-api/src/main/java/cn/iocoder/yudao/module/farm/enums/TaskStatus.java

@ -0,0 +1,31 @@
package cn.iocoder.yudao.module.farm.enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;
@Getter
public enum TaskStatus {
PLAN(0,"计划中"),
READY(1,"准备中"),
STARTED(2,"开始"),
EXCEPTION(3,"异常状态"),
COMPLETE(4,"任务完成"),
RETRY(5,"返工"),
END(6,"任务关闭");
@JsonValue
@EnumValue
private final Integer code;
private final String desc;
TaskStatus(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
}

4
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/dto/DiscussDto.java

@ -0,0 +1,4 @@
package cn.iocoder.yudao.module.farm.controller.admin.discuss.dto;
public class DiscussDto {
}

5
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussBaseVO.java

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.farm.controller.admin.discuss.vo; package cn.iocoder.yudao.module.farm.controller.admin.discuss.vo;
import cn.iocoder.yudao.module.farm.controller.admin.workHour.vo.WorkHourBaseVO;
import lombok.*; import lombok.*;
import java.util.*; import java.util.*;
import io.swagger.annotations.*; import io.swagger.annotations.*;
@ -24,6 +25,8 @@ public class DiscussBaseVO {
private String content; private String content;
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
private String images; private List<String> images;
private List<WorkHourBaseVO> workHourList;
} }

8
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussExcelVO.java

@ -1,5 +1,8 @@
package cn.iocoder.yudao.module.farm.controller.admin.discuss.vo; package cn.iocoder.yudao.module.farm.controller.admin.discuss.vo;
import cn.iocoder.yudao.module.farm.controller.admin.workHour.vo.WorkHourBaseVO;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.*; import lombok.*;
import java.util.*; import java.util.*;
import io.swagger.annotations.*; import io.swagger.annotations.*;
@ -27,9 +30,12 @@ public class DiscussExcelVO {
private String content; private String content;
@ExcelProperty("") @ExcelProperty("")
private String images; private List<String> images;
@ExcelProperty("") @ExcelProperty("")
private Date createTime; private Date createTime;
@ExcelProperty("")
private List<WorkHourBaseVO> workHourList;
} }

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/ProjectController.java

@ -26,7 +26,7 @@ import cn.iocoder.yudao.module.farm.dal.dataobject.project.ProjectDO;
import cn.iocoder.yudao.module.farm.convert.project.ProjectConvert; import cn.iocoder.yudao.module.farm.convert.project.ProjectConvert;
import cn.iocoder.yudao.module.farm.service.project.ProjectService; import cn.iocoder.yudao.module.farm.service.project.ProjectService;
@Api(tags = "管理后台 - 农场项目") @Api(tags = "管理后台 - 项目管理")
@RestController @RestController
@RequestMapping("/farm/project") @RequestMapping("/farm/project")
@Validated @Validated

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/TaskController.java

@ -26,7 +26,7 @@ import cn.iocoder.yudao.module.farm.dal.dataobject.task.TaskDO;
import cn.iocoder.yudao.module.farm.convert.task.TaskConvert; import cn.iocoder.yudao.module.farm.convert.task.TaskConvert;
import cn.iocoder.yudao.module.farm.service.task.TaskService; import cn.iocoder.yudao.module.farm.service.task.TaskService;
@Api(tags = "管理后台 - 农场项目") @Api(tags = "管理后台 - 任务管理")
@RestController @RestController
@RequestMapping("/farm/task") @RequestMapping("/farm/task")
@Validated @Validated

4
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/vo/TaskBaseVO.java

@ -1,10 +1,10 @@
package cn.iocoder.yudao.module.farm.controller.admin.task.vo; package cn.iocoder.yudao.module.farm.controller.admin.task.vo;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import cn.iocoder.yudao.module.farm.enums.TaskStatus;
import lombok.*; import lombok.*;
import java.util.*; import java.util.*;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ -45,4 +45,6 @@ public class TaskBaseVO {
@ApiModelProperty(value = "优先级") @ApiModelProperty(value = "优先级")
private Integer weight; private Integer weight;
@ApiModelProperty("任务状态")
private TaskStatus status;
} }

6
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourBaseVO.java

@ -13,13 +13,13 @@ import javax.validation.constraints.*;
public class WorkHourBaseVO { public class WorkHourBaseVO {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
private Integer userId; private Long userId;
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
private Integer projectId; private Long projectId;
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
private Integer taskId; private Long taskId;
@ApiModelProperty(value = "", required = true) @ApiModelProperty(value = "", required = true)
@NotNull(message = "不能为空") @NotNull(message = "不能为空")

12
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/discuss/DiscussDO.java

@ -1,5 +1,8 @@
package cn.iocoder.yudao.module.farm.dal.dataobject.discuss; package cn.iocoder.yudao.module.farm.dal.dataobject.discuss;
import cn.iocoder.yudao.module.farm.controller.admin.workHour.vo.WorkHourBaseVO;
import cn.iocoder.yudao.module.farm.dal.dataobject.workHour.WorkHourDO;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.*; import lombok.*;
import java.util.*; import java.util.*;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
@ -10,7 +13,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
* *
* @author 系统管理员 * @author 系统管理员
*/ */
@TableName("farm_discuss") @TableName(value = "farm_discuss",autoResultMap = true)
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
@ -32,13 +35,18 @@ public class DiscussDO extends BaseDO {
* *
*/ */
private Long taskId; private Long taskId;
@TableField(typeHandler = JacksonTypeHandler.class)
private List<WorkHourBaseVO> workHourList;
/** /**
* *
*/ */
private String content; private String content;
/** /**
* *
*/ */
private String images; @TableField(typeHandler = JacksonTypeHandler.class)
private List<String> images;
} }

3
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/task/TaskDO.java

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.farm.dal.dataobject.task;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import cn.iocoder.yudao.module.farm.enums.TaskStatus;
import lombok.*; import lombok.*;
import java.util.*; import java.util.*;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
@ -70,4 +71,6 @@ public class TaskDO extends BaseDO {
*/ */
private Integer weight; private Integer weight;
private TaskStatus status;
} }

6
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/workHour/WorkHourDO.java

@ -27,15 +27,15 @@ public class WorkHourDO extends BaseDO {
/** /**
* *
*/ */
private Integer userId; private Long userId;
/** /**
* *
*/ */
private Integer projectId; private Long projectId;
/** /**
* *
*/ */
private Integer taskId; private Long taskId;
/** /**
* *
*/ */

30
zsw-farm/zsw-farm-impl/src/test/java/cn/iocoder/yudao/module/farm/service/task/TaskServiceImplTest.java

@ -108,8 +108,8 @@ public class TaskServiceImplTest extends BaseDbUnitTest {
public void testGetTaskPage() { public void testGetTaskPage() {
// mock 数据 // mock 数据
TaskDO dbTask = randomPojo(TaskDO.class, o -> { // 等会查询到 TaskDO dbTask = randomPojo(TaskDO.class, o -> { // 等会查询到
o.setName(null); // o.setName(null);
o.setContent(null); // o.setContent(null);
o.setResources(null); o.setResources(null);
o.setImages(null); o.setImages(null);
o.setPlanStartTime(null); o.setPlanStartTime(null);
@ -118,10 +118,10 @@ public class TaskServiceImplTest extends BaseDbUnitTest {
o.setCreateTime(null); o.setCreateTime(null);
}); });
taskMapper.insert(dbTask); taskMapper.insert(dbTask);
// 测试 name 不匹配 // // 测试 name 不匹配
taskMapper.insert(cloneIgnoreId(dbTask, o -> o.setName(null))); // taskMapper.insert(cloneIgnoreId(dbTask, o -> o.setName(null)));
// 测试 content 不匹配 // // 测试 content 不匹配
taskMapper.insert(cloneIgnoreId(dbTask, o -> o.setContent(null))); // taskMapper.insert(cloneIgnoreId(dbTask, o -> o.setContent(null)));
// 测试 resources 不匹配 // 测试 resources 不匹配
taskMapper.insert(cloneIgnoreId(dbTask, o -> o.setResources(null))); taskMapper.insert(cloneIgnoreId(dbTask, o -> o.setResources(null)));
// 测试 images 不匹配 // 测试 images 不匹配
@ -136,8 +136,8 @@ public class TaskServiceImplTest extends BaseDbUnitTest {
taskMapper.insert(cloneIgnoreId(dbTask, o -> o.setCreateTime(null))); taskMapper.insert(cloneIgnoreId(dbTask, o -> o.setCreateTime(null)));
// 准备参数 // 准备参数
TaskPageReqVO reqVO = new TaskPageReqVO(); TaskPageReqVO reqVO = new TaskPageReqVO();
reqVO.setName(null); // reqVO.setName(null);
reqVO.setContent(null); // reqVO.setContent(null);
reqVO.setResources(null); reqVO.setResources(null);
reqVO.setImages(null); reqVO.setImages(null);
reqVO.setBeginPlanStartTime(null); reqVO.setBeginPlanStartTime(null);
@ -161,8 +161,8 @@ public class TaskServiceImplTest extends BaseDbUnitTest {
public void testGetTaskList() { public void testGetTaskList() {
// mock 数据 // mock 数据
TaskDO dbTask = randomPojo(TaskDO.class, o -> { // 等会查询到 TaskDO dbTask = randomPojo(TaskDO.class, o -> { // 等会查询到
o.setName(null); // o.setName(null);
o.setContent(null); // o.setContent(null);
o.setResources(null); o.setResources(null);
o.setImages(null); o.setImages(null);
o.setPlanStartTime(null); o.setPlanStartTime(null);
@ -172,9 +172,9 @@ public class TaskServiceImplTest extends BaseDbUnitTest {
}); });
taskMapper.insert(dbTask); taskMapper.insert(dbTask);
// 测试 name 不匹配 // 测试 name 不匹配
taskMapper.insert(cloneIgnoreId(dbTask, o -> o.setName(null))); // taskMapper.insert(cloneIgnoreId(dbTask, o -> o.setName(null)));
// 测试 content 不匹配 // // 测试 content 不匹配
taskMapper.insert(cloneIgnoreId(dbTask, o -> o.setContent(null))); // taskMapper.insert(cloneIgnoreId(dbTask, o -> o.setContent(null)));
// 测试 resources 不匹配 // 测试 resources 不匹配
taskMapper.insert(cloneIgnoreId(dbTask, o -> o.setResources(null))); taskMapper.insert(cloneIgnoreId(dbTask, o -> o.setResources(null)));
// 测试 images 不匹配 // 测试 images 不匹配
@ -189,8 +189,8 @@ public class TaskServiceImplTest extends BaseDbUnitTest {
taskMapper.insert(cloneIgnoreId(dbTask, o -> o.setCreateTime(null))); taskMapper.insert(cloneIgnoreId(dbTask, o -> o.setCreateTime(null)));
// 准备参数 // 准备参数
TaskExportReqVO reqVO = new TaskExportReqVO(); TaskExportReqVO reqVO = new TaskExportReqVO();
reqVO.setName(null); // reqVO.setName(null);
reqVO.setContent(null); // reqVO.setContent(null);
reqVO.setResources(null); reqVO.setResources(null);
reqVO.setImages(null); reqVO.setImages(null);
reqVO.setBeginPlanStartTime(null); reqVO.setBeginPlanStartTime(null);

Loading…
Cancel
Save