package com.yuanchu.mom.controller;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.yuanchu.mom.annotation.ValueAuth;
|
import com.yuanchu.mom.annotation.ValueClassify;
|
import com.yuanchu.mom.common.GetLook;
|
import com.yuanchu.mom.dto.PersonSupervisePlanDetailsDto;
|
import com.yuanchu.mom.dto.PersonSupervisePlanDto;
|
import com.yuanchu.mom.pojo.PersonSupervisePlan;
|
import com.yuanchu.mom.pojo.PersonSupervisePlanDetails;
|
import com.yuanchu.mom.service.*;
|
import com.yuanchu.mom.vo.Result;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import lombok.AllArgsConstructor;
|
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.multipart.MultipartFile;
|
|
import javax.servlet.http.HttpServletResponse;
|
import java.time.LocalDateTime;
|
import java.util.Date;
|
|
/**
|
* <p>
|
* 监管计划 前端控制器
|
* </p>
|
*
|
* @author tangbowen
|
* @since 2024-09-29 11:13:25
|
*/
|
@Api(tags = "人员 - 监督计划")
|
@AllArgsConstructor
|
@RestController
|
@RequestMapping("/superVisePlan")
|
public class SuperVisePlanController {
|
|
private PersonSupervisePlanDetailsService personSupervisePlanDetailsService;
|
|
private PersonSupervisePlanService personSupervisePlanService;
|
|
private GetLook getLook;
|
|
@ValueClassify("监督计划")
|
@ApiOperation(value = "查询 年度计划")
|
@GetMapping("/yearPlanList")
|
public Result<IPage<PersonSupervisePlanDto>> yearPlanList(Integer size, Integer current, @RequestParam(value = "organizationPerson",required = false) String organizationPerson) {
|
return Result.success(personSupervisePlanService.yearPlanDtoIPage(new Page<>(current, size), organizationPerson));
|
}
|
|
@ValueClassify("监督计划")
|
@ApiOperation(value = "批准 年度计划")
|
@GetMapping("/yearPlanDetailApproval")
|
public Result yearPlanDetailApproval(Integer id,Integer approvalStatus) {
|
personSupervisePlanService.update(Wrappers.<PersonSupervisePlan>lambdaUpdate()
|
.eq(PersonSupervisePlan::getId, id)
|
.set(PersonSupervisePlan::getApprovalStatus, approvalStatus)
|
.set(PersonSupervisePlan::getApprovalId,getLook.selectPowerByMethodAndUserId(null).get("userId"))
|
.set(PersonSupervisePlan::getApprovalDate, LocalDateTime.now()));
|
return Result.success("更新成功");
|
}
|
|
@ValueClassify("监督计划")
|
@ApiOperation(value = "删除 年度计划")
|
@DeleteMapping("/yearPlanDel")
|
public Result yearPlanDel(String id) {
|
personSupervisePlanService.removeById(id);
|
// 对应的年度计划详情也需删除
|
personSupervisePlanDetailsService.remove(Wrappers.<PersonSupervisePlanDetails>lambdaQuery()
|
.eq(PersonSupervisePlanDetails::getPlanId, id));
|
return Result.success();
|
}
|
|
@ValueClassify("监督计划")
|
@ApiOperation(value = "查询 年度计划详情")
|
@GetMapping("/yearPlanDetailList")
|
public Result<IPage<PersonSupervisePlanDetailsDto>> yearPlanDetailList(Page page,
|
Integer planId,
|
@RequestParam(value = "date",required = false) String date,
|
@RequestParam(value = "project",required = false) String project) {
|
return Result.success(personSupervisePlanDetailsService.yearPlanDetailPage(page, date,project, planId));
|
}
|
|
@ValueClassify("监督计划")
|
@ApiOperation(value = "导入 年度计划")
|
@PostMapping("/yearPlanDetailImport")
|
public Result yearPlanDetailImport(@RequestPart("file") MultipartFile file) {
|
personSupervisePlanService.yearPlanDetailImport(file);
|
return Result.success();
|
}
|
|
@ValueClassify("监督计划")
|
@ApiOperation(value = "删除 年度计划详情")
|
@DeleteMapping("/yearPlanDetailDel")
|
public Result yearPlanDetailDel(String id) {
|
return Result.success(personSupervisePlanDetailsService.removeById(id));
|
}
|
|
@ValueClassify("监督计划")
|
@ApiOperation(value = "新增 年度计划详情")
|
@PostMapping("/yearPlanDetailAdd")
|
public Result yearPlanDetailAdd(@RequestBody PersonSupervisePlanDetails personSupervisePlanDetails) {
|
personSupervisePlanDetailsService.save(personSupervisePlanDetails);
|
return Result.success();
|
}
|
|
@ValueClassify("监督计划")
|
@ApiOperation(value = "编辑 年度计划详情")
|
@PostMapping("/yearPlanDetailEdit")
|
public Result yearPlanDetailEdit(@RequestBody PersonSupervisePlanDetails personSupervisePlanDetails) {
|
personSupervisePlanDetailsService.updateById(personSupervisePlanDetails);
|
return Result.success("保存成功");
|
}
|
|
/**
|
* 导出人员监督计划
|
* @return
|
*/
|
@ValueAuth
|
@ApiOperation(value = "导出人员监督计划")
|
@PostMapping("/exportSuperVisePlan")
|
public void exportSuperVisePlan(Integer id, HttpServletResponse response){
|
personSupervisePlanService.exportSuperVisePlan(id, response);
|
}
|
}
|