|
|
@ -1,8 +1,17 @@
|
|
|
|
package com.bs.ct.controller;
|
|
|
|
package com.bs.ct.controller;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import java.util.Random;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.bs.common.core.domain.entity.SysDept;
|
|
|
|
|
|
|
|
import com.bs.ct.domain.CtTaskBranch;
|
|
|
|
|
|
|
|
import com.bs.ct.service.ICtTaskBranchService;
|
|
|
|
|
|
|
|
import com.bs.system.service.ISysDeptService;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
@ -39,6 +48,10 @@ import javax.annotation.Resource;
|
|
|
|
public class CtTaskInfoController extends BaseController {
|
|
|
|
public class CtTaskInfoController extends BaseController {
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private ICtTaskInfoService ctTaskInfoService;
|
|
|
|
private ICtTaskInfoService ctTaskInfoService;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private ISysDeptService deptService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private ICtTaskBranchService ctTaskBranchService;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 分页查询任务信息列表
|
|
|
|
* 分页查询任务信息列表
|
|
|
@ -50,6 +63,7 @@ public class CtTaskInfoController extends BaseController {
|
|
|
|
LambdaQueryWrapper<CtTaskInfo> queryWrapper = new LambdaQueryWrapper();
|
|
|
|
LambdaQueryWrapper<CtTaskInfo> queryWrapper = new LambdaQueryWrapper();
|
|
|
|
condition(queryWrapper,ctTaskInfo);
|
|
|
|
condition(queryWrapper,ctTaskInfo);
|
|
|
|
List<CtTaskInfo> list = ctTaskInfoService.list(queryWrapper);
|
|
|
|
List<CtTaskInfo> list = ctTaskInfoService.list(queryWrapper);
|
|
|
|
|
|
|
|
setAll(list);
|
|
|
|
return getDataTable(list);
|
|
|
|
return getDataTable(list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -65,6 +79,42 @@ public class CtTaskInfoController extends BaseController {
|
|
|
|
return success(list);
|
|
|
|
return success(list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void setAll(List<CtTaskInfo> list) {
|
|
|
|
|
|
|
|
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
|
|
|
|
|
|
|
Map<Long, String> deptMap = depts.stream()
|
|
|
|
|
|
|
|
.collect(Collectors.toMap(SysDept::getDeptId, SysDept::getDeptName));
|
|
|
|
|
|
|
|
for (CtTaskInfo taskInfo : list) {
|
|
|
|
|
|
|
|
Date startDate = taskInfo.getStartDate();
|
|
|
|
|
|
|
|
Date endDate = taskInfo.getEndDate();
|
|
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
|
|
|
|
|
|
|
|
// 转换日期为字符串
|
|
|
|
|
|
|
|
String startDateStr = sdf.format(startDate);
|
|
|
|
|
|
|
|
String endDateStr = sdf.format(endDate);
|
|
|
|
|
|
|
|
taskInfo.setStartToEndDate(startDateStr + "-" + endDateStr);
|
|
|
|
|
|
|
|
String deptName = deptMap.get(taskInfo.getDeptId());
|
|
|
|
|
|
|
|
taskInfo.setDeptName(deptName);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 撤回其他任务
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@ApiOperation("撤回其他任务")
|
|
|
|
|
|
|
|
@GetMapping("/withdraw/{ids}")
|
|
|
|
|
|
|
|
public void withdraw(@PathVariable List<Long> ids) {
|
|
|
|
|
|
|
|
List<CtTaskInfo> sdTaskOthers = ctTaskInfoService.listByIds(ids);
|
|
|
|
|
|
|
|
for (CtTaskInfo sdTaskOther : sdTaskOthers) {
|
|
|
|
|
|
|
|
sdTaskOther.setStatus("0");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
List<CtTaskBranch> sdTaskOtherBranches = ctTaskBranchService.list(new LambdaQueryWrapper<CtTaskBranch>()
|
|
|
|
|
|
|
|
.in(CtTaskBranch::getTaskId, ids));
|
|
|
|
|
|
|
|
for (CtTaskBranch sdTaskOtherBranch : sdTaskOtherBranches) {
|
|
|
|
|
|
|
|
sdTaskOtherBranch.setTaskStatus("0");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ctTaskBranchService.updateBatchById(sdTaskOtherBranches);
|
|
|
|
|
|
|
|
ctTaskInfoService.updateBatchById(sdTaskOthers);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 导出任务信息列表
|
|
|
|
* 导出任务信息列表
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -95,6 +145,13 @@ public class CtTaskInfoController extends BaseController {
|
|
|
|
@Log(title = "任务信息新增", businessType = BusinessType.INSERT)
|
|
|
|
@Log(title = "任务信息新增", businessType = BusinessType.INSERT)
|
|
|
|
@PostMapping
|
|
|
|
@PostMapping
|
|
|
|
public AjaxResult add(@RequestBody CtTaskInfo ctTaskInfo) {
|
|
|
|
public AjaxResult add(@RequestBody CtTaskInfo ctTaskInfo) {
|
|
|
|
|
|
|
|
Long newId = System.currentTimeMillis() + new Random().nextInt(1000);
|
|
|
|
|
|
|
|
ctTaskInfo.setId(newId);
|
|
|
|
|
|
|
|
List<CtTaskBranch> branchList = ctTaskInfo.getBranchList();
|
|
|
|
|
|
|
|
for (CtTaskBranch sdTaskOtherBranch : branchList) {
|
|
|
|
|
|
|
|
sdTaskOtherBranch.setTaskId(ctTaskInfo.getId());
|
|
|
|
|
|
|
|
ctTaskBranchService.saveOrUpdate(sdTaskOtherBranch);
|
|
|
|
|
|
|
|
}
|
|
|
|
return toAjax(ctTaskInfoService.save(ctTaskInfo));
|
|
|
|
return toAjax(ctTaskInfoService.save(ctTaskInfo));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -105,6 +162,17 @@ public class CtTaskInfoController extends BaseController {
|
|
|
|
@Log(title = "任务信息修改", businessType = BusinessType.UPDATE)
|
|
|
|
@Log(title = "任务信息修改", businessType = BusinessType.UPDATE)
|
|
|
|
@PutMapping
|
|
|
|
@PutMapping
|
|
|
|
public AjaxResult edit(@RequestBody CtTaskInfo ctTaskInfo) {
|
|
|
|
public AjaxResult edit(@RequestBody CtTaskInfo ctTaskInfo) {
|
|
|
|
|
|
|
|
List<CtTaskBranch> branchList = ctTaskInfo.getBranchList();
|
|
|
|
|
|
|
|
if (branchList != null && branchList.size() > 0) {
|
|
|
|
|
|
|
|
for (CtTaskBranch sdTaskOtherBranch : branchList) {
|
|
|
|
|
|
|
|
sdTaskOtherBranch.setTaskId(ctTaskInfo.getId());
|
|
|
|
|
|
|
|
if (sdTaskOtherBranch.getId() == null) {
|
|
|
|
|
|
|
|
ctTaskBranchService.save(sdTaskOtherBranch);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
ctTaskBranchService.updateById(sdTaskOtherBranch);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return toAjax(ctTaskInfoService.updateById(ctTaskInfo));
|
|
|
|
return toAjax(ctTaskInfoService.updateById(ctTaskInfo));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -136,7 +204,7 @@ public class CtTaskInfoController extends BaseController {
|
|
|
|
|
|
|
|
|
|
|
|
//任务标题
|
|
|
|
//任务标题
|
|
|
|
if(Validator.isNotEmpty(ctTaskInfo.getTaskTitle())){
|
|
|
|
if(Validator.isNotEmpty(ctTaskInfo.getTaskTitle())){
|
|
|
|
queryWrapper.eq(CtTaskInfo::getTaskTitle,ctTaskInfo.getTaskTitle());
|
|
|
|
queryWrapper.like(CtTaskInfo::getTaskTitle,ctTaskInfo.getTaskTitle());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//任务编号
|
|
|
|
//任务编号
|
|
|
@ -146,17 +214,17 @@ public class CtTaskInfoController extends BaseController {
|
|
|
|
|
|
|
|
|
|
|
|
//开始时间
|
|
|
|
//开始时间
|
|
|
|
if(Validator.isNotEmpty(ctTaskInfo.getStartDate())){
|
|
|
|
if(Validator.isNotEmpty(ctTaskInfo.getStartDate())){
|
|
|
|
queryWrapper.eq(CtTaskInfo::getStartDate,ctTaskInfo.getStartDate());
|
|
|
|
queryWrapper.ge(CtTaskInfo::getStartDate,ctTaskInfo.getStartDate());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//结束时间
|
|
|
|
//结束时间
|
|
|
|
if(Validator.isNotEmpty(ctTaskInfo.getEndDate())){
|
|
|
|
if(Validator.isNotEmpty(ctTaskInfo.getEndDate())){
|
|
|
|
queryWrapper.eq(CtTaskInfo::getEndDate,ctTaskInfo.getEndDate());
|
|
|
|
queryWrapper.le(CtTaskInfo::getEndDate,ctTaskInfo.getEndDate());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//任务要求
|
|
|
|
//任务要求
|
|
|
|
if(Validator.isNotEmpty(ctTaskInfo.getTaskContent())){
|
|
|
|
if(Validator.isNotEmpty(ctTaskInfo.getTaskContent())){
|
|
|
|
queryWrapper.eq(CtTaskInfo::getTaskContent,ctTaskInfo.getTaskContent());
|
|
|
|
queryWrapper.like(CtTaskInfo::getTaskContent,ctTaskInfo.getTaskContent());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//完成状态
|
|
|
|
//完成状态
|
|
|
|