Commit 4460a9de authored by xinglei's avatar xinglei

预案人员测试

parent a72a725a
......@@ -46,4 +46,9 @@ public class FasConstant {
public static final String RISK_SOURCE_STATUS_ANOMALY = "ANOMALY";//风险点状态-正常
public static final String PLAN_SOURCE_TYPE = "plan_source_type";//预案资源类型
public static final String ALL_POINT = "all";
public static String appKey = "";
public static String product = "";
public static String token = "";
public static String staticOrgCode = "";
}
......@@ -174,6 +174,4 @@ public class CommonController extends BaseController {
List<AgencyUserModel> users = commonService.getAllUser(getToken(),getProduct(),getAppKey(), compCode);
return CommonResponseUtil.success(users);
}
}
package com.yeejoin.amos.fas.business.controller;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
......@@ -27,6 +28,8 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import static com.yeejoin.amos.fas.business.constants.FasConstant.*;
@RestController
@RequestMapping("/api/view3d")
@Api(tags="全景监控api")
......@@ -151,6 +154,10 @@ public class View3dController extends BaseController {
public CommonResponse getStatisticsDuty(){
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
appKey = getAppKey();
product = getProduct();
staticOrgCode = orgCode;
token = getToken();
return view3dService.getStatisticsDuty(getAppKey(),getProduct(),orgCode);
}
......@@ -249,4 +256,10 @@ public class View3dController extends BaseController {
public CommonResponse listPointsByRegion(@PathVariable Long regionId, @RequestParam(required = false, defaultValue = "all") String type){
return CommonResponseUtil.success(view3dService.listPointsByRegionId(regionId,type));
}
@ApiOperation(value = "预案人员测试方法",notes = "预案人员测试方法")
@GetMapping(value = "dutyListByDate")
public Map<String, String> getDutyListByDate(){
return view3dService.getDutyListByDate();
}
}
......@@ -10,4 +10,8 @@ public class DutyModeServerFallback implements IDutyModeServer{
return CommonResponseUtil.failure("fegin调用失败!!!");
}
@Override
public CommonResponse dutyListByDate(String appKey, String product, String token, String orgCode, String param) {
return CommonResponseUtil.failure("fegin调用失败!!!");
}
}
......@@ -2,10 +2,7 @@ package com.yeejoin.amos.fas.business.feign;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.*;
import com.yeejoin.amos.fas.core.util.CommonResponse;
......@@ -19,4 +16,11 @@ public interface IDutyModeServer {
@RequestHeader(name="orgCode",required = true) String orgCode,
@RequestBody String param);
@RequestMapping(value = "/duty/dutyListByDate", method = RequestMethod.POST,consumes = "application/json")
public CommonResponse dutyListByDate(
@RequestHeader(name="appKey",required = true) String appKey,
@RequestHeader(name="product",required = true) String product,
@RequestHeader(name="token",required = true) String token,
@RequestHeader(name="orgCode",required = true) String orgCode,
@RequestBody String param);
}
......@@ -56,8 +56,6 @@ public class RemoteSecurityService {
return userModel;
}
//部门id获取部门信息
public DepartmentModel getDepartmentByDeptId(String toke,String product,String appKey,String deparmentId) {
if (deparmentId == null || deparmentId.equals("")) {
......
......@@ -19,6 +19,7 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.springframework.web.multipart.MultipartFile;
import com.google.common.base.Joiner;
......@@ -104,11 +105,13 @@ public class FireCarServiceImpl implements IFireCarService {
if(!CollectionUtils.isEmpty(deptIds)){
List<DepartmentModel> depts =remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(deptIds));
Map<Long, String> deptMap = depts.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr,DepartmentModel::getDepartmentName));
if (!ObjectUtils.isEmpty(deptMap)){
content.forEach(e -> {
e.put("departmentName",deptMap.get(Long.valueOf(e.get("dept_id").toString())));
});
}
}
}
Page<HashMap<String, Object>> result = new PageImpl<HashMap<String, Object>>(content, param, total);
return result;
}
......
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.yeejoin.amos.fas.business.action.ContingencyAction;
import com.yeejoin.amos.fas.business.bo.BindPointBo;
import com.yeejoin.amos.fas.business.bo.CheckErrorBo;
import com.yeejoin.amos.fas.business.bo.RiskPointRpnChangeBo;
......@@ -47,6 +48,8 @@ import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import static com.yeejoin.amos.fas.business.constants.FasConstant.token;
/**
* @author DELL
*/
......@@ -616,6 +619,13 @@ public class View3dServiceImpl implements IView3dService {
return pointList;
}
@Override
public Map<String, String> getDutyListByDate() {
ContingencyAction contingencyAction = new ContingencyAction();
Map<String, String> f1 = contingencyAction.getStrengthMap("F1");
return f1;
}
private List<Map<String,Object>> getPointsByRegionIds(List<Long> ids){
return view3dMapper.getAllPointInRegions(ids);
}
......
......@@ -173,4 +173,6 @@ public interface IView3dService {
* @return list
*/
List<Map<String, Object>> listPointsByRegionId(Long regionId, String type);
Map<String, String> getDutyListByDate();
}
package com.yeejoin.amos.fas.business.util;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.*;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.springframework.web.client.RestTemplate;
import static com.yeejoin.amos.fas.business.constants.FasConstant.*;
@Component
public class HttpUtil {
private ObjectMapper objectMapper = new ObjectMapper();
private static String dutyUrl;
@Value("${DutyMode.dutyUrl}")
public void setDutyUrl(String dutyUrl) {
HttpUtil.dutyUrl = dutyUrl;
}
public static String doGet(String url) {
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setConnectTimeout(2000);
RestTemplate restTemplate = new RestTemplate(requestFactory);
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.setContentType(MediaType.TEXT_HTML);
httpHeaders.setContentType(MediaType.APPLICATION_JSON_UTF8);
HttpEntity<String> httpEntity = new HttpEntity(httpHeaders);
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, httpEntity, String.class);
JSONObject jsonObject = JSONObject.parseObject(response.getBody());
return jsonObject.toString();
}
public static String PostJson(String url, String json) {
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setConnectTimeout(2000);
RestTemplate restTemplate = new RestTemplate(requestFactory);
HttpHeaders headers = new HttpHeaders();
HttpMethod method = HttpMethod.POST;
// 以表单的方式提交
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
headers.add("X-From-Service", "true");
//将请求头部和参数合成一个请求
HttpEntity<String> requestEntity = new HttpEntity<>(json, headers);
//执行HTTP请求,将返回的结构使用ResultVO类格式化
ResponseEntity<String> response = restTemplate.postForEntity(url, requestEntity, String.class);
JSONObject jsonObject = JSONObject.parseObject(response.getBody());
return jsonObject.toString();
}
public static String doPostJson(String url, String json) {
if (ObjectUtils.isEmpty(url)){
url = dutyUrl;
}
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setConnectTimeout(2000);
RestTemplate restTemplate = new RestTemplate(requestFactory);
HttpHeaders headers = new HttpHeaders();
HttpMethod method = HttpMethod.POST;
// 以表单的方式提交
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
headers.set("appKey", appKey);
headers.set("product", product);
headers.set("token", token);
headers.set("orgCode", staticOrgCode);
headers.set("X-Access-Token", token);
//将请求头部和参数合成一个请求
HttpEntity<String> requestEntity = new HttpEntity<>(json, headers);
//执行HTTP请求,将返回的结构使用ResultVO类格式化
ResponseEntity<String> response = restTemplate.postForEntity(url, requestEntity, String.class);
JSONObject jsonObject = JSONObject.parseObject(response.getBody());
return jsonObject.toString();
}
public static String appendPostJson(String suffix,String json) {
String url = dutyUrl + suffix;
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setConnectTimeout(2000);
RestTemplate restTemplate = new RestTemplate(requestFactory);
HttpHeaders headers = new HttpHeaders();
HttpMethod method = HttpMethod.POST;
// 以表单的方式提交
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
headers.set("appKey", appKey);
headers.set("product", product);
headers.set("token", token);
headers.set("orgCode", staticOrgCode);
headers.set("X-Access-Token", token);
//将请求头部和参数合成一个请求
HttpEntity<String> requestEntity = new HttpEntity<>(json, headers);
//执行HTTP请求,将返回的结构使用ResultVO类格式化
ResponseEntity<String> response = restTemplate.postForEntity(url, requestEntity, String.class);
JSONObject jsonObject = JSONObject.parseObject(response.getBody());
return jsonObject.toString();
}
}
......@@ -58,6 +58,7 @@ emqx.password=a123456
Push.fegin.name=APPMESSAGEPUSHSERVICE-36
dutyMode.fegin.name=AMOSDUTYMODE
DutyMode.dutyUrl=http://172.16.11.36:10005/
##\u89C4\u5219\u5BF9\u8C61\u81EA\u52A8\u626B\u63CF
rule.definition.load=true
......
......@@ -59,6 +59,7 @@ emqx.password=a123456
Push.fegin.name=AMOS-PUSH
dutyMode.fegin.name=AMOS-DUTY
DutyMode.dutyUrl=http://172.16.11.36:10005/
##\u89C4\u5219\u5BF9\u8C61\u81EA\u52A8\u626B\u63CF
rule.definition.load=true
......
......@@ -59,6 +59,7 @@ emqx.password=a123456
Push.fegin.name=PPMESSAGEPUSHSERVICE15
dutyMode.fegin.name=AMOS-DUTY
DutyMode.dutyUrl=http://172.16.11.36:10005/
##\u89C4\u5219\u5BF9\u8C61\u81EA\u52A8\u626B\u63CF
rule.definition.load=true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment