Browse Source

考评详情添加部门修改权限

wangchangsheng 1 year ago
parent
commit
f7c3ab61a9

+ 5 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/controller/OrganizationEvaluationController.java

@@ -11,6 +11,7 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.Arrays;
 import java.util.Arrays;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
@@ -31,6 +32,9 @@ public class OrganizationEvaluationController {
 	@Autowired
 	@Autowired
 	private IOrganizationEvaluationService organizationEvaluationService;
 	private IOrganizationEvaluationService organizationEvaluationService;
 
 
+	@Autowired
+	private HttpServletRequest request;
+
 
 
 	/**
 	/**
 	 * 分页查询
 	 * 分页查询
@@ -204,7 +208,7 @@ public class OrganizationEvaluationController {
 	public R planValueList(
 	public R planValueList(
 		@RequestParam(value = "id", required = false) String  id,
 		@RequestParam(value = "id", required = false) String  id,
 		@RequestParam(value = "dept", required = false) String dept) {
 		@RequestParam(value = "dept", required = false) String dept) {
-		OrganizationEvaluationResDTO resDTO = organizationEvaluationService.getByidAndInfo(id, dept);
+		OrganizationEvaluationResDTO resDTO = organizationEvaluationService.getByidAndInfo(id, dept,request);
 		return R.ok().data(resDTO);
 		return R.ok().data(resDTO);
 	}
 	}
 
 

+ 6 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/controller/OrganizationEvaluationInfoController.java

@@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
@@ -32,6 +33,10 @@ public class OrganizationEvaluationInfoController {
 	private IOrganizationEvaluationInfoService organizationEvaluationInfoService;
 	private IOrganizationEvaluationInfoService organizationEvaluationInfoService;
 
 
 
 
+	@Autowired
+	private HttpServletRequest request;
+
+
 	/**
 	/**
 	 *
 	 *
 	 * @param organizationEvaluationId 目标责任书id
 	 * @param organizationEvaluationId 目标责任书id
@@ -42,7 +47,7 @@ public class OrganizationEvaluationInfoController {
 	public R finishValueList(
 	public R finishValueList(
 		@RequestParam(value = "organizationEvaluationId", required = false) String organizationEvaluationId,
 		@RequestParam(value = "organizationEvaluationId", required = false) String organizationEvaluationId,
 		@RequestParam(value = "dept", required = false) String dept) {
 		@RequestParam(value = "dept", required = false) String dept) {
-		Map list = organizationEvaluationInfoService.finishValueList(organizationEvaluationId, dept);
+		Map list = organizationEvaluationInfoService.finishValueList(organizationEvaluationId, dept, request);
 		return R.ok().data(list);
 		return R.ok().data(list);
 	}
 	}
 
 

+ 2 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/controller/WorkflowController.java

@@ -8,6 +8,7 @@ import com.ims.eval.entity.custom.GetInstance;
 import com.ims.eval.entity.custom.IsOkAction;
 import com.ims.eval.entity.custom.IsOkAction;
 import com.ims.eval.entity.custom.TodoTask;
 import com.ims.eval.entity.custom.TodoTask;
 import com.ims.eval.entity.dto.result.R;
 import com.ims.eval.entity.dto.result.R;
+import com.ims.eval.entity.flow.FlowResult;
 import com.ims.eval.service.custom.WorkflowService;
 import com.ims.eval.service.custom.WorkflowService;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -63,7 +64,7 @@ public class WorkflowController {
 	 */
 	 */
 	@PostMapping(value = "todoTaskList")
 	@PostMapping(value = "todoTaskList")
 	public R todoTaskList(@RequestBody TodoTask todoTask) {
 	public R todoTaskList(@RequestBody TodoTask todoTask) {
-		JSONObject json = null;
+		FlowResult json = null;
 		try {
 		try {
 			json = workflowService.todoTaskList(todoTask,request);
 			json = workflowService.todoTaskList(todoTask,request);
 		} catch (Exception e) {
 		} catch (Exception e) {

+ 5 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/entity/dto/response/OrganizationEvaluationInfoResDTO.java

@@ -112,4 +112,9 @@ public class OrganizationEvaluationInfoResDTO {
 	 * 状态
 	 * 状态
 	 */
 	 */
 	private String state;
 	private String state;
+
+	/**
+	 * 修改标记
+	 */
+	private Boolean updateMark;
 }
 }

+ 3 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/entity/flow/FlowResult.java

@@ -1,5 +1,6 @@
 package com.ims.eval.entity.flow;
 package com.ims.eval.entity.flow;
 
 
+import com.alibaba.fastjson.JSONArray;
 import lombok.Data;
 import lombok.Data;
 
 
 @Data
 @Data
@@ -27,5 +28,7 @@ public class FlowResult {
 	 */
 	 */
 	private String data;
 	private String data;
 
 
+	private JSONArray rows;
+
 
 
 }
 }

+ 2 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/service/IOrganizationEvaluationInfoService.java

@@ -4,6 +4,7 @@ import com.ims.eval.entity.OrganizationEvaluationInfo;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ims.eval.entity.dto.request.OrganizationEvaluationInfoUpdateDTO;
 import com.ims.eval.entity.dto.request.OrganizationEvaluationInfoUpdateDTO;
 
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
@@ -19,7 +20,7 @@ import java.util.Map;
  */
  */
 public interface IOrganizationEvaluationInfoService extends IService<OrganizationEvaluationInfo> {
 public interface IOrganizationEvaluationInfoService extends IService<OrganizationEvaluationInfo> {
 
 
-	Map finishValueList(String organizationEvaluationId, String dept);
+	Map finishValueList(String organizationEvaluationId, String dept, HttpServletRequest request);
 
 
 	boolean saveBatchDto(List<OrganizationEvaluationInfo>  organizationEvaluationInfoList) throws Exception;
 	boolean saveBatchDto(List<OrganizationEvaluationInfo>  organizationEvaluationInfoList) throws Exception;
 
 

+ 3 - 2
ims-service/ims-eval/src/main/java/com/ims/eval/service/IOrganizationEvaluationService.java

@@ -6,8 +6,10 @@ import com.ims.eval.entity.OrganizationEvaluation;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ims.eval.entity.dto.response.OrganizationEvaluationResDTO;
 import com.ims.eval.entity.dto.response.OrganizationEvaluationResDTO;
 import com.ims.eval.entity.dto.response.ResponsibilityIndicatorInfoResDTO;
 import com.ims.eval.entity.dto.response.ResponsibilityIndicatorInfoResDTO;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.Arrays;
 import java.util.Arrays;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
@@ -42,8 +44,7 @@ public interface IOrganizationEvaluationService extends IService<OrganizationEva
 	boolean editState(String id, String state,String instId);
 	boolean editState(String id, String state,String instId);
 
 
 
 
-	OrganizationEvaluationResDTO getByidAndInfo(String id, String dept);
-
+	OrganizationEvaluationResDTO getByidAndInfo(String id, String dept,HttpServletRequest request);
 
 
 
 
 }
 }

+ 41 - 27
ims-service/ims-eval/src/main/java/com/ims/eval/service/custom/WorkflowService.java

@@ -1,7 +1,9 @@
 package com.ims.eval.service.custom;
 package com.ims.eval.service.custom;
 
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.alibaba.nacos.client.naming.utils.CollectionUtils;
 import com.ims.eval.config.ImaConfig;
 import com.ims.eval.config.ImaConfig;
 import com.ims.eval.entity.custom.DoAction;
 import com.ims.eval.entity.custom.DoAction;
 import com.ims.eval.entity.custom.IsOkAction;
 import com.ims.eval.entity.custom.IsOkAction;
@@ -19,9 +21,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.web.client.RestTemplate;
 import org.springframework.web.client.RestTemplate;
 
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 
 
 
 /**
 /**
@@ -52,33 +52,33 @@ public class WorkflowService {
 	private ScoreCalculationSchedule scoreCalculationSchedule;
 	private ScoreCalculationSchedule scoreCalculationSchedule;
 
 
 
 
-
 	/**
 	/**
 	 * 发起流程
 	 * 发起流程
+	 *
 	 * @param doAction
 	 * @param doAction
 	 * @return
 	 * @return
 	 */
 	 */
-	public JSONObject doAction(DoAction doAction, HttpServletRequest request){
+	public JSONObject doAction(DoAction doAction, HttpServletRequest request) {
 		HttpHeaders headers = new HttpHeaders();
 		HttpHeaders headers = new HttpHeaders();
 		headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
 		headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
 		headers.add("Blade-Auth", request.getHeader("Blade-Auth"));
 		headers.add("Blade-Auth", request.getHeader("Blade-Auth"));
 		headers.add("code", request.getHeader("code"));
 		headers.add("code", request.getHeader("code"));
 		Map<String, String> map = new LinkedHashMap<>();
 		Map<String, String> map = new LinkedHashMap<>();
-		map.put("iamCode",doAction.getIamCode());
-		map.put("defKey",doAction.getDefKey());
-		map.put("businessKey",doAction.getBusinessKey());
-		map.put("action",doAction.getAction());
-		map.put("opinion",doAction.getOpinion());
+		map.put("iamCode", doAction.getIamCode());
+		map.put("defKey", doAction.getDefKey());
+		map.put("businessKey", doAction.getBusinessKey());
+		map.put("action", doAction.getAction());
+		map.put("opinion", doAction.getOpinion());
 
 
 		HttpEntity<Map> param = new HttpEntity<>(map, headers);
 		HttpEntity<Map> param = new HttpEntity<>(map, headers);
-		ResponseEntity<String> responseEntity2 = restTemplate.exchange("http://10.65.78.23:8080/bpm/instance/doAction", HttpMethod.POST,param,String.class);
+		ResponseEntity<String> responseEntity2 = restTemplate.exchange("http://10.65.78.23:8080/bpm/instance/doAction", HttpMethod.POST, param, String.class);
 		log.info("\n code:{}\n header:{}\n body:{}\n", responseEntity2.getStatusCodeValue(), responseEntity2.getHeaders(), responseEntity2.getBody());
 		log.info("\n code:{}\n header:{}\n body:{}\n", responseEntity2.getStatusCodeValue(), responseEntity2.getHeaders(), responseEntity2.getBody());
-		if(200== responseEntity2.getStatusCodeValue()){
+		if (200 == responseEntity2.getStatusCodeValue()) {
 			FlowResult result = JSON.parseObject(responseEntity2.getBody()).toJavaObject(FlowResult.class);
 			FlowResult result = JSON.parseObject(responseEntity2.getBody()).toJavaObject(FlowResult.class);
 
 
-			if(result.getIsOk()){
-				boolean biz = updateWorkflowState(result.getData(),doAction.getDefKey(),doAction.getBusinessKey(),"");
-				if(biz){
+			if (result.getIsOk()) {
+				boolean biz = updateWorkflowState(result.getData(), doAction.getDefKey(), doAction.getBusinessKey(), "");
+				if (biz) {
 					log.info("保存流程实例id成功");
 					log.info("保存流程实例id成功");
 				}
 				}
 			}
 			}
@@ -89,31 +89,45 @@ public class WorkflowService {
 
 
 	/**
 	/**
 	 * 获取待办任务
 	 * 获取待办任务
+	 *
 	 * @param todoTask
 	 * @param todoTask
 	 * @return
 	 * @return
 	 */
 	 */
-	public JSONObject todoTaskList(TodoTask todoTask, HttpServletRequest request){
+	public FlowResult todoTaskList(TodoTask todoTask, HttpServletRequest request) {
 		HttpHeaders headers = new HttpHeaders();
 		HttpHeaders headers = new HttpHeaders();
 		headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
 		headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
 		headers.add("Blade-Auth", request.getHeader("Blade-Auth"));
 		headers.add("Blade-Auth", request.getHeader("Blade-Auth"));
 		headers.add("code", request.getHeader("code"));
 		headers.add("code", request.getHeader("code"));
 //		MultiValueMap<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(todoTask), LinkedMultiValueMap.class);
 //		MultiValueMap<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(todoTask), LinkedMultiValueMap.class);
 		Map<String, String> map = new LinkedHashMap<>();
 		Map<String, String> map = new LinkedHashMap<>();
-		map.put("iamCode",todoTask.getIamCode());
-		map.put("order",todoTask.getOrder());
-		map.put("sort",todoTask.getSort());
-		map.put("offset",todoTask.getOffset());
-		map.put("limit",todoTask.getLimit());
+		map.put("iamCode", todoTask.getIamCode());
+		map.put("order", todoTask.getOrder());
+		map.put("sort", todoTask.getSort());
+		map.put("offset", todoTask.getOffset());
+		map.put("limit", todoTask.getLimit());
 		HttpEntity<Map> param = new HttpEntity<>(map, headers);
 		HttpEntity<Map> param = new HttpEntity<>(map, headers);
-		ResponseEntity<String> responseEntity2 = restTemplate.exchange("http://10.65.78.23:8080/bpm/my/todoTaskList", HttpMethod.POST,param,String.class);
+		ResponseEntity<String> responseEntity2 = restTemplate.exchange("http://10.65.78.23:8080/bpm/my/todoTaskList", HttpMethod.POST, param, String.class);
 		log.info("\n code:{}\n header:{}\n body:{}\n", responseEntity2.getStatusCodeValue(), responseEntity2.getHeaders(), responseEntity2.getBody());
 		log.info("\n code:{}\n header:{}\n body:{}\n", responseEntity2.getStatusCodeValue(), responseEntity2.getHeaders(), responseEntity2.getBody());
-		if(200== responseEntity2.getStatusCodeValue()){
-			return JSON.parseObject(responseEntity2.getBody());
+		//
+		if (200 == responseEntity2.getStatusCodeValue()) {
+			FlowResult result = JSON.parseObject(responseEntity2.getBody()).toJavaObject(FlowResult.class);
+			if (result.getIsOk()) {
+				List<JSONObject> ds = new ArrayList<>();
+				for (int i = 0; i < result.getRows().size(); i++) {
+					String typeId = result.getRows().getJSONObject(i).get("typeId").toString();
+					if(!"440219646351376385".equals(typeId)){
+						ds.add(result.getRows().getJSONObject(i));
+						continue;
+					}
+				}
+				result.getRows().removeAll(ds);
+			}
+				return result;
+			}
+			return null;
 		}
 		}
-		return null;
-	}
 
 
-//440416982620438529
+
 
 
 	/**
 	/**
 	 * 流程审批
 	 * 流程审批

+ 15 - 2
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/OrganizationEvaluationInfoServiceImpl.java

@@ -3,6 +3,7 @@ package com.ims.eval.service.impl;
 import com.ims.common.utils.StringUtils;
 import com.ims.common.utils.StringUtils;
 import com.ims.eval.config.CustomException;
 import com.ims.eval.config.CustomException;
 import com.ims.eval.entity.IndicatorDictionary;
 import com.ims.eval.entity.IndicatorDictionary;
+import com.ims.eval.entity.Myuser;
 import com.ims.eval.entity.OrganizationEvaluationInfo;
 import com.ims.eval.entity.OrganizationEvaluationInfo;
 import com.ims.eval.dao.OrganizationEvaluationInfoMapper;
 import com.ims.eval.dao.OrganizationEvaluationInfoMapper;
 import com.ims.eval.entity.dto.response.OrganizationEvaluationInfoResDTO;
 import com.ims.eval.entity.dto.response.OrganizationEvaluationInfoResDTO;
@@ -10,10 +11,12 @@ import com.ims.eval.service.ICalculateIndicatorItemInfoService;
 import com.ims.eval.service.IIndicatorDictionaryService;
 import com.ims.eval.service.IIndicatorDictionaryService;
 import com.ims.eval.service.IOrganizationEvaluationInfoService;
 import com.ims.eval.service.IOrganizationEvaluationInfoService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ims.eval.service.IUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
+import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.util.Date;
 import java.util.Date;
 import java.util.List;
 import java.util.List;
@@ -40,11 +43,21 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
 	@Autowired
 	@Autowired
 	private IIndicatorDictionaryService indicatorDictionaryService;
 	private IIndicatorDictionaryService indicatorDictionaryService;
 
 
+	@Autowired
+	private IUserService userService;
+
 	@Override
 	@Override
-	public Map finishValueList(String organizationEvaluationId, String dept) {
+	public Map finishValueList(String organizationEvaluationId, String dept, HttpServletRequest request) {
 
 
-		List<OrganizationEvaluationInfoResDTO> list = baseMapper.selectListEvaluationInfoId(organizationEvaluationId,dept,"");//默认获取指定的怎目标
+		Myuser myuser = userService.getSysUser(request);
+		if(null == myuser){
+			throw new CustomException("暂无权限");
+		}
 
 
+		List<OrganizationEvaluationInfoResDTO> list = baseMapper.selectListEvaluationInfoId(organizationEvaluationId,dept,"");//默认获取指定的怎目标
+		list.stream().forEach(i->{
+			i.setUpdateMark(i.getDeptName().equals(myuser.getDeptName()));
+		});
 		Map<String  ,List<OrganizationEvaluationInfoResDTO>> map  = list.stream().collect(Collectors.groupingBy(OrganizationEvaluationInfoResDTO::getIsQuantified));
 		Map<String  ,List<OrganizationEvaluationInfoResDTO>> map  = list.stream().collect(Collectors.groupingBy(OrganizationEvaluationInfoResDTO::getIsQuantified));
 		map.put("quantifiedList", map.remove("是"));
 		map.put("quantifiedList", map.remove("是"));
 		map.put("nonQuantifiedList", map.remove("否"));
 		map.put("nonQuantifiedList", map.remove("否"));

+ 4 - 2
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/OrganizationEvaluationServiceImpl.java

@@ -19,6 +19,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
 import java.io.Serializable;
 import java.io.Serializable;
 import java.util.*;
 import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
@@ -482,10 +483,11 @@ public class OrganizationEvaluationServiceImpl extends ServiceImpl<OrganizationE
 		return b;
 		return b;
 	}
 	}
 
 
+
 	@Override
 	@Override
-	public OrganizationEvaluationResDTO getByidAndInfo(String id, String dept) {
+	public OrganizationEvaluationResDTO getByidAndInfo(String id, String dept,HttpServletRequest request) {
 		OrganizationEvaluationResDTO resDTO = baseMapper.selectById(id);
 		OrganizationEvaluationResDTO resDTO = baseMapper.selectById(id);
-		Map<String  ,List<OrganizationEvaluationInfoResDTO>> map  = organizationEvaluationInfoService.finishValueList(id,dept);
+		Map<String  ,List<OrganizationEvaluationInfoResDTO>> map  = organizationEvaluationInfoService.finishValueList(id,dept,request);
 		if(null != resDTO){
 		if(null != resDTO){
 			resDTO.setMap(map);
 			resDTO.setMap(map);
 		}
 		}