|
@@ -2,16 +2,16 @@ package com.ims.eval.controller;
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.ims.eval.cache.CacheContext;
|
|
|
-import com.ims.eval.entity.MultipleBrand;
|
|
|
+import com.ims.eval.entity.OrganizationEvaluation;
|
|
|
import com.ims.eval.entity.OrganizationEvaluationInfo;
|
|
|
import com.ims.eval.entity.dto.request.AddEvaluationInfoDTO;
|
|
|
import com.ims.eval.entity.dto.response.MyuserResDTO;
|
|
|
import com.ims.eval.entity.dto.response.OrganizationEvaluationInfoResDTO;
|
|
|
import com.ims.eval.entity.dto.result.R;
|
|
|
-import com.ims.eval.service.IMultipleBrandService;
|
|
|
import com.ims.eval.service.IOrganizationEvaluationInfoService;
|
|
|
+import com.ims.eval.service.IOrganizationEvaluationService;
|
|
|
import com.ims.eval.service.custom.PostUserService;
|
|
|
import com.ims.eval.util.ExcelUtil;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -28,14 +28,13 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.io.InputStream;
|
|
|
import java.util.*;
|
|
|
-import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
|
* 考评指标明细
|
|
|
-
|
|
|
- 前端控制器
|
|
|
+ * <p>
|
|
|
+ * 前端控制器
|
|
|
* </p>
|
|
|
*
|
|
|
* @author wang
|
|
@@ -56,6 +55,8 @@ public class OrganizationEvaluationInfoController {
|
|
|
@Autowired
|
|
|
private PostUserService postUserService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IOrganizationEvaluationService organizationEvaluationService;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -84,7 +85,7 @@ public class OrganizationEvaluationInfoController {
|
|
|
@RequestParam(value = "organizationEvaluationId", required = false) String organizationEvaluationId,
|
|
|
@RequestParam(value = "binSection", required = false) String binSection,
|
|
|
@RequestParam(value = "binStage", required = false) String binStage) {
|
|
|
- List<Map> list = organizationEvaluationInfoService.getEvaluationIndicatorList(organizationEvaluationId, binSection,binStage, request);
|
|
|
+ List<Map> list = organizationEvaluationInfoService.getEvaluationIndicatorList(organizationEvaluationId, binSection, binStage, request);
|
|
|
return R.ok().data(list);
|
|
|
}
|
|
|
|
|
@@ -103,27 +104,35 @@ public class OrganizationEvaluationInfoController {
|
|
|
@RequestParam(value = "indicatorId", required = false) String indicatorId,
|
|
|
@RequestParam(value = "binSection", required = false) String binSection,
|
|
|
@RequestParam(value = "binStage", required = false) String binStage) {
|
|
|
+ LambdaQueryWrapper<OrganizationEvaluation> qw = new LambdaQueryWrapper<>();
|
|
|
+ qw.eq(OrganizationEvaluation::getId, organizationEvaluationId);
|
|
|
+ List<OrganizationEvaluation> orgEva = organizationEvaluationService.list(qw);
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ if (orgEva != null) {
|
|
|
+ sb.append(orgEva.get(0).getCheckCycle()).append("_").append(orgEva.get(0).getYear());
|
|
|
+ if (orgEva.get(0).getMonth() != null) {
|
|
|
+ sb.append("_").append(orgEva.get(0).getMonth());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
|
|
HttpServletRequest request = Objects.requireNonNull(attributes).getRequest();
|
|
|
JSONObject json = postUserService.getSysUser(request.getHeader("code"), request.getHeader("Blade-Auth"), request);
|
|
|
MyuserResDTO user = JSONObject.parseObject(json.getJSONObject("data").toJSONString(), MyuserResDTO.class);
|
|
|
|
|
|
- Map list = organizationEvaluationInfoService.getEvaluationInfoList(organizationEvaluationId,organizationShortName, indicatorId,binSection,binStage, request);
|
|
|
- List<Map> value2 = (List<Map>)list.get("value");
|
|
|
+ Map list = organizationEvaluationInfoService.getEvaluationInfoList(organizationEvaluationId, organizationShortName, indicatorId, binSection, binStage, request);
|
|
|
+ List<Map> value2 = (List<Map>) list.get("value");
|
|
|
String s = CacheContext.childCompanyId.get(user.getId());
|
|
|
- if (s!=null){
|
|
|
- List<String> childList = CacheContext.getChildList(s);
|
|
|
+ if (s != null) {
|
|
|
+ Set<String> childList = CacheContext.getChildList(s, sb.toString());
|
|
|
List<Map> value1 = value2.stream().filter(a -> childList.contains(a.get("organizationId"))).collect(Collectors.toList());
|
|
|
- list.put("value",value1);
|
|
|
+ list.put("value", value1);
|
|
|
}
|
|
|
|
|
|
return R.ok().data(list);
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
@GetMapping("/download-excel")
|
|
|
public ResponseEntity<byte[]> downloadExcel(
|
|
|
@RequestParam(value = "organizationEvaluationId", required = false) String organizationEvaluationId,
|
|
@@ -132,7 +141,7 @@ public class OrganizationEvaluationInfoController {
|
|
|
@RequestParam(value = "binStage", required = false) String binStage) throws Exception {
|
|
|
|
|
|
|
|
|
- byte[] excelBytes = organizationEvaluationInfoService.downloadExcel(organizationEvaluationId, indicatorId,binSection,binStage, request);
|
|
|
+ byte[] excelBytes = organizationEvaluationInfoService.downloadExcel(organizationEvaluationId, indicatorId, binSection, binStage, request);
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
|
|
headers.setContentDispositionFormData("attachment", "example.xlsx");
|
|
@@ -143,9 +152,9 @@ public class OrganizationEvaluationInfoController {
|
|
|
|
|
|
|
|
|
@PostMapping("/import-excel")
|
|
|
- public R importExcel(@RequestParam("file") MultipartFile file,HttpServletRequest request) throws Exception {
|
|
|
+ public R importExcel(@RequestParam("file") MultipartFile file, HttpServletRequest request) throws Exception {
|
|
|
|
|
|
- boolean b = organizationEvaluationInfoService.importExcel(file,request);
|
|
|
+ boolean b = organizationEvaluationInfoService.importExcel(file, request);
|
|
|
|
|
|
if (b) {
|
|
|
return R.ok().data(b);
|
|
@@ -217,7 +226,7 @@ public class OrganizationEvaluationInfoController {
|
|
|
@RequestParam(value = "indicatorName", required = false) String indicatorName,
|
|
|
@RequestParam(value = "binSection", required = false) String binSection,
|
|
|
@RequestParam(value = "isQuantified", required = false) String isQuantified) {
|
|
|
- List<OrganizationEvaluationInfoResDTO> list = organizationEvaluationInfoService.finishValueList(organizationEvaluationId, dept, organizationShortName,indicatorName,binSection,isQuantified,request);
|
|
|
+ List<OrganizationEvaluationInfoResDTO> list = organizationEvaluationInfoService.finishValueList(organizationEvaluationId, dept, organizationShortName, indicatorName, binSection, isQuantified, request);
|
|
|
return R.ok().data(list);
|
|
|
}
|
|
|
|
|
@@ -250,7 +259,7 @@ public class OrganizationEvaluationInfoController {
|
|
|
|
|
|
@PostMapping(value = "/import")
|
|
|
@ResponseBody
|
|
|
- public R importAlertrule(@RequestParam("file") MultipartFile file,HttpServletRequest request) {
|
|
|
+ public R importAlertrule(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
|
|
|
|
|
|
if (!file.isEmpty()) {
|
|
|
try {
|
|
@@ -274,7 +283,7 @@ public class OrganizationEvaluationInfoController {
|
|
|
}
|
|
|
boolean b = organizationEvaluationInfoService.saveOrUpdateBatch(bindingList);
|
|
|
if (b) {
|
|
|
- organizationEvaluationInfoService.calculationByEvaluationId("","",bindingList.get(0).getOrganizationEvaluationId(),"");
|
|
|
+ organizationEvaluationInfoService.calculationByEvaluationId("", "", bindingList.get(0).getOrganizationEvaluationId(), "");
|
|
|
return R.ok().data(b);
|
|
|
} else {
|
|
|
return R.error().data("保存失败!");
|
|
@@ -292,13 +301,13 @@ public class OrganizationEvaluationInfoController {
|
|
|
|
|
|
@PostMapping(value = "/calculation")
|
|
|
@ApiOperation(value = "计算得分", notes = "计算得分")
|
|
|
- public R calculation(@RequestParam(value = "id", required = false)String id,
|
|
|
- @RequestParam(value = "indicatorId", required = false) String indicatorId ,
|
|
|
- @RequestParam(value = "organizationEvaluationId", required = false) String organizationEvaluationId,
|
|
|
- @RequestParam(value = "optionCode", required = false) String optionCode) {
|
|
|
+ public R calculation(@RequestParam(value = "id", required = false) String id,
|
|
|
+ @RequestParam(value = "indicatorId", required = false) String indicatorId,
|
|
|
+ @RequestParam(value = "organizationEvaluationId", required = false) String organizationEvaluationId,
|
|
|
+ @RequestParam(value = "optionCode", required = false) String optionCode) {
|
|
|
|
|
|
try {
|
|
|
- boolean b = organizationEvaluationInfoService.calculationByEvaluationId(id,indicatorId,organizationEvaluationId,optionCode);
|
|
|
+ boolean b = organizationEvaluationInfoService.calculationByEvaluationId(id, indicatorId, organizationEvaluationId, optionCode);
|
|
|
if (b) {
|
|
|
return R.ok().data(b);
|
|
|
} else {
|