fix:订单明细用车拉取修复空开始时间的问题
This commit is contained in:
parent
49e891c1ec
commit
242b09569d
|
@ -196,11 +196,11 @@ public class OrderDetailQuery {
|
|||
return null;
|
||||
}
|
||||
|
||||
if(carOrderDetail.getStartTime().contains("1900")){
|
||||
if( carOrderDetail.getStartTime() != null && carOrderDetail.getStartTime().contains("1900")){
|
||||
carOrderDetail.setStartTime(carOrderDetail.getCreateTime());
|
||||
}
|
||||
|
||||
if(carOrderDetail.getArriveTime().contains("1900")){
|
||||
if(carOrderDetail.getArriveTime() != null && carOrderDetail.getArriveTime().contains("1900")){
|
||||
carOrderDetail.setArriveTime(carOrderDetail.getCreateTime());
|
||||
}
|
||||
|
||||
|
|
|
@ -73,11 +73,27 @@ public class User implements Serializable {
|
|||
this.employeeNo = employeeNo;
|
||||
}
|
||||
|
||||
|
||||
public UserDepartmentInfo.Builder addDeptInfo() {
|
||||
return new UserDepartmentInfo.Builder(this);
|
||||
}
|
||||
|
||||
public UserDepartmentInfo getDepartmentInfo() {
|
||||
if (userDepartmentInfoList != null && !userDepartmentInfoList.isEmpty()) {
|
||||
return userDepartmentInfoList.get(0);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String generateDeptInfo() {
|
||||
if (userDepartmentInfoList != null && !userDepartmentInfoList.isEmpty()) {
|
||||
UserDepartmentInfo userDepartmentInfo = userDepartmentInfoList.get(0);
|
||||
return userDepartmentInfo.getDeptInfo();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String lowestDeptCode() {
|
||||
Optional<UserDepartmentInfo> first = this.userDepartmentInfoList
|
||||
.stream()
|
||||
|
|
|
@ -41,6 +41,13 @@ public class UserDepartmentInfo implements Serializable {
|
|||
private String departmentNameSeven;
|
||||
private Integer ifPrimary;
|
||||
|
||||
public String getDeptInfo(){
|
||||
return departmentNameOne + "-" + departmentNameTwo +
|
||||
"-" + departmentNameThree + "-" + departmentNameFour +
|
||||
"-" + departmentNameFive + "-" + departmentNameSix + "-" + departmentNameSeven;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
|
|
@ -1,13 +1,46 @@
|
|||
package com.chint.infrastructure.export;
|
||||
|
||||
import com.chint.domain.aggregates.order.FlightOrderDetail;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.aggregates.user.UserDepartmentInfo;
|
||||
import com.chint.domain.repository.UserRepository;
|
||||
import com.chint.infrastructure.util.SystemUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class OrderDetailExportFactory {
|
||||
|
||||
// public List<OrderDetailExport> createExportData(){
|
||||
//
|
||||
// }
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
public List<OrderDetailExport> createExportData(List<FlightOrderDetail> orderDetails) {
|
||||
return orderDetails.stream().map(it -> {
|
||||
OrderDetailExport orderDetailExport = new OrderDetailExport();
|
||||
orderDetailExport.setOrderAmount(it.getOrderAmount());
|
||||
orderDetailExport.setOrderDate(it.getCreateTime());
|
||||
orderDetailExport.setOrderTime(it.getCreateTime());
|
||||
orderDetailExport.setAccountCompanyName(it.getAccountCompanyName());
|
||||
orderDetailExport.setOrderNo(it.getOrderNo());
|
||||
orderDetailExport.setOrderStatus(it.getOrderStatus());
|
||||
orderDetailExport.setEmployeeNo(it.getUserCode());
|
||||
orderDetailExport.setEmployeeName(it.getUserName());
|
||||
orderDetailExport.setProjectCode(it.getProjectOrderNo());
|
||||
User byUserEmployeeNo = userRepository.findByUserEmployeeNo(it.getUserCode());
|
||||
if (byUserEmployeeNo != null) {
|
||||
orderDetailExport.setEmployeeDepartment(byUserEmployeeNo.generateDeptInfo());
|
||||
UserDepartmentInfo departmentInfo = byUserEmployeeNo.getDepartmentInfo();
|
||||
orderDetailExport.setCompanyId(departmentInfo.getCompanyCode());
|
||||
orderDetailExport.setCompanyName(departmentInfo.getCompanyName());
|
||||
}
|
||||
orderDetailExport.setSystemCode(SystemUtil.translateSysCode(it.getBelongSysType()));
|
||||
orderDetailExport.setProductType("国内机票");
|
||||
return orderDetailExport;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package com.chint.infrastructure.util;
|
||||
|
||||
import static com.chint.infrastructure.constant.BelongSystemConstant.*;
|
||||
|
||||
public class SystemUtil {
|
||||
|
||||
public static String translateSysCode(String belongFk) {
|
||||
return switch (belongFk) {
|
||||
case BELONG_SYS_TYPE_FSSC -> BELONG_SYS_CODE_FSSC;
|
||||
case BELONG_SYS_TYPE_H3BPM -> BELONG_SYS_CODE_H3BPM;
|
||||
case BELONG_SYS_TYPE_XNFSSC -> BELONG_SYS_CODE_XNFSSC;
|
||||
case BELONG_SYS_TYPE_ANFSSC -> BELONG_SYS_CODE_XNFSSC;
|
||||
default -> BELONG_SYS_TYPE_NOT;
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue