暂时注释新能jar包

This commit is contained in:
lulz1 2024-03-01 08:38:41 +08:00
parent 7500ba4854
commit 1de351fa10
5 changed files with 119 additions and 139 deletions

10
pom.xml
View File

@ -82,11 +82,11 @@
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>com.authine.cloudpivot</groupId>
<artifactId>cloudpivot-opensdk</artifactId>
<version>1.0</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.authine.cloudpivot</groupId>-->
<!-- <artifactId>cloudpivot-opensdk</artifactId>-->
<!-- <version>1.0</version>-->
<!-- </dependency>-->
</dependencies>

View File

@ -1,33 +1,19 @@
package com.chint.interfaces.rest.bpm;
import com.alibaba.fastjson.JSON;
import com.authine.cloudpivot.opensdk.ApiException;
import com.authine.cloudpivot.opensdk.CloudpivotOpenClient;
import com.authine.cloudpivot.opensdk.model.request.workflow.StartWorkflowRequest;
import com.authine.cloudpivot.opensdk.model.response.workflow.StartWorkflowResponse;
import com.chint.domain.aggregates.user.User;
import com.chint.infrastructure.util.BaseContext;
import com.chint.interfaces.rest.base.PostRequest;
import com.chint.interfaces.rest.bpm.XNBPM.ClientFactory;
import com.chint.interfaces.rest.bpm.XNBPM.XNTokenDto;
import com.chint.interfaces.rest.bpm.dot.*;
import com.chint.interfaces.rest.bpm.dot.BPMBaseResponse;
import com.chint.interfaces.rest.bpm.dto.BPMBaseRequest;
import com.chint.interfaces.rest.bpm.dto.BPMResponse;
import com.chint.interfaces.rest.bpm.dto.ExceedStandardDto;
import com.chint.interfaces.rest.bpm.dto.RescheduleDto;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import static com.chint.infrastructure.constant.BPMConstant.H3BPM_EXCEED_STANDARD_URL;
import static com.chint.infrastructure.constant.BPMConstant.XNBPM_TOKEN_URL;
@Service
@ -82,34 +68,35 @@ public class BPMRequest {
* 新能云枢接口
*/
public BPMResponse XNBPMSubmitWorkflow(String workflowCode, Object entityObject) {
//获取用户信息
User user = BaseContext.getCurrentUser();
String employeeNo = user.getEmployeeNo();//sf号
XNTokenDto xnTokenDto = httpPostRequest.get(XNBPMUrl + XNBPM_TOKEN_URL + "?code=" + employeeNo, XNTokenDto.class);
if (!"0".equals(xnTokenDto.getErrcode())) {
throw new RuntimeException("用户不存在!");
}
String userId = xnTokenDto.getUser_id();
CloudpivotOpenClient client = ClientFactory.getInstance();
StartWorkflowRequest request = new StartWorkflowRequest();
Gson gson = new Gson();
String entityParamValues = gson.toJson(entityObject);
Type type = new TypeToken<HashMap<String, Object>>() {
}.getType();
HashMap<String, Object> map = gson.fromJson(entityParamValues, type);
request.setData(map);//数据
request.setDepartmentId("");//部门id默认主部门
request.setFinishStart(true);//发起流程
request.setUserId(userId);//员工号
request.setWorkflowCode(workflowCode);//超标流程
try {
StartWorkflowResponse response = client.startWorkflow(request);
System.out.println("response = " + JSON.toJSONString(response));
} catch (ApiException e) {
throw new RuntimeException(e.getMessage());
}
BPMResponse bpmResponse = new BPMResponse();
bpmResponse.setSuccess(true);
return bpmResponse;
// //获取用户信息
// User user = BaseContext.getCurrentUser();
// String employeeNo = user.getEmployeeNo();//sf号
// XNTokenDto xnTokenDto = httpPostRequest.get(XNBPMUrl + XNBPM_TOKEN_URL + "?code=" + employeeNo, XNTokenDto.class);
// if (!"0".equals(xnTokenDto.getErrcode())) {
// throw new RuntimeException("用户不存在!");
// }
// String userId = xnTokenDto.getUser_id();
// CloudpivotOpenClient client = ClientFactory.getInstance();
// StartWorkflowRequest request = new StartWorkflowRequest();
// Gson gson = new Gson();
// String entityParamValues = gson.toJson(entityObject);
// Type type = new TypeToken<HashMap<String, Object>>() {
// }.getType();
// HashMap<String, Object> map = gson.fromJson(entityParamValues, type);
// request.setData(map);//数据
// request.setDepartmentId("");//部门id默认主部门
// request.setFinishStart(true);//发起流程
// request.setUserId(userId);//员工号
// request.setWorkflowCode(workflowCode);//超标流程
// try {
// StartWorkflowResponse response = client.startWorkflow(request);
// System.out.println("response = " + JSON.toJSONString(response));
// } catch (ApiException e) {
// throw new RuntimeException(e.getMessage());
// }
// BPMResponse bpmResponse = new BPMResponse();
// bpmResponse.setSuccess(true);
// return bpmResponse;
return null;
}
}

View File

@ -1,8 +1,6 @@
package com.chint.interfaces.rest.bpm.XNBPM;
import com.authine.cloudpivot.opensdk.CloudpivotOpenClient;
import com.authine.cloudpivot.opensdk.client.impl.JdkHttpClient;
import com.authine.cloudpivot.opensdk.config.CloudpivotEnvConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -13,7 +11,7 @@ import static com.chint.infrastructure.constant.BPMConstant.*;
*/
@Service
public class ClientFactory {
private static CloudpivotOpenClient client;
// private static CloudpivotOpenClient client;
private static String XNBPMUrl;
@ -23,15 +21,15 @@ public class ClientFactory {
}
public synchronized static CloudpivotOpenClient getInstance() {
if (client == null) {
synchronized (CloudpivotOpenClient.class) {
if (client == null) {
CloudpivotEnvConfig config = new CloudpivotEnvConfig(XNBPMUrl + "/api", CLIENT_ID, CLIENT_SECRET);
client = new CloudpivotOpenClient(config, new JdkHttpClient());
}
}
}
return client;
}
// public synchronized static CloudpivotOpenClient getInstance() {
// if (client == null) {
// synchronized (CloudpivotOpenClient.class) {
// if (client == null) {
// CloudpivotEnvConfig config = new CloudpivotEnvConfig(XNBPMUrl + "/api", CLIENT_ID, CLIENT_SECRET);
// client = new CloudpivotOpenClient(config, new JdkHttpClient());
// }
// }
// }
// return client;
// }
}

View File

@ -118,7 +118,7 @@ public class CTripTest {
System.out.println(loginRequest.h5Login(null));
}
@Test
// @Test
void estimateFlight() {
BaseContext.setCurrentUser(user);
user.setCompanyCode("A30000001");

View File

@ -2,12 +2,7 @@ package com.chint;
import cn.hutool.core.lang.hash.Hash;
import com.alibaba.fastjson.JSON;
import com.authine.cloudpivot.opensdk.ApiException;
import com.authine.cloudpivot.opensdk.CloudpivotOpenClient;
import com.authine.cloudpivot.opensdk.model.request.bizobject.CreateBoRequest;
import com.authine.cloudpivot.opensdk.model.request.workflow.StartWorkflowRequest;
import com.authine.cloudpivot.opensdk.model.response.bizobject.CreateBoResponse;
import com.authine.cloudpivot.opensdk.model.response.workflow.StartWorkflowResponse;
import com.chint.domain.aggregates.user.User;
import com.chint.infrastructure.constant.LYConstant;
import com.chint.infrastructure.util.BaseContext;
@ -376,40 +371,40 @@ public class LYTest {
*/
@Test
public void testDemo() throws Exception {
XNTokenDto xnTokenDto = httpPostRequest.get(XNBPMUrl + XNBPM_TOKEN_URL + "?code=" + "191107079", XNTokenDto.class);
if (!"0".equals(xnTokenDto.getErrcode())) {
throw new RuntimeException("用户不存在!");
}
String userId = xnTokenDto.getUser_id();
CloudpivotOpenClient client = ClientFactory.getInstance();
StartWorkflowRequest request = new StartWorkflowRequest();
Gson gson = new Gson();
ExceedStandardDto exceedStandardDto = new ExceedStandardDto();
exceedStandardDto.setOrderType("酒店超标")//内容选项酒店超标火车票超标机票超标
.setOrderSource("携程商旅")//内容选项:携程商旅/同程商旅
.setOrderNo("001021214")//订单号
.setHotelStandard("标间")//酒店超标提供住宿标准
.setHotelName("酒店名称")//酒店超标提供酒店名称
.setHouseLayout("双人床")//酒店超标提供房型
.setSeatingStandard("")//火车票超标提供席别标准
.setCabinClass("")//机票超标提供舱等
.setExcessAmount(BigDecimal.valueOf(1000))//超标金额
.setReason("酒店爆满订不到");//超标原因
String entityParamValues = gson.toJson(exceedStandardDto);
Type type = new TypeToken<HashMap<String, Object>>(){}.getType();
HashMap<String, Object> map = gson.fromJson(entityParamValues, type);
request.setData(map);//数据
request.setDepartmentId("");//部门id默认主部门
request.setFinishStart(true);//发起流程
request.setUserId(userId);//员工号
request.setWorkflowCode("JG_AS_CLCESQ");//超标流程
try {
StartWorkflowResponse response = client.startWorkflow(request);
System.out.println("response = " + JSON.toJSONString(response));
} catch (ApiException e) {
throw new RuntimeException(e.getMessage());
}
// XNTokenDto xnTokenDto = httpPostRequest.get(XNBPMUrl + XNBPM_TOKEN_URL + "?code=" + "191107079", XNTokenDto.class);
// if (!"0".equals(xnTokenDto.getErrcode())) {
// throw new RuntimeException("用户不存在!");
// }
// String userId = xnTokenDto.getUser_id();
// CloudpivotOpenClient client = ClientFactory.getInstance();
// StartWorkflowRequest request = new StartWorkflowRequest();
// Gson gson = new Gson();
// ExceedStandardDto exceedStandardDto = new ExceedStandardDto();
// exceedStandardDto.setOrderType("酒店超标")//内容选项酒店超标火车票超标机票超标
// .setOrderSource("携程商旅")//内容选项:携程商旅/同程商旅
// .setOrderNo("001021214")//订单号
// .setHotelStandard("标间")//酒店超标提供住宿标准
// .setHotelName("酒店名称")//酒店超标提供酒店名称
// .setHouseLayout("双人床")//酒店超标提供房型
// .setSeatingStandard("")//火车票超标提供席别标准
// .setCabinClass("")//机票超标提供舱等
// .setExcessAmount(BigDecimal.valueOf(1000))//超标金额
// .setReason("酒店爆满订不到");//超标原因
//
// String entityParamValues = gson.toJson(exceedStandardDto);
// Type type = new TypeToken<HashMap<String, Object>>(){}.getType();
// HashMap<String, Object> map = gson.fromJson(entityParamValues, type);
// request.setData(map);//数据
// request.setDepartmentId("");//部门id默认主部门
// request.setFinishStart(true);//发起流程
// request.setUserId(userId);//员工号
// request.setWorkflowCode("JG_AS_CLCESQ");//超标流程
// try {
// StartWorkflowResponse response = client.startWorkflow(request);
// System.out.println("response = " + JSON.toJSONString(response));
// } catch (ApiException e) {
// throw new RuntimeException(e.getMessage());
// }
}
@ -418,40 +413,40 @@ public class LYTest {
*/
@Test
public void testDemo2() throws Exception {
XNTokenDto xnTokenDto = httpPostRequest.get(XNBPMUrl + XNBPM_TOKEN_URL + "?code=" + "191107079", XNTokenDto.class);
if (!"0".equals(xnTokenDto.getErrcode())) {
throw new RuntimeException("用户不存在!");
}
String userId = xnTokenDto.getUser_id();
CloudpivotOpenClient client = ClientFactory.getInstance();
StartWorkflowRequest request = new StartWorkflowRequest();
Gson gson = new Gson();
RescheduleDto rescheduleDto = new RescheduleDto();
rescheduleDto.setOrderType("机票改签")//内容选项机票改签机票退票火车票改签火车票退票
.setOrderSource("携程商旅")//携程商旅/同程商旅
.setOrderNo("00002")//订单号
.setStartTime("2024-02-22 10:00:00")//机票改签或火车票改签提供: 原时间
.setRebookStartTime("2024-02-23 10:00:00")//机票改签或火车票改签提供: 改签后时间
.setTrainNumber("")//火车票改签提供: 原车次
.setSeatingStandard("")//火车票改签提供: 原席别
.setRebookTrainNumber("")//火车票改签提供: 改签后车次
.setRebookSeatingStandard("")//火车票改签提供: 改签后席别
.setFee(BigDecimal.valueOf(100))//费用
.setReason("行程冲突");//原因
String entityParamValues = gson.toJson(rescheduleDto);
Type type = new TypeToken<HashMap<String, Object>>(){}.getType();
HashMap<String, Object> map = gson.fromJson(entityParamValues, type);
request.setData(map);//数据
request.setDepartmentId("");//部门id默认主部门
request.setFinishStart(true);//发起流程
request.setUserId(userId);//员工号
request.setWorkflowCode("JG_AS_CLGQSQ");//改签流程
try {
StartWorkflowResponse response = client.startWorkflow(request);
System.out.println("response = " + JSON.toJSONString(response));
} catch (ApiException e) {
throw new RuntimeException(e.getMessage());
}
// XNTokenDto xnTokenDto = httpPostRequest.get(XNBPMUrl + XNBPM_TOKEN_URL + "?code=" + "191107079", XNTokenDto.class);
// if (!"0".equals(xnTokenDto.getErrcode())) {
// throw new RuntimeException("用户不存在!");
// }
// String userId = xnTokenDto.getUser_id();
// CloudpivotOpenClient client = ClientFactory.getInstance();
// StartWorkflowRequest request = new StartWorkflowRequest();
// Gson gson = new Gson();
// RescheduleDto rescheduleDto = new RescheduleDto();
// rescheduleDto.setOrderType("机票改签")//内容选项机票改签机票退票火车票改签火车票退票
// .setOrderSource("携程商旅")//携程商旅/同程商旅
// .setOrderNo("00002")//订单号
// .setStartTime("2024-02-22 10:00:00")//机票改签或火车票改签提供: 原时间
// .setRebookStartTime("2024-02-23 10:00:00")//机票改签或火车票改签提供: 改签后时间
// .setTrainNumber("")//火车票改签提供: 原车次
// .setSeatingStandard("")//火车票改签提供: 原席别
// .setRebookTrainNumber("")//火车票改签提供: 改签后车次
// .setRebookSeatingStandard("")//火车票改签提供: 改签后席别
// .setFee(BigDecimal.valueOf(100))//费用
// .setReason("行程冲突");//原因
// String entityParamValues = gson.toJson(rescheduleDto);
// Type type = new TypeToken<HashMap<String, Object>>(){}.getType();
// HashMap<String, Object> map = gson.fromJson(entityParamValues, type);
// request.setData(map);//数据
// request.setDepartmentId("");//部门id默认主部门
// request.setFinishStart(true);//发起流程
// request.setUserId(userId);//员工号
// request.setWorkflowCode("JG_AS_CLGQSQ");//改签流程
// try {
// StartWorkflowResponse response = client.startWorkflow(request);
// System.out.println("response = " + JSON.toJSONString(response));
// } catch (ApiException e) {
// throw new RuntimeException(e.getMessage());
// }
}
}