BPM超标、改签接口案例测试
This commit is contained in:
parent
c49ab49fe9
commit
f09dd77636
|
@ -290,4 +290,7 @@ public class Constant {
|
|||
public static final String STANDARD_LEVEL_THREE = "STANDARD_LEVEL_THREE";//方法名称
|
||||
public static final String STANDARD_LEVEL_FOUR = "STANDARD_LEVEL_FOUR";//方法名称
|
||||
|
||||
|
||||
//BPM
|
||||
public static final String EXCEED_STANDARD_URL = "http://10.207.0.245:8012/Portal/Webservices/ExternalStartService.asmx?op=StartWorkflowByEntityTransJson";
|
||||
}
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
package com.chint.interfaces.rest.ly;
|
||||
|
||||
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.ly.dto.bpm.BPMBaseRequest;
|
||||
import com.chint.interfaces.rest.ly.dto.bpm.BPMResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.bpm.ExceedStandardDto;
|
||||
import com.chint.interfaces.rest.ly.dto.bpm.RescheduleDto;
|
||||
import com.google.gson.Gson;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import static com.chint.infrastructure.constant.Constant.EXCEED_STANDARD_URL;
|
||||
|
||||
public class BPMRequest {
|
||||
|
||||
@Autowired
|
||||
private PostRequest httpPostRequest;
|
||||
|
||||
//超标申请
|
||||
public BPMResponse exceedStandard(ExceedStandardDto exceedStandardDto) {
|
||||
return submitWorkflow("JT_FI_CLCESQ", exceedStandardDto);
|
||||
}
|
||||
|
||||
//改签
|
||||
public BPMResponse reschedule(RescheduleDto rescheduleDto) {
|
||||
return submitWorkflow("JT_FI_CLGQSQ", rescheduleDto);
|
||||
}
|
||||
|
||||
public BPMResponse submitWorkflow(String workflowCode, Object entityObject) {
|
||||
BPMBaseRequest bpmRequest = new BPMBaseRequest();
|
||||
Gson gson = new Gson();
|
||||
String entityParamValues = gson.toJson(entityObject);
|
||||
//获取用户信息
|
||||
User user = BaseContext.getCurrentUser();
|
||||
bpmRequest.setWorkflowCode(workflowCode)
|
||||
.setUserCode(String.valueOf(user.getEmployeeNo()))//sf号
|
||||
.setFinishStart(true)//true:会自动流转到下一审批点,false:停在手工填写节点
|
||||
.setEntityParamValues(entityParamValues);
|
||||
BPMResponse response = httpPostRequest.post(EXCEED_STANDARD_URL, bpmRequest, BPMResponse.class);
|
||||
System.out.println("response = " + response);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.chint.interfaces.rest.ly.dto.bpm;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class BPMBaseRequest {
|
||||
private String workflowCode;//流程编码
|
||||
private String userCode;//发起人SF号
|
||||
private Boolean finishStart;//是否结果填单节点
|
||||
private String EntityParamValues;//数据
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.chint.interfaces.rest.ly.dto.bpm;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BPMResponse {
|
||||
private Boolean Success;//创建成功标志
|
||||
private String InstanceID;//实例id
|
||||
private String Message;//返回消息
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.chint.interfaces.rest.ly.dto.bpm;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 超标
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ExceedStandardDto {
|
||||
|
||||
private String OrderType; //订单类型 是否必填:是 内容选项:酒店超标,火车票超标,机票超标
|
||||
private String OrderSource; //订单来源 是否必填:是 携程商旅/同程商旅
|
||||
private String OrderNo; //订单号 是否必填:是
|
||||
private String HotelStandard; //住宿标准 是否必填:否 当订单类型=酒店超标 时需提供
|
||||
private String HotelName; //酒店名称 是否必填:否 当订单类型=酒店超标 时需提供
|
||||
private String HouseLayout; //房型 是否必填:否 当订单类型=酒店超标 时需提供
|
||||
private String SeatingStandard; //席别标准 是否必填:否 当订单类型=火车票超标 时需提供
|
||||
private String CabinClass; //舱等 是否必填:否 当订单类型=机票超标 时需提供
|
||||
private BigDecimal ExcessAmount;//超标金额 是否必填:是
|
||||
private String Reason; //超标原因 是否必填:否
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.chint.interfaces.rest.ly.dto.bpm;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 改签
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class RescheduleDto {
|
||||
private String OrderType;//订单类型 是否必填:是
|
||||
private String OrderSource;//订单来源 是否必填:是
|
||||
private String OrderNo;//订单号 是否必填:是
|
||||
private String StartTime;//原时间 是否必填:否 机票改签或火车票改签提供。
|
||||
private String RebookStartTime;//改签后时间 是否必填:否 机票改签或火车票改签提供
|
||||
private String TrainNumber;//原车次 是否必填:否 火车票改签提供
|
||||
private String SeatingStandard;//原席别 是否必填:否 火车票改签提供
|
||||
private String RebookTrainNumber;//改签后车次 是否必填:否 火车票改签提供
|
||||
private String RebookSeatingStandard;//改签后席别 是否必填:否 火车票改签提供
|
||||
private BigDecimal Fee;//费用 是否必填:是
|
||||
private String Reason;//原因 是否必填:否
|
||||
|
||||
}
|
|
@ -4,16 +4,25 @@ import com.chint.domain.aggregates.base.BaseEntity;
|
|||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.infrastructure.constant.Constant;
|
||||
import com.chint.infrastructure.util.BaseContext;
|
||||
import com.chint.interfaces.rest.base.PostRequest;
|
||||
import com.chint.interfaces.rest.ly.LYLoginRequest;
|
||||
import com.chint.interfaces.rest.ly.LYPostRequest;
|
||||
import com.chint.interfaces.rest.ly.LYTokenRequest;
|
||||
import com.chint.interfaces.rest.ly.LYUserRequest;
|
||||
import com.chint.interfaces.rest.ly.dto.applyordersync.*;
|
||||
import com.chint.interfaces.rest.ly.dto.bpm.BPMBaseRequest;
|
||||
import com.chint.interfaces.rest.ly.dto.bpm.BPMResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.bpm.ExceedStandardDto;
|
||||
import com.chint.interfaces.rest.ly.dto.bpm.RescheduleDto;
|
||||
import com.chint.interfaces.rest.ly.dto.commonresult.Result;
|
||||
import com.chint.interfaces.rest.ly.dto.estimateprice.*;
|
||||
import com.chint.interfaces.rest.ly.vo.estimateprice.HotelListVo;
|
||||
import com.chint.interfaces.rest.ly.vo.estimateprice.TrainPriceVo;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
@ -43,6 +52,9 @@ public class LYTest {
|
|||
@Autowired
|
||||
private LYLoginRequest loginRequest;
|
||||
|
||||
@Autowired
|
||||
private PostRequest httpPostRequest;
|
||||
|
||||
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";
|
||||
|
@ -62,6 +74,9 @@ public class LYTest {
|
|||
private final String minPriceUrl = L_Y_BASE_URL + L_Y_HOTLE_MIN_PRICE_PATH;
|
||||
private final String hotleListUrl = L_Y_BASE_URL + L_Y_HOTLE_LIST_PATH;
|
||||
|
||||
private final String ExceedStandardUrl = "http://10.207.0.245:8012/Portal/Webservices/ExternalStartService.asmx?op=StartWorkflowByEntityTransJson";
|
||||
|
||||
|
||||
private User user = new User(1L, 230615020L, 1, "卢麟哲", "1033719135@qq.com", "15857193365");
|
||||
private User hxh = new User(1L, 231116009L, 1, "黄小恒", "1628870217@qq.com", "18296007063");
|
||||
|
||||
|
@ -286,5 +301,55 @@ public class LYTest {
|
|||
System.out.println(loginRequest.loginPC(L_Y_ENTRANCE_HOME));
|
||||
}
|
||||
|
||||
//超标
|
||||
@Test
|
||||
void exceedStandard() {
|
||||
BPMBaseRequest bpmRequest = new BPMBaseRequest();
|
||||
Gson gson = new Gson();
|
||||
ExceedStandardDto exceedStandardDto = new ExceedStandardDto();
|
||||
exceedStandardDto.setOrderType("酒店超标")//内容选项:酒店超标,火车票超标,机票超标
|
||||
.setOrderSource("携程商旅")//内容选项:携程商旅/同程商旅
|
||||
.setOrderNo("00002")//订单号
|
||||
.setHotelStandard("标间")//酒店超标提供:住宿标准
|
||||
.setHotelName("酒店名称")//酒店超标提供:酒店名称
|
||||
.setHouseLayout("双人床")//酒店超标提供:房型
|
||||
.setSeatingStandard("")//火车票超标提供:席别标准
|
||||
.setCabinClass("")//:机票超标提供:舱等
|
||||
.setExcessAmount(BigDecimal.valueOf(100))//超标金额
|
||||
.setReason("酒店爆满订不到");//超标原因
|
||||
String entityParamValues = gson.toJson(exceedStandardDto);
|
||||
bpmRequest.setWorkflowCode("JT_FI_CLCESQ")//流程编码
|
||||
.setUserCode("231116011")//sf号
|
||||
.setFinishStart(true)//true:会自动流转到下一审批点,false:停在手工填写节点
|
||||
.setEntityParamValues(entityParamValues);
|
||||
BPMResponse response = httpPostRequest.post(ExceedStandardUrl, bpmRequest, BPMResponse.class);
|
||||
System.out.println("response = " + response);
|
||||
}
|
||||
|
||||
//改签
|
||||
@Test
|
||||
void reschedule() {
|
||||
BPMBaseRequest bpmRequest = new BPMBaseRequest();
|
||||
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);
|
||||
bpmRequest.setWorkflowCode("JT_FI_CLGQSQ")//流程编码
|
||||
.setUserCode("231116011")//sf号
|
||||
.setFinishStart(true)//true:会自动流转到下一审批点,false:停在手工填写节点
|
||||
.setEntityParamValues(entityParamValues);
|
||||
BPMResponse response = httpPostRequest.post(ExceedStandardUrl, bpmRequest, BPMResponse.class);
|
||||
System.out.println("response = " + response);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue