Compare commits

...

4 Commits

Author SHA1 Message Date
lulz1 276c05ee72 备份用户部门代码 2024-04-04 16:55:43 +08:00
lulz1 16935ccb5d Merge branch 'dev' of http://47.97.21.20:3000/echo/route into dev 2024-04-04 16:27:07 +08:00
lulz1 1e3e22bcb2 Merge remote-tracking branch 'origin/dev' into dev 2024-04-04 16:26:33 +08:00
dengwc 2dfc9e0490 结算明细字段映射调整 2024-04-03 17:32:53 +08:00
5 changed files with 61 additions and 26 deletions

View File

@ -588,8 +588,14 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
return orderHotelRecord;
}
private String belongDeport(String accountCompanyName, String employeeNo) {
private String belongDeport(String employeeNo, String accountCompanyName) {
User user = userRepository.findByUserEmployeeNo(employeeNo);
if (user == null) {
user = userHttpRequest.loadUserInfo(User.withEmployeeNo(employeeNo));
if (user == null) {
return null;
}
}
if (user.getUserDepartmentInfoList() == null || user.getUserDepartmentInfoList().isEmpty()) {
userHttpRequest.loadUserDeptInfo(user);
}

View File

@ -8,6 +8,7 @@ import com.chint.domain.aggregates.order.order_record.OrderTrainRecord;
import com.chint.domain.aggregates.order.order_record.ly_order_record.*;
import com.chint.infrastructure.repository.jdbc.*;
import com.chint.infrastructure.util.BeanCopyUtils;
import com.chint.interfaces.rest.bpm.dto.BPMResponse;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -22,8 +23,9 @@ import java.util.Optional;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import static com.chint.infrastructure.constant.BelongSystemConstant.TRAVAL_SYS_TYPE_LY;
import static com.chint.infrastructure.constant.BelongSystemConstant.*;
import static com.chint.infrastructure.constant.OrderRecordConstant.*;
import static com.chint.infrastructure.constant.RankConstant.OUT_OF_STANDARD;
/**
* 同程数据转换
@ -133,7 +135,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
.setPreServiceFee(String.valueOf(lyOrderFlightRecord.getServiceAmount())) //服务费
.setPostServiceFee("") //配送服务费
.setAirportTax(String.valueOf(lyOrderFlightRecord.getCapitalCost())) //机建费
.setChangeFee(String.valueOf(lyOrderFlightRecord.getChangeFee())) //改签手续费
.setChangeFee(String.valueOf(lyOrderFlightRecord.getChangeFee() - lyOrderFlightRecord.getUpgradeFee())) //改签手续费
.setFuelTax(String.valueOf(lyOrderFlightRecord.getFuelCost())) //燃油费
.setRefundFee(String.valueOf(lyOrderFlightRecord.getRefundFee())) //退票手续费
.setUpFee(String.valueOf(lyOrderFlightRecord.getUpgradeFee())) //改签差价
@ -371,7 +373,8 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
if (Objects.isNull(routeOrder)) {
return new OrderRecordBasic();
}
return orderRecordFactory.buildWithRouteOrder(routeOrder);
// return orderRecordFactory.buildWithRouteOrder(routeOrder);
return new OrderRecordBasic();
}
//获取账期号 202403
@ -485,13 +488,20 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
//对应所属系统
public String findBelongSysType(List<TripSubmitItemList> itemList, String outApplayOrderNo) {
return itemList.stream()
String sysCode = itemList.stream()
.filter(item -> LY_CUSTOM1.equals(item.getCode()))
.findFirst()
.map(TripSubmitItemList::getContent)
.map(item -> StringUtils.isBlank(item.getContent()) ? null : item.getContent())
.orElseGet(() -> Optional.ofNullable(outApplayOrderNo)
.map(no -> no.split("-")[0])
.orElse(""));
.orElse("NOT"));
return switch (sysCode) {
case BELONG_SYS_CODE_FSSC -> BELONG_SYS_TYPE_FSSC;
case BELONG_SYS_CODE_H3BPM -> BELONG_SYS_TYPE_H3BPM;
case BELONG_SYS_CODE_XNFSSC -> BELONG_SYS_TYPE_XNFSSC;
case BELONG_SYS_CODE_ANFSSC -> BELONG_SYS_TYPE_ANFSSC;
default -> "NOT";
};
}
//核算企业code

View File

@ -25,6 +25,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
@ -85,16 +86,22 @@ public class LyStatementOrder {
ResStatementList resStatementList = reqStatement.queryStatementList(statementList);
log.info("resStatementList: {}", resStatementList);
ArrayList<ResStatementList.OnlineStatementList> onlineStatementList = resStatementList.getData().getOnlineStatementList();
// 获取当前时间
LocalDate now = LocalDate.now();
LocalDate startDate = now.minusMonths(2).withDayOfMonth(1);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String startTime = startDate.atStartOfDay().format(formatter);
String endTime = LocalDateTime.now().format(formatter);
for (ResStatementList.OnlineStatementList onlineStatement : onlineStatementList) {
String statementCode = onlineStatement.getStatementCode();//对账单编码
//1.查询机票账单详情
flightStatement(statementCode, beginDate, endDate);
flightStatement(statementCode, startTime, endTime);
//2.查询酒店账单详情
hotelStatement(statementCode, beginDate, endDate);
hotelStatement(statementCode, startTime, endTime);
//3.查询火车票账单详情
trainStatement(statementCode, beginDate, endDate);
trainStatement(statementCode, startTime, endTime);
//4.查询用车账单详情
carStatement(statementCode, beginDate, endDate);
carStatement(statementCode, startTime, endTime);
}
log.info("保存成功!");
@ -103,7 +110,7 @@ public class LyStatementOrder {
/**
* 飞机账单同步
*/
public void flightStatement(String statementCode, String beginDate, String endDate) {
public void flightStatement(String statementCode, String startTime, String endTime) {
int flightCount = 0;//初始化变量
int flightPageCount;//飞机总分页数
do {
@ -114,7 +121,7 @@ public class LyStatementOrder {
//保存数据
List<FlightStatement.StatementOrderList> statementOrderList = flightStatement.getData().getStatementOrderList();
//查询已经保存的数据
List<String> orderSerialNoList = jdbcLyOrderFlightRecord.queryBillOrderNo(beginDate, endDate);
List<String> orderSerialNoList = jdbcLyOrderFlightRecord.queryBillOrderNo(startTime, endTime);
//过滤出已经保存的数据
List<FlightStatement.StatementOrderList> statementOrderListNew = statementOrderList.stream().filter(o ->
!orderSerialNoList.contains(o.getBillOrderNo())
@ -129,7 +136,7 @@ public class LyStatementOrder {
/**
* 酒店账单同步
*/
public void hotelStatement(String statementCode, String beginDate, String endDate) {
public void hotelStatement(String statementCode, String startTime, String endTime) {
int hotelCount = 0;//初始化变量
int hotelPageCount;//酒店总分页数
do {
@ -139,7 +146,7 @@ public class LyStatementOrder {
//保存数据
List<HotelStatement.StatementOrderList> statementOrderList = hotelStatement.getData().getStatementOrderList();
//查询已经保存的数据
List<String> orderSerialNoList = jdbcLyOrderHotelRecord.queryBillOrderNo(beginDate, endDate);
List<String> orderSerialNoList = jdbcLyOrderHotelRecord.queryBillOrderNo(startTime, endTime);
//过滤出已经保存的数据
List<HotelStatement.StatementOrderList> statementOrderListNew = statementOrderList.stream().filter(o ->
!orderSerialNoList.contains(o.getBillOrderNo())
@ -155,7 +162,7 @@ public class LyStatementOrder {
/**
* 火车账单同步
*/
public void trainStatement(String statementCode, String beginDate, String endDate) {
public void trainStatement(String statementCode, String startTime, String endTime) {
int trainCount = 0;//初始化变量
int trainPageCount;//酒店总分页数
do {
@ -165,7 +172,7 @@ public class LyStatementOrder {
//保存数据
List<TrainStatement.StatementOrderList> statementOrderList = trainStatement.getData().getStatementOrderList();
//查询已经保存的数据
List<String> orderSerialNoList = jdbcLyOrderTrainRecord.queryBillOrderNo(beginDate, endDate);
List<String> orderSerialNoList = jdbcLyOrderTrainRecord.queryBillOrderNo(startTime, endTime);
//过滤出已经保存的数据
List<TrainStatement.StatementOrderList> statementOrderListNew = statementOrderList.stream().filter(o ->
!orderSerialNoList.contains(o.getBillOrderNo())
@ -181,7 +188,7 @@ public class LyStatementOrder {
/**
* 用车账单同步
*/
public void carStatement(String statementCode, String beginDate, String endDate) {
public void carStatement(String statementCode, String startTime, String endTime) {
int carCount = 0;//初始化变量
int carPageCount;//酒店总分页数
do {
@ -191,7 +198,7 @@ public class LyStatementOrder {
//保存数据
List<CarStatement.StatementOrderList> statementOrderList = carStatement.getData().getStatementOrderList();
//查询已经保存的数据
List<String> orderSerialNoList = jdbcLyOrderCarRecord.queryBillOrderNo(beginDate, endDate);
List<String> orderSerialNoList = jdbcLyOrderCarRecord.queryBillOrderNo(startTime, endTime);
//过滤出已经保存的数据
List<CarStatement.StatementOrderList> statementOrderListNew = statementOrderList.stream().filter(o ->
!orderSerialNoList.contains(o.getBillOrderNo())
@ -205,7 +212,7 @@ public class LyStatementOrder {
}
/* //保存需要的机票订单明细字段
//保存需要的机票订单明细字段
private void saveLyOrderFlightDetail(List<LyOrderFlightRecord> lyOrderFlightRecords) {
lyOrderFlightRecords.forEach(lyOrderFlightRecord -> {
lySearchRequest.getFlightOrderDetail(lyOrderFlightRecord.getOrderSerialNo());
@ -236,5 +243,5 @@ public class LyStatementOrder {
lySearchRequest.getCarDetailResponse(lyOrderCarRecord.getOrderSerialNo());
});
}*/
}
}

View File

@ -68,6 +68,9 @@ public class UserHttpRequestImpl implements UserHttpRequest {
@Override
public User loadUserInfo(User user) {
loadSFInfo(user);
if (user == null) {
return null;
}
return loadRankCode(user);
}
@ -104,8 +107,12 @@ public class UserHttpRequestImpl implements UserHttpRequest {
}
private User loadSFInfo(User user) {
List<UserDataDTO> fromJson = userSFRequest
.getUserSFDataFromOpenApi(user)
List<UserDataDTO> userSFDataFromOpenApi = userSFRequest
.getUserSFDataFromOpenApi(user);
if (userSFDataFromOpenApi == null) {
return null;
}
List<UserDataDTO> fromJson = userSFDataFromOpenApi
.stream()
.filter(userDataDTO -> userDataDTO.getStatus().equals("A"))
.toList();
@ -210,11 +217,13 @@ public class UserHttpRequestImpl implements UserHttpRequest {
public User loadUserDeptInfo(User user) {
List<UserDataDTO> userDataDTOList = userSFRequest.getUserSFDataFromOpenApi(user);
if (userDataDTOList != null && userDataDTOList.size() == 1) {
if (userDataDTOList == null) {
return null;
}
if (userDataDTOList.size() == 1) {
addDeptInfo(userDataDTOList.get(0), user, true);
}
if (userDataDTOList != null && userDataDTOList.size() > 1) {
if (userDataDTOList.size() > 1) {
for (UserDataDTO userDataDTO : userDataDTOList) {
if (userDataDTO.getPersonIdExternal().equals(userDataDTO.getLoginUsername())) {
addDeptInfo(userDataDTO, user, true);

View File

@ -69,6 +69,9 @@ public class UserSFRequest {
DataCenterResult result = dataCenterService.post(USER_DATA_PATH, map);
Type type = new TypeToken<List<UserDataDTO>>() {
}.getType();
if(result.getData() == null){
return null;
}
List<UserDataDTO> userDataDTOs = gson.fromJson(result.getData().toString(), type);
if (result.getData() != null) {
return userDataDTOs;