新能云枢超标、改签流程代码调整

This commit is contained in:
dengwc 2024-03-01 10:49:46 +08:00
parent 99bd01fe7b
commit c8290fd7d9
6 changed files with 254 additions and 120 deletions

10
pom.xml
View File

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

View File

@ -41,4 +41,13 @@ public class BPMController {
System.out.println("bpmBack = " + bpmBack); System.out.println("bpmBack = " + bpmBack);
return Result.Success(CommonMessageConstant.SUCCESS); return Result.Success(CommonMessageConstant.SUCCESS);
} }
//差旅更变审批
@ApiOperation("BPM改签审批结果回传")
@PostMapping("/change/back")
public Result<TravelStandards> changeBack(@RequestBody BPMBack bpmBack) {
//获取订单号和审批结果
System.out.println("bpmBack = " + bpmBack);
return Result.Success(CommonMessageConstant.SUCCESS);
}
} }

View File

@ -1,19 +1,31 @@
package com.chint.interfaces.rest.bpm; 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.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.BPMBaseResponse; import com.chint.interfaces.rest.bpm.dot.BPMBaseResponse;
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.util.HashMap;
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
@ -68,35 +80,34 @@ public class BPMRequest {
* 新能云枢接口 * 新能云枢接口
*/ */
public BPMResponse XNBPMSubmitWorkflow(String workflowCode, Object entityObject) { public BPMResponse XNBPMSubmitWorkflow(String workflowCode, Object entityObject) {
// //获取用户信息 //获取用户信息
// User user = BaseContext.getCurrentUser(); User user = BaseContext.getCurrentUser();
// String employeeNo = user.getEmployeeNo();//sf号 String employeeNo = user.getEmployeeNo();//sf号
// XNTokenDto xnTokenDto = httpPostRequest.get(XNBPMUrl + XNBPM_TOKEN_URL + "?code=" + employeeNo, XNTokenDto.class); XNTokenDto xnTokenDto = httpPostRequest.get(XNBPMUrl + XNBPM_TOKEN_URL + "?code=" + employeeNo, XNTokenDto.class);
// if (!"0".equals(xnTokenDto.getErrcode())) { if (!"0".equals(xnTokenDto.getErrcode())) {
// throw new RuntimeException("用户不存在!"); throw new RuntimeException("用户不存在!");
// } }
// String userId = xnTokenDto.getUser_id(); String userId = xnTokenDto.getUser_id();
// CloudpivotOpenClient client = ClientFactory.getInstance(); CloudpivotOpenClient client = ClientFactory.getInstance();
// StartWorkflowRequest request = new StartWorkflowRequest(); StartWorkflowRequest request = new StartWorkflowRequest();
// Gson gson = new Gson(); Gson gson = new Gson();
// String entityParamValues = gson.toJson(entityObject); String entityParamValues = gson.toJson(entityObject);
// Type type = new TypeToken<HashMap<String, Object>>() { Type type = new TypeToken<HashMap<String, Object>>() {
// }.getType(); }.getType();
// HashMap<String, Object> map = gson.fromJson(entityParamValues, type); HashMap<String, Object> map = gson.fromJson(entityParamValues, type);
// request.setData(map);//数据 request.setData(map);//数据
// request.setDepartmentId("");//部门id默认主部门 request.setDepartmentId("");//部门id默认主部门
// request.setFinishStart(true);//发起流程 request.setFinishStart(true);//发起流程
// request.setUserId(userId);//员工号 request.setUserId(userId);//员工号
// request.setWorkflowCode(workflowCode);//超标流程 request.setWorkflowCode(workflowCode);//超标流程
// try { try {
// StartWorkflowResponse response = client.startWorkflow(request); StartWorkflowResponse response = client.startWorkflow(request);
// System.out.println("response = " + JSON.toJSONString(response)); System.out.println("response = " + JSON.toJSONString(response));
// } catch (ApiException e) { } catch (ApiException e) {
// throw new RuntimeException(e.getMessage()); throw new RuntimeException(e.getMessage());
// } }
// BPMResponse bpmResponse = new BPMResponse(); BPMResponse bpmResponse = new BPMResponse();
// bpmResponse.setSuccess(true); bpmResponse.setSuccess(true);
// return bpmResponse; return bpmResponse;
return null;
} }
} }

View File

@ -1,6 +1,9 @@
package com.chint.interfaces.rest.bpm.XNBPM; 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.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -11,7 +14,7 @@ import static com.chint.infrastructure.constant.BPMConstant.*;
*/ */
@Service @Service
public class ClientFactory { public class ClientFactory {
// private static CloudpivotOpenClient client; private static CloudpivotOpenClient client;
private static String XNBPMUrl; private static String XNBPMUrl;
@ -21,15 +24,15 @@ public class ClientFactory {
} }
// public synchronized static CloudpivotOpenClient getInstance() { public synchronized static CloudpivotOpenClient getInstance() {
// if (client == null) { if (client == null) {
// synchronized (CloudpivotOpenClient.class) { synchronized (CloudpivotOpenClient.class) {
// if (client == null) { if (client == null) {
// CloudpivotEnvConfig config = new CloudpivotEnvConfig(XNBPMUrl + "/api", CLIENT_ID, CLIENT_SECRET); CloudpivotEnvConfig config = new CloudpivotEnvConfig(XNBPMUrl + "/api", CLIENT_ID, CLIENT_SECRET);
// client = new CloudpivotOpenClient(config, new JdkHttpClient()); client = new CloudpivotOpenClient(config, new JdkHttpClient());
// } }
// } }
// } }
// return client; return client;
// } }
} }

View File

@ -0,0 +1,55 @@
package com.chint.interfaces.rest.bpm.dto;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
/**
* 变更
*/
@Data
@Accessors(chain = true)
public class ChangeDto {
private String StartTime;//出差开始时间 是否必填
private String EndTime;//出差结束时间 是否必填
private String Reason;//出差说明 是否必填
private List<NewTrip> JT_FI_CLBGSQ_ITEM_NewTrip;//新增行程信息 是否必填
private List<OldTrip> JT_FI_CLBGSQ_ITEM_OldTrip;//原行程信息 是否必填
private List<ChangeTrip> JT_FI_CLBGSQ_ITEM_ChangeTrip;//变更行程信息 是否必填
//新增行程信息
@Data
@Accessors(chain = true)
public static class NewTrip {
private String AllowProductTypes;//行程类型 是否必填
private String DepartCitiesName;//出发地 是否必填
private String ArriveCitiesName;//目的地 是否必填
private String bsDate;//开始时间 是否必填
private String edDate;//结束时间 是否必填
private String Reason;//新增行程原因 是否必填
}
//原行程信息
@Data
@Accessors(chain = true)
public static class OldTrip {
private String AllowProductTypes;//行程类型 是否必填
private String DepartCitiesName;//出发地 是否必填
private String ArriveCitiesName;//目的地 是否必填
private String bsDate;//开始时间 是否必填
private String edDate;//结束时间 是否必填
}
//变更行程信息
@Data
@Accessors(chain = true)
public static class ChangeTrip {
private String AllowProductTypes;//行程类型 是否必填
private String DepartCitiesName;//出发地 是否必填
private String ArriveCitiesName;//目的地 是否必填
private String bsDate;//开始时间 是否必填
private String edDate;//结束时间 是否必填
private String Reason;//新增行程原因 是否必填
}
}

View File

@ -3,6 +3,10 @@ package com.chint;
import cn.hutool.core.lang.hash.Hash; import cn.hutool.core.lang.hash.Hash;
import com.alibaba.fastjson.JSON; 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.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;
@ -11,10 +15,7 @@ import com.chint.interfaces.rest.base.PostRequest;
import com.chint.interfaces.rest.bpm.XNBPM.ClientFactory; import com.chint.interfaces.rest.bpm.XNBPM.ClientFactory;
import com.chint.interfaces.rest.bpm.XNBPM.XNTokenDto; 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.*;
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.chint.interfaces.rest.ly.LYLoginRequest; import com.chint.interfaces.rest.ly.LYLoginRequest;
import com.chint.interfaces.rest.ly.LYPostRequest; import com.chint.interfaces.rest.ly.LYPostRequest;
import com.chint.interfaces.rest.ly.LYTokenRequest; import com.chint.interfaces.rest.ly.LYTokenRequest;
@ -319,7 +320,7 @@ public class LYTest {
ExceedStandardDto exceedStandardDto = new ExceedStandardDto(); ExceedStandardDto exceedStandardDto = new ExceedStandardDto();
exceedStandardDto.setOrderType("酒店超标")//内容选项酒店超标火车票超标机票超标 exceedStandardDto.setOrderType("酒店超标")//内容选项酒店超标火车票超标机票超标
.setOrderSource("携程商旅")//内容选项:携程商旅/同程商旅 .setOrderSource("携程商旅")//内容选项:携程商旅/同程商旅
.setOrderNo("001021214")//订单号 .setOrderNo("001121214")//订单号
.setHotelStandard("标间")//酒店超标提供住宿标准 .setHotelStandard("标间")//酒店超标提供住宿标准
.setHotelName("酒店名称")//酒店超标提供酒店名称 .setHotelName("酒店名称")//酒店超标提供酒店名称
.setHouseLayout("双人床")//酒店超标提供房型 .setHouseLayout("双人床")//酒店超标提供房型
@ -366,45 +367,100 @@ public class LYTest {
System.out.println("response = " + response); System.out.println("response = " + response);
} }
//差旅变更
@Test
void change() {
BPMBaseRequest bpmRequest = new BPMBaseRequest();
Gson gson = new Gson();
ChangeDto changeDto = new ChangeDto();
//新增行程
ArrayList<ChangeDto.NewTrip> newTrips = new ArrayList<>();
ChangeDto.NewTrip newTrip = new ChangeDto.NewTrip();
newTrip.setAllowProductTypes("飞机")
.setDepartCitiesName("温州")
.setArriveCitiesName("北京")
.setBsDate("2024-03-01")
.setEdDate("2024-03-01")
.setReason("出差帮扶");
newTrips.add(newTrip);
//原行程
ArrayList<ChangeDto.OldTrip> oldTrips = new ArrayList<>();
ChangeDto.OldTrip oldTrip = new ChangeDto.OldTrip();
oldTrip.setAllowProductTypes("火车")
.setDepartCitiesName("温州")
.setArriveCitiesName("杭州")
.setBsDate("2024-03-01")
.setEdDate("2024-03-01");
oldTrips.add(oldTrip);
//变更行程
ArrayList<ChangeDto.ChangeTrip> changeTrips = new ArrayList<>();
ChangeDto.ChangeTrip changeTrip = new ChangeDto.ChangeTrip();
changeTrip.setAllowProductTypes("火车")
.setDepartCitiesName("乐清")
.setArriveCitiesName("杭州")
.setBsDate("2024-03-01")
.setEdDate("2024-03-01")
.setReason("出发地变更");
changeTrips.add(changeTrip);
//设置值
changeDto.setStartTime("2024-03-01")//出差开始时间
.setEndTime("2024-03-01")//出差结束时间
.setReason("出差帮扶")//出差说明
.setJT_FI_CLBGSQ_ITEM_NewTrip(newTrips)//新增行程信息
.setJT_FI_CLBGSQ_ITEM_OldTrip(oldTrips)//原行程信息
.setJT_FI_CLBGSQ_ITEM_ChangeTrip(changeTrips);//变更行程信息
String entityParamValues = gson.toJson(changeDto);
bpmRequest.setWorkflowCode("JT_FI_CLBGSQ")//流程编码
.setUserCode("231116011")//sf号
.setFinishStart(true)//true会自动流转到下一审批点false:停在手工填写节点
.setEntityParamValues(entityParamValues);
BPMBaseResponse bpmBaseResponse = httpPostRequest.post(H3BPMUrl + H3BPM_EXCEED_STANDARD_URL, bpmRequest, BPMBaseResponse.class);
System.out.println("response = " + bpmBaseResponse);
BPMResponse response = bpmBaseResponse.getD();
System.out.println("response = " + response);
}
/** /**
* 云枢超标流程测试 * 云枢超标流程测试
*/ */
@Test @Test
public void testDemo() throws Exception { public void testDemo() throws Exception {
// XNTokenDto xnTokenDto = httpPostRequest.get(XNBPMUrl + XNBPM_TOKEN_URL + "?code=" + "191107079", XNTokenDto.class); XNTokenDto xnTokenDto = httpPostRequest.get(XNBPMUrl + XNBPM_TOKEN_URL + "?code=" + "191107079", XNTokenDto.class);
// if (!"0".equals(xnTokenDto.getErrcode())) { if (!"0".equals(xnTokenDto.getErrcode())) {
// throw new RuntimeException("用户不存在!"); throw new RuntimeException("用户不存在!");
// } }
// String userId = xnTokenDto.getUser_id(); String userId = xnTokenDto.getUser_id();
// CloudpivotOpenClient client = ClientFactory.getInstance(); CloudpivotOpenClient client = ClientFactory.getInstance();
// StartWorkflowRequest request = new StartWorkflowRequest(); StartWorkflowRequest request = new StartWorkflowRequest();
// Gson gson = new Gson(); Gson gson = new Gson();
// ExceedStandardDto exceedStandardDto = new ExceedStandardDto(); ExceedStandardDto exceedStandardDto = new ExceedStandardDto();
// exceedStandardDto.setOrderType("酒店超标")//内容选项酒店超标火车票超标机票超标 exceedStandardDto.setOrderType("酒店超标")//内容选项酒店超标火车票超标机票超标
// .setOrderSource("携程商旅")//内容选项:携程商旅/同程商旅 .setOrderSource("携程商旅")//内容选项:携程商旅/同程商旅
// .setOrderNo("001021214")//订单号 .setOrderNo("001021214")//订单号
// .setHotelStandard("标间")//酒店超标提供住宿标准 .setHotelStandard("标间")//酒店超标提供住宿标准
// .setHotelName("酒店名称")//酒店超标提供酒店名称 .setHotelName("酒店名称")//酒店超标提供酒店名称
// .setHouseLayout("双人床")//酒店超标提供房型 .setHouseLayout("双人床")//酒店超标提供房型
// .setSeatingStandard("")//火车票超标提供席别标准 .setSeatingStandard("")//火车票超标提供席别标准
// .setCabinClass("")//机票超标提供舱等 .setCabinClass("")//机票超标提供舱等
// .setExcessAmount(BigDecimal.valueOf(1000))//超标金额 .setExcessAmount(BigDecimal.valueOf(1000))//超标金额
// .setReason("酒店爆满订不到");//超标原因 .setReason("酒店爆满订不到");//超标原因
//
// String entityParamValues = gson.toJson(exceedStandardDto); String entityParamValues = gson.toJson(exceedStandardDto);
// Type type = new TypeToken<HashMap<String, Object>>(){}.getType(); Type type = new TypeToken<HashMap<String, Object>>(){}.getType();
// HashMap<String, Object> map = gson.fromJson(entityParamValues, type); HashMap<String, Object> map = gson.fromJson(entityParamValues, type);
// request.setData(map);//数据 request.setData(map);//数据
// request.setDepartmentId("");//部门id默认主部门 request.setDepartmentId("");//部门id默认主部门
// request.setFinishStart(true);//发起流程 request.setFinishStart(true);//发起流程
// request.setUserId(userId);//员工号 request.setUserId(userId);//员工号
// request.setWorkflowCode("JG_AS_CLCESQ");//超标流程 request.setWorkflowCode("JG_AS_CLCESQ");//超标流程
// try { try {
// StartWorkflowResponse response = client.startWorkflow(request); StartWorkflowResponse response = client.startWorkflow(request);
// System.out.println("response = " + JSON.toJSONString(response)); System.out.println("response = " + JSON.toJSONString(response));
// } catch (ApiException e) { } catch (ApiException e) {
// throw new RuntimeException(e.getMessage()); throw new RuntimeException(e.getMessage());
// } }
} }
@ -413,40 +469,40 @@ public class LYTest {
*/ */
@Test @Test
public void testDemo2() throws Exception { public void testDemo2() throws Exception {
// XNTokenDto xnTokenDto = httpPostRequest.get(XNBPMUrl + XNBPM_TOKEN_URL + "?code=" + "191107079", XNTokenDto.class); XNTokenDto xnTokenDto = httpPostRequest.get(XNBPMUrl + XNBPM_TOKEN_URL + "?code=" + "191107079", XNTokenDto.class);
// if (!"0".equals(xnTokenDto.getErrcode())) { if (!"0".equals(xnTokenDto.getErrcode())) {
// throw new RuntimeException("用户不存在!"); throw new RuntimeException("用户不存在!");
// } }
// String userId = xnTokenDto.getUser_id(); String userId = xnTokenDto.getUser_id();
// CloudpivotOpenClient client = ClientFactory.getInstance(); CloudpivotOpenClient client = ClientFactory.getInstance();
// StartWorkflowRequest request = new StartWorkflowRequest(); StartWorkflowRequest request = new StartWorkflowRequest();
// Gson gson = new Gson(); Gson gson = new Gson();
// RescheduleDto rescheduleDto = new RescheduleDto(); RescheduleDto rescheduleDto = new RescheduleDto();
// rescheduleDto.setOrderType("机票改签")//内容选项机票改签机票退票火车票改签火车票退票 rescheduleDto.setOrderType("机票改签")//内容选项机票改签机票退票火车票改签火车票退票
// .setOrderSource("携程商旅")//携程商旅/同程商旅 .setOrderSource("携程商旅")//携程商旅/同程商旅
// .setOrderNo("00002")//订单号 .setOrderNo("00002")//订单号
// .setStartTime("2024-02-22 10:00:00")//机票改签或火车票改签提供: 原时间 .setStartTime("2024-02-22 10:00:00")//机票改签或火车票改签提供: 原时间
// .setRebookStartTime("2024-02-23 10:00:00")//机票改签或火车票改签提供: 改签后时间 .setRebookStartTime("2024-02-23 10:00:00")//机票改签或火车票改签提供: 改签后时间
// .setTrainNumber("")//火车票改签提供: 原车次 .setTrainNumber("")//火车票改签提供: 原车次
// .setSeatingStandard("")//火车票改签提供: 原席别 .setSeatingStandard("")//火车票改签提供: 原席别
// .setRebookTrainNumber("")//火车票改签提供: 改签后车次 .setRebookTrainNumber("")//火车票改签提供: 改签后车次
// .setRebookSeatingStandard("")//火车票改签提供: 改签后席别 .setRebookSeatingStandard("")//火车票改签提供: 改签后席别
// .setFee(BigDecimal.valueOf(100))//费用 .setFee(BigDecimal.valueOf(100))//费用
// .setReason("行程冲突");//原因 .setReason("行程冲突");//原因
// String entityParamValues = gson.toJson(rescheduleDto); String entityParamValues = gson.toJson(rescheduleDto);
// Type type = new TypeToken<HashMap<String, Object>>(){}.getType(); Type type = new TypeToken<HashMap<String, Object>>(){}.getType();
// HashMap<String, Object> map = gson.fromJson(entityParamValues, type); HashMap<String, Object> map = gson.fromJson(entityParamValues, type);
// request.setData(map);//数据 request.setData(map);//数据
// request.setDepartmentId("");//部门id默认主部门 request.setDepartmentId("");//部门id默认主部门
// request.setFinishStart(true);//发起流程 request.setFinishStart(true);//发起流程
// request.setUserId(userId);//员工号 request.setUserId(userId);//员工号
// request.setWorkflowCode("JG_AS_CLGQSQ");//改签流程 request.setWorkflowCode("JG_AS_CLGQSQ");//改签流程
// try { try {
// StartWorkflowResponse response = client.startWorkflow(request); StartWorkflowResponse response = client.startWorkflow(request);
// System.out.println("response = " + JSON.toJSONString(response)); System.out.println("response = " + JSON.toJSONString(response));
// } catch (ApiException e) { } catch (ApiException e) {
// throw new RuntimeException(e.getMessage()); throw new RuntimeException(e.getMessage());
// } }
} }
} }