修复订单回推的单号写单多余数据
This commit is contained in:
parent
f731c0ff17
commit
933189384d
|
@ -4,6 +4,8 @@ package com.chint.application.out;
|
||||||
import com.chint.application.dtos.SupplierLoginParam;
|
import com.chint.application.dtos.SupplierLoginParam;
|
||||||
import com.chint.application.services.SupplierLoginService;
|
import com.chint.application.services.SupplierLoginService;
|
||||||
import com.chint.infrastructure.util.Result;
|
import com.chint.infrastructure.util.Result;
|
||||||
|
import com.chint.interfaces.rest.base.dto.H5LoginResponse;
|
||||||
|
import com.chint.interfaces.rest.base.dto.PCLoginResponse;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.login.H5Response;
|
import com.chint.interfaces.rest.ctrip.dto.login.H5Response;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.login.PCResponse;
|
import com.chint.interfaces.rest.ctrip.dto.login.PCResponse;
|
||||||
import com.chint.interfaces.rest.ly.dto.login.LYRedirectUrlResponse;
|
import com.chint.interfaces.rest.ly.dto.login.LYRedirectUrlResponse;
|
||||||
|
@ -41,26 +43,26 @@ public class SupplierLoginController {
|
||||||
|
|
||||||
@ApiOperation("单点登录携程-移动")
|
@ApiOperation("单点登录携程-移动")
|
||||||
@PostMapping("/CTrip/login")
|
@PostMapping("/CTrip/login")
|
||||||
public Result<H5Response> cTripLogin(@RequestBody SupplierLoginParam supplierLoginParam) {
|
public Result<H5LoginResponse> cTripLogin(@RequestBody SupplierLoginParam supplierLoginParam) {
|
||||||
return Result.Success(SUCCESS, supplierLoginService.cTripLogin(supplierLoginParam));
|
return Result.Success(SUCCESS, supplierLoginService.cTripLogin(supplierLoginParam));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("单点登录携程-PC")
|
@ApiOperation("单点登录携程-PC")
|
||||||
@PostMapping("/CTrip/login/pc")
|
@PostMapping("/CTrip/login/pc")
|
||||||
public Result<PCResponse> cTripLoginPC(@RequestBody SupplierLoginParam supplierLoginParam) {
|
public Result<PCLoginResponse> cTripLoginPC(@RequestBody SupplierLoginParam supplierLoginParam) {
|
||||||
return Result.Success(SUCCESS, supplierLoginService.cTripLoginPC(supplierLoginParam));
|
return Result.Success(SUCCESS, supplierLoginService.cTripLoginPC(supplierLoginParam));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("单点登录携程-移动-Html")
|
@ApiOperation("单点登录携程-移动-Html")
|
||||||
@PostMapping("/CTrip/login/ht")
|
@PostMapping("/CTrip/login/ht")
|
||||||
public Result<H5Response> cTripLoginHtml(@RequestBody SupplierLoginParam supplierLoginParam) {
|
public Result<H5LoginResponse> cTripLoginHtml(@RequestBody SupplierLoginParam supplierLoginParam) {
|
||||||
return Result.Success(SUCCESS, supplierLoginService.cTripLoginHtml(supplierLoginParam));
|
return Result.Success(SUCCESS, supplierLoginService.cTripLoginHtml(supplierLoginParam));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("单点登录携程-PC-Html")
|
@ApiOperation("单点登录携程-PC-Html")
|
||||||
@PostMapping("/CTrip/login/pc/ht")
|
@PostMapping("/CTrip/login/pc/ht")
|
||||||
public Result<PCResponse> cTripLoginPCHtml(@RequestBody SupplierLoginParam supplierLoginParam) {
|
public Result<PCLoginResponse> cTripLoginPCHtml(@RequestBody SupplierLoginParam supplierLoginParam) {
|
||||||
return Result.Success(SUCCESS, supplierLoginService.cTripLoginPCHtml(supplierLoginParam));
|
return Result.Success(SUCCESS, supplierLoginService.cTripLoginPCHtml(supplierLoginParam));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ import com.chint.interfaces.rest.bpm.dto.orderdetail.FlightOrderDetailDto;
|
||||||
import com.chint.interfaces.rest.bpm.dto.orderdetail.HotelOrderDetailDto;
|
import com.chint.interfaces.rest.bpm.dto.orderdetail.HotelOrderDetailDto;
|
||||||
import com.chint.interfaces.rest.bpm.dto.orderdetail.TrainOrderDetailDto;
|
import com.chint.interfaces.rest.bpm.dto.orderdetail.TrainOrderDetailDto;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
@ -26,9 +25,9 @@ import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.StringJoiner;
|
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import static com.chint.application.queryies.util.QueryUtil.reGetReceiptsNum;
|
||||||
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
|
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
|
||||||
import static com.chint.infrastructure.constant.FSSCConstant.FSSC_ORDER_STATUS_CANCEL;
|
import static com.chint.infrastructure.constant.FSSCConstant.FSSC_ORDER_STATUS_CANCEL;
|
||||||
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y;
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y;
|
||||||
|
@ -107,7 +106,7 @@ public class OrderDetailQuery {
|
||||||
|
|
||||||
String receiptsNum = hotelOrderDetail.getReceiptsNum();
|
String receiptsNum = hotelOrderDetail.getReceiptsNum();
|
||||||
if (receiptsNum != null) {
|
if (receiptsNum != null) {
|
||||||
hotelOrderDetail.setReceiptsNum(regetReceiptsNum(receiptsNum));
|
hotelOrderDetail.setReceiptsNum(reGetReceiptsNum(receiptsNum));
|
||||||
}
|
}
|
||||||
// 仅当订单是“临时订单数据”时,不加入结果列表
|
// 仅当订单是“临时订单数据”时,不加入结果列表
|
||||||
if (orderDetail.getSupplierName().equals(SUPPLIER_L_Y) &&
|
if (orderDetail.getSupplierName().equals(SUPPLIER_L_Y) &&
|
||||||
|
@ -137,7 +136,7 @@ public class OrderDetailQuery {
|
||||||
|
|
||||||
String receiptsNum = trainOrderDetail.getReceiptsNum();
|
String receiptsNum = trainOrderDetail.getReceiptsNum();
|
||||||
if (receiptsNum != null) {
|
if (receiptsNum != null) {
|
||||||
trainOrderDetail.setReceiptsNum(regetReceiptsNum(receiptsNum));
|
trainOrderDetail.setReceiptsNum(reGetReceiptsNum(receiptsNum));
|
||||||
}
|
}
|
||||||
TrainOrderDetailDto orderDetailDto = TrainOrderDetailDto.copyFrom(trainOrderDetail);
|
TrainOrderDetailDto orderDetailDto = TrainOrderDetailDto.copyFrom(trainOrderDetail);
|
||||||
RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId());
|
RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId());
|
||||||
|
@ -168,7 +167,7 @@ public class OrderDetailQuery {
|
||||||
|
|
||||||
String receiptsNum = carOrderDetail.getReceiptsNum();
|
String receiptsNum = carOrderDetail.getReceiptsNum();
|
||||||
if (receiptsNum != null) {
|
if (receiptsNum != null) {
|
||||||
carOrderDetail.setReceiptsNum(regetReceiptsNum(receiptsNum));
|
carOrderDetail.setReceiptsNum(reGetReceiptsNum(receiptsNum));
|
||||||
}
|
}
|
||||||
|
|
||||||
//如果订单的状态处于开始时间有, 结束时间无的状态 ,那么该订单处于进行中,暂时返回null
|
//如果订单的状态处于开始时间有, 结束时间无的状态 ,那么该订单处于进行中,暂时返回null
|
||||||
|
@ -198,7 +197,7 @@ public class OrderDetailQuery {
|
||||||
|
|
||||||
String receiptsNum = flightOrderDetail.getReceiptsNum();
|
String receiptsNum = flightOrderDetail.getReceiptsNum();
|
||||||
if (receiptsNum != null) {
|
if (receiptsNum != null) {
|
||||||
flightOrderDetail.setReceiptsNum(regetReceiptsNum(receiptsNum));
|
flightOrderDetail.setReceiptsNum(reGetReceiptsNum(receiptsNum));
|
||||||
}
|
}
|
||||||
FlightOrderDetailDto orderDetailDto = FlightOrderDetailDto.copyFrom(flightOrderDetail);
|
FlightOrderDetailDto orderDetailDto = FlightOrderDetailDto.copyFrom(flightOrderDetail);
|
||||||
|
|
||||||
|
@ -243,12 +242,5 @@ public class OrderDetailQuery {
|
||||||
return new PageResult<>(total, OrderDetailResList);
|
return new PageResult<>(total, OrderDetailResList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String regetReceiptsNum(String receiptsNum) {
|
|
||||||
if (receiptsNum.contains("-")) {
|
|
||||||
String[] parts = receiptsNum.split("-");
|
|
||||||
return parts[1];
|
|
||||||
} else {
|
|
||||||
return receiptsNum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.chint.application.queryies.util;
|
||||||
|
|
||||||
|
public class QueryUtil {
|
||||||
|
|
||||||
|
public static String reGetReceiptsNum(String receiptsNum) {
|
||||||
|
if (receiptsNum.contains("-")) {
|
||||||
|
String[] split = receiptsNum.split("-");
|
||||||
|
receiptsNum = split[1];
|
||||||
|
}
|
||||||
|
if(receiptsNum.contains("#")){
|
||||||
|
String[] split1 = receiptsNum.split("#");
|
||||||
|
receiptsNum = split1[0];
|
||||||
|
}
|
||||||
|
return receiptsNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -5,6 +5,8 @@ import com.chint.domain.aggregates.order.RouteOrder;
|
||||||
import com.chint.domain.aggregates.user.User;
|
import com.chint.domain.aggregates.user.User;
|
||||||
import com.chint.domain.repository.RouteRepository;
|
import com.chint.domain.repository.RouteRepository;
|
||||||
import com.chint.infrastructure.util.BaseContext;
|
import com.chint.infrastructure.util.BaseContext;
|
||||||
|
import com.chint.interfaces.rest.base.dto.H5LoginResponse;
|
||||||
|
import com.chint.interfaces.rest.base.dto.PCLoginResponse;
|
||||||
import com.chint.interfaces.rest.ctrip.CTripLoginRequest;
|
import com.chint.interfaces.rest.ctrip.CTripLoginRequest;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.login.H5Response;
|
import com.chint.interfaces.rest.ctrip.dto.login.H5Response;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.login.PCResponse;
|
import com.chint.interfaces.rest.ctrip.dto.login.PCResponse;
|
||||||
|
@ -38,19 +40,19 @@ public class SupplierLoginService {
|
||||||
return lyLoginRequest.loginPC(L_Y_ENTRANCE_HOME, getEmployeeNo(supplierLoginParam.getRouteId()));
|
return lyLoginRequest.loginPC(L_Y_ENTRANCE_HOME, getEmployeeNo(supplierLoginParam.getRouteId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public H5Response cTripLogin(SupplierLoginParam supplierLoginParam) {
|
public H5LoginResponse cTripLogin(SupplierLoginParam supplierLoginParam) {
|
||||||
return cTripLoginRequest.hSingleLogin(getEmployeeNo(supplierLoginParam.getRouteId()));
|
return cTripLoginRequest.hSingleLogin(getEmployeeNo(supplierLoginParam.getRouteId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public PCResponse cTripLoginPC(SupplierLoginParam supplierLoginParam) {
|
public PCLoginResponse cTripLoginPC(SupplierLoginParam supplierLoginParam) {
|
||||||
return cTripLoginRequest.authLogin(getEmployeeNo(supplierLoginParam.getRouteId()));
|
return cTripLoginRequest.authLogin(getEmployeeNo(supplierLoginParam.getRouteId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public H5Response cTripLoginHtml(SupplierLoginParam supplierLoginParam) {
|
public H5LoginResponse cTripLoginHtml(SupplierLoginParam supplierLoginParam) {
|
||||||
return cTripLoginRequest.hSingleLoginHtml(getEmployeeNo(supplierLoginParam.getRouteId()));
|
return cTripLoginRequest.hSingleLoginHtml(getEmployeeNo(supplierLoginParam.getRouteId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public PCResponse cTripLoginPCHtml(SupplierLoginParam supplierLoginParam) {
|
public PCLoginResponse cTripLoginPCHtml(SupplierLoginParam supplierLoginParam) {
|
||||||
return cTripLoginRequest.authLoginHtml(getEmployeeNo(supplierLoginParam.getRouteId()));
|
return cTripLoginRequest.authLoginHtml(getEmployeeNo(supplierLoginParam.getRouteId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,6 @@ public class SystemAnnouncement implements Serializable {
|
||||||
if (expiryDate.isBefore(LocalDateTime.now())) {
|
if (expiryDate.isBefore(LocalDateTime.now())) {
|
||||||
this.setStatus("0");
|
this.setStatus("0");
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@ package com.chint.infrastructure.constant;
|
||||||
|
|
||||||
public class AmapConstant {
|
public class AmapConstant {
|
||||||
public static final String USER_CREATE_PATH = "/ws/boss/enterprise/openapi/employee/create";
|
public static final String USER_CREATE_PATH = "/ws/boss/enterprise/openapi/employee/create";
|
||||||
public static final String USER_UPDATE_PATH = "/ws/boss/enterprise/openapi/employee/query";
|
public static final String USER_UPDATE_PATH = "/ws/boss/enterprise/openapi/employee/update";
|
||||||
public static final String USER_QUERY_PATH = "/ws/boss/enterprise/openapi/employee/update";
|
public static final String USER_QUERY_PATH = "/ws/boss/enterprise/openapi/employee/query";
|
||||||
public static final String USER_DELETE_PATH = "/ws/boss/enterprise/openapi/employee/delete";
|
public static final String USER_DELETE_PATH = "/ws/boss/enterprise/openapi/employee/delete";
|
||||||
|
|
||||||
//token地址
|
//token地址
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.chint.infrastructure.repository;
|
package com.chint.infrastructure.repository;
|
||||||
|
|
||||||
import com.chint.application.dtos.OrderRecordQueryDTO;
|
import com.chint.application.dtos.OrderRecordQueryDTO;
|
||||||
|
import com.chint.application.queryies.util.QueryUtil;
|
||||||
import com.chint.domain.aggregates.order.order_record.OrderCarRecord;
|
import com.chint.domain.aggregates.order.order_record.OrderCarRecord;
|
||||||
import com.chint.domain.repository.OrderCarRecordRepository;
|
import com.chint.domain.repository.OrderCarRecordRepository;
|
||||||
import com.chint.infrastructure.repository.jdbc.JdbcOrderCarRecordRepository;
|
import com.chint.infrastructure.repository.jdbc.JdbcOrderCarRecordRepository;
|
||||||
|
@ -142,6 +143,7 @@ public class OrderCarRecordRepositoryImpl implements OrderCarRecordRepository {
|
||||||
record.setBelongDepart(rs.getString("belong_depart"));
|
record.setBelongDepart(rs.getString("belong_depart"));
|
||||||
return record;
|
return record;
|
||||||
});
|
});
|
||||||
|
orderCarRecords.forEach(it->it.setReceiptsNum(QueryUtil.reGetReceiptsNum(it.getReceiptsNum())));
|
||||||
return PageResult.totalPageNum(totalRecords == null ? 0 : totalRecords, orderCarRecords);
|
return PageResult.totalPageNum(totalRecords == null ? 0 : totalRecords, orderCarRecords);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.chint.infrastructure.repository;
|
package com.chint.infrastructure.repository;
|
||||||
|
|
||||||
import com.chint.application.dtos.OrderRecordQueryDTO;
|
import com.chint.application.dtos.OrderRecordQueryDTO;
|
||||||
|
import com.chint.application.queryies.util.QueryUtil;
|
||||||
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
|
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
|
||||||
import com.chint.domain.repository.OrderFlightRecordRepository;
|
import com.chint.domain.repository.OrderFlightRecordRepository;
|
||||||
import com.chint.infrastructure.repository.jdbc.JdbcOrderFlightRecordRepository;
|
import com.chint.infrastructure.repository.jdbc.JdbcOrderFlightRecordRepository;
|
||||||
|
@ -73,7 +74,7 @@ public class OrderFlightRecordRepositoryImpl implements OrderFlightRecordReposit
|
||||||
public PageResult<OrderFlightRecord> findByRecordParam(OrderRecordQueryDTO queryDTO) {
|
public PageResult<OrderFlightRecord> findByRecordParam(OrderRecordQueryDTO queryDTO) {
|
||||||
StringJoiner whereClause = new StringJoiner(" AND ", " WHERE ", "");
|
StringJoiner whereClause = new StringJoiner(" AND ", " WHERE ", "");
|
||||||
MapSqlParameterSource parameters = new MapSqlParameterSource();
|
MapSqlParameterSource parameters = new MapSqlParameterSource();
|
||||||
loadQuerySql(whereClause,parameters,queryDTO);
|
loadQuerySql(whereClause, parameters, queryDTO);
|
||||||
// 计算OFFSET(跳过的行数)
|
// 计算OFFSET(跳过的行数)
|
||||||
int offset = (queryDTO.getPageNum() - 1) * queryDTO.getPageSize();
|
int offset = (queryDTO.getPageNum() - 1) * queryDTO.getPageSize();
|
||||||
String sql = "SELECT * FROM order_flight_record" + whereClause + " ORDER BY detail_id ASC LIMIT :limit OFFSET :offset";
|
String sql = "SELECT * FROM order_flight_record" + whereClause + " ORDER BY detail_id ASC LIMIT :limit OFFSET :offset";
|
||||||
|
@ -155,6 +156,7 @@ public class OrderFlightRecordRepositoryImpl implements OrderFlightRecordReposit
|
||||||
record.setBelongDepart(rs.getString("belong_depart"));
|
record.setBelongDepart(rs.getString("belong_depart"));
|
||||||
return record;
|
return record;
|
||||||
});
|
});
|
||||||
|
orderFlightRecords.forEach(it->it.setReceiptsNum(QueryUtil.reGetReceiptsNum(it.getReceiptsNum())));
|
||||||
return PageResult.totalPageNum(totalRecords == null ? 0 : totalRecords, orderFlightRecords);
|
return PageResult.totalPageNum(totalRecords == null ? 0 : totalRecords, orderFlightRecords);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.chint.infrastructure.repository;
|
package com.chint.infrastructure.repository;
|
||||||
|
|
||||||
import com.chint.application.dtos.OrderRecordQueryDTO;
|
import com.chint.application.dtos.OrderRecordQueryDTO;
|
||||||
|
import com.chint.application.queryies.util.QueryUtil;
|
||||||
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
|
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
|
||||||
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
|
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
|
||||||
import com.chint.domain.repository.OrderHotelRecordRepository;
|
import com.chint.domain.repository.OrderHotelRecordRepository;
|
||||||
|
@ -85,7 +86,7 @@ public class OrderHotelRecordRepositoryImpl implements OrderHotelRecordRepositor
|
||||||
String countSql = "SELECT COUNT(*) FROM order_hotel_record" + whereClause;
|
String countSql = "SELECT COUNT(*) FROM order_hotel_record" + whereClause;
|
||||||
Integer totalRecords = jdbcTemplate.queryForObject(countSql, parameters, Integer.class);
|
Integer totalRecords = jdbcTemplate.queryForObject(countSql, parameters, Integer.class);
|
||||||
|
|
||||||
List<OrderHotelRecord> orderFlightRecords = jdbcTemplate.query(sql, parameters, (rs, rowNum) -> {
|
List<OrderHotelRecord> orderHotelRecords = jdbcTemplate.query(sql, parameters, (rs, rowNum) -> {
|
||||||
OrderHotelRecord record = new OrderHotelRecord();
|
OrderHotelRecord record = new OrderHotelRecord();
|
||||||
// 基本类型
|
// 基本类型
|
||||||
record.setId(rs.getLong("id"));
|
record.setId(rs.getLong("id"));
|
||||||
|
@ -154,6 +155,7 @@ public class OrderHotelRecordRepositoryImpl implements OrderHotelRecordRepositor
|
||||||
record.setBelongDepart(rs.getString("belong_depart"));
|
record.setBelongDepart(rs.getString("belong_depart"));
|
||||||
return record;
|
return record;
|
||||||
});
|
});
|
||||||
return PageResult.totalPageNum(totalRecords == null ? 0 : totalRecords, orderFlightRecords);
|
orderHotelRecords.forEach(it->it.setReceiptsNum(QueryUtil.reGetReceiptsNum(it.getReceiptsNum())));
|
||||||
|
return PageResult.totalPageNum(totalRecords == null ? 0 : totalRecords, orderHotelRecords);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.chint.infrastructure.repository;
|
package com.chint.infrastructure.repository;
|
||||||
|
|
||||||
import com.chint.application.dtos.OrderRecordQueryDTO;
|
import com.chint.application.dtos.OrderRecordQueryDTO;
|
||||||
|
import com.chint.application.queryies.util.QueryUtil;
|
||||||
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
|
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
|
||||||
import com.chint.domain.aggregates.order.order_record.OrderTrainRecord;
|
import com.chint.domain.aggregates.order.order_record.OrderTrainRecord;
|
||||||
import com.chint.domain.repository.OrderTrainRecordRepository;
|
import com.chint.domain.repository.OrderTrainRecordRepository;
|
||||||
|
@ -151,6 +152,7 @@ public class OrderTrainRecordRepositoryImpl implements OrderTrainRecordRepositor
|
||||||
record.setBelongDepart(rs.getString("belong_depart"));
|
record.setBelongDepart(rs.getString("belong_depart"));
|
||||||
return record;
|
return record;
|
||||||
});
|
});
|
||||||
|
orderTrainRecords.forEach(it->it.setReceiptsNum(QueryUtil.reGetReceiptsNum(it.getReceiptsNum())));
|
||||||
return PageResult.totalPageNum(totalRecords == null ? 0 : totalRecords, orderTrainRecords);
|
return PageResult.totalPageNum(totalRecords == null ? 0 : totalRecords, orderTrainRecords);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.chint.interfaces.rest.amap;
|
||||||
|
|
||||||
|
import com.chint.interfaces.rest.amap.request.TokenRequest;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class AmapLoginRequest {
|
||||||
|
|
||||||
|
private TokenRequest tokenRequest;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -2,20 +2,23 @@ package com.chint.interfaces.rest.amap;
|
||||||
|
|
||||||
import com.chint.domain.aggregates.user.User;
|
import com.chint.domain.aggregates.user.User;
|
||||||
import com.chint.domain.repository.UserNameRepository;
|
import com.chint.domain.repository.UserNameRepository;
|
||||||
import com.chint.interfaces.rest.base.PostRequest;
|
import com.chint.interfaces.rest.amap.dto.UserQueryResponse;
|
||||||
|
import com.chint.interfaces.rest.amap.request.AmapRequest;
|
||||||
import com.chint.interfaces.rest.user.UserHttpRequest;
|
import com.chint.interfaces.rest.user.UserHttpRequest;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
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.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.AmapConstant.USER_CREATE_PATH;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.chint.infrastructure.constant.AmapConstant.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class AmapUserRequest {
|
public class AmapUserRequest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PostRequest postRequest;
|
private AmapRequest amapRequest;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserNameRepository userNameRepository;
|
private UserNameRepository userNameRepository;
|
||||||
|
@ -23,25 +26,38 @@ public class AmapUserRequest {
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserHttpRequest userHttpRequest;
|
private UserHttpRequest userHttpRequest;
|
||||||
|
|
||||||
//应用ID
|
|
||||||
@Value("${amap.appId}")
|
|
||||||
private String appId;
|
|
||||||
|
|
||||||
@Value("${amap.eId}")
|
|
||||||
private String eId;
|
|
||||||
|
|
||||||
@Value("${amap.baseUrl}")
|
@Value("${amap.baseUrl}")
|
||||||
private String BaseUrl;
|
private String BaseUrl;
|
||||||
|
|
||||||
@Value("${amap.signKey}")
|
public BaseResponse syncUser(User user) {
|
||||||
private String signKey;
|
UserQueryResponse userQueryResponse = queryUser(user);
|
||||||
|
List<UserQueryResponse.UserDate> data = userQueryResponse.getData();
|
||||||
|
if (data == null || data.isEmpty()) {
|
||||||
|
return createUser(user);
|
||||||
|
} else {
|
||||||
|
return updateUser(user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public BaseResponse createUser(User user) {
|
public BaseResponse createUser(User user) {
|
||||||
String createUserUrl = BaseUrl + USER_CREATE_PATH;
|
String createUserUrl = BaseUrl + USER_CREATE_PATH;
|
||||||
BaseRequestParam baseRequestParam = createUserParamByUser(user).generateSign(signKey);
|
BaseRequestParam baseRequestParam = createUserParamByUser(user);
|
||||||
return postRequest.postSend(createUserUrl, baseRequestParam, BaseResponse.class);
|
return amapRequest.post(createUserUrl, baseRequestParam, BaseResponse.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UserQueryResponse queryUser(User user) {
|
||||||
|
String queryUserUrl = BaseUrl + USER_QUERY_PATH;
|
||||||
|
UserQueryParam userQueryParam = new UserQueryParam();
|
||||||
|
userQueryParam.setUserId(user.getEmployeeNo());
|
||||||
|
return amapRequest.post(queryUserUrl, userQueryParam, UserQueryResponse.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseResponse updateUser(User user) {
|
||||||
|
String updateUserUrl = BaseUrl + USER_UPDATE_PATH;
|
||||||
|
BaseRequestParam baseRequestParam = createUserParamByUser(user);
|
||||||
|
return amapRequest.post(updateUserUrl, baseRequestParam, BaseResponse.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class UserParam extends BaseRequestParam {
|
public static class UserParam extends BaseRequestParam {
|
||||||
|
@ -61,12 +77,33 @@ public class AmapUserRequest {
|
||||||
private String projectIdList;
|
private String projectIdList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class UserQueryParam extends BaseRequestParam {
|
||||||
|
private String userId; // 用户Id
|
||||||
|
private String mobile; // 手机号
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class UserInfo extends BaseRequestParam {
|
||||||
|
private UserInfo userInfo;
|
||||||
|
private String userId; // 用户Id
|
||||||
|
private String mobile; // 手机号
|
||||||
|
// The rest of the fields as defined in your request body image
|
||||||
|
private String cardId;
|
||||||
|
private String realName;
|
||||||
|
private String departmentId;
|
||||||
|
private String immediateSuperiorUserId;
|
||||||
|
private String email;
|
||||||
|
private Integer status;
|
||||||
|
private String extInfo;
|
||||||
|
private String baseAdCode;
|
||||||
|
private String employeeGroupName;
|
||||||
|
private String regulationList;
|
||||||
|
private String projectIdList;
|
||||||
|
}
|
||||||
|
|
||||||
public UserParam createUserParamByUser(User user) {
|
public UserParam createUserParamByUser(User user) {
|
||||||
UserParam userParam = new UserParam();
|
UserParam userParam = new UserParam();
|
||||||
userParam.setAppId(appId);
|
|
||||||
userParam.setEnt(4);
|
|
||||||
userParam.setTimestamp(String.valueOf(System.currentTimeMillis()));
|
|
||||||
userParam.setEid(eId);
|
|
||||||
userParam.setUserId(user.getEmployeeNo());
|
userParam.setUserId(user.getEmployeeNo());
|
||||||
userParam.setEmail(user.getEmail());
|
userParam.setEmail(user.getEmail());
|
||||||
userParam.setMobile(user.getPhoneNumber());
|
userParam.setMobile(user.getPhoneNumber());
|
||||||
|
|
|
@ -3,6 +3,9 @@ package com.chint.interfaces.rest.amap;
|
||||||
import com.chint.infrastructure.util.SignUtils;
|
import com.chint.infrastructure.util.SignUtils;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class BaseRequestParam {
|
public class BaseRequestParam {
|
||||||
// 应用ID,根据业务场景填写
|
// 应用ID,根据业务场景填写
|
||||||
|
@ -16,6 +19,18 @@ public class BaseRequestParam {
|
||||||
// 时间戳,标记请求发送时间
|
// 时间戳,标记请求发送时间
|
||||||
private String timestamp;
|
private String timestamp;
|
||||||
|
|
||||||
|
public BaseRequestParam generateSign(String appId, Integer eid, Integer ent, String signKey) {
|
||||||
|
this.appId = appId;
|
||||||
|
this.timestamp = LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant().toString();
|
||||||
|
try {
|
||||||
|
String sign = SignUtils.generateSignature(this, signKey);
|
||||||
|
this.sign = sign;
|
||||||
|
return this;
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public BaseRequestParam generateSign(String signKey) {
|
public BaseRequestParam generateSign(String signKey) {
|
||||||
try {
|
try {
|
||||||
String sign = SignUtils.generateSignature(this, signKey);
|
String sign = SignUtils.generateSignature(this, signKey);
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.chint.interfaces.rest.amap.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UserQueryResponse {
|
||||||
|
public Boolean result;
|
||||||
|
public String traceId;
|
||||||
|
public Integer code;
|
||||||
|
public List<UserDate> data;
|
||||||
|
public String message;
|
||||||
|
public String version;
|
||||||
|
public Long timestamp;
|
||||||
|
|
||||||
|
@lombok.Data
|
||||||
|
public static class UserDate {
|
||||||
|
public String baseAdCode;
|
||||||
|
public String baseCityName;
|
||||||
|
public String departmentId;
|
||||||
|
public Integer eid;
|
||||||
|
public String email;
|
||||||
|
public String employeeGroupCode;
|
||||||
|
public String extInfo;
|
||||||
|
public Integer gdUserId;
|
||||||
|
public String immediateSuperiorUserId;
|
||||||
|
public String mobile;
|
||||||
|
public String realName;
|
||||||
|
public List<String> regulationIdList;
|
||||||
|
public String remark;
|
||||||
|
public Integer totalQuota;
|
||||||
|
public String userId;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,89 @@
|
||||||
|
package com.chint.interfaces.rest.amap.util;
|
||||||
|
|
||||||
|
import com.chint.interfaces.rest.amap.BaseRequestParam;
|
||||||
|
import com.google.common.base.Charsets;
|
||||||
|
import com.google.common.hash.Hashing;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||||
|
import org.apache.http.message.BasicNameValuePair;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
|
public class ParamUtil {
|
||||||
|
|
||||||
|
private final static Gson gson = new Gson();
|
||||||
|
|
||||||
|
public static UrlEncodedFormEntity convertObjectToUrlEncodedFormEntity(BaseRequestParam obj, String charset, String signKey) throws Exception {
|
||||||
|
List<BasicNameValuePair> formParams = new ArrayList<>();
|
||||||
|
Class<? extends BaseRequestParam> clazz = obj.getClass();
|
||||||
|
Class<?> superclass = clazz.getSuperclass();
|
||||||
|
Field[] declaredFields = superclass.getDeclaredFields();
|
||||||
|
Field[] fields = clazz.getDeclaredFields();
|
||||||
|
|
||||||
|
// 创建一个新数组,长度为两个原始数组长度之和
|
||||||
|
Field[] combinedArray = new Field[declaredFields.length + fields.length];
|
||||||
|
|
||||||
|
// 复制第一个数组到新数组
|
||||||
|
System.arraycopy(declaredFields, 0, combinedArray, 0, declaredFields.length);
|
||||||
|
// 复制第二个数组到新数组,开始位置是第一个数组长度
|
||||||
|
System.arraycopy(fields, 0, combinedArray, declaredFields.length, fields.length);
|
||||||
|
|
||||||
|
for (Field field : combinedArray) {
|
||||||
|
try {
|
||||||
|
field.setAccessible(true);
|
||||||
|
Object value = field.get(obj);
|
||||||
|
if (value != null) {
|
||||||
|
// 检查字段类型是否为基本类型或字符串
|
||||||
|
if (isPrimitiveOrWrapper(value.getClass()) || value instanceof String) {
|
||||||
|
formParams.add(new BasicNameValuePair(field.getName(), value.toString()));
|
||||||
|
} else {
|
||||||
|
// 将复杂类型对象转换为JSON字符串
|
||||||
|
String json = gson.toJson(value);
|
||||||
|
formParams.add(new BasicNameValuePair(field.getName(), json));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StringJoiner joiner = new StringJoiner("&");
|
||||||
|
List<Field> fieldList = Arrays.asList(fields);
|
||||||
|
for (Field field : fieldList) {
|
||||||
|
field.setAccessible(true);
|
||||||
|
String fieldName = field.getName();
|
||||||
|
String methodName = "get" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
|
||||||
|
Method method;
|
||||||
|
try {
|
||||||
|
method = clazz.getMethod(methodName);
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
continue; // If there's no getter method, skip this field
|
||||||
|
}
|
||||||
|
Object value = method.invoke(obj);
|
||||||
|
if (value != null && !fieldName.equals("sign")) { // Skip the 'sign' field
|
||||||
|
joiner.add(fieldName + "=" + value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String res = joiner + "@" + signKey;
|
||||||
|
String sign = Hashing.md5().hashString(res, Charsets.UTF_8).toString().toUpperCase();
|
||||||
|
formParams.add(new BasicNameValuePair("sign", sign));
|
||||||
|
try {
|
||||||
|
return new UrlEncodedFormEntity(formParams, charset);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isPrimitiveOrWrapper(Class<?> type) {
|
||||||
|
return type.isPrimitive() || type == Double.class || type == Float.class || type == Long.class ||
|
||||||
|
type == Integer.class || type == Short.class || type == Character.class || type == Byte.class ||
|
||||||
|
type == Boolean.class || type == String.class;
|
||||||
|
}
|
||||||
|
}
|
|
@ -52,38 +52,23 @@ public class PostRequest {
|
||||||
String json = gson.toJson(jsonRequest);
|
String json = gson.toJson(jsonRequest);
|
||||||
log.info(json);
|
log.info(json);
|
||||||
post.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));
|
post.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));
|
||||||
String responseBody = null;
|
return post(post, responseType);
|
||||||
HttpEntity responseEntity = null;
|
|
||||||
HttpResponse response = null;
|
|
||||||
try {
|
|
||||||
response = client.execute(post);
|
|
||||||
responseEntity = response.getEntity();
|
|
||||||
responseBody = EntityUtils.toString(responseEntity, "UTF-8");
|
|
||||||
log.info(responseBody);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
return gson.fromJson(responseBody, responseType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <T> T post(String url, UrlEncodedFormEntity entity, Class<T> responseType) {
|
||||||
|
HttpPost post = new HttpPost(url);
|
||||||
|
post.setEntity(entity);
|
||||||
|
return post(post, responseType);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public <T> T post(String headName, String headValue, String url, Object jsonRequest, Class<T> responseType) {
|
public <T> T post(String headName, String headValue, String url, Object jsonRequest, Class<T> responseType) {
|
||||||
HttpPost post = new HttpPost(url);
|
HttpPost post = new HttpPost(url);
|
||||||
post.addHeader(headName, headValue);
|
post.addHeader(headName, headValue);
|
||||||
String json = gson.toJson(jsonRequest);
|
String json = gson.toJson(jsonRequest);
|
||||||
log.info(json);
|
log.info(json);
|
||||||
post.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));
|
post.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));
|
||||||
String responseBody = null;
|
return post(post, responseType);
|
||||||
HttpEntity responseEntity = null;
|
|
||||||
HttpResponse response = null;
|
|
||||||
try {
|
|
||||||
response = client.execute(post);
|
|
||||||
responseEntity = response.getEntity();
|
|
||||||
responseBody = EntityUtils.toString(responseEntity, "UTF-8");
|
|
||||||
log.info(responseBody);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
return gson.fromJson(responseBody, responseType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> T post(HttpPost post, Class<T> responseType) {
|
public <T> T post(HttpPost post, Class<T> responseType) {
|
||||||
|
@ -196,41 +181,19 @@ public class PostRequest {
|
||||||
|
|
||||||
public <T> T postANBPM(String url, Object jsonRequest, Class<T> responseType) {
|
public <T> T postANBPM(String url, Object jsonRequest, Class<T> responseType) {
|
||||||
HttpPost post = new HttpPost(url);
|
HttpPost post = new HttpPost(url);
|
||||||
String json = JSON.toJSONString(jsonRequest);
|
String json = gson.toJson(jsonRequest);
|
||||||
log.info(json);
|
log.info(json);
|
||||||
post.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));
|
post.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));
|
||||||
String responseBody = null;
|
return post(post, responseType);
|
||||||
HttpEntity responseEntity = null;
|
|
||||||
HttpResponse response = null;
|
|
||||||
try {
|
|
||||||
response = client.execute(post);
|
|
||||||
responseEntity = response.getEntity();
|
|
||||||
responseBody = EntityUtils.toString(responseEntity, "UTF-8");
|
|
||||||
log.info(responseBody);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
return gson.fromJson(responseBody, responseType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public <T> T postJSON(String url, Object jsonRequest, Class<T> responseType) {
|
public <T> T postJSON(String url, Object jsonRequest, Class<T> responseType) {
|
||||||
HttpPost post = new HttpPost(url);
|
HttpPost post = new HttpPost(url);
|
||||||
String json = JSON.toJSONString(jsonRequest);
|
String json = gson.toJson(jsonRequest);
|
||||||
log.info(json);
|
log.info(json);
|
||||||
post.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));
|
post.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));
|
||||||
String responseBody = null;
|
return post(post, responseType);
|
||||||
HttpEntity responseEntity = null;
|
|
||||||
HttpResponse response = null;
|
|
||||||
try {
|
|
||||||
response = client.execute(post);
|
|
||||||
responseEntity = response.getEntity();
|
|
||||||
responseBody = EntityUtils.toString(responseEntity, "UTF-8");
|
|
||||||
log.info(responseBody);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
return JSON.parseObject(responseBody, responseType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Gson gson() {
|
public Gson gson() {
|
||||||
|
@ -241,7 +204,6 @@ public class PostRequest {
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getReDirectUrl(String url) {
|
public String getReDirectUrl(String url) {
|
||||||
CloseableHttpClient client = HttpClients.createDefault();
|
CloseableHttpClient client = HttpClients.createDefault();
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.chint.interfaces.rest.base.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class H5LoginResponse {
|
||||||
|
private String redirectUrl;
|
||||||
|
private String htmlContent;
|
||||||
|
private boolean success;
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.chint.interfaces.rest.base.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PCLoginResponse {
|
||||||
|
private String redirectUrl;
|
||||||
|
private String htmlContent;
|
||||||
|
private boolean success;
|
||||||
|
}
|
|
@ -7,6 +7,8 @@ import com.chint.infrastructure.constant.CommonMessageConstant;
|
||||||
import com.chint.infrastructure.util.BaseContext;
|
import com.chint.infrastructure.util.BaseContext;
|
||||||
import com.chint.infrastructure.util.Digest;
|
import com.chint.infrastructure.util.Digest;
|
||||||
import com.chint.interfaces.rest.base.PostRequest;
|
import com.chint.interfaces.rest.base.PostRequest;
|
||||||
|
import com.chint.interfaces.rest.base.dto.H5LoginResponse;
|
||||||
|
import com.chint.interfaces.rest.base.dto.PCLoginResponse;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.login.*;
|
import com.chint.interfaces.rest.ctrip.dto.login.*;
|
||||||
import jakarta.annotation.PostConstruct;
|
import jakarta.annotation.PostConstruct;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -100,9 +102,9 @@ public class CTripLoginRequest {
|
||||||
return postRequest.post(loginUrl + IDPEntityID, loginParam, String.class);
|
return postRequest.post(loginUrl + IDPEntityID, loginParam, String.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PCResponse authLoginHtml(String employeeNo) {
|
public PCLoginResponse authLoginHtml(String employeeNo) {
|
||||||
String html = cTripPCLoginRequest(employeeNo);
|
String html = cTripPCLoginRequest(employeeNo);
|
||||||
PCResponse pcResponse = new PCResponse();
|
PCLoginResponse pcResponse = new PCLoginResponse();
|
||||||
pcResponse.setHtmlContent(html);
|
pcResponse.setHtmlContent(html);
|
||||||
String url = getPCUrlFromHtml(html);
|
String url = getPCUrlFromHtml(html);
|
||||||
pcResponse.setSuccess(true);
|
pcResponse.setSuccess(true);
|
||||||
|
@ -110,10 +112,10 @@ public class CTripLoginRequest {
|
||||||
return pcResponse;
|
return pcResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PCResponse authLogin(String employeeNo) {
|
public PCLoginResponse authLogin(String employeeNo) {
|
||||||
String body = cTripPCLoginRequest(employeeNo);
|
String body = cTripPCLoginRequest(employeeNo);
|
||||||
String url = getPCUrlFromHtml(body);
|
String url = getPCUrlFromHtml(body);
|
||||||
PCResponse pcResponse = new PCResponse();
|
PCLoginResponse pcResponse = new PCLoginResponse();
|
||||||
pcResponse.setRedirectUrl(url);
|
pcResponse.setRedirectUrl(url);
|
||||||
pcResponse.setSuccess(true);
|
pcResponse.setSuccess(true);
|
||||||
return pcResponse;
|
return pcResponse;
|
||||||
|
@ -185,19 +187,19 @@ public class CTripLoginRequest {
|
||||||
return h5TokenResponse.getToken();
|
return h5TokenResponse.getToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
public H5Response hSingleLoginHtml(String employeeNo){
|
public H5LoginResponse hSingleLoginHtml(String employeeNo){
|
||||||
String html = cTripLoginRequest(employeeNo);
|
String html = cTripLoginRequest(employeeNo);
|
||||||
String url = getUrlFromHtml(cTripLoginRequest(employeeNo));
|
String url = getUrlFromHtml(cTripLoginRequest(employeeNo));
|
||||||
H5Response h5Response = new H5Response();
|
H5LoginResponse h5Response = new H5LoginResponse();
|
||||||
h5Response.setSuccess(true);
|
h5Response.setSuccess(true);
|
||||||
h5Response.setHtmlContent(html);
|
h5Response.setHtmlContent(html);
|
||||||
h5Response.setRedirectUrl(url);
|
h5Response.setRedirectUrl(url);
|
||||||
return h5Response;
|
return h5Response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public H5Response hSingleLogin(String employeeNo) {
|
public H5LoginResponse hSingleLogin(String employeeNo) {
|
||||||
String url = getUrlFromHtml(cTripLoginRequest(employeeNo));
|
String url = getUrlFromHtml(cTripLoginRequest(employeeNo));
|
||||||
H5Response h5Response = new H5Response();
|
H5LoginResponse h5Response = new H5LoginResponse();
|
||||||
h5Response.setSuccess(true);
|
h5Response.setSuccess(true);
|
||||||
h5Response.setRedirectUrl(url);
|
h5Response.setRedirectUrl(url);
|
||||||
return h5Response;
|
return h5Response;
|
||||||
|
|
|
@ -7,6 +7,4 @@ public class ResponseStatus {
|
||||||
private Boolean Success;
|
private Boolean Success;
|
||||||
private int ErrorCode;
|
private int ErrorCode;
|
||||||
private String Message;
|
private String Message;
|
||||||
|
|
||||||
// Constructors, getters, and setters
|
|
||||||
}
|
}
|
|
@ -281,8 +281,6 @@ public class UserHttpRequestImpl implements UserHttpRequest {
|
||||||
public String belongDeport(String employeeNo, String accountCompanyName) {
|
public String belongDeport(String employeeNo, String accountCompanyName) {
|
||||||
User user = userRepository.findByUserEmployeeNo(employeeNo);
|
User user = userRepository.findByUserEmployeeNo(employeeNo);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
user = loadUserBaseInfo(User.withEmployeeNo(employeeNo));
|
user = loadUserBaseInfo(User.withEmployeeNo(employeeNo));
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
|
|
|
@ -3,10 +3,8 @@ package com.chint;
|
||||||
import com.chint.domain.aggregates.user.User;
|
import com.chint.domain.aggregates.user.User;
|
||||||
import com.chint.interfaces.rest.amap.AmapUserRequest;
|
import com.chint.interfaces.rest.amap.AmapUserRequest;
|
||||||
import com.chint.interfaces.rest.amap.BaseResponse;
|
import com.chint.interfaces.rest.amap.BaseResponse;
|
||||||
import com.chint.interfaces.rest.amap.dto.detail.OrderDetailResponse;
|
import com.chint.interfaces.rest.amap.token.TokenDto;
|
||||||
import com.chint.interfaces.rest.amap.dto.token.TokenDto;
|
import com.chint.interfaces.rest.amap.token.TokenResponse;
|
||||||
import com.chint.interfaces.rest.amap.dto.token.TokenResponse;
|
|
||||||
import com.chint.interfaces.rest.amap.request.OrderDetailRequest;
|
|
||||||
import com.chint.interfaces.rest.amap.request.TokenRequest;
|
import com.chint.interfaces.rest.amap.request.TokenRequest;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -21,14 +19,26 @@ public class AmapTest {
|
||||||
|
|
||||||
private Gson gson = new Gson();
|
private Gson gson = new Gson();
|
||||||
|
|
||||||
private User user = new User(1L, "230615020", 1, "卢麟哲", "1033719135@qq.com", "15857193365", "A30000001");
|
private User user = new User(1L, "230615020", 1, "卢麟哲", "lulz1@chint.com", "15857193365", "A30000001");
|
||||||
|
|
||||||
// @Test
|
@Test
|
||||||
public void createUser(){
|
public void createUser(){
|
||||||
BaseResponse baseResponse = amapUserRequest.createUser(user);
|
BaseResponse baseResponse = amapUserRequest.createUser(user);
|
||||||
System.out.println(gson.toJson(baseResponse));
|
System.out.println(gson.toJson(baseResponse));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void queryUser(){
|
||||||
|
UserQueryResponse userQueryResponse = amapUserRequest.queryUser(user);
|
||||||
|
System.out.println(gson.toJson(userQueryResponse));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void updateUser(){
|
||||||
|
BaseResponse baseResponse = amapUserRequest.updateUser(user);
|
||||||
|
System.out.println(gson.toJson(baseResponse));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TokenRequest tokenRequest;
|
private TokenRequest tokenRequest;
|
||||||
|
|
|
@ -18,6 +18,7 @@ import com.chint.infrastructure.util.BaseContext;
|
||||||
import com.chint.infrastructure.util.Digest;
|
import com.chint.infrastructure.util.Digest;
|
||||||
import com.chint.infrastructure.util.PinyinUtil;
|
import com.chint.infrastructure.util.PinyinUtil;
|
||||||
import com.chint.interfaces.rest.base.PostRequest;
|
import com.chint.interfaces.rest.base.PostRequest;
|
||||||
|
import com.chint.interfaces.rest.base.dto.PCLoginResponse;
|
||||||
import com.chint.interfaces.rest.ctrip.*;
|
import com.chint.interfaces.rest.ctrip.*;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.city.FlightCitySearchResponse;
|
import com.chint.interfaces.rest.ctrip.dto.city.FlightCitySearchResponse;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.country.CountryResponse;
|
import com.chint.interfaces.rest.ctrip.dto.country.CountryResponse;
|
||||||
|
@ -181,7 +182,7 @@ public class CTripTest {
|
||||||
//@Test
|
//@Test
|
||||||
void authLogin() {
|
void authLogin() {
|
||||||
BaseContext.setCurrentUser(user);
|
BaseContext.setCurrentUser(user);
|
||||||
PCResponse response = loginRequest.authLogin(null);
|
PCLoginResponse response = loginRequest.authLogin(null);
|
||||||
System.out.println(response.getRedirectUrl());
|
System.out.println(response.getRedirectUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -821,9 +821,9 @@ public class LYTest {
|
||||||
System.out.println(json);
|
System.out.println(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
@Test
|
||||||
void searchTrain() {
|
void searchTrain() {
|
||||||
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DT24032768188401512");
|
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DT24033168626574219");
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
String json = gson.toJson(trainOrderDetail);
|
String json = gson.toJson(trainOrderDetail);
|
||||||
System.out.println(json);
|
System.out.println(json);
|
||||||
|
|
|
@ -280,7 +280,7 @@ class RouteApplicationTests {
|
||||||
|
|
||||||
// @Test
|
// @Test
|
||||||
void loginSignProd() {
|
void loginSignProd() {
|
||||||
String sfno = "240412063";
|
String sfno = "231008023";
|
||||||
String syscode = "FSSC";
|
String syscode = "FSSC";
|
||||||
String billcode = "CLSQ240225000099";
|
String billcode = "CLSQ240225000099";
|
||||||
String companycode = "正泰集团股份有限公司";
|
String companycode = "正泰集团股份有限公司";
|
||||||
|
@ -347,7 +347,7 @@ class RouteApplicationTests {
|
||||||
System.out.println(Arrays.toString(ids.toArray()));
|
System.out.println(Arrays.toString(ids.toArray()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
@Test
|
||||||
void deleteRouteByEmployeeNo() {
|
void deleteRouteByEmployeeNo() {
|
||||||
List<RouteOrder> byEmployeeNo = routeRepository.findByEmployeeNo("230615020");
|
List<RouteOrder> byEmployeeNo = routeRepository.findByEmployeeNo("230615020");
|
||||||
for (RouteOrder routeOrder : byEmployeeNo) {
|
for (RouteOrder routeOrder : byEmployeeNo) {
|
||||||
|
@ -1259,18 +1259,17 @@ class RouteApplicationTests {
|
||||||
System.out.println(lastMonthStr());
|
System.out.println(lastMonthStr());
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
@Test
|
||||||
void testsplit2(){
|
void testsplit2(){
|
||||||
String inputOrderNo = "FSSC-CLSQ240409000001dev#NBWSAW";
|
String receiptsNum = "FSSC-CLSQ240409000001dev#NBWSAW";
|
||||||
String orderNo = null;
|
if (receiptsNum.contains("-")) {
|
||||||
if (inputOrderNo.contains("-")) {
|
String[] split = receiptsNum.split("-");
|
||||||
String[] split = inputOrderNo.split("-");
|
receiptsNum = split[1];
|
||||||
orderNo = split[1];
|
|
||||||
if(orderNo.contains("#")){
|
|
||||||
String[] split1 = orderNo.split("#");
|
|
||||||
orderNo = split1[0];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
System.out.println(orderNo);
|
if(receiptsNum.contains("#")){
|
||||||
|
String[] split1 = receiptsNum.split("#");
|
||||||
|
receiptsNum = split1[0];
|
||||||
|
}
|
||||||
|
System.out.println(receiptsNum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue