| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- package com.ims.eval.controller;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import com.ims.eval.config.CustomException;
- import com.ims.eval.entity.DeptResponsibility;
- import com.ims.eval.entity.Indicator;
- import com.ims.eval.entity.dto.response.DeptResponsibilityResDTO;
- import com.ims.eval.entity.dto.result.R;
- import com.ims.eval.service.IDeptResponsibilityService;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import javax.servlet.http.HttpServletRequest;
- import java.util.Arrays;
- import java.util.List;
- import java.util.Map;
- /**
- * <p>
- * 部门目标责任表 前端控制器
- * </p>
- *
- * @author wang
- * @since 2023-02-27
- */
- @RestController
- @RequestMapping("//dept-responsibility")
- public class DeptResponsibilityController {
- @Autowired
- private IDeptResponsibilityService deptResponsibilityService;
- @Autowired
- private HttpServletRequest request;
- /**
- * 分页查询
- *
- * @param pageNum 当前页数
- * @param pageSize 当前页大小
- * @param id 主键
- * @param responsibilityCode 业务编码
- * @param cycleUnit 周期单位
- * @param checkCycle 周期
- * @param beginDate 考核开始时间
- * @param endDate 考核截止时间
- * @param stage 审批状态
- * @param createBy 创建者
- * @param year 年
- * @param month 月
- * @param des 描述
- * @return
- */
- //@ImsPreAuth("eval:deptResponsibility:view")
- @GetMapping(value = "list")
- public R list(@RequestParam(value = "pageNum") Integer pageNum,
- @RequestParam(value = "pageSize") Integer pageSize,
- @RequestParam(value = "id", required = false) String id,
- @RequestParam(value = "responsibilityCode", required = false) String responsibilityCode,
- @RequestParam(value = "cycleUnit", required = false) String cycleUnit,
- @RequestParam(value = "checkCycle", required = false) List<String> checkCycle,
- @RequestParam(value = "beginDate", required = false) String beginDate,
- @RequestParam(value = "endDate", required = false) String endDate,
- @RequestParam(value = "stage", required = false) String stage,
- @RequestParam(value = "createBy", required = false) String createBy,
- @RequestParam(value = "year", required = false) String year,
- @RequestParam(value = "month", required = false) String month,
- @RequestParam(value = "des", required = false) String des) {
- IPage<DeptResponsibility> list = deptResponsibilityService.list(pageNum, pageSize, id, responsibilityCode, cycleUnit, checkCycle, beginDate, endDate, stage, createBy, year, month, des);
- return R.ok().data(list);
- }
- /**
- * 添加
- *
- * @param deptResponsibility
- * @return
- */
- //@ImsPreAuth("eval:deptResponsibility:edit")
- @PostMapping(value = "/save")
- @ApiOperation(value = "新增(修改)", notes = "新增(修改)")
- public R add(@RequestBody DeptResponsibility deptResponsibility) {
- try {
- boolean b = deptResponsibilityService.saveOrUpdate(deptResponsibility);
- if (b) {
- return R.ok().data(b);
- } else {
- return R.error().data("保存失败!");
- }
- } catch (CustomException e) {
- return R.customError(e.getMessage()).data("失败!");
- }
- }
- /**
- * 生成目标责任书
- *
- * @param responsibilityIds 目标责任书ids
- * @return
- */
- //@ImsPreAuth("eval:deptResponsibility:edit")
- @PostMapping(value = "/generate")
- @ApiOperation(value = "生成部门责任书", notes = "生成部门责任书")
- public R generateResponsibility(@RequestParam(value = "responsibilityIds", required = true) String responsibilityIds) {
- try {
- List<String> orgEvalRuleIdList = Arrays.asList(responsibilityIds.split(","));
- boolean b = false;
- for (String id : orgEvalRuleIdList) {
- b = deptResponsibilityService.generateResponsibility(id);
- if (!b) {
- return R.error().data("保存失败!");
- }
- }
- return R.ok().data(b);
- } catch (CustomException e) {
- return R.customError(e.getMessage()).data("失败!");
- }
- }
- /**
- *
- * @param id 目标责任书id
- * @return
- */
- //@ImsPreAuth("eval:responsibilityIndicatorInfo:view")
- @GetMapping(value = "getByidAndInfo")
- public R planValueList(
- @RequestParam(value = "id", required = false) String id,
- @RequestParam(value = "dept", required = false) String dept) {
- DeptResponsibilityResDTO resDTO = deptResponsibilityService.getByidAndInfo(id, dept);
- return R.ok().data(resDTO);
- }
- /**
- * 批量删除
- *
- * @param ids
- * @return
- */
- //@ImsPreAuth("eval:deptResponsibility:remove")
- @PostMapping(value = "/remove/{ids}")
- @ApiOperation(value = "删除", notes = "删除")
- public R deleteAll(@PathVariable("ids") String ids) {
- try {
- String[] strings = ids.split(",");
- boolean b = deptResponsibilityService.removeByIds(Arrays.asList(strings));
- if (b) {
- return R.ok().data(b);
- } else {
- return R.error().data("删除失败!");
- }
- } catch (CustomException e) {
- return R.customError(e.getMessage()).data("失败!");
- }
- }
- @GetMapping(value = "targetValueeport")
- public R targetValueeport(
- @RequestParam(value = "id", required = false) String id,
- @RequestParam(value = "dept", required = false) String dept) {
- List<Map> list = deptResponsibilityService.targetValueeport(id, dept,request);
- return R.ok().data(list);
- }
- }
|