2022-10-20 17:29:33 +08:00
|
|
|
package com.rzyc.controller;
|
|
|
|
|
|
|
|
|
|
import com.common.utils.RandomNumber;
|
|
|
|
|
import com.common.utils.StringUtils;
|
|
|
|
|
import com.common.utils.model.MultiResult;
|
|
|
|
|
import com.common.utils.model.SingleResult;
|
2022-10-21 16:24:29 +08:00
|
|
|
import com.rzyc.bean.task.dto.*;
|
2022-10-31 09:40:53 +08:00
|
|
|
import com.rzyc.bean.task.vo.*;
|
2022-10-21 16:24:29 +08:00
|
|
|
import com.rzyc.config.MethodAnnotation;
|
|
|
|
|
import com.rzyc.enums.TaskState;
|
2022-10-20 17:29:33 +08:00
|
|
|
import com.rzyc.model.OADistribution;
|
|
|
|
|
import com.rzyc.model.OATask;
|
2022-10-27 17:24:20 +08:00
|
|
|
import com.rzyc.model.OaTaskUser;
|
2022-10-31 09:40:53 +08:00
|
|
|
import com.rzyc.model.TaskRecord;
|
2022-10-20 17:29:33 +08:00
|
|
|
import com.rzyc.model.user.SysUser;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import org.apache.commons.beanutils.BeanUtils;
|
|
|
|
|
import org.apache.commons.beanutils.ConvertUtils;
|
|
|
|
|
import org.apache.commons.beanutils.converters.DateConverter;
|
2022-10-21 16:24:29 +08:00
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
2022-10-20 17:29:33 +08:00
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import javax.validation.Valid;
|
2022-10-21 16:24:29 +08:00
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.Calendar;
|
2022-10-20 17:29:33 +08:00
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description:
|
|
|
|
|
* @Author: ZQW
|
|
|
|
|
* @CreateTime: 2022/10/20 9:37
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@Api(tags = "小程序待办事项")
|
|
|
|
|
@CrossOrigin("*")
|
|
|
|
|
@RequestMapping("applets")
|
|
|
|
|
@RestController
|
|
|
|
|
@Validated
|
|
|
|
|
public class AppletsTaskController extends BaseController{
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description: 工作要务列表
|
|
|
|
|
* @Author ZQW
|
|
|
|
|
* @CreateTime 2022/10/20 10:19
|
|
|
|
|
*/
|
|
|
|
|
@ApiOperation(value = "工作要务列表",position = 1)
|
|
|
|
|
@GetMapping("workList")
|
2022-10-21 16:24:29 +08:00
|
|
|
@PreAuthorize("hasAnyAuthority('workList','workList:update')")
|
|
|
|
|
@MethodAnnotation(authorizations = {"workList","workList:update"},name = "工作要务列表")
|
2022-10-20 17:29:33 +08:00
|
|
|
public MultiResult<WorkPriorityVo> workList(@Valid WorkDto workDto){
|
|
|
|
|
MultiResult<WorkPriorityVo> result = new MultiResult<>();
|
|
|
|
|
List<WorkPriorityVo> workList = oaTaskMapper.workList(workDto);
|
2022-10-31 09:40:53 +08:00
|
|
|
|
2022-10-27 17:24:20 +08:00
|
|
|
for (WorkPriorityVo priorityVo : workList) {
|
2022-10-31 09:40:53 +08:00
|
|
|
String oaDistributionId = priorityVo.getOADistributionId();
|
|
|
|
|
int finishNum = taskRecordMapper.countNum(oaDistributionId);
|
2022-10-27 17:24:20 +08:00
|
|
|
priorityVo.setFinishNum(finishNum);
|
|
|
|
|
}
|
2022-10-20 17:29:33 +08:00
|
|
|
result.setData(workList);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return: 新增或修改履职记录
|
|
|
|
|
* @Author: ZQW
|
|
|
|
|
* @Date: 2022/9/20
|
|
|
|
|
*/
|
|
|
|
|
@ApiOperation(value = "新增或修改履职记录",position = 2)
|
|
|
|
|
@PostMapping("addExecute")
|
2022-10-21 16:24:29 +08:00
|
|
|
@PreAuthorize("hasAnyAuthority('addExecute','addExecute:update')")
|
|
|
|
|
@MethodAnnotation(authorizations = {"addExecute","addExecute:update"},name = "工作要务列表")
|
2022-10-20 17:29:33 +08:00
|
|
|
public SingleResult<String> addExecute(@Valid PerRecordDto perRecordDto) throws Exception{
|
|
|
|
|
SingleResult<String> result = new SingleResult<>();
|
2022-10-31 09:40:53 +08:00
|
|
|
TaskRecord taskRecord = new TaskRecord();
|
|
|
|
|
BeanUtils.copyProperties(taskRecord,perRecordDto);
|
2022-10-20 17:29:33 +08:00
|
|
|
//日期格式转换
|
|
|
|
|
ConvertUtils.register(new DateConverter(null), Date.class);
|
|
|
|
|
|
2022-10-31 09:40:53 +08:00
|
|
|
OADistribution oaDistribution = oaDistributionMapper.selectByPrimaryKey(perRecordDto.getOADistributionId());
|
|
|
|
|
System.out.println("任务 ========" + oaDistribution);
|
2022-10-20 17:29:33 +08:00
|
|
|
|
2022-10-31 09:40:53 +08:00
|
|
|
if(null == oaDistribution){
|
2022-10-20 17:29:33 +08:00
|
|
|
result.setCode(0);
|
|
|
|
|
result.setMessage("未知任务");
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-31 09:40:53 +08:00
|
|
|
if(StringUtils.isBlank(perRecordDto.getRecordId())){
|
|
|
|
|
taskRecord.setRecordId(RandomNumber.getUUid());
|
|
|
|
|
taskRecord.setOADistributionId(taskRecord.getOADistributionId());
|
|
|
|
|
taskRecord.setCreateBy(getUserId());
|
|
|
|
|
taskRecord.setCreateTime(new Date());
|
|
|
|
|
taskRecordMapper.insert(taskRecord);
|
|
|
|
|
System.err.println("插入的数据===" + taskRecord);
|
2022-10-20 17:29:33 +08:00
|
|
|
}else {
|
2022-10-31 09:40:53 +08:00
|
|
|
taskRecord.setModfiyBy(getUserId());
|
|
|
|
|
taskRecord.setModfiyTime(new Date());
|
|
|
|
|
taskRecordMapper.updateById(taskRecord);
|
|
|
|
|
System.err.println("修改的数据===" + taskRecord);
|
2022-10-20 17:29:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description: 履职记录列表
|
|
|
|
|
* @Author ZQW
|
|
|
|
|
* @CreateTime 2022/10/20 15:35
|
|
|
|
|
*/
|
|
|
|
|
@ApiOperation(value = "履职记录列表",position = 3)
|
|
|
|
|
@ApiImplicitParams(value = {
|
2022-10-31 09:40:53 +08:00
|
|
|
@ApiImplicitParam(name = "id",value = "任务接收id")
|
2022-10-20 17:29:33 +08:00
|
|
|
})
|
|
|
|
|
@GetMapping("preList")
|
2022-10-21 16:24:29 +08:00
|
|
|
@PreAuthorize("hasAnyAuthority('preList','preList:update')")
|
|
|
|
|
@MethodAnnotation(authorizations = {"preList","preList:update"},name = "工作要务列表")
|
2022-10-20 17:29:33 +08:00
|
|
|
public MultiResult<PerformanceVo> preList(@Valid IdDto idDto){
|
|
|
|
|
MultiResult<PerformanceVo> result = new MultiResult<>();
|
2022-10-31 09:40:53 +08:00
|
|
|
List<PerformanceVo> preList = taskRecordMapper.preList(idDto.getId());
|
2022-10-20 17:29:33 +08:00
|
|
|
result.setData(preList);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2022-10-21 16:24:29 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description: 专项工作列表
|
|
|
|
|
* @Author ZQW
|
|
|
|
|
* @CreateTime 2022/10/20 10:19
|
|
|
|
|
*/
|
|
|
|
|
@ApiOperation(value = "专项工作列表",position = 11)
|
|
|
|
|
@GetMapping("speWorkList")
|
|
|
|
|
@PreAuthorize("hasAnyAuthority('speWorkList','speWorkList:update')")
|
|
|
|
|
@MethodAnnotation(authorizations = {"speWorkList","speWorkList:update"},name = "工作要务列表")
|
|
|
|
|
public MultiResult<SpecialWorkVo> speWorkList(@Valid SpeWorkDto SpeWorkDto){
|
|
|
|
|
MultiResult<SpecialWorkVo> result = new MultiResult<>();
|
|
|
|
|
List<SpecialWorkVo> workList = oaTaskMapper.speWorkList(SpeWorkDto);
|
|
|
|
|
result.setData(workList);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description: 专项工作任务详情
|
|
|
|
|
* @Author ZQW
|
|
|
|
|
* @CreateTime 2022/10/21 10:17
|
|
|
|
|
*/
|
|
|
|
|
@ApiOperation(value = "专项工作任务详情",position = 12)
|
|
|
|
|
@GetMapping("singleWorkDetail")
|
2022-10-31 09:40:53 +08:00
|
|
|
@ApiImplicitParams(value = {
|
|
|
|
|
@ApiImplicitParam(name = "id",value = "任务接收id")
|
|
|
|
|
})
|
2022-10-21 16:24:29 +08:00
|
|
|
@PreAuthorize("hasAnyAuthority('singleWorkDetail','singleWorkDetail:update')")
|
|
|
|
|
@MethodAnnotation(authorizations = {"singleWorkDetail","singleWorkDetail:update"},name = "工作要务列表")
|
2022-10-31 09:40:53 +08:00
|
|
|
public SingleResult<SingleWorkVo> singleWorkDetail(@Valid IdDto idDto){
|
2022-10-21 16:24:29 +08:00
|
|
|
SingleResult<SingleWorkVo> result = new SingleResult();
|
2022-10-31 09:40:53 +08:00
|
|
|
OADistribution oaDistribution = oaDistributionMapper.selectByPrimaryKey(idDto.getId());
|
|
|
|
|
String sendUser = oaDistribution.getSysuserid();
|
|
|
|
|
SysUser user = sysUserMapper.selectUser(sendUser);
|
|
|
|
|
|
|
|
|
|
SingleWorkVo specialWorkVos = oaDistributionMapper.singleWorkDetail(idDto);
|
|
|
|
|
specialWorkVos.setSendName(user.getSysusername());
|
2022-10-21 16:24:29 +08:00
|
|
|
result.setData(specialWorkVos);
|
2022-10-31 09:40:53 +08:00
|
|
|
System.err.println("任务详情========" + specialWorkVos);
|
2022-10-21 16:24:29 +08:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description: 判断当前任务是否过期
|
|
|
|
|
* @Author ZQW
|
|
|
|
|
* @CreateTime 2022/10/21 14:52
|
|
|
|
|
*/
|
2022-10-27 17:24:20 +08:00
|
|
|
@ApiOperation(value = "判断当前任务是否过期",position = 13)
|
2022-10-21 16:24:29 +08:00
|
|
|
@PostMapping("judgeTask")
|
|
|
|
|
@PreAuthorize("hasAnyAuthority('judgeTask:update')")
|
|
|
|
|
@MethodAnnotation(authorizations = {"judgeTask:update"},name = "判断当前任务是否过期")
|
|
|
|
|
public SingleResult<String> judgeTask(@Valid IdDto idDto){
|
|
|
|
|
SingleResult<String> result = new SingleResult<>();
|
|
|
|
|
OATask oaTask = oaTaskMapper.selectOATask(idDto.getId());
|
|
|
|
|
System.out.println("任务=====" + oaTask);
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
2022-10-27 17:24:20 +08:00
|
|
|
//当前时间
|
2022-10-21 16:24:29 +08:00
|
|
|
Date nowDate = new Date();
|
2022-10-27 17:24:20 +08:00
|
|
|
//任务截止时间
|
2022-10-21 16:24:29 +08:00
|
|
|
Date endDate = oaTask.getEnddate();
|
|
|
|
|
|
|
|
|
|
Calendar nowTime = Calendar.getInstance();
|
|
|
|
|
Calendar endTime = Calendar.getInstance();
|
|
|
|
|
nowTime.setTime(nowDate);
|
|
|
|
|
endTime.setTime(endDate);
|
|
|
|
|
|
|
|
|
|
//任务状态不是过期的才会执行以下代码且当前时间在结束时间之后
|
|
|
|
|
if(oaTask.getAppstatus() != TaskState.OVERTIME.getState() && nowTime.after(endTime)){
|
|
|
|
|
oaTask.setAppstatus(TaskState.OVERTIME.getState());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
oaTaskMapper.updateOATask(oaTask);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2022-10-27 17:24:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description: 参与人员姓名显示
|
|
|
|
|
* @Author ZQW
|
|
|
|
|
* @CreateTime 2022/10/25 11:00
|
|
|
|
|
*/
|
2022-10-31 09:40:53 +08:00
|
|
|
@ApiOperation(value = "参与人员姓名显示",position = 14)
|
2022-10-27 17:24:20 +08:00
|
|
|
@GetMapping("nameList")
|
|
|
|
|
@PreAuthorize("hasAnyAuthority('nameList','nameList:update')")
|
|
|
|
|
@MethodAnnotation(authorizations = {"nameList","nameList:update"},name = "参与人员姓名显示")
|
2022-10-31 09:40:53 +08:00
|
|
|
public MultiResult<NameVo> nameList(@Valid NameDto nameDto){
|
2022-10-27 17:24:20 +08:00
|
|
|
MultiResult<NameVo> result = new MultiResult<>();
|
2022-10-31 09:40:53 +08:00
|
|
|
List<NameVo> nameVoList = oaDistributionMapper.selectName(nameDto);
|
|
|
|
|
System.err.println("输出====" + nameVoList);
|
|
|
|
|
result.setData(nameVoList);
|
2022-10-27 17:24:20 +08:00
|
|
|
return result;
|
2022-10-31 09:40:53 +08:00
|
|
|
}
|
2022-10-20 17:29:33 +08:00
|
|
|
}
|