package cn.autoform.web.client.impl;
|
|
import cn.autoform.bean.*;
|
import cn.autoform.bean.page.PageResult;
|
import cn.autoform.bean.power.PowerButton;
|
import cn.autoform.bean.system.UserInfo;
|
import cn.autoform.db.entity.IpAndPortEntity;
|
import cn.autoform.db.exten.SelectForm;
|
import cn.autoform.db.exten.ServicesFormData;
|
import cn.autoform.db.exten.TableStructure;
|
import cn.autoform.fw.exception.FormClientException;
|
import cn.autoform.fw.exception.FormClientTimeout;
|
import cn.autoform.fw.exception.RestResult;
|
import cn.autoform.log.bean.OperationLog;
|
import cn.autoform.util.tool.GetFormClientResult;
|
import cn.autoform.util.tool.JSONTool;
|
import cn.autoform.util.tool.ObjectUtil;
|
import cn.autoform.util.tool.RequestContext;
|
import cn.autoform.web.client.FormClient;
|
import cn.autoform.web.client.util.HttpClientTool;
|
import cn.autoform.web.client.util.IpAndPortTool;
|
import com.alibaba.fastjson.TypeReference;
|
import com.iemsoft.framework.cloud.core.tools.http.Http;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.stereotype.Service;
|
import org.springframework.ui.ModelMap;
|
|
import java.util.*;
|
import java.util.concurrent.TimeoutException;
|
|
@Service
|
public class FormClientImpl implements FormClient {
|
|
@Value("${autoForm.businessSystem}")
|
private String autoFormClient;
|
|
@Autowired
|
IpAndPortTool ipAndPortTool;
|
|
private static final Map<String, String> ipMap = new HashMap<>();
|
|
public static final String CLIENT_CONTEXT_PATH = "/auto-form-client";
|
|
static {
|
ipMap.put("dataInsert", "%s/epc/epc-form" + CLIENT_CONTEXT_PATH + "/data/insert");
|
ipMap.put("impDatas", "%s/epc/epc-form" + CLIENT_CONTEXT_PATH + "/data/impDatas");
|
ipMap.put("dataUpdate", "%s/epc/epc-form" + CLIENT_CONTEXT_PATH + "/data/update");
|
ipMap.put("dataDelete", "%s/epc/epc-form" + CLIENT_CONTEXT_PATH + "/data/delete");
|
ipMap.put("dataSelectAll", "%s/epc/epc-form" + CLIENT_CONTEXT_PATH + "/data/selectAll");
|
ipMap.put("dataSelectPage", "%s/epc/epc-form" + CLIENT_CONTEXT_PATH + "/data/selectPage");
|
ipMap.put("dataSelectOne", "%s/epc/epc-form" + CLIENT_CONTEXT_PATH + "/data/selectOne");
|
ipMap.put("createTable", "%s/epc/epc-form" + CLIENT_CONTEXT_PATH + "/create/table");
|
ipMap.put("updateTable", "%s/epc/epc-form" + CLIENT_CONTEXT_PATH + "/update/table");
|
ipMap.put("selectFormValue", "%s/epc/epc-form" + CLIENT_CONTEXT_PATH + "/select/formFieldMainValue");
|
ipMap.put("getAssociateDataSourse", "%s/epc/epc-form" + CLIENT_CONTEXT_PATH + "/select/associateDataSourse");
|
ipMap.put("getAssociateData", "%s/epc/epc-form" + CLIENT_CONTEXT_PATH + "/select/associateData");
|
ipMap.put("getAssociateTitle", "%s/epc/epc-form" + CLIENT_CONTEXT_PATH + "/select/associateTitle");
|
ipMap.put("operationLog", "%s/epc/epc-form" + "/form/operationLog");
|
|
ipMap.put("workFlowOver", "%s/epc/epc-form" + CLIENT_CONTEXT_PATH + "/WorkFlow/over");
|
ipMap.put("workFlowBefor", "%s/epc/epc-form" + CLIENT_CONTEXT_PATH + "/WorkFlow/befor");
|
ipMap.put("workFlowAfter", "%s/epc/epc-form" + CLIENT_CONTEXT_PATH + "/WorkFlow/after");
|
ipMap.put("workFlowRollback", "%s/epc/epc-form" + CLIENT_CONTEXT_PATH + "/WorkFlow/rollback");
|
ipMap.put("workFlowCreate", "%s/epc/epc-form" + CLIENT_CONTEXT_PATH + "/WorkFlow/create");
|
|
ipMap.put("budget", "%s/epc/epc-form" + CLIENT_CONTEXT_PATH + "/form/data/budget");
|
ipMap.put("getUserInfo", "%s/epc/epc-tenant/tenant/getUserCode");
|
// ipMap.put("getHigorg", "%s/epc/epc-tenant/tenant/data/budget");
|
ipMap.put("getCode", "%s/epc/epc-form" + CLIENT_CONTEXT_PATH + "/select/higCode");
|
ipMap.put("getUserName", "%s/epc/epc-form" + CLIENT_CONTEXT_PATH + "/data/getUserName");
|
ipMap.put("updateState", "%s/epc/epc-form/form/data/updateState"); //费用云内部请求
|
ipMap.put("selectState", "%s/epc/epc-form/form/data/selectState"); //费用云内部请求
|
ipMap.put("getAllButton", "%s/epc/epc-form/form/button/getAllButton");//费用云 自定义按钮权限
|
ipMap.put("formSolidiFication", "%s/epc/epc-form/data/formSolidiFication");//单据固化
|
ipMap.put("addExcelLog", "%s/epc/epc-form/form/excel/addExcelLog");
|
ipMap.put("updateExcelLog", "%s/epc/epc-form/form/excel/updateExcelLog");
|
ipMap.put("selectLog", "%s/epc/epc-form/form/select/operationLog");//操作日志查询接口
|
// ipMap.put("dataInsert", "%s/data/insert");
|
// ipMap.put("dataUpdate", "%s/data/update");
|
// ipMap.put("dataDelete", "%s/data/delete");
|
// ipMap.put("dataSelectAll", "%s/data/selectAll");
|
// ipMap.put("dataSelectPage", "%s/data/selectPage");
|
// ipMap.put("dataSelectOne", "%s/data/selectOne");
|
// ipMap.put("createTable", "%s/create/table");
|
// ipMap.put("updateTable", "%s/update/table");
|
// ipMap.put("selectFormValue", "%s/select/formFieldMainValue");
|
// ipMap.put("getAssociateDataSourse", "%s/select/associateDataSourse");
|
// ipMap.put("getAssociateData", "%s/select/associateData");
|
// ipMap.put("getAssociateTitle", "%s/select/associateTitle");
|
}
|
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
@Override
|
public Object addFormDataClient(ServicesFormData formData) throws TimeoutException, FormClientException {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
HttpClientTool<RestResult> hc = new HttpClientTool(String.format(ipMap.get("dataInsert"), ipAndPortEntity.getIp()));
|
hc.setBodyInfos(formData);
|
RestResult result = hc.sendPost(
|
j -> JSONTool.toObj(j, new TypeReference<RestResult>() {
|
}));
|
return GetFormClientResult.getRightResult(result);
|
}
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
@Override
|
public PageResult<List<OperationLog>> selectOperationLog(Map<String,Object> map) throws TimeoutException, FormClientException {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
HttpClientTool<RestResult> hc = new HttpClientTool(String.format(ipMap.get("selectLog"), ipAndPortEntity.getIp()));
|
hc.setBodyInfos(map);
|
RestResult result = hc.sendPost(
|
j -> JSONTool.toObj(j, new TypeReference<RestResult>() {
|
}));
|
return GetFormClientResult.getRightResult(result);
|
}
|
@Override
|
public Object addOperationLog(Map<String,String> map) throws TimeoutException, FormClientException {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
HttpClientTool<RestResult> hc = new HttpClientTool(String.format(ipMap.get("operationLog"), ipAndPortEntity.getIp()));
|
hc.setBodyInfos(map);
|
RestResult result = hc.sendPost(
|
j -> JSONTool.toObj(j, new TypeReference<RestResult>() {
|
}));
|
return GetFormClientResult.getRightResult(result);
|
}
|
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
@Override
|
public String mmp(String org) throws TimeoutException, FormClientException {
|
Map<String, String> map = new HashMap<String, String>();
|
map.put("code", org);
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
HttpClientTool<RestResult> hc = new HttpClientTool(String.format(ipMap.get("getCode"), ipAndPortEntity.getIp()));
|
hc.setBodyInfos(map);
|
RestResult result = hc.sendPost(
|
j -> JSONTool.toObj(j, new TypeReference<RestResult>() {
|
}));
|
Map<String, Object> res = JSONTool.toObj(JSONTool.toJson(result.getData()), Map.class);
|
Object a = res.get("data");
|
if (a != null) {
|
Map<String, String> orgs = JSONTool.toObj(JSONTool.toJson(a), Map.class);
|
return orgs.get("parentCode");
|
}
|
return null;
|
}
|
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
@Override
|
public void updateFormDataClient(ServicesFormData formData) throws TimeoutException, FormClientException {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
HttpClientTool<RestResult> hc = new HttpClientTool(String.format(ipMap.get("dataUpdate"), ipAndPortEntity.getIp()));
|
hc.setBodyInfos(formData);
|
System.out.println("回写状态:" + JSONTool.toJson(formData));
|
RestResult result = hc.sendPost(
|
j -> JSONTool.toObj(j, new TypeReference<RestResult>() {
|
}));
|
GetFormClientResult.getRightResult(result);
|
}
|
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
@Override
|
public void deleteFormDataClient(ServicesFormData formData) throws TimeoutException, FormClientException {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
HttpClientTool<RestResult> hc = new HttpClientTool(String.format(ipMap.get("dataDelete"), ipAndPortEntity.getIp()));
|
hc.setBodyInfos(formData);
|
RestResult result = hc.sendPost(
|
j -> JSONTool.toObj(j, new TypeReference<RestResult>() {
|
}));
|
GetFormClientResult.getRightResult(result);
|
}
|
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
@Override
|
public List<Map<String, Object>> queryFormDataList(SelectForm selectForm) throws FormClientException {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
HttpClientTool<RestResult<List<Map<String, Object>>>> hc = new HttpClientTool(String.format(ipMap.get("dataSelectAll"), ipAndPortEntity.getIp()));
|
hc.setBodyInfos(selectForm);
|
RestResult<List<Map<String, Object>>> result;
|
try {
|
result = hc.sendPost(
|
j -> JSONTool.toObj(j, new TypeReference<RestResult<List<Map<String, Object>>>>() {
|
}));
|
return GetFormClientResult.getRightResult(result);
|
} catch (TimeoutException e) {
|
throw new FormClientTimeout();
|
}
|
}
|
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
@Override
|
public Map<String, Object> queryFormDataOne(SelectForm selectForm) throws TimeoutException, FormClientException {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
HttpClientTool<RestResult<Map<String, Object>>> hc = new HttpClientTool(String.format(ipMap.get("dataSelectOne"), ipAndPortEntity.getIp()));
|
hc.setBodyInfos(selectForm);
|
RestResult<Map<String, Object>> result = hc.sendPost(
|
j -> JSONTool.toObj(j, new TypeReference<RestResult<Map<String, Object>>>() {
|
}.getType()));
|
return GetFormClientResult.getRightResult(result);
|
}
|
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
@Override
|
public PageResult<Map<String, Object>> queryFormDataPage(SelectForm selectForm) throws FormClientException {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
HttpClientTool<RestResult<PageResult<Map<String, Object>>>> hc = new HttpClientTool(String.format(ipMap.get("dataSelectPage"), ipAndPortEntity.getIp()));
|
hc.setBodyInfos(selectForm);
|
try {
|
return GetFormClientResult.getRightResult(hc.sendPost(
|
j -> JSONTool.toObj(j, new TypeReference<RestResult<PageResult<Map<String, Object>>>>() {
|
})));
|
} catch (TimeoutException e) {
|
e.printStackTrace();
|
throw new FormClientTimeout();
|
}
|
|
}
|
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
@Override
|
public void createTable(TableStructure tableStructure) throws TimeoutException, FormClientException {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
// System.out.println(JSONTool.toJson(tableStructure));
|
// System.out.println(String.format(ipMap.get("createTable"), ipAndPortEntity.getIp()));
|
HttpClientTool<RestResult<Integer>> hc = new HttpClientTool(String.format(ipMap.get("createTable"), ipAndPortEntity.getIp()));
|
hc.setBodyInfos(tableStructure);
|
GetFormClientResult.getRightResult(hc.sendPost(
|
j -> JSONTool.toObj(j, new TypeReference<RestResult<Integer>>() {
|
})));
|
}
|
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
@Override
|
public void updateTable(TableStructure tableStructure) throws Exception {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
HttpClientTool<RestResult<Integer>> hc = new HttpClientTool(String.format(ipMap.get("updateTable"), ipAndPortEntity.getIp()));
|
hc.setBodyInfos(tableStructure);
|
hc.sendPost(
|
j -> JSONTool.toObj(j, new TypeReference<RestResult<Integer>>() {
|
}));
|
// GetFormClientResult.getRightResult();
|
}
|
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
@Override
|
public List<String> getFormFieldMainValue(String field, String tableName, String formID, String tenantID) throws TimeoutException, FormClientException {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
HttpClientTool<RestResult<List<String>>> hc = new HttpClientTool(String.format(ipMap.get("selectFormValue"), ipAndPortEntity.getIp()));
|
Map<String, String> BodyInfos = new HashMap<>();
|
BodyInfos.put("field", field);
|
BodyInfos.put("tableName", tableName);
|
hc.setBodyInfos(BodyInfos);
|
RestResult<List<String>> result = hc.sendPost(
|
j -> JSONTool.toObj(j, new TypeReference<RestResult<List<String>>>() {
|
}));
|
return GetFormClientResult.getRightResult(result);
|
}
|
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
@Override
|
public List<Map<String, Object>> getAssociateDataSourse() throws TimeoutException, FormClientException {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
HttpClientTool<RestResult<List<Map<String, Object>>>> hc = new HttpClientTool(String.format(ipMap.get("getAssociateDataSourse"), ipAndPortEntity.getIp()));
|
RestResult<List<Map<String, Object>>> result = hc.sendPost(
|
j -> JSONTool.toObj(j, new TypeReference<RestResult<List<Map<String, Object>>>>() {
|
}));
|
return GetFormClientResult.getRightResult(result);
|
}
|
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
@Override
|
public Map<String, Object> getAssociateData(BudgetData budgetData) throws TimeoutException, FormClientException {
|
System.err.println(JSONTool.toJson(budgetData));
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
HttpClientTool<RestResult<Map<String, Object>>> hc = new HttpClientTool(String.format(ipMap.get("getAssociateData"), ipAndPortEntity.getIp()));
|
hc.setBodyInfos(budgetData);
|
RestResult<Map<String, Object>> result = hc.sendPost(
|
j -> JSONTool.toObj(j, new TypeReference<RestResult<Map<String, Object>>>() {
|
}));
|
return GetFormClientResult.getRightResult(result);
|
}
|
|
@SuppressWarnings("rawtypes")
|
@Override
|
public List<BudgetTitle> getAssociateTitle(Map<String, Object> key) throws TimeoutException, FormClientException {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
@SuppressWarnings("unchecked")
|
HttpClientTool<RestResult<List<BudgetTitle>>> hc = new HttpClientTool(String.format(ipMap.get("getAssociateTitle"), ipAndPortEntity.getIp()));
|
hc.setBodyInfos(key);
|
RestResult<List<BudgetTitle>> result = hc.sendPost(
|
j -> JSONTool.toObj(j, new TypeReference<RestResult<List<BudgetTitle>>>() {
|
}));
|
return GetFormClientResult.getRightResult(result);
|
}
|
|
@SuppressWarnings("rawtypes")
|
@Override
|
public Object getBudget(ProcessBudget processBudget) throws TimeoutException, FormClientException {
|
System.err.println(JSONTool.toJson(processBudget));
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
@SuppressWarnings("unchecked")
|
HttpClientTool<RestResult<Object>> hc = new HttpClientTool(String.format(ipMap.get("budget"), ipAndPortEntity.getIp()));
|
hc.setBodyInfos(processBudget);
|
RestResult<Object> result = hc.sendPost(
|
j -> JSONTool.toObj(j, new TypeReference<RestResult<Object>>() {
|
}));
|
return GetFormClientResult.getRightResult(result);
|
}
|
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
@Override
|
public void workFlowOver(WorkFlowStateEntity workFlowStateEntity) throws TimeoutException, FormClientException {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
RestResult<Object> result = (RestResult<Object>)
|
Http.post(String.format(ipMap.get("workFlowOver"), ipAndPortEntity.getIp()), RestResult.class)
|
.addBody(workFlowStateEntity)
|
.addHeader(RequestContext.getHeader())
|
.execute(new TypeReference<RestResult<Object>>() {
|
}.getType())
|
.orElse(RestResult.newInstance());
|
GetFormClientResult.getRightResult(result);
|
|
}
|
|
@Override
|
public void workFlowAfter(WorkFlowStateEntity workFlowStateEntity) throws TimeoutException, FormClientException {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
RestResult<Object> result = (RestResult<Object>)
|
Http.post(String.format(ipMap.get("workFlowAfter"), ipAndPortEntity.getIp()), RestResult.class)
|
.addBody(workFlowStateEntity)
|
.addHeader(RequestContext.getHeader())
|
.execute(new TypeReference<RestResult<Object>>() {
|
}.getType())
|
.orElse(RestResult.newInstance());
|
GetFormClientResult.getRightResult(result);
|
}
|
|
@Override
|
public void workFlowBefor(WorkFlowStateEntity workFlowStateEntity) throws TimeoutException, FormClientException {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
RestResult<Object> result = (RestResult<Object>)
|
Http.post(String.format(ipMap.get("workFlowBefor"), ipAndPortEntity.getIp()), RestResult.class)
|
.addBody(workFlowStateEntity)
|
.addHeader(RequestContext.getHeader())
|
.execute(new TypeReference<RestResult<Object>>() {
|
}.getType())
|
.orElse(RestResult.newInstance());
|
GetFormClientResult.getRightResult(result);
|
}
|
|
@SuppressWarnings("rawtypes")
|
@Override
|
public String getUserName(String formID, String tenantID, Integer dataRowNum) throws TimeoutException, FormClientException {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
@SuppressWarnings("unchecked")
|
HttpClientTool<RestResult<String>> hc = new HttpClientTool(String.format(ipMap.get("getUserName"), ipAndPortEntity.getIp()));
|
hc.setBodyInfos(new ModelMap("formID", formID)
|
.addAttribute("tenantID", tenantID)
|
.addAttribute("dataRowNum", dataRowNum)
|
.addAttribute("formName", "formdata_" + tenantID + "_" + formID));
|
RestResult<String> result = hc.sendPost(
|
j -> JSONTool.toObj(j, new TypeReference<RestResult<String>>() {
|
}));
|
return GetFormClientResult.getRightResult(result);
|
}
|
|
@SuppressWarnings("rawtypes")
|
@Override
|
public int updateState(ProcessState process) throws FormClientException, TimeoutException {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
Map<String, Object> result = (Map<String, Object>)
|
Http.post(String.format(ipMap.get("updateState"), ipAndPortEntity.getIp()), Map.class)
|
.addBody(process)
|
.addHeader(RequestContext.getHeader())
|
.execute(new TypeReference<Map<String, Object>>() {
|
}.getType())
|
.orElse(Collections.EMPTY_MAP);
|
return Integer.parseInt(Objects.toString(JSONTool.toJson(result.get("data")), "-1"));
|
}
|
|
@Override
|
public ProcessState selectState(ProcessState process) throws TimeoutException {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
HttpClientTool<Map<String, Object>> hc = new HttpClientTool<Map<String, Object>>(String.format(ipMap.get("selectState"), ipAndPortEntity.getIp()));
|
hc.setBodyInfos(process);
|
Map<String, Object> result = hc.sendPost(
|
j -> JSONTool.toObj(j, new TypeReference<Map<String, Object>>() {
|
}));
|
System.out.println("查询返回结果:" + JSONTool.toJson(result));
|
Object o = result.get("data");
|
if (!ObjectUtil.empty(o)) {
|
return JSONTool.toObj(JSONTool.toJson(o), ProcessState.class);
|
} else {
|
return null;
|
}
|
}
|
|
@Override
|
public PowerButton getAllButton(String formId, ProcessState state) throws TimeoutException {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
HttpClientTool<Map<String, Object>> hc = new HttpClientTool<Map<String, Object>>(String.format(ipMap.get("getAllButton"), ipAndPortEntity.getIp()));
|
hc.setBodyInfos(new ModelMap("formId", formId).addAttribute("state", state));
|
Map<String, Object> result = hc.sendPost(
|
j -> JSONTool.toObj(j, new TypeReference<Map<String, Object>>() {
|
}));
|
Object obj = result.get("data");
|
return JSONTool.toObj(JSONTool.toJson(obj), PowerButton.class);
|
}
|
|
@Override
|
public int formSolidiFication(FormSolidiFication map) throws TimeoutException {
|
@SuppressWarnings("unchecked")
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
HttpClientTool<Map<String, Object>> hc = new HttpClientTool<Map<String, Object>>(String.format(ipMap.get("formSolidiFication"), ipAndPortEntity.getIp()));
|
hc.setBodyInfos(map);
|
Map<String, Object> ma = hc.sendPost(
|
j -> JSONTool.toObj(j, new TypeReference<Map<String, Object>>() {
|
}));
|
return Integer.parseInt(Objects.toString(ma.get("data"), "-1"));
|
}
|
|
@Override
|
public Integer impDatas(List<ServicesFormData> allFormDataList) throws TimeoutException {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
HttpClientTool<Map<String, Object>> hc = new HttpClientTool<Map<String, Object>>(String.format(ipMap.get("impDatas"), ipAndPortEntity.getIp()));
|
hc.setBodyInfos(allFormDataList);
|
Map<String, Object> ma = hc.sendPost(
|
j -> JSONTool.toObj(j, new TypeReference<Map<String, Object>>() {
|
}));
|
return Integer.parseInt(Objects.toString(ma.get("data"), "-1"));
|
}
|
|
@Override
|
public Integer addExcelLog(ExcelLog excelLog) throws TimeoutException {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
HttpClientTool<Map<String, Object>> hc = new HttpClientTool<Map<String, Object>>(String.format(ipMap.get("addExcelLog"), ipAndPortEntity.getIp()));
|
hc.setBodyInfos(excelLog);
|
Map<String, Object> ma = hc.sendPost(
|
j -> JSONTool.toObj(j, new TypeReference<Map<String, Object>>() {
|
}));
|
return Integer.parseInt(Objects.toString(ma.get("data"), "-1"));
|
}
|
|
@Override
|
public Integer updateExcelLog(ExcelLog excelLog) throws TimeoutException {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
HttpClientTool<Map<String, Object>> hc = new HttpClientTool<Map<String, Object>>(String.format(ipMap.get("updateExcelLog"), ipAndPortEntity.getIp()));
|
hc.setBodyInfos(excelLog);
|
Map<String, Object> ma = hc.sendPost(
|
j -> JSONTool.toObj(j, new TypeReference<Map<String, Object>>() {
|
}));
|
return Integer.parseInt(Objects.toString(ma.get("data"), "-1"));
|
}
|
|
@Override
|
public void workFlowRollback(WorkFlowStateEntity workFlowStateEntity) {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
RestResult<Object> result = (RestResult<Object>)
|
Http.post(String.format(ipMap.get("workFlowRollback"), ipAndPortEntity.getIp()), RestResult.class)
|
.addBody(workFlowStateEntity)
|
.addHeader(RequestContext.getHeader())
|
.execute(new TypeReference<RestResult<Object>>() {
|
}.getType())
|
.orElse(RestResult.newInstance());
|
GetFormClientResult.getRightResult(result);
|
}
|
|
@Override
|
public void workFlowCreate(WorkFlowStateEntity workFlowStateEntity) {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
RestResult<Object> result = (RestResult<Object>)
|
Http.post(String.format(ipMap.get("workFlowCreate"), ipAndPortEntity.getIp()), RestResult.class)
|
.addBody(workFlowStateEntity)
|
.addHeader(RequestContext.getHeader())
|
.execute(new TypeReference<RestResult<Object>>() {
|
}.getType())
|
.orElse(RestResult.newInstance());
|
GetFormClientResult.getRightResult(result);
|
}
|
|
@Override
|
public UserInfo getUserInfo() {
|
IpAndPortEntity ipAndPortEntity = ipAndPortTool.queryIpAndPortByServiceName(autoFormClient);
|
RestResult<UserInfo> result = (RestResult<UserInfo>)
|
Http.post(String.format(ipMap.get("getUserInfo"), ipAndPortEntity.getIp()), RestResult.class)
|
.addBody(new UserInfo())
|
.addHeader(RequestContext.getHeader())
|
.execute(new TypeReference<RestResult<UserInfo>>() {
|
}.getType())
|
.orElse(RestResult.newInstance());
|
GetFormClientResult.getRightResultGetUserCode(result);
|
return result.getData();
|
}
|
|
|
}
|