新能云枢超标、改签流程调用测试编写
This commit is contained in:
parent
3dca884467
commit
48888e5e49
7
pom.xml
7
pom.xml
|
@ -75,6 +75,13 @@
|
||||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||||
<version>3.0.3</version>
|
<version>3.0.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.authine.cloudpivot</groupId>
|
||||||
|
<artifactId>cloudpivot-opensdk</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -24,7 +24,8 @@ public class FSSCController {
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
public Result<LoginResponse> loginToFSSC() {
|
public Result<LoginResponse> loginToFSSC() {
|
||||||
User currentUser = BaseContext.getCurrentUser();
|
User currentUser = BaseContext.getCurrentUser();
|
||||||
return Result.Success(SUCCESS, LoginResponse.success(FSSCUrl + FSSC_LOGIN_PATH_APPROVAL + currentUser.getEmployeeNo().toString()));
|
String companyCode = currentUser.getCompanyCode();//公司编号
|
||||||
|
return Result.Success(SUCCESS, LoginResponse.success(FSSCUrl + FSSC_LOGIN_PATH_APPROVAL + currentUser.getEmployeeNo()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,56 +38,60 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
||||||
TrainOrderDetail trainOrderDetail = new TrainOrderDetail();
|
TrainOrderDetail trainOrderDetail = new TrainOrderDetail();
|
||||||
//映射值
|
//映射值
|
||||||
/* trainOrderDetail.setOrderNo(data.getOrderNo())
|
/* trainOrderDetail.setOrderNo(data.getOrderNo())
|
||||||
.setOverStandard(null)
|
.setOverStandard(ruleViolate)
|
||||||
.setParentOrderNo()
|
.setParentOrderNo(null)
|
||||||
.setOriginalOrderNo(null)
|
.setOriginalOrderNo(originalOrderNo)
|
||||||
.setOrderStatus(null)
|
.setOrderStatus(null)
|
||||||
.setAccountCompanyId()
|
.setAccountCompanyId(null)
|
||||||
.setAccountCompanyName()
|
.setAccountCompanyName(null)
|
||||||
.setReceiptsNum(travelData.getTravelApplyNo())
|
.setReceiptsNum(travelData.getTravelApplyNo())
|
||||||
.setScheduleNum()
|
.setScheduleNum(null)
|
||||||
.setBookingUserCode(data.getOutEmployeeId())
|
.setBookingUserCode(data.getOutEmployeeId())
|
||||||
.setBookingName()
|
.setBookingName(null)
|
||||||
.setBookingUserPhone()
|
.setBookingUserPhone(null)
|
||||||
.setCreateTime()
|
.setCreateTime(issueTime)
|
||||||
.setStartTime()
|
.setStartTime(departureTime)
|
||||||
.setArriveTime()
|
.setArriveTime(arrivalTime)
|
||||||
.setFromStationName()
|
.setFromStationName(data.getFromStation())
|
||||||
.setToStationName()
|
.setToStationName(data.getToStation())
|
||||||
.setTrainNo()
|
.setTrainNo(data.getTrainNo())
|
||||||
.setFromCity()
|
.setFromCity(departCityName)
|
||||||
.setToCity()
|
.setToCity(arriveCityName)
|
||||||
.setRunTime()
|
.setRunTime(null)
|
||||||
.setOrderAmount()
|
.setOrderAmount(data.getTotalAmount())
|
||||||
.setPreServiceFee()
|
.setPreServiceFee(servicePrice)
|
||||||
.setPostServiceFee()
|
.setPostServiceFee(afterSettlementServicePrice)
|
||||||
.setRefundAmount()
|
.setRefundAmount(refundPrice)
|
||||||
.setChangeDifference()
|
.setChangeDifference(changePriceDiff)
|
||||||
.setChangeCost()
|
.setChangeCost(serviceCharge)
|
||||||
.setTickets()
|
.setTickets(
|
||||||
.setSeatType()
|
data.getPriceVarList().stream()
|
||||||
.setSeatName()
|
.flatMap(priceVar -> priceVar.getPassengers().stream())
|
||||||
.setTicketPrice()
|
.toList()
|
||||||
.setRefundCost()
|
)
|
||||||
.setRefundPrice()
|
.setSeatType(data.getItems().isEmpty() ? null : data.getItems().get(0).getSeatClass())
|
||||||
.setStandardItems()
|
.setSeatName(data.getItems().isEmpty() ? null : data.getItems().get(0).getSeatNo())
|
||||||
.setUserName()
|
.setTicketPrice(price)
|
||||||
.setUserCode()
|
.setRefundCost(null)
|
||||||
.setOverStandard()
|
.setRefundPrice(refundPrice)
|
||||||
.setPhone()
|
.setStandardItems(policyName)
|
||||||
// .setXXX()
|
.setUserName(passengerName)
|
||||||
// .setXXX()
|
.setUserCode(employeeCode)
|
||||||
// .setXXX()
|
.setOverStandard(ruleViolate)
|
||||||
// .setXXX()
|
.setPhone(null)
|
||||||
// .setXXX()
|
// .setXXX(携程预订/同程预订)
|
||||||
.setBOOK_ORG_STRUCT_1()
|
// .setXXX(PersonalPrice)
|
||||||
.setBOOK_ORG_STRUCT_2()
|
// .setXXX(CompanyPrice)
|
||||||
.setBOOK_ORG_STRUCT_3()
|
// .setXXX(null)
|
||||||
.setPaymentType()
|
// .setXXX(foulReason)//超标原因
|
||||||
// .setXXX()
|
.setBOOK_ORG_STRUCT_1(null)
|
||||||
// .setXXX()
|
.setBOOK_ORG_STRUCT_2(null)
|
||||||
// .setXXX()
|
.setBOOK_ORG_STRUCT_3(null)
|
||||||
;*/
|
.setPaymentType(payType)
|
||||||
|
// .setXXX(null)//入住人组织架构信息3
|
||||||
|
// .setXXX(null)//项目订单号
|
||||||
|
// .setXXX(null)//成本中心*/
|
||||||
|
;
|
||||||
|
|
||||||
return trainOrderDetail;
|
return trainOrderDetail;
|
||||||
}
|
}
|
||||||
|
@ -245,6 +249,7 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private HotelOrderDetail convertHotel(HotelDetailResponse hotelDetailResponse) {
|
private HotelOrderDetail convertHotel(HotelDetailResponse hotelDetailResponse) {
|
||||||
HotelOrderDetail hotelOrderDetail = new HotelOrderDetail();
|
HotelOrderDetail hotelOrderDetail = new HotelOrderDetail();
|
||||||
HotelDetailResponse.Data data = hotelDetailResponse.getData();
|
HotelDetailResponse.Data data = hotelDetailResponse.getData();
|
||||||
|
|
|
@ -4,7 +4,14 @@ public class BPMConstant {
|
||||||
//BPM
|
//BPM
|
||||||
|
|
||||||
public static final String H3BPM = "H3BPM";
|
public static final String H3BPM = "H3BPM";
|
||||||
public static final String H3BPM_EXCEED_STANDARD_URL = "/Portal/Webservices/ExternalStartService.asmx/StartWorkflowByEntityTransJson";
|
public static final String XNBPM = "XNBPM";
|
||||||
|
public static final String H3BPM_EXCEED_STANDARD_URL = "/Portal/Webservices/ExternalStartService.asmx/StartWorkflowByEntityTransJson";//H3BPM
|
||||||
|
public static final String XNBPM_TOKEN_URL = "/api/login/crm/ajax";//新能云枢获取token和用户id
|
||||||
|
public static final String XNBPM_EXCEED_STANDARD_URL = "/api/openapi/v3/workflow/start";//新能云枢发起流程
|
||||||
|
|
||||||
|
public static final String CLIENT_ID = "xclient";//客户端id
|
||||||
|
public static final String CLIENT_SECRET = "0a417ecce58c31b32364ce19ca8fcd15";//密钥
|
||||||
|
|
||||||
public static final String EXCEED_STANDARD_TYPE_TRAIN = "火车票超标";//方法名称
|
public static final String EXCEED_STANDARD_TYPE_TRAIN = "火车票超标";//方法名称
|
||||||
public static final String EXCEED_STANDARD_TYPE_HOTEL = "酒店超标";//方法名称
|
public static final String EXCEED_STANDARD_TYPE_HOTEL = "酒店超标";//方法名称
|
||||||
public static final String EXCEED_STANDARD_TYPE_FLIGHT = "机票超标";//方法名称
|
public static final String EXCEED_STANDARD_TYPE_FLIGHT = "机票超标";//方法名称
|
||||||
|
|
|
@ -5,7 +5,9 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.http.HttpEntity;
|
import org.apache.http.HttpEntity;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
import org.apache.http.client.HttpClient;
|
import org.apache.http.client.HttpClient;
|
||||||
|
import org.apache.http.client.methods.HttpGet;
|
||||||
import org.apache.http.client.methods.HttpPost;
|
import org.apache.http.client.methods.HttpPost;
|
||||||
|
import org.apache.http.client.methods.HttpUriRequest;
|
||||||
import org.apache.http.entity.ContentType;
|
import org.apache.http.entity.ContentType;
|
||||||
import org.apache.http.entity.StringEntity;
|
import org.apache.http.entity.StringEntity;
|
||||||
import org.apache.http.impl.client.HttpClients;
|
import org.apache.http.impl.client.HttpClients;
|
||||||
|
@ -74,6 +76,18 @@ public class PostRequest {
|
||||||
return gson.fromJson(responseBody, responseType);
|
return gson.fromJson(responseBody, responseType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public <T> T get(String url, Class<T> responseType) {
|
||||||
|
HttpUriRequest request = new HttpGet(url);
|
||||||
|
String responseBody;
|
||||||
|
try {
|
||||||
|
responseBody = EntityUtils.toString(client.execute(request).getEntity(), "UTF-8");
|
||||||
|
return gson.fromJson(responseBody, responseType);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Gson gson() {
|
public Gson gson() {
|
||||||
return gson;
|
return gson;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,33 @@
|
||||||
package com.chint.interfaces.rest.bpm;
|
package com.chint.interfaces.rest.bpm;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.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.domain.aggregates.user.User;
|
||||||
import com.chint.infrastructure.util.BaseContext;
|
import com.chint.infrastructure.util.BaseContext;
|
||||||
import com.chint.interfaces.rest.base.PostRequest;
|
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.*;
|
||||||
import com.chint.interfaces.rest.bpm.dto.BPMBaseRequest;
|
import com.chint.interfaces.rest.bpm.dto.BPMBaseRequest;
|
||||||
import com.chint.interfaces.rest.bpm.dto.BPMResponse;
|
import com.chint.interfaces.rest.bpm.dto.BPMResponse;
|
||||||
import com.chint.interfaces.rest.bpm.dto.ExceedStandardDto;
|
import com.chint.interfaces.rest.bpm.dto.ExceedStandardDto;
|
||||||
import com.chint.interfaces.rest.bpm.dto.RescheduleDto;
|
import com.chint.interfaces.rest.bpm.dto.RescheduleDto;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
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.H3BPM_EXCEED_STANDARD_URL;
|
||||||
|
import static com.chint.infrastructure.constant.BPMConstant.XNBPM_TOKEN_URL;
|
||||||
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@ -25,17 +39,31 @@ public class BPMRequest {
|
||||||
@Value("${bpm.H3BPMUrl}")
|
@Value("${bpm.H3BPMUrl}")
|
||||||
private String H3BPMUrl;
|
private String H3BPMUrl;
|
||||||
|
|
||||||
|
@Value("${bpm.XNBPMUrl}")
|
||||||
|
private String XNBPMUrl;
|
||||||
|
|
||||||
//超标申请
|
//超标申请
|
||||||
public BPMResponse exceedStandard(ExceedStandardDto exceedStandardDto) {
|
public BPMResponse exceedStandard(ExceedStandardDto exceedStandardDto) {
|
||||||
return submitWorkflow("JT_FI_CLCESQ", exceedStandardDto);
|
if ("H3BPM".equals("XNBPM")) {
|
||||||
|
return XNBPMSubmitWorkflow("JG_AS_CLCESQ", exceedStandardDto);
|
||||||
|
} else {
|
||||||
|
return H3BPMSubmitWorkflow("JT_FI_CLCESQ", exceedStandardDto);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//改签
|
//改签申请
|
||||||
public BPMResponse reschedule(RescheduleDto rescheduleDto) {
|
public BPMResponse reschedule(RescheduleDto rescheduleDto) {
|
||||||
return submitWorkflow("JT_FI_CLGQSQ", rescheduleDto);
|
if ("H3BPM".equals("XNBPM")) {
|
||||||
|
return XNBPMSubmitWorkflow("JG_AS_CLGQSQ", rescheduleDto);
|
||||||
|
} else {
|
||||||
|
return H3BPMSubmitWorkflow("JT_FI_CLGQSQ", rescheduleDto);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BPMResponse submitWorkflow(String workflowCode, Object entityObject) {
|
/**
|
||||||
|
* H3BPM
|
||||||
|
*/
|
||||||
|
public BPMResponse H3BPMSubmitWorkflow(String workflowCode, Object entityObject) {
|
||||||
BPMBaseRequest bpmRequest = new BPMBaseRequest();
|
BPMBaseRequest bpmRequest = new BPMBaseRequest();
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
String entityParamValues = gson.toJson(entityObject);
|
String entityParamValues = gson.toJson(entityObject);
|
||||||
|
@ -49,4 +77,39 @@ public class BPMRequest {
|
||||||
System.out.println("response = " + bpmBaseResponse);
|
System.out.println("response = " + bpmBaseResponse);
|
||||||
return bpmBaseResponse.getD();
|
return bpmBaseResponse.getD();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新能云枢接口
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
import static com.chint.infrastructure.constant.BPMConstant.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新能云枢
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ClientFactory {
|
||||||
|
private static CloudpivotOpenClient client;
|
||||||
|
|
||||||
|
private static String XNBPMUrl;
|
||||||
|
|
||||||
|
@Value("${bpm.XNBPMUrl}")
|
||||||
|
public void setXNBPMUrl(String XNBPMUrl) {
|
||||||
|
ClientFactory.XNBPMUrl = XNBPMUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.chint.interfaces.rest.bpm.XNBPM;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class XNTokenDto {
|
||||||
|
private String errcode;
|
||||||
|
private String access_token;
|
||||||
|
private String refresh_token;
|
||||||
|
private String user_id;
|
||||||
|
}
|
|
@ -63,3 +63,4 @@ paila:
|
||||||
|
|
||||||
bpm:
|
bpm:
|
||||||
H3BPMUrl: http://10.207.0.245:8012
|
H3BPMUrl: http://10.207.0.245:8012
|
||||||
|
XNBPMUrl: http://10.145.30.119:8090
|
|
@ -51,3 +51,4 @@ paila:
|
||||||
|
|
||||||
bpm:
|
bpm:
|
||||||
H3BPMUrl: http://10.207.0.245:8012
|
H3BPMUrl: http://10.207.0.245:8012
|
||||||
|
XNBPMUrl: http://10.145.30.119:8090
|
|
@ -1,9 +1,20 @@
|
||||||
package com.chint;
|
package com.chint;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.hash.Hash;
|
||||||
|
import com.alibaba.fastjson2.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.domain.aggregates.user.User;
|
||||||
import com.chint.infrastructure.constant.LYConstant;
|
import com.chint.infrastructure.constant.LYConstant;
|
||||||
import com.chint.infrastructure.util.BaseContext;
|
import com.chint.infrastructure.util.BaseContext;
|
||||||
|
import com.chint.infrastructure.util.OrderNo;
|
||||||
import com.chint.interfaces.rest.base.PostRequest;
|
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.*;
|
||||||
import com.chint.interfaces.rest.bpm.dto.BPMBaseRequest;
|
import com.chint.interfaces.rest.bpm.dto.BPMBaseRequest;
|
||||||
import com.chint.interfaces.rest.bpm.dto.BPMResponse;
|
import com.chint.interfaces.rest.bpm.dto.BPMResponse;
|
||||||
|
@ -18,19 +29,23 @@ import com.chint.interfaces.rest.ly.dto.commonresult.Result;
|
||||||
import com.chint.interfaces.rest.ly.dto.estimateprice.*;
|
import com.chint.interfaces.rest.ly.dto.estimateprice.*;
|
||||||
import com.chint.interfaces.rest.ly.vo.estimateprice.TrainPriceVo;
|
import com.chint.interfaces.rest.ly.vo.estimateprice.TrainPriceVo;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.BPMConstant.H3BPM_EXCEED_STANDARD_URL;
|
import static com.chint.infrastructure.constant.BPMConstant.H3BPM_EXCEED_STANDARD_URL;
|
||||||
|
import static com.chint.infrastructure.constant.BPMConstant.XNBPM_TOKEN_URL;
|
||||||
|
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
public class LYTest {
|
public class LYTest {
|
||||||
|
@ -54,6 +69,8 @@ public class LYTest {
|
||||||
@Value("${bpm.H3BPMUrl}")
|
@Value("${bpm.H3BPMUrl}")
|
||||||
private String H3BPMUrl;
|
private String H3BPMUrl;
|
||||||
|
|
||||||
|
@Value("${bpm.XNBPMUrl}")
|
||||||
|
private String XNBPMUrl;
|
||||||
public static final String L_Y_BASE_URL = "https://api.qa.dttrip.cn/openapi";
|
public static final String L_Y_BASE_URL = "https://api.qa.dttrip.cn/openapi";
|
||||||
|
|
||||||
public static final String L_Y_ORDER_PATH = "/openapi/api/TravelApplyOrder/ApplyOrderSync";
|
public static final String L_Y_ORDER_PATH = "/openapi/api/TravelApplyOrder/ApplyOrderSync";
|
||||||
|
@ -354,4 +371,87 @@ public class LYTest {
|
||||||
System.out.println("response = " + response);
|
System.out.println("response = " + response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云枢超标流程测试
|
||||||
|
*/
|
||||||
|
@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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云枢改签流程测试
|
||||||
|
*/
|
||||||
|
@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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue