Przeglądaj źródła

基础指标对标

全业务考评 9 miesięcy temu
rodzic
commit
16dc733778

+ 12 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/config/ImaConfig.java

@@ -38,6 +38,12 @@ public class ImaConfig {
 	@Value("${iam.flow-url.pro}")
 	private String flowUrlPro;
 
+	@Value("${iam.zbdb-url.dev}")
+	private String zbdbUrlDev;
+
+	@Value("${iam.zbdb-url.pro}")
+	private String zbdbUrlPro;
+
 	public String getMenu() {
 
 		if("dev".equals(active)) {
@@ -67,5 +73,11 @@ public class ImaConfig {
 		return flowUrlPro;
 	}
 
+	public String getZbdbUrl() {
+		if("dev".equals(active)){
+			return zbdbUrlDev;
+		}
+		return zbdbUrlPro;
+	}
 
 }

+ 135 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/controller/BasicIndicatorBenchmarkingController.java

@@ -0,0 +1,135 @@
+package com.ims.eval.controller;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.ims.eval.entity.dto.result.R;
+import com.ims.eval.service.custom.impl.BasicIndicatorBenchmarkingService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * <p>
+ * 基础指标对标
+ * </p>
+ *
+ * @author wang
+ * @since 2023-03-03
+ */
+@Slf4j
+@RestController
+@RequestMapping("//benchmarkin")
+public class BasicIndicatorBenchmarkingController {
+
+	@Autowired
+	private BasicIndicatorBenchmarkingService basicIndicatorBenchmarkingService;
+
+	@Autowired
+	private HttpServletRequest request;
+
+
+
+
+	/**
+	 * 获取对标数据错误
+	 * @param object
+	 * @return
+	 */
+	@PostMapping(value = "queryData1011")
+	public R queryData1011(@RequestBody JSONObject object,HttpServletRequest request) {
+		JSONObject json = null;
+		try {
+
+			json = basicIndicatorBenchmarkingService.queryData(object,request);
+		} catch (Exception e) {
+			log.error("错误",e);
+			return R.error().customError("获取获取对标数据错误");
+		}
+		return R.ok().data(json);
+	}
+
+	/**
+	 * 组织机构数据
+	 * @param object
+	 * @param request
+	 * @return
+	 */
+	@PostMapping(value = "queryData1015")
+	public R queryData1015(@RequestBody JSONObject object,HttpServletRequest request) {
+		JSONObject json = null;
+		try {
+
+			json = basicIndicatorBenchmarkingService.queryData(object,request);
+		} catch (Exception e) {
+			log.error("错误",e);
+			return R.error().customError("获取组织机构数据错误");
+		}
+		return R.ok().data(json);
+	}
+
+	/**
+	 * 主题域
+	 * @param object
+	 * @param request
+	 * @return
+	 */
+	@PostMapping(value = "queryData1019")
+	public R queryData1019(@RequestBody JSONObject object,HttpServletRequest request) {
+		JSONObject json = null;
+		try {
+
+			json = basicIndicatorBenchmarkingService.queryData(object,request);
+		} catch (Exception e) {
+			log.error("错误",e);
+			return R.error().customError("获取主题域错误");
+		}
+		return R.ok().data(json);
+	}
+
+
+	/**
+	 * 指标项
+	 * @param object
+	 * @param request
+	 * @return
+	 */
+	@PostMapping(value = "queryData1020")
+	public R queryData1020(@RequestBody JSONObject object,HttpServletRequest request) {
+		JSONObject json = null;
+		try {
+
+			json = basicIndicatorBenchmarkingService.queryData(object,request);
+		} catch (Exception e) {
+			log.error("错误",e);
+			return R.error().customError("获取指标项错误");
+		}
+		return R.ok().data(json);
+	}
+
+	/**
+	 * 指标项
+	 * @param object
+	 * @param request
+	 * @return
+	 */
+	@PostMapping(value = "queryData1004")
+	public R queryData1004(@RequestBody JSONObject object,HttpServletRequest request) {
+		JSONObject json = null;
+		try {
+
+			json = basicIndicatorBenchmarkingService.queryData(object,request);
+		} catch (Exception e) {
+			log.error("错误",e);
+			return R.error().customError("获取指标数据错误");
+		}
+		return R.ok().data(json);
+	}
+
+
+
+}

+ 63 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/service/custom/impl/BasicIndicatorBenchmarkingService.java

@@ -0,0 +1,63 @@
+package com.ims.eval.service.custom.impl;
+
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.ims.eval.config.ImaConfig;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.*;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * <p>
+ * 基础指标对标 服务实现类
+ * </p>
+ *
+ * @author wang
+ * @since 2023-03-12
+ */
+@Service
+@Slf4j
+public class BasicIndicatorBenchmarkingService {
+
+	@Autowired
+	private RestTemplate restTemplate;
+
+	@Autowired
+	private ImaConfig imaConfig;
+
+
+	/**
+	 * 获取对标数据错误
+	 *
+	 * @param body
+	 * @return
+	 */
+	public JSONObject queryData(JSONObject body, HttpServletRequest request) {
+		HttpHeaders headers = new HttpHeaders();
+		headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
+		headers.add("zb-token", "a1d48f2759e0f311375247eb1f7462cad8e64f8b21654c1a9f02f43b45976ff7");
+
+		//请求参数为body
+		HttpEntity<String> requestEntity = new HttpEntity<>(body.toString(), headers);
+		ResponseEntity<String> responseEntity2 = restTemplate.exchange(imaConfig.getZbdbUrl() + "/queryData", HttpMethod.POST, requestEntity, String.class);
+		log.info("\n code:{}\n header:{}\n body:{}\n", responseEntity2.getStatusCodeValue(), responseEntity2.getHeaders(), responseEntity2.getBody());
+		if (200 == responseEntity2.getStatusCodeValue()) {
+			return JSON.parseObject(responseEntity2.getBody());
+		}
+		return null;
+	}
+
+
+
+
+
+
+
+
+
+}

+ 1 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/EvaluationPortalServiceImpl.java

@@ -51,7 +51,7 @@ public class EvaluationPortalServiceImpl extends ServiceImpl<EvaluationPortalMap
 		Map<String, Object> map = new HashMap<>();
 		Calendar date = Calendar.getInstance();
 		try {
-			List<Map<String, Object>> yearList = baseMapper.selectPortalList(binSection, date.get(Calendar.YEAR) == Integer.valueOf(year) ? String.valueOf(Integer.valueOf(year) - 1) : newyear, null);
+			List<Map<String, Object>> yearList = baseMapper.selectPortalList(binSection, date.get(Calendar.YEAR) == Integer.valueOf(newyear) ? String.valueOf(Integer.valueOf(newyear) - 1) : newyear, null);
 			List<Map<String, Object>> seasonList = baseMapper.selectPortalList(binSection, year, season);
 			Map<Object, List<Map<String, Object>>> yearMap = yearList.stream().collect(Collectors.groupingBy(e -> e.get("bin_section"), Collectors.toList()));
 			Map<Object, List<Map<String, Object>>> seasonMap = seasonList.stream().collect(Collectors.groupingBy(e -> e.get("bin_section"), Collectors.toList()));

+ 3 - 0
ims-service/ims-eval/src/main/resources/application.yml

@@ -36,6 +36,9 @@ iam:
   flow-url:
     dev: http://10.65.78.23:8080/
     pro: http://10.65.79.85:8080/
+  zbdb-url:
+    dev: http://10.65.78.65:18082/
+    pro: http://10.65.78.65:18082/