提交 2c7c2064 authored 作者: 邓砥奕's avatar 邓砥奕

更新task

上级 a5aee945
...@@ -3,6 +3,9 @@ package com.tykj.dev.device.task.service; ...@@ -3,6 +3,9 @@ package com.tykj.dev.device.task.service;
import com.tykj.dev.device.task.subject.bto.TaskBto; import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.common.StatusEnum; import com.tykj.dev.device.task.subject.common.StatusEnum;
import com.tykj.dev.device.task.subject.domin.Task; import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.task.subject.vo.TaskSelectVo;
import java.util.List;
/** /**
* @author dengdiyi * @author dengdiyi
...@@ -84,4 +87,10 @@ public interface TaskService { ...@@ -84,4 +87,10 @@ public interface TaskService {
* 根据id获得Task * 根据id获得Task
*/ */
TaskBto get(Integer id); TaskBto get(Integer id);
/**
* @param taskSelectVo
* 获取跟踪和待办业务列表
*/
List<Task> getList(TaskSelectVo taskSelectVo);
} }
...@@ -6,10 +6,12 @@ import com.tykj.dev.device.task.subject.bto.TaskBto; ...@@ -6,10 +6,12 @@ import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.common.StatusEnum; import com.tykj.dev.device.task.subject.common.StatusEnum;
import com.tykj.dev.device.task.subject.common.StatusMap; import com.tykj.dev.device.task.subject.common.StatusMap;
import com.tykj.dev.device.task.subject.domin.Task; import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.task.subject.vo.TaskSelectVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Collections; import java.util.Collections;
import java.util.List;
import java.util.Optional; import java.util.Optional;
/** /**
...@@ -219,4 +221,12 @@ public class TaskServiceImpl implements TaskService { ...@@ -219,4 +221,12 @@ public class TaskServiceImpl implements TaskService {
Optional<Task> task = taskDao.findById(id); Optional<Task> task = taskDao.findById(id);
return task.map(Task::parse2Bto).orElse(null); return task.map(Task::parse2Bto).orElse(null);
} }
/**
* @param taskSelectVo 获取跟踪和待办业务列表
*/
@Override
public List<Task> getList(TaskSelectVo taskSelectVo) {
return null;
}
} }
package com.tykj.dev.device.task.subject.vo;
import com.tykj.dev.misc.base.CustomPage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author dengdiyi
*/
@Data
@ApiModel("待办任务查询类")
public class TaskSelectVo extends CustomPage {
@ApiModelProperty(value = "查询方式(0:全部业务,1:我的发起,2:待办业务,3:业务跟踪,4:办结任务,5:封存业务)",example = "0")
private Integer selectNum;
@ApiModelProperty(value = "业务类型id",example = "1")
private Integer bussinessType;
@ApiModelProperty(value = "模糊查询关键字",example = "测试")
public String content;
@ApiModelProperty(value = "发起时间",example = "2020-10-10 01:10:10")
public Date startTime;
@ApiModelProperty(value = "结束时间",example = "2020-10-10 01:10:10")
public Date endTime;
}
package com.tykj.dev.device.task.subject.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author dengdiyi
*/
@Data
@ApiModel("任务置顶类")
public class TaskTopVo {
@ApiModelProperty(value = "任务Id")
private Integer taskId;
@ApiModelProperty(name = "置顶标志",example = "0",value = "0为不置顶,1为置顶")
private Integer topFlag;
}
package com.tykj.dev.device.task;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author zjm
* @version 1.0.0
* @ClassName userApp.java
* @Description TODO
* @createTime 2020年09月01日 14:32:00
*/
@SpringBootApplication(scanBasePackages={
"com.tykj.dev.*",
}
)
public class taskApp {
public static void main(String[] args) {
SpringApplication.run(taskApp.class, args);
}
}
package com.tykj.dev.device.user.base.beabs;
import org.modelmapper.ModelMapper;
import org.modelmapper.convention.MatchingStrategies;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;
/**
* @author zjm
* @version 1.0.0
* @ClassName BeanHelper.java
* @Description TODO
* @createTime 2020年08月11日 11:18:00
*/
@Service
public class BeanHelper {
private static ModelMapper mapper = new ModelMapper();
static {
mapper.getConfiguration().setAmbiguityIgnored(true);
//设置为严格匹配
mapper.getConfiguration().setFullTypeMatchingRequired(true);
mapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
}
public static ModelMapper getUserMapper() {
return mapper;
}
@Bean
public ModelMapper initModelMapper() {
return mapper;
}
// @Bean
// public ObjectMapper objectMapper() {
// return new ObjectMapper().disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
// }
}
package com.tykj.dev.device.user.base.req; package com.tykj.dev.device.user.base.req;
import com.tykj.dev.device.user.base.beabs.BeanHelper;
import com.tykj.dev.device.user.subject.entity.User; import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.misc.base.BeanHelper;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import org.modelmapper.ModelMapper; import org.modelmapper.ModelMapper;
......
package com.tykj.dev.device.user.base.ret; package com.tykj.dev.device.user.base.ret;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.tykj.dev.device.user.base.beabs.BeanHelper;
import com.tykj.dev.device.user.subject.entity.User; import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.misc.base.BeanHelper;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
......
package com.tykj.dev.device.user.base.ret; package com.tykj.dev.device.user.base.ret;
import com.tykj.dev.device.user.base.beabs.BeanHelper;
import com.tykj.dev.device.user.subject.entity.Role; import com.tykj.dev.device.user.subject.entity.Role;
import com.tykj.dev.misc.base.BeanHelper;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
......
package com.tykj.dev.device.user.subject.entity; package com.tykj.dev.device.user.subject.entity;
import com.tykj.dev.device.user.base.beabs.BeanHelper;
import com.tykj.dev.device.user.base.ret.AreaVo; import com.tykj.dev.device.user.base.ret.AreaVo;
import com.tykj.dev.misc.base.BeanHelper;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
......
package com.tykj.dev.device.user.subject.entity; package com.tykj.dev.device.user.subject.entity;
import com.tykj.dev.device.user.base.beabs.BeanHelper;
import com.tykj.dev.device.user.base.ret.UnitsTrainVo; import com.tykj.dev.device.user.base.ret.UnitsTrainVo;
import com.tykj.dev.device.user.base.ret.UnitsVo; import com.tykj.dev.device.user.base.ret.UnitsVo;
import com.tykj.dev.misc.base.BeanHelper;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
......
package com.tykj.dev.device.user.subject.entity; package com.tykj.dev.device.user.subject.entity;
import com.tykj.dev.device.user.base.beabs.BeanHelper;
import com.tykj.dev.device.user.base.ret.*; import com.tykj.dev.device.user.base.ret.*;
import com.tykj.dev.misc.base.BeanHelper;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
......
...@@ -30,11 +30,6 @@ ...@@ -30,11 +30,6 @@
<version>2.1.1</version> <version>2.1.1</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.tykj.dev</groupId>
<artifactId>device-user</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
package com.tykj.dev.misc.base;
import lombok.Data;
import org.springframework.data.domain.Sort;
/**
* 描述:Jpa排序类
* @author HuangXiahao
* @version V1.0
* @data 2020/5/13
**/
@Data
public class CustomOrder {
private String coulmn;
private Sort.Direction direction;
}
package com.tykj.dev.misc.base;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.util.Assert;
import javax.validation.constraints.Min;
import java.util.ArrayList;
import java.util.List;
/**
* @author HuangXiahao
* @class CustomOrder
* @data 2020/5/13
**/
public class CustomPage {
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
@Min(0)
private Integer page = 0;
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
@Min(1)
private Integer size = 15;
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
private List<CustomOrder> orders = new ArrayList<>();
public Integer getPage() {
return page;
}
public void setPage(Integer page) {
this.page = page;
}
public Integer getSize() {
return size;
}
public void setSize(Integer size) {
Assert.isTrue(page>=0,"分页信息错误!");
this.size = size;
}
public void setOrders(List<CustomOrder> orders) {
this.orders = orders;
}
public List<CustomOrder> getOrders() {
return orders;
}
@JsonIgnore
public long getOffset() {
return page * size;
}
@JsonIgnore
public Integer getLimit() {
return size;
}
@JsonIgnore
public PageRequest getPageable() {
if (orders.size()!=0){
List<Sort.Order> orders = new ArrayList<>();
this.orders.stream().forEach(item ->
orders.add(new Sort.Order(item.getDirection(),item.getCoulmn())));
return PageRequest.of(getPage(),getLimit(),Sort.by(orders));
}
return PageRequest.of(getPage(),getLimit());
}
}
package com.tykj.dev.misc.base;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.HashMap;
/**
* @author dengdiyi
* @description 接口返回统一标准类
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultObj {
private Object result;
private String msg;
public ResultObj(Object o){
this.result = o;
this.msg = "no message";
}
public ResultObj(String m){
this.msg = m;
this.result = new HashMap<>(1);
}
}
package com.tykj.dev.misc.base;
import com.tykj.dev.device.user.util.UserUtils;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.domain.AuditorAware;
import java.util.Optional;
/**
* @author dengdiyi
*/
@Configuration
public class UserIDAuditorBean implements AuditorAware<Integer> {
/*
*实现jpa自动插入当前用户id
*/
@Override
public Optional<Integer> getCurrentAuditor() {
//获取当前用户Id并返回
UserUtils userUtils = com.tykj.dev.misc.utils.SpringUtils.getBean("userUtils");
Integer userId = null;
if (userUtils != null) {
userId = userUtils.getCurrentUserId();
}
if (userId != null){
return Optional.of(userId);
}
else {
return Optional.empty();
}
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论