|
@@ -17,10 +17,10 @@ import com.ims.eval.service.IEvaluationDeptService;
|
|
import com.ims.eval.util.ExcelUtil;
|
|
import com.ims.eval.util.ExcelUtil;
|
|
import com.ims.eval.util.WordUtil;
|
|
import com.ims.eval.util.WordUtil;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import java.io.*;
|
|
import java.io.*;
|
|
@@ -42,16 +42,16 @@ import java.util.Map;
|
|
@RequestMapping("//evaluation-dept-assessment")
|
|
@RequestMapping("//evaluation-dept-assessment")
|
|
public class DepartmentalPerformanceIndicatorAssessmentController {
|
|
public class DepartmentalPerformanceIndicatorAssessmentController {
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
|
+ @Resource
|
|
private IEvaluationDeptBusinessAssessmentService evaluationDeptBusinessAssessmentService;
|
|
private IEvaluationDeptBusinessAssessmentService evaluationDeptBusinessAssessmentService;
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
|
+ @Resource
|
|
private IEvaluationDeptBusinessContentService evaluationDeptBusinessContentService;
|
|
private IEvaluationDeptBusinessContentService evaluationDeptBusinessContentService;
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
|
+ @Resource
|
|
private IEvaluationDeptService evaluationDeptService;
|
|
private IEvaluationDeptService evaluationDeptService;
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
|
+ @Resource
|
|
private HttpServletRequest request;
|
|
private HttpServletRequest request;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -90,6 +90,86 @@ public class DepartmentalPerformanceIndicatorAssessmentController {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * 详情-头部信息
|
|
|
|
+ *
|
|
|
|
+ * @param id 业务主键
|
|
|
|
+ * @return 结果
|
|
|
|
+ */
|
|
|
|
+ @GetMapping(value = "/detailsHead/{id}")
|
|
|
|
+ public R detailsHead(@PathVariable("id") String id) {
|
|
|
|
+ EvaluationDeptBusinessAssessment evaluationDeptBusinessAssessment = evaluationDeptBusinessAssessmentService.getById(id);
|
|
|
|
+ return R.ok().data(evaluationDeptBusinessAssessment);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 导入
|
|
|
|
+ *
|
|
|
|
+ * @param file 文件
|
|
|
|
+ * @return 结果
|
|
|
|
+ */
|
|
|
|
+ @PostMapping(value = "/import")
|
|
|
|
+ public R importData(@RequestParam("file") MultipartFile file, @RequestParam("id") String id) {
|
|
|
|
+ if (!file.isEmpty()) {
|
|
|
|
+ try {
|
|
|
|
+ //获取原始的文件名
|
|
|
|
+ String originalFilename = file.getOriginalFilename();
|
|
|
|
+ //获取文件类型
|
|
|
|
+ String fileType = originalFilename.substring(originalFilename.lastIndexOf(".") + 1, originalFilename.length());
|
|
|
|
+ //默认从第一行开始读取
|
|
|
|
+ int startRows = 1;
|
|
|
|
+ //获取输入流
|
|
|
|
+ InputStream is = file.getInputStream();
|
|
|
|
+ List<EvaluationDeptBusinessContent> evaluationDeptBusinessContentList = new ArrayList<>();
|
|
|
|
+ //Excel导入导出的单元类
|
|
|
|
+ List<String[]> strings = ExcelUtil.readData(fileType, startRows, true, is);
|
|
|
|
+ //遍历Excel表每一行的数据
|
|
|
|
+ for (String[] str : strings) {
|
|
|
|
+ EvaluationDeptBusinessContent evaluationDeptBusinessContent = new EvaluationDeptBusinessContent();
|
|
|
|
+ evaluationDeptBusinessContent.setBusinessPlanId(id);
|
|
|
|
+ evaluationDeptBusinessContent.setTargetName(str[3]);
|
|
|
|
+ evaluationDeptBusinessContent.setCompletionStatus(str[6]);
|
|
|
|
+ evaluationDeptBusinessContent.setEvaluationScore(str[8]);
|
|
|
|
+ evaluationDeptBusinessContentList.add(evaluationDeptBusinessContent);
|
|
|
|
+ }
|
|
|
|
+ boolean b = evaluationDeptBusinessContentService.importAssessmentDataList(evaluationDeptBusinessContentList);
|
|
|
|
+ if (b) {
|
|
|
|
+ return R.ok().data(b);
|
|
|
|
+ } else {
|
|
|
|
+ return R.error("导入失败!");
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("错误", e);
|
|
|
|
+ return R.customError(e.getMessage()).data("失败!");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return R.error("上传文件为空!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 修改状态
|
|
|
|
+ *
|
|
|
|
+ * @param id 主键
|
|
|
|
+ * @param stage 状态
|
|
|
|
+ * @return 结果
|
|
|
|
+ */
|
|
|
|
+ @PostMapping(value = "/targetStart")
|
|
|
|
+ public R targetStart(@RequestParam(value = "id") String id,
|
|
|
|
+ @RequestParam(value = "stage") String stage) {
|
|
|
|
+ try {
|
|
|
|
+ EvaluationDeptBusinessAssessment evaluationDeptBusinessAssessment = evaluationDeptBusinessAssessmentService.getById(id);
|
|
|
|
+ evaluationDeptBusinessAssessment.setStage(stage);
|
|
|
|
+ boolean b = evaluationDeptBusinessAssessmentService.updateById(evaluationDeptBusinessAssessment);
|
|
|
|
+ if (b) {
|
|
|
|
+ return R.ok().data(b);
|
|
|
|
+ } else {
|
|
|
|
+ return R.error("失败!");
|
|
|
|
+ }
|
|
|
|
+ } catch (CustomException e) {
|
|
|
|
+ return R.customError(e.getMessage()).data("失败!");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
* 生成报表
|
|
* 生成报表
|
|
*
|
|
*
|
|
* @return 结果
|
|
* @return 结果
|
|
@@ -138,7 +218,7 @@ public class DepartmentalPerformanceIndicatorAssessmentController {
|
|
public R statisticalSummary(@RequestParam(value = "year") String year) {
|
|
public R statisticalSummary(@RequestParam(value = "year") String year) {
|
|
Map<String, List<EvaluationDeptBusinessAssessmentDTO>> map = new HashMap<>();
|
|
Map<String, List<EvaluationDeptBusinessAssessmentDTO>> map = new HashMap<>();
|
|
List<EvaluationDeptBusinessAssessment> evaluationDeptBusinessAssessmentList = evaluationDeptBusinessAssessmentService.selectEvaluationDeptBusinessAssessmentByYear(year);
|
|
List<EvaluationDeptBusinessAssessment> evaluationDeptBusinessAssessmentList = evaluationDeptBusinessAssessmentService.selectEvaluationDeptBusinessAssessmentByYear(year);
|
|
- if ("2023".equals(year)) {
|
|
|
|
|
|
+ if (evaluationDeptBusinessAssessmentList.size() == 1) {
|
|
QueryWrapper<EvaluationDept> qw = new QueryWrapper<>();
|
|
QueryWrapper<EvaluationDept> qw = new QueryWrapper<>();
|
|
qw.lambda().eq(EvaluationDept::getYjzbjhType, "1");
|
|
qw.lambda().eq(EvaluationDept::getYjzbjhType, "1");
|
|
qw.lambda().orderByAsc(EvaluationDept::getSerialNumber);
|
|
qw.lambda().orderByAsc(EvaluationDept::getSerialNumber);
|
|
@@ -192,7 +272,7 @@ public class DepartmentalPerformanceIndicatorAssessmentController {
|
|
Map<String, Object> dataMap = new HashMap<>();
|
|
Map<String, Object> dataMap = new HashMap<>();
|
|
List<EvaluationDeptBusinessAssessment> evaluationDeptBusinessAssessmentList = evaluationDeptBusinessAssessmentService.selectEvaluationDeptBusinessAssessmentByYear(year);
|
|
List<EvaluationDeptBusinessAssessment> evaluationDeptBusinessAssessmentList = evaluationDeptBusinessAssessmentService.selectEvaluationDeptBusinessAssessmentByYear(year);
|
|
List<DeptDTO> deptList = new ArrayList<>();
|
|
List<DeptDTO> deptList = new ArrayList<>();
|
|
- if ("2023".equals(year)) {
|
|
|
|
|
|
+ if (evaluationDeptBusinessAssessmentList.size() == 1) {
|
|
QueryWrapper<EvaluationDept> qw = new QueryWrapper<>();
|
|
QueryWrapper<EvaluationDept> qw = new QueryWrapper<>();
|
|
qw.lambda().eq(EvaluationDept::getYjzbjhType, "1");
|
|
qw.lambda().eq(EvaluationDept::getYjzbjhType, "1");
|
|
qw.lambda().orderByAsc(EvaluationDept::getSerialNumber);
|
|
qw.lambda().orderByAsc(EvaluationDept::getSerialNumber);
|
|
@@ -225,6 +305,47 @@ public class DepartmentalPerformanceIndicatorAssessmentController {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * 校验审核状态
|
|
|
|
+ *
|
|
|
|
+ * @param id 主键
|
|
|
|
+ * @return 结果
|
|
|
|
+ */
|
|
|
|
+ @GetMapping(value = "/checkAuditStatus/{id}/{deptId}")
|
|
|
|
+ public R checkAuditStatus(@PathVariable String id, @PathVariable String deptId) {
|
|
|
|
+ boolean b = true;
|
|
|
|
+ String msg = "";
|
|
|
|
+ QueryWrapper<EvaluationDeptBusinessContent> qw = new QueryWrapper<>();
|
|
|
|
+ if (StringUtils.isNotEmpty(id)) {
|
|
|
|
+ qw.lambda().eq(EvaluationDeptBusinessContent::getBusinessPlanId, id);
|
|
|
|
+ }
|
|
|
|
+ List<EvaluationDeptBusinessContent> evaluationDeptBusinessContentList = evaluationDeptBusinessContentService.list(qw);
|
|
|
|
+ if ("23031009".equals(deptId)) {//组织人事部
|
|
|
|
+ for (EvaluationDeptBusinessContent evaluationDeptBusinessContent : evaluationDeptBusinessContentList) {
|
|
|
|
+ if (!"0".equals(evaluationDeptBusinessContent.getAuditStatusKp())) {
|
|
|
|
+ b = false;
|
|
|
|
+ msg = "数据审核状态未通过!";
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ for (EvaluationDeptBusinessContent evaluationDeptBusinessContent : evaluationDeptBusinessContentList) {
|
|
|
|
+ if (evaluationDeptBusinessContent.getDeptId().equals(deptId)) {
|
|
|
|
+ if (!"0".equals(evaluationDeptBusinessContent.getAuditStatusKp())) {
|
|
|
|
+ b = false;
|
|
|
|
+ msg = "数据审核状态未通过,请联系相关部门进行审核!";
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (b) {
|
|
|
|
+ return R.ok().data(b);
|
|
|
|
+ } else {
|
|
|
|
+ return R.error(msg);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
* 下载报表
|
|
* 下载报表
|
|
*
|
|
*
|
|
* @param request request
|
|
* @param request request
|
|
@@ -274,125 +395,4 @@ public class DepartmentalPerformanceIndicatorAssessmentController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 修改状态
|
|
|
|
- *
|
|
|
|
- * @param id 主键
|
|
|
|
- * @param stage 状态
|
|
|
|
- * @return 结果
|
|
|
|
- */
|
|
|
|
- @PostMapping(value = "/targetStart")
|
|
|
|
- public R targetStart(@RequestParam(value = "id") String id,
|
|
|
|
- @RequestParam(value = "stage") String stage) {
|
|
|
|
- try {
|
|
|
|
- EvaluationDeptBusinessAssessment evaluationDeptBusinessAssessment = evaluationDeptBusinessAssessmentService.getById(id);
|
|
|
|
- evaluationDeptBusinessAssessment.setStage(stage);
|
|
|
|
- boolean b = evaluationDeptBusinessAssessmentService.updateById(evaluationDeptBusinessAssessment);
|
|
|
|
- if (b) {
|
|
|
|
- return R.ok().data(b);
|
|
|
|
- } else {
|
|
|
|
- return R.error("失败!");
|
|
|
|
- }
|
|
|
|
- } catch (CustomException e) {
|
|
|
|
- return R.customError(e.getMessage()).data("失败!");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 详情-头部信息
|
|
|
|
- *
|
|
|
|
- * @param id 业务主键
|
|
|
|
- * @return 结果
|
|
|
|
- */
|
|
|
|
- @GetMapping(value = "/detailsHead/{id}")
|
|
|
|
- public R detailsHead(@PathVariable("id") String id) {
|
|
|
|
- EvaluationDeptBusinessAssessment evaluationDeptBusinessAssessment = evaluationDeptBusinessAssessmentService.getById(id);
|
|
|
|
- return R.ok().data(evaluationDeptBusinessAssessment);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 导入
|
|
|
|
- *
|
|
|
|
- * @param file 文件
|
|
|
|
- * @return 结果
|
|
|
|
- */
|
|
|
|
- @PostMapping(value = "/import")
|
|
|
|
- public R importData(@RequestParam("file") MultipartFile file, @RequestParam("id") String id) {
|
|
|
|
- if (!file.isEmpty()) {
|
|
|
|
- try {
|
|
|
|
- //获取原始的文件名
|
|
|
|
- String originalFilename = file.getOriginalFilename();
|
|
|
|
- //获取文件类型
|
|
|
|
- String fileType = originalFilename.substring(originalFilename.lastIndexOf(".") + 1, originalFilename.length());
|
|
|
|
- //默认从第一行开始读取
|
|
|
|
- int startRows = 1;
|
|
|
|
- //获取输入流
|
|
|
|
- InputStream is = file.getInputStream();
|
|
|
|
- List<EvaluationDeptBusinessContent> evaluationDeptBusinessContentList = new ArrayList<>();
|
|
|
|
- //Excel导入导出的单元类
|
|
|
|
- List<String[]> strings = ExcelUtil.readData(fileType, startRows, true, is);
|
|
|
|
- //遍历Excel表每一行的数据
|
|
|
|
- for (String[] str : strings) {
|
|
|
|
- EvaluationDeptBusinessContent evaluationDeptBusinessContent = new EvaluationDeptBusinessContent();
|
|
|
|
- evaluationDeptBusinessContent.setBusinessPlanId(id);
|
|
|
|
- evaluationDeptBusinessContent.setTargetName(str[3]);
|
|
|
|
- evaluationDeptBusinessContent.setCompletionStatus(str[6]);
|
|
|
|
- evaluationDeptBusinessContent.setEvaluationScore(str[8]);
|
|
|
|
- evaluationDeptBusinessContentList.add(evaluationDeptBusinessContent);
|
|
|
|
- }
|
|
|
|
- boolean b = evaluationDeptBusinessContentService.importAssessmentDataList(evaluationDeptBusinessContentList);
|
|
|
|
- if (b) {
|
|
|
|
- return R.ok().data(b);
|
|
|
|
- } else {
|
|
|
|
- return R.error("导入失败!");
|
|
|
|
- }
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- log.error("错误", e);
|
|
|
|
- return R.customError(e.getMessage()).data("失败!");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return R.error("上传文件为空!");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 校验审核状态
|
|
|
|
- *
|
|
|
|
- * @param id 主键
|
|
|
|
- * @return 结果
|
|
|
|
- */
|
|
|
|
- @GetMapping(value = "/checkAuditStatus/{id}/{deptId}")
|
|
|
|
- public R checkAuditStatus(@PathVariable String id, @PathVariable String deptId) {
|
|
|
|
- boolean b = true;
|
|
|
|
- String msg = "";
|
|
|
|
- QueryWrapper<EvaluationDeptBusinessContent> qw = new QueryWrapper<>();
|
|
|
|
- if (StringUtils.isNotEmpty(id)) {
|
|
|
|
- qw.lambda().eq(EvaluationDeptBusinessContent::getBusinessPlanId, id);
|
|
|
|
- }
|
|
|
|
- List<EvaluationDeptBusinessContent> evaluationDeptBusinessContentList = evaluationDeptBusinessContentService.list(qw);
|
|
|
|
- if ("23031009".equals(deptId)) {//组织人事部
|
|
|
|
- for (EvaluationDeptBusinessContent evaluationDeptBusinessContent : evaluationDeptBusinessContentList) {
|
|
|
|
- if (!"0".equals(evaluationDeptBusinessContent.getAuditStatusKp())) {
|
|
|
|
- b = false;
|
|
|
|
- msg = "数据审核状态未通过!";
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- for (EvaluationDeptBusinessContent evaluationDeptBusinessContent : evaluationDeptBusinessContentList) {
|
|
|
|
- if (evaluationDeptBusinessContent.getDeptId().equals(deptId)) {
|
|
|
|
- if (!"0".equals(evaluationDeptBusinessContent.getAuditStatusKp())) {
|
|
|
|
- b = false;
|
|
|
|
- msg = "数据审核状态未通过,请联系相关部门进行审核!";
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (b) {
|
|
|
|
- return R.ok().data(b);
|
|
|
|
- } else {
|
|
|
|
- return R.error(msg);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
}
|
|
}
|