Browse Source

任务优先级排序

master
zy_Java 6 years ago
parent
commit
e49e526abb
  1. 6
      tall/src/main/java/com/ccsens/tall/persist/dao/TaskSubTimeDao.java
  2. 4
      tall/src/main/java/com/ccsens/tall/service/IProTaskDetailService.java
  3. 4
      tall/src/main/java/com/ccsens/tall/service/ITaskSubTimeService.java
  4. 14
      tall/src/main/java/com/ccsens/tall/service/ProTaskDetailService.java
  5. 5
      tall/src/main/java/com/ccsens/tall/service/TaskDeliverService.java
  6. 17
      tall/src/main/java/com/ccsens/tall/service/TaskSubTimeService.java
  7. 1
      tall/src/main/java/com/ccsens/tall/web/ProjectController.java
  8. 12
      tall/src/main/java/com/ccsens/tall/web/TaskController.java
  9. 2
      tall/src/main/resources/application-prod.yml
  10. 2
      tall/src/main/resources/application-test.yml
  11. 5
      tall/src/main/resources/mapper_dao/TaskDetailDao.xml
  12. 23
      tall/src/main/resources/mapper_dao/TaskSubTimeDao.xml

6
tall/src/main/java/com/ccsens/tall/persist/dao/TaskSubTimeDao.java

@ -14,7 +14,9 @@ public interface TaskSubTimeDao extends ProTaskSubTimeMapper{
void clearTaskRealTime(@Param("projectId")Long projectId);
List<TaskVo.KanBanTask> getKanbanTake(@Param("userId")Long userId,@Param("projectId")Long projectId, @Param("roleId")Long roleId,@Param("type") Integer type,@Param("memberId")Long memberId);
List<TaskVo.KanBanTask> getKanbanTake(@Param("userId")Long userId,@Param("projectId")Long projectId, @Param("roleId")Long roleId,
@Param("type") Integer type,@Param("memberId")Long memberId,@Param("orderType")Integer orderType,@Param("order")Integer order);
List<TaskVo.KanBanTask> getKanbanTakeByType(@Param("userId")Long userId,@Param("projectId")Long projectId, @Param("roleId")Long roleId, @Param("type")Integer type);
List<TaskVo.KanBanTask> getKanbanTakeByType(@Param("userId")Long userId,@Param("projectId")Long projectId, @Param("roleId")Long roleId,
@Param("type")Integer type,@Param("orderType")Integer orderType,@Param("order")Integer order);
}

4
tall/src/main/java/com/ccsens/tall/service/IProTaskDetailService.java

@ -4,13 +4,15 @@ import com.ccsens.tall.bean.dto.TaskDto;
import com.ccsens.tall.bean.po.ProSubTimeMember;
import com.ccsens.tall.bean.po.ProTaskDetail;
import com.ccsens.tall.bean.vo.TaskVo;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
public interface IProTaskDetailService {
void saveTaskDetail(ProTaskDetail taskDetail);
Object getTasksByRoleId(Long currentUserId, Long projectId, Long roleId, Long startTime, Long endTime, Integer process, Integer page, Integer pageSize) throws Exception;
Object getTasksByRoleId(Long currentUserId, Long projectId, Long roleId, Long startTime, Long endTime, Integer process,
Integer page, Integer pageSize) throws Exception;
TaskVo.NormalTask getTaskInfoByTaskId(Long currentUserId, Long projectId, Long taskId) throws Exception;

4
tall/src/main/java/com/ccsens/tall/service/ITaskSubTimeService.java

@ -4,6 +4,7 @@ import com.ccsens.tall.bean.dto.TaskDto;
import com.ccsens.tall.bean.po.ProTaskSubTime;
import com.ccsens.tall.bean.vo.TaskVo;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@ -18,7 +19,8 @@ public interface ITaskSubTimeService {
void clearTaskRealTime(Long projectId);
List<TaskVo.KanBan> getKanbanTake(Long currentUserId, Long projectId, Long roleId, Integer type, Integer page, Integer pageSize) throws Exception;
List<TaskVo.KanBan> getKanbanTake(Long currentUserId, Long projectId, Long roleId, Integer type,
Integer page, Integer pageSize, Integer orderType, Integer order) throws Exception;
void changeKanbanTake(Long currentUserId, TaskDto.ChangeKanbanTask changeKanbanTask) throws Exception;
}

14
tall/src/main/java/com/ccsens/tall/service/ProTaskDetailService.java

@ -81,7 +81,8 @@ public class ProTaskDetailService implements IProTaskDetailService {
}
@Override
public Object getTasksByRoleId(Long currentUserId, Long projectId, Long roleId, Long startTime, Long endTime, Integer process, Integer page, Integer pageSize) throws Exception {
public Object getTasksByRoleId(Long currentUserId, Long projectId, Long roleId, Long startTime, Long endTime, Integer process,
Integer page, Integer pageSize) throws Exception {
SysProject sysProject = sysProjectDao.selectByPrimaryKey(projectId);
if (ObjectUtil.isNull(sysProject)) {
throw new BaseException(CodeEnum.NOT_PROJECT);
@ -134,7 +135,8 @@ public class ProTaskDetailService implements IProTaskDetailService {
/**
* 查看任务 项目经理
*/
private TaskVo.ProTaskInfo getTaskInfoByProjectIdAndPM(Long currentUserId, Long projectId,Long roleId, Long startTime, Long endTime, Integer process, Integer page, Integer pageSize) throws Exception {
private TaskVo.ProTaskInfo getTaskInfoByProjectIdAndPM(Long currentUserId, Long projectId,Long roleId, Long startTime, Long endTime,
Integer process, Integer page, Integer pageSize) throws Exception {
TaskVo.ProTaskInfo proTaskInfo = new TaskVo.ProTaskInfo();
List<TaskVo.GlobalTask> globalTaskList = new ArrayList<>();
@ -233,7 +235,8 @@ public class ProTaskDetailService implements IProTaskDetailService {
/**
* 查看任务 项目成员
*/
private TaskVo.ProTaskInfo getTaskInfoByProjectIdAndRoleId(Long currentUserId, Long projectId, Long roleId, Long startTime, Long endTime, Integer process, Integer page, Integer pageSize) throws Exception {
private TaskVo.ProTaskInfo getTaskInfoByProjectIdAndRoleId(Long currentUserId, Long projectId, Long roleId, Long startTime,
Long endTime, Integer process, Integer page, Integer pageSize) throws Exception {
TaskVo.ProTaskInfo proTaskInfo = new TaskVo.ProTaskInfo();
List<TaskVo.GlobalTask> globalTaskList = new ArrayList<>();
@ -246,7 +249,8 @@ public class ProTaskDetailService implements IProTaskDetailService {
allMemberId = allMember.getId();
}
//查找该角色的所有任务(全体成员的任务也是这个角色的任务)
List<TaskVo.NormalTask> secondTaskVoList = taskDetailDao.selectTaskByRoleAndAllMembers(projectId, roleId,allMemberId, startTime, endTime);
List<TaskVo.NormalTask> secondTaskVoList = taskDetailDao.selectTaskByRoleAndAllMembers(projectId, roleId,
allMemberId, startTime, endTime);
if (CollectionUtil.isNotEmpty(secondTaskVoList)) {
for (TaskVo.NormalTask normalTask : secondTaskVoList) {
@ -285,7 +289,7 @@ public class ProTaskDetailService implements IProTaskDetailService {
}
}
if (CollectionUtil.isNotEmpty(task.getCommonTask())) {
normalTaskList = sortTaskTime(task.getCommonTask());
normalTaskList = sortTaskTime(task.getCommonTask());
}
}

5
tall/src/main/java/com/ccsens/tall/service/TaskDeliverService.java

@ -24,6 +24,7 @@ import com.ccsens.util.config.RabbitMQConfig;
import com.ccsens.util.exception.BaseException;
import lombok.extern.slf4j.Slf4j;
import org.omg.CORBA.OBJ_ADAPTER;
import org.omg.CORBA.StructMember;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -427,7 +428,9 @@ public class TaskDeliverService implements ITaskDeliverService {
filePath.setDeleteTime(filePath.getUpdateTime().getTime());
}
//修改文件路径为可下载路径
filePath.setUrl(WebConstant.TEST_URL_BASE + filePath.getUrl());
if(StrUtil.isNotEmpty(filePath.getUrl())) {
filePath.setUrl(WebConstant.TEST_URL_BASE + filePath.getUrl());
}
if (ObjectUtil.isNotNull(filePath.getUploaderId())) {
//添加上传人的姓名信息
ProMember member = proMemberService.selectByUserId(filePath.getUploaderId(), task.getProjectId());

17
tall/src/main/java/com/ccsens/tall/service/TaskSubTimeService.java

@ -447,7 +447,8 @@ public class TaskSubTimeService implements ITaskSubTimeService {
* @return 任务列表
*/
@Override
public List<TaskVo.KanBan> getKanbanTake(Long currentUserId, Long projectId, Long roleId, Integer type, Integer page, Integer pageSize) throws Exception {
public List<TaskVo.KanBan> getKanbanTake(Long currentUserId, Long projectId, Long roleId, Integer type,
Integer page, Integer pageSize, Integer orderType, Integer order) throws Exception {
//返回的list
List<TaskVo.KanBan> kanBans = new ArrayList<>();
//查找此用户在任务下的成员
@ -457,7 +458,7 @@ public class TaskSubTimeService implements ITaskSubTimeService {
}
//TODO 暂时确定三个状态
Map<Integer, String> typeMap = new HashMap<>();
Map<Integer, String> typeMap = new HashMap<>(0);
typeMap.put(0, "未开始");
typeMap.put(1, "进行中");
typeMap.put(2, "已完成");
@ -470,10 +471,10 @@ public class TaskSubTimeService implements ITaskSubTimeService {
kanBan.setTypeName(entry.getValue());
PageHelper.startPage(page, pageSize);
if (kanBan.getCode() <= 2) {
List<TaskVo.KanBanTask> kanBanTaskList = taskSubTimeDao.getKanbanTake(currentUserId,projectId, roleId, kanBan.getCode(), member.getId());
List<TaskVo.KanBanTask> kanBanTaskList = taskSubTimeDao.getKanbanTake(currentUserId,projectId, roleId, kanBan.getCode(), member.getId(),orderType,order);
kanBan.setTaskList(new PageInfo<>(kanBanTaskList));
} else {
List<TaskVo.KanBanTask> kanBanTaskList = taskSubTimeDao.getKanbanTakeByType(currentUserId,projectId, roleId, kanBan.getCode());
List<TaskVo.KanBanTask> kanBanTaskList = taskSubTimeDao.getKanbanTakeByType(currentUserId,projectId, roleId, kanBan.getCode(),orderType,order);
kanBan.setTaskList(new PageInfo<>(kanBanTaskList));
}
kanBans.add(kanBan);
@ -484,10 +485,10 @@ public class TaskSubTimeService implements ITaskSubTimeService {
kanBan.setTypeName(typeMap.get(type));
PageHelper.startPage(page, pageSize);
if (kanBan.getCode() <= 2) {
List<TaskVo.KanBanTask> kanBanTaskList = taskSubTimeDao.getKanbanTake(currentUserId,projectId, roleId, type, member.getId());
List<TaskVo.KanBanTask> kanBanTaskList = taskSubTimeDao.getKanbanTake(currentUserId,projectId, roleId, type, member.getId(),orderType,order);
kanBan.setTaskList(new PageInfo<>(kanBanTaskList));
} else {
List<TaskVo.KanBanTask> kanBanTaskList = taskSubTimeDao.getKanbanTakeByType(currentUserId,projectId, roleId, type);
List<TaskVo.KanBanTask> kanBanTaskList = taskSubTimeDao.getKanbanTakeByType(currentUserId,projectId, roleId, type,orderType,order);
kanBan.setTaskList(new PageInfo<>(kanBanTaskList));
}
kanBans.add(kanBan);
@ -499,8 +500,8 @@ public class TaskSubTimeService implements ITaskSubTimeService {
/**
* 修改看板上的任务状态
*
* @param currentUserId
* @param changeKanbanTask
* @param currentUserId userId
* @param changeKanbanTask 任务状态
*/
@Override
public void changeKanbanTake(Long currentUserId, TaskDto.ChangeKanbanTask changeKanbanTask) throws Exception {

1
tall/src/main/java/com/ccsens/tall/web/ProjectController.java

@ -116,6 +116,7 @@ public class ProjectController {
Integer pageSize = 10;
page = page == null ? 1 : page;
process = process == null ? 0 : process;
Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject());
Object proTaskInfo = taskDetailService.getTasksByRoleId(currentUserId,projectId,roleId,startTime,endTime,process,page,pageSize);
return JsonResponse.newInstance().ok(proTaskInfo);

12
tall/src/main/java/com/ccsens/tall/web/TaskController.java

@ -126,7 +126,9 @@ public class TaskController {
@ApiImplicitParams({
@ApiImplicitParam(name = "projectId", value = "项目id 必填", required = true, paramType = "query"),
@ApiImplicitParam(name = "type", value = "任务状态 0未开始 1进行中 2已完成", required = true, paramType = "query"),
@ApiImplicitParam(name = "roleId", value = "角色id 不传则查找全部", required = true, paramType = "query")
@ApiImplicitParam(name = "roleId", value = "角色id 不传则查找全部", required = true, paramType = "query"),
@ApiImplicitParam(name = "orderType", value = "排序方式 0时间排序 1优先级排序 没有则默认时间排序",paramType = "query",dataType = "string"),
@ApiImplicitParam(name = "order", value = "排序方式 0倒序 1正序 默认倒序",paramType = "query")
})
@RequestMapping(value = "kanban", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
public JsonResponse<List<TaskVo.KanBan>> getKanbanTake(HttpServletRequest request,
@ -134,11 +136,15 @@ public class TaskController {
@RequestParam(required = false)Long roleId,
@RequestParam(required = false)Integer type,
@RequestParam(required = false)Integer page,
@RequestParam(required = false)Integer pageSize) throws Exception {
@RequestParam(required = false)Integer pageSize,
@RequestParam(required = false)Integer orderType,
@RequestParam(required = false)Integer order) throws Exception {
page = page == null ? 1 : page;
pageSize = pageSize == null ? 10 : pageSize;
orderType = orderType == null ? 0 : orderType;
order = order == null ? 0 : order;
Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject());
List<TaskVo.KanBan> kanbanList = subTimeService.getKanbanTake(currentUserId,projectId,roleId,type,page,pageSize);
List<TaskVo.KanBan> kanbanList = subTimeService.getKanbanTake(currentUserId,projectId,roleId,type,page,pageSize,orderType,order);
return JsonResponse.newInstance().ok(kanbanList);
}

2
tall/src/main/resources/application-prod.yml

@ -38,4 +38,4 @@ eureka:
gatewayUrl: https://www.tall.wiki/gateway/
notGatewayUrl: https://www.tall.wiki/
wx:
prefixUrl: https://test.tall.wiki/wxconfigurer-api
prefixUrl: https://test.tall.wiki/wxconfigurer-api/

2
tall/src/main/resources/application-test.yml

@ -39,4 +39,4 @@ eureka:
gatewayUrl: https://test.tall.wiki/gateway/
notGatewayUrl: https://test.tall.wiki/
wx:
prefixUrl: https://test.tall.wiki/wxconfigurer-api
prefixUrl: https://test.tall.wiki/wxconfigurer-api/

5
tall/src/main/resources/mapper_dao/TaskDetailDao.xml

@ -89,7 +89,8 @@
p.id as p_id,
sp.description as spDescription,
sp.id as spid,
sp.show_type as spShowType
sp.show_type as spShowType,
d.priority as priority
FROM
t_pro_task_sub_time s LEFT JOIN t_pro_task_detail d ON s.task_detail_id = d.id
LEFT JOIN t_pro_task_plugin p ON p.task_detail_id = d.id
@ -117,7 +118,6 @@
AND
s.end_time &gt; #{startTime}
</if>
AND
d.Level in (2,3)
AND
@ -128,6 +128,7 @@
)t
GROUP BY t.tSubTimeId
order by t.tDetailId
</select>

23
tall/src/main/resources/mapper_dao/TaskSubTimeDao.xml

@ -73,6 +73,8 @@
d.rec_status = 0
and
d.level != 0
and
d.level != 1
<if test="roleId != null">
and
r.id = #{roleId}
@ -93,7 +95,15 @@
t.mid > 0
)
)
ORDER BY s.begin_time DESC
ORDER BY
<if test="orderType == 0">
s.begin_time DESC
</if>
<if test="orderType == 1">
d.priority DESC
,s.begin_time DESC
</if>
</select>
<select id="getKanbanTakeByType" parameterType="java.util.Map" resultType="com.ccsens.tall.bean.vo.TaskVo$KanBanTask">
@ -127,6 +137,8 @@
d.rec_status = 0
and
d.level != 0
and
d.level != 1
<if test="roleId != null">
and
r.id = #{roleId}
@ -135,6 +147,13 @@
s.complated_status = #{type}
and
FROM_UNIXTIME(s.begin_time/1000,'%Y-%m-%d %H:%m:%s') &lt; NOW()
ORDER BY s.begin_time DESC
ORDER BY
<if test="orderType == 0">
s.begin_time DESC
</if>
<if test="orderType == 1">
d.priority DESC
,s.begin_time DESC
</if>
</select>
</mapper>
Loading…
Cancel
Save