Commit 4769ee42 authored by 单奇雲's avatar 单奇雲

Merge branch 'dev_upgrade' of http://172.16.10.76/station/YeeAmosFireAutoSysRoot into dev_upgrade

parents 1bc40a6f 9d0130e1
......@@ -11,6 +11,12 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.fas.business.feign.IDutyModeServer;
import com.yeejoin.amos.fas.business.util.HttpUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
......@@ -27,7 +33,7 @@ import com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus;
import com.yeejoin.amos.fas.business.service.model.ContingencyRo;
import com.yeejoin.amos.fas.business.util.StringUtil;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import com.yeejoin.amos.fas.dao.entity.FireStrength;
import org.springframework.util.ObjectUtils;
@Component
public class ContingencyAction implements CustomerAction {
......@@ -35,6 +41,8 @@ public class ContingencyAction implements CustomerAction {
private static String PACKAGEURL = "com.yeejoin.amos.fas.business.action.result.message.";
public static final Logger log = LoggerFactory.getLogger(ContingencyAction.class);
@Autowired
private IContingencyInstance iContingencyInstance;
......@@ -49,9 +57,12 @@ public class ContingencyAction implements CustomerAction {
@Autowired
private IRiskSourceService riskSourceService;
@Autowired
private IDutyModeServer dutyModeServer;
private static Map<String, String> OPERATE_RECORD_ID = new HashMap<>();
private static Map<String, Map<String,String>> stringStringMap = new HashMap<>();
private static Map<String, Map<String, String>> stringStringMap = new HashMap<>();
static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
//当值值班长(S1)、副值班长(S2)、值班员(A1,A2,A3)、白班值班员、保安人员、驻站消防队长(F1)
......@@ -68,48 +79,46 @@ public class ContingencyAction implements CustomerAction {
/**
* 预案文件中值为和数据字典中的对应关系
* 消防
F1 消防队长 fireLeader
F2..F6 队员 firePerson 规则配置中队员1...6:firePerson1...firePerson6
FD .... 司机 fireDriver 规则配置中司机 1..6:fireDriver1...fireDriver6
运维
S1 值班长 dutyLeader
S2 副值班长 deputyDutyLeader
B1..B6 值班员 dutyCivilian 规则配置中值班员1...6:dutyCivilian1...dutyCivilian6
A1...A6 副值班员 deputyDutyCivilian 规则配置中副值班员1...6:deputyDutyCivilian1...deputyDutyCivilian6
* F1 消防队长 fireLeader
* F2..F6 队员 firePerson 规则配置中队员1...6:firePerson1...firePerson6
* FD .... 司机 fireDriver 规则配置中司机 1..6:fireDriver1...fireDriver6
* 运维
* S1 值班长 dutyLeader
* S2 副值班长 deputyDutyLeader
* B1..B6 值班员 dutyCivilian 规则配置中值班员1...6:dutyCivilian1...dutyCivilian6
* A1...A6 副值班员 deputyDutyCivilian 规则配置中副值班员1...6:deputyDutyCivilian1...deputyDutyCivilian6
*/
private Map<String, String> getStrengthMap(String batchNo) {
public Map<String, String> getStrengthMap(String batchNo) {
Map<String,String> returnMap = stringStringMap.get(batchNo);
Map<String, String> returnMap = stringStringMap.get(batchNo);
if (CollectionUtils.isEmpty(returnMap)) {
stringStringMap = new HashMap<>();
returnMap = new HashMap<>();
Date now = new Date();
String time = sdf.format(now);
List<FireStrength> strengths = fireStrengthService.queryForStrengthList(time);
// List<FireStrength> strengths = iStrengthRepository.queryForStrengthList(time);
if (!CollectionUtils.isEmpty(strengths))
{
for (FireStrength fireStrength : strengths)
{
String name = returnMap.get(fireStrength.getPosition());
if (StringUtil.isNotEmpty(name))
{
returnMap.put(fireStrength.getPosition(), name + "、" + fireStrength.getUsername());
}else
{
returnMap.put(fireStrength.getPosition(), fireStrength.getUsername());
}
Date curDate = new Date();
JSONObject param = new JSONObject();
param.put("dutyDate", curDate);
//CommonResponse commonResponse = dutyModeServer.dutyListByDate(appKey, product, token, staticOrgCode, param.toJSONString());
String result = HttpUtil.appendPostJson("duty/dutyListByDate", param.toJSONString());
JSONObject jsonObject = JSONObject.parseObject(result);
JSONArray dataList = (JSONArray) jsonObject.get("dataList");
log.info(String.format("请求值班系统返回dataList:%s", dataList));
if (!ObjectUtils.isEmpty(dataList)) {
Map<String, String> finalReturnMap = returnMap;
dataList.forEach(
x -> {
JSONObject obj = (JSONObject) x;
String name = obj.getString("position");
finalReturnMap.put(name, obj.getString("dutyName"));
}
);
}
stringStringMap.put(batchNo,returnMap);
stringStringMap.put(batchNo, returnMap);
}
log.info(String.format("returnMap:【 %s 】", returnMap));
return returnMap;
}
......@@ -176,7 +185,7 @@ public class ContingencyAction implements CustomerAction {
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
stopSnapshop(contingencyRo);
//转换content中的变量
content = instedParams(content,contingencyRo);
content = instedParams(content, contingencyRo);
BubbleTipResult result = new BubbleTipResult();
Map<String, Object> tempmap1 = new HashMap<>();
......@@ -207,7 +216,7 @@ public class ContingencyAction implements CustomerAction {
//转换智能辅助中的变量
content = instedParams(content,contingencyRo);
content = instedParams(content, contingencyRo);
BubbleTipResult result = new BubbleTipResult();
Map<String, Object> tempmap1 = new HashMap<>();
......@@ -241,7 +250,7 @@ public class ContingencyAction implements CustomerAction {
Method getMethod = null;
try {
for (Field field : fields) {
if(field.getName().equals("serialVersionUID"))
if (field.getName().equals("serialVersionUID"))
continue;
String fileNameInMethod = String.valueOf(field.getName().charAt(0)).toUpperCase() + field.getName().substring(1);
getMethod = contingencyRo.getClass().getMethod("get" + fileNameInMethod);
......@@ -272,7 +281,7 @@ public class ContingencyAction implements CustomerAction {
stopSnapshop(contingencyRo);
//转换content中的变量
tips = instedParams(tips,contingencyRo);
tips = instedParams(tips, contingencyRo);
BubbleTipResult result = new BubbleTipResult();
......@@ -295,12 +304,12 @@ public class ContingencyAction implements CustomerAction {
this.sendcmd("fromws", "optionArea", "", result);
sendButton(contingencyRo.getBatchNo(),contingencyPlanId,contingencyRo.getEquipmentId(),actionName,buttonJson);
sendButton(contingencyRo.getBatchNo(), contingencyPlanId, contingencyRo.getEquipmentId(), actionName, buttonJson);
}
private boolean sendButton(String batchNo,String contingencyPlanId,String equipmentId,String actionName,String buttonJson) {
private boolean sendButton(String batchNo, String contingencyPlanId, String equipmentId, String actionName, String buttonJson) {
// String url = bussunisDomain+ "/api/risksource/contingency/setup";
......@@ -317,8 +326,8 @@ public class ContingencyAction implements CustomerAction {
*/
try {
Map button = objectMapper.readValue(buttonJson,Map.class);
Map operateInstance = (Map)((List)button.get("operate")).get(0);
Map button = objectMapper.readValue(buttonJson, Map.class);
Map operateInstance = (Map) ((List) button.get("operate")).get(0);
// map.put("batchNo",batchNo);
// map.put("actionName",actionName);
// map.put("equipmentId",equipmentId);
......@@ -362,7 +371,7 @@ public class ContingencyAction implements CustomerAction {
stopSnapshop(contingencyRo);
//转换content中的变量
tips = instedParams(tips,contingencyRo);
tips = instedParams(tips, contingencyRo);
BubbleTipResult result1 = new BubbleTipResult();
Map<String, Object> tempmap2 = new HashMap<>();
......@@ -430,7 +439,7 @@ public class ContingencyAction implements CustomerAction {
BubbleTipResult result = new BubbleTipResult();
Map<String, Object> tempmap1 = new HashMap<>();
//转换content中的变量
content = instedParams(content,contingencyRo);
content = instedParams(content, contingencyRo);
tempmap1.put("content", content);
tempmap1.put("messageType", messageType);//消息类型 messageType 黑色框消息类型 CONTINGENCY,,滚动消息:CURRENTMESSAGE
......
......@@ -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;
}
......
......@@ -31,6 +31,7 @@ import com.yeejoin.amos.fas.business.util.JexlUtil;
import com.yeejoin.amos.fas.business.util.RpnUtils;
import com.yeejoin.amos.fas.business.vo.EquipCommunicationData;
import com.yeejoin.amos.fas.client.invoke.RsDataQueue;
import com.yeejoin.amos.fas.common.enums.CheckStatusEnum;
import com.yeejoin.amos.fas.common.enums.DataRefreshTypeEum;
import com.yeejoin.amos.fas.common.enums.View3dRefreshAreaEum;
import com.yeejoin.amos.fas.core.common.request.CommonPageable;
......@@ -361,6 +362,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
Equipment equipment = equipmentService.queryOne(importantEquipId);
if (!CollectionUtils.isEmpty(returnList) && equipment != null) {
fmeaEquipmentPointMapper.saveBatch(returnList);
}
if(equipment != null){
RsDataQueue rsDataQueue = RsDataQueue.getInstance();
rsDataQueue.addEquipmentMessage(fmeaId,equipment.getName());
}
......@@ -383,9 +386,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
if (!CollectionUtils.isEmpty(returnList)) {
fmeaPointInputitemMapper.saveBatch(returnList);
}
RsDataQueue rsDataQueue = RsDataQueue.getInstance();
rsDataQueue.addPatrolMessage(fmeaId);
}
return returnList;
}
......@@ -554,12 +557,12 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
for(int i=0;i<content.size();i++){
if(content.get(i).get("userId") !=null && userMap.containsKey(content.get(i).get("userId"))){
if(StringUtil.isNotEmpty(content.get(i).get("userId")) && userMap.containsKey(content.get(i).get("userId"))){
AgencyUserModel user = userMap.get(content.get(i).get("userId"));
content.get(i).put("userName", user.getRealName());
content.get(i).put("tel", user.getMobile());
}
if(content.get(i).get("deptId") !=null && deptMap.containsKey(Long.valueOf(content.get(i).get("deptId").toString()))){
if(StringUtil.isNotEmpty(content.get(i).get("deptId")) && deptMap.containsKey(Long.valueOf(content.get(i).get("deptId").toString()))){
content.get(i).put("deptName", deptMap.get(Long.valueOf(content.get(i).get("deptId").toString())));
}
}
......@@ -628,7 +631,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
* @param protalData
*/
@Async
private void protalRuleMessagePush(ProtalDataRo protalData){
void protalRuleMessagePush(ProtalDataRo protalData){
String bacthNo = UUID.randomUUID().toString();
protalData.setBatchNo(bacthNo);
protalData.setOriginalNodeState(protalData.getNodeState());
......@@ -1116,18 +1119,22 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
BigDecimal sidValue = new BigDecimal(fmea.getSidValue());
BigDecimal didValue = new BigDecimal(fmea.getDidValue());
//1.1计算rpni
BigDecimal rpni = oidValue.multiply(sidValue).multiply(didValue).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal rpn;
//1.2计算rpn:为空则rpni = rpn;不为空则重新计算s*d*newo
//1.2未评价过,计算绑定的巡检点项 设备点位故障率
if (fmea.getNewEvaluationOid() == null) {
EvaluationModel evaluationModel = this.getEvaluationModel(fmeaId);
if(evaluationModel != null){//已经绑定点位或者巡检点项且匹配到风险模型,则更新为计算后的结果
BigDecimal newOidValue = new BigDecimal(evaluationModel.getCoefficient());
rpn = newOidValue.multiply(sidValue).multiply(didValue).setScale(2, BigDecimal.ROUND_HALF_UP);
fmea.setNewEvaluationOid(evaluationModel.getId());
}else {//未绑定点位或者巡检点项或者匹配不到风险模型,则更新为rpn与rpni一致
fmea.setNewEvaluationOid(fmea.getEvaluationOid());
rpn = rpni;
}
} else {
BigDecimal newOidValue = new BigDecimal(fmea.getNewOidValue());
rpn = newOidValue.multiply(sidValue).multiply(didValue).setScale(2, BigDecimal.ROUND_HALF_UP);
}
List<RiskLevel> levels = riskLevelDao.findAll();
RiskLevel newLevel = RpnUtils.getBetweenLevel(rpn, levels);
......@@ -1344,11 +1351,13 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
//3.更新父节点rpn、rpni、风险等级
this.updateParentRpn(riskSource.getParentId());
//4.极光推送给手机客户端
if(notifyType=="recovery"||notifyType=="fmeaUpdate"||(notifyType=="alarm"&&rpnDiffer>0)||(notifyType=="patrol"&&rpnDiffer>0&&checkStatus.equals("不合格")))
if("recovery".equals(notifyType) || "fmeaUpdate".equals(notifyType) || ("alarm".equals(notifyType)&&rpnDiffer>0)||("patrol".equals(notifyType) && rpnDiffer>0 && CheckStatusEnum.UNQUALIFIED.getName().equals(checkStatus))){
jpushRiskSourceMessage(jpushMsgBo);
//5.规则告警(消息)TODO
if(notifyType=="recovery"||notifyType=="fmeaUpdate"||(notifyType=="alarm"&&rpnDiffer>0)||(notifyType=="patrol"&&rpnDiffer>0&&checkStatus.equals("不合格")))
}
//5.规则告警(消息)
if("recovery".equals(notifyType) || "fmeaUpdate".equals(notifyType) || ("alarm".equals(notifyType)&&rpnDiffer>0) ||(notifyType=="patrol" && rpnDiffer>0 && CheckStatusEnum.UNQUALIFIED.getName().equals(checkStatus))){
notifyRule(riskSourceId, rpn, rpni, notifyType,changeType, jpushMsgBo.getMsg());
}
//6.通知全景监控屏幕数据刷新
iDataRefreshService.refreshViewData(DataRefreshTypeEum.rpn.getCode());
}
......@@ -1516,4 +1525,18 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
public void batchSaveRegionUe4(List<BindRegionBo> regionBoList) {
riskSourceMapper.batchSaveRegionUe4(regionBoList);
}
private EvaluationModel getEvaluationModel(Long fmeaId){
List<FmeaEquipmentPoint> equipmentPoints = fmeaEquipmentPointMapper.listFmeaByFmeaId(fmeaId);
List<FmeaPointInputitem> pointInputitems = fmeaPointInputitemMapper.listFmeaByFmeaId(fmeaId);
Double maxRate = RpnUtils.getMaxRate(equipmentPoints, pointInputitems);
if(maxRate != null){
List<EvaluationModel> oModels = iEvaluationModelDao.findAllByType("O");
EvaluationModel oEvaluationModel = getBetweenModel(maxRate, oModels);
return oEvaluationModel;
}
return null;
}
}
......@@ -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