|
@@ -4,11 +4,14 @@ import cn.hutool.core.convert.Convert;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.json.JSONArray;
|
|
import cn.hutool.json.JSONArray;
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
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.config.ImaConfig;
|
|
import com.ims.eval.entity.DeptAssessmentDeclaration;
|
|
import com.ims.eval.entity.DeptAssessmentDeclaration;
|
|
import com.ims.eval.entity.DeptAssessmentDeclarationComplete;
|
|
import com.ims.eval.entity.DeptAssessmentDeclarationComplete;
|
|
import com.ims.eval.entity.DeptAssessmentDeclarationContent;
|
|
import com.ims.eval.entity.DeptAssessmentDeclarationContent;
|
|
@@ -22,12 +25,16 @@ import com.ims.eval.service.custom.PostUserService;
|
|
import com.ims.eval.util.ExcelUtil;
|
|
import com.ims.eval.util.ExcelUtil;
|
|
import com.ims.eval.util.ExcelUtils;
|
|
import com.ims.eval.util.ExcelUtils;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.http.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
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.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
import java.net.URLEncoder;
|
|
import java.net.URLEncoder;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
@@ -66,6 +73,12 @@ public class DeptAssessmentDeclarationController {
|
|
@Resource
|
|
@Resource
|
|
private HttpServletRequest request;
|
|
private HttpServletRequest request;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private RestTemplate restTemplate;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private ImaConfig imaConfig;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 绩效结果考核申报列表信息(分页)
|
|
* 绩效结果考核申报列表信息(分页)
|
|
*
|
|
*
|
|
@@ -400,9 +413,30 @@ public class DeptAssessmentDeclarationController {
|
|
*/
|
|
*/
|
|
@PostMapping(value = "/targetStart")
|
|
@PostMapping(value = "/targetStart")
|
|
public R targetStart(@RequestParam(value = "id") String id,
|
|
public R targetStart(@RequestParam(value = "id") String id,
|
|
- @RequestParam(value = "stage") String stage) {
|
|
|
|
|
|
+ @RequestParam(value = "stage") String stage) throws IOException {
|
|
try {
|
|
try {
|
|
DeptAssessmentDeclaration deptAssessmentDeclaration = deptAssessmentDeclarationService.getById(id);
|
|
DeptAssessmentDeclaration deptAssessmentDeclaration = deptAssessmentDeclarationService.getById(id);
|
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
|
+ headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
|
|
|
|
+ headers.add("Blade-Auth", request.getHeader("Blade-Auth"));
|
|
|
|
+ headers.add("code", request.getHeader("code"));
|
|
|
|
+
|
|
|
|
+ HttpEntity<Map> param = new HttpEntity<>(null, headers);
|
|
|
|
+ ResponseEntity<String> responseEntity2 = restTemplate.exchange(imaConfig.getFlowUrl() + "/bpm/instance/getOpinion?instId={1}", HttpMethod.POST, param, String.class, deptAssessmentDeclaration.getInstId());
|
|
|
|
+ log.info("\n code:{}\n header:{}\n body:{}\n", responseEntity2.getStatusCodeValue(), responseEntity2.getHeaders(), responseEntity2.getBody());
|
|
|
|
+ if (200 == responseEntity2.getStatusCodeValue()) {
|
|
|
|
+ JSONObject jsonObject = JSON.parseObject(responseEntity2.getBody());
|
|
|
|
+ if ("200".equals(jsonObject.getString("code"))) {
|
|
|
|
+ String data = jsonObject.getString("data");
|
|
|
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
|
|
+ Object[] jsonArray = objectMapper.readValue(data, Object[].class);
|
|
|
|
+ if (jsonArray.length > 1){
|
|
|
|
+ String lastItemJson = objectMapper.writeValueAsString(jsonArray[jsonArray.length - 1]);
|
|
|
|
+ //processState = JSON.parseObject(lastItemJson).getString("taskName");
|
|
|
|
+ stage = JSON.parseObject(lastItemJson).getString("taskName");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
deptAssessmentDeclaration.setStage(stage);
|
|
deptAssessmentDeclaration.setStage(stage);
|
|
boolean b = deptAssessmentDeclarationService.updateById(deptAssessmentDeclaration);
|
|
boolean b = deptAssessmentDeclarationService.updateById(deptAssessmentDeclaration);
|
|
if (b) {
|
|
if (b) {
|