修改登录财务共享获取跳转地址的方式

This commit is contained in:
lulz1 2024-03-27 09:51:31 +08:00
parent dc7fe144ac
commit 8e2c3d1000
33 changed files with 482 additions and 72 deletions

View File

@ -1,7 +1,9 @@
package com.chint.application.out;
import com.chint.domain.aggregates.system.FsscSystem;
import com.chint.domain.aggregates.system.SystemCode;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.SystemCodeRepository;
import com.chint.domain.service.JTCompanyDomainService;
import com.chint.infrastructure.util.BaseContext;
import com.chint.infrastructure.util.Result;
@ -15,12 +17,12 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.chint.infrastructure.constant.BPMConstant.*;
import static com.chint.infrastructure.constant.BPMConstant.FSSC;
import static com.chint.infrastructure.constant.BPMConstant.XN_FSSC;
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
import static com.chint.infrastructure.constant.FSSCConstant.*;
@ -44,6 +46,12 @@ public class FSSCController {
@Autowired
private PostRequest postRequest;
@Autowired
private SystemCodeRepository systemCodeRepository;
@Value("${chint.envMark}")
private String envMark;
private Map<String, String> urlCache = new HashMap<>();
@PostConstruct
@ -60,27 +68,18 @@ public class FSSCController {
User user = BaseContext.getCurrentUser();
String employeeNo = user.getEmployeeNo();
//这里需要根据companyCode进行匹配到正确的申请单网址
List<String> systemCodes = user.getFsscSystemList()
.stream()
.map(FsscSystem::getSystemCode)
.toList();
List<FsscSystem> res = new ArrayList<>();
if (systemCodes.contains(FSSC)) {
FsscSystem fsscSystem = new FsscSystem(FSSC_NAME, FSSC,
postRequest.getReDirectUrl(FSSC_LOAD_URL + generateFsscUrlPath(employeeNo)));
res.add(fsscSystem);
List<FsscSystem> fsscSystemList = user.getFsscSystemList();
fsscSystemList.forEach(it -> {
SystemCode sysCode = systemCodeRepository.findBySysCode(it.getSystemCode());
String dataBaseUrl;
if (envMark.equals("prod")) {
dataBaseUrl = sysCode.getSystemCodeUrl().getRedirectUrlProd();
} else {
dataBaseUrl = sysCode.getSystemCodeUrl().getRedirectUrlDev();
}
//如果用户的公司编码属于集团 那么加入集团财务共享跳转地址
if (systemCodes.contains(XN_FSSC)) {
FsscSystem fsscSystem = new FsscSystem(XN_FSSC_NAME, XN_FSSC,
postRequest.getReDirectUrl(FSSC_LOAD_URL + generateXNFsscUrlPath(employeeNo)));
res.add(fsscSystem);
}
return Result.Success(SUCCESS, res);
it.setRedirectUrl(postRequest.getReDirectUrl(generateUrlPathFromDataBase(dataBaseUrl, employeeNo)));
});
return Result.Success(SUCCESS, fsscSystemList);
}
public String generateFsscUrlPath(String employeeNo) {
@ -91,4 +90,7 @@ public class FSSCController {
return XN_FSSC_REDIRECT_PATH_APPROVAL_ONE + employeeNo + FSSC_REDIRECT_PATH_APPROVAL_TWO;
}
public String generateUrlPathFromDataBase(String dataBaseUrl, String employeeNo) {
return dataBaseUrl + employeeNo + FSSC_REDIRECT_PATH_APPROVAL_TWO;
}
}

View File

@ -5,10 +5,10 @@ import com.chint.domain.aggregates.location.basedata.PrefectureLevelCityInfoEnti
import com.chint.domain.aggregates.order.Location;
import com.chint.domain.aggregates.order.RouteOrder;
import com.chint.domain.aggregates.standards.CityTag;
import com.chint.domain.service.TrainStandardsService;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.exceptions.LocationException;
import com.chint.domain.repository.*;
import com.chint.domain.service.TrainStandardsService;
import com.chint.domain.value_object.FlightPriceData;
import com.chint.domain.value_object.HotelPriceData;
import com.chint.domain.value_object.PriceQueryData;
@ -150,7 +150,7 @@ public class CTripEstimatePrice implements EstimatePrice {
public FlightPriceData queryFlightPrice(PriceQueryData priceQueryData) {
checkPriceQueryData(priceQueryData);
FlightProductInfo flightProductInfo = new FlightProductInfo();
FlightPriceData flightPriceData = new FlightPriceData();
String employeeNo;
String standardLevel;
if (priceQueryData.getRouteId() != null) {
@ -176,6 +176,13 @@ public class CTripEstimatePrice implements EstimatePrice {
getCityId(originLocation);
Location arriveLocation = locationRepository.findById(priceQueryData.getArriveCity());
getCityId(arriveLocation);
//增加判断如果查不到城市id就返回为空
if (originLocation.getCityId() == null || arriveLocation.getCityId() == null) {
flightPriceData.setSuccess(false);
flightPriceData.setMaxPrice(NO_PRICE_ERROR);
return flightPriceData;
}
routeInfo.setArriveCityID(
originLocation.getCityId().toString());
routeInfo.setDepartCityID(
@ -187,7 +194,7 @@ public class CTripEstimatePrice implements EstimatePrice {
BookingRelatedApiRequest bookingRelatedApiRequest = cTripEstimateRequest
.generateBaseRequest(flightProductInfo, null, null, employeeNo, standardLevel);
BookingRelatedApiResponse estimate = cTripEstimateRequest.estimate(bookingRelatedApiRequest);
FlightPriceData flightPriceData = new FlightPriceData();
if (estimate.getStatus().getSuccess()) {
Optional.ofNullable(
@ -334,10 +341,13 @@ public class CTripEstimatePrice implements EstimatePrice {
private Location getCityId(Location location) {
if (location.getCityId() == null) {
if (location.getLevel().equals(LOCATION_LEVEL_COUNTY)) {
CountryLevelInfoEntity byCityName = countryLevelInfoRepository
.findByCityName(location.getLocationName())
List<CountryLevelInfoEntity> list = countryLevelInfoRepository
.findByCityName(location.getLocationName());
if (list != null && !list.isEmpty()) {
CountryLevelInfoEntity byCityName = list
.get(0);
location.setCityId(byCityName.getCountyId());
}
} else {
List<PrefectureLevelCityInfoEntity> prefectureLevelCityInfoEntity = prefectureLevelRepository
.findByCityName(location.getLocationName());

View File

@ -1,9 +1,13 @@
package com.chint.domain.aggregates.order.order_record;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
@Data
@Table("order_car_record")
public class OrderCarRecord extends OrderBaseRecord {
@Id
private Long id;
private Long orderDetailId;
private String trvaleSysType; // 数据来源商旅平台 XC携程 TC同程

View File

@ -1,9 +1,13 @@
package com.chint.domain.aggregates.order.order_record;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
@Data
@Table("order_flight_record")
public class OrderFlightRecord extends OrderBaseRecord{
@Id
private Long id;
private Long orderDetailId;
private String trvaleSysType; // 数据来源商旅平台 XC携程 TC同程

View File

@ -1,9 +1,13 @@
package com.chint.domain.aggregates.order.order_record;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
@Data
@Table("order_hotel_record")
public class OrderHotelRecord extends OrderBaseRecord{
@Id
private Long id;
private Long orderDetailId;
private String trvaleSysType; // 数据来源商旅平台 XC携程 TC同程

View File

@ -1,9 +1,13 @@
package com.chint.domain.aggregates.order.order_record;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
@Data
@Table("order_train_record")
public class OrderTrainRecord extends OrderBaseRecord{
@Id
private Long id;
private Long orderDetailId;
private String trvaleSysType; // 数据来源商旅平台 XC携程 TC同程

View File

@ -1,11 +1,25 @@
package com.chint.domain.aggregates.system;
import com.chint.interfaces.rest.base.PostRequest;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
public class FsscSystem {
private final String systemName;
private final String systemCode;
private final String redirectUrl;
private String systemName;
private String systemCode;
private String redirectUrl;
public FsscSystem(String systemName, String systemCode) {
this.systemName = systemName;
this.systemCode = systemCode;
}
public FsscSystem(String systemName, String systemCode, String redirectUrl) {
this.systemName = systemName;
this.systemCode = systemCode;
this.redirectUrl = redirectUrl;
}
}

View File

@ -16,4 +16,5 @@ public class JTCompany implements Serializable {
private Long id;
private String companyName;
private String companyCode;
private Long systemCodeId;
}

View File

@ -23,4 +23,6 @@ public class SystemCode implements Serializable {
private Integer ifImmediateResponse; //是否立马回复审批结果0不是1是
@MappedCollection(idColumn = "system_id", keyColumn = "system_key")
private List<CompanyInfo> companyInfos;
@MappedCollection(idColumn = "system_code_id")
private SystemCodeUrl systemCodeUrl;
}

View File

@ -0,0 +1,20 @@
package com.chint.domain.aggregates.system;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
import java.io.Serial;
import java.io.Serializable;
@Data
@Table("system_code_url")
public class SystemCodeUrl implements Serializable {
@Serial
private static final long serialVersionUID = 5003392233348155635L;
@Id
private Long id;
private Long systemCodeId;
private String redirectUrlDev;
private String redirectUrlProd;
}

View File

@ -99,6 +99,12 @@ public class User implements Serializable {
this.companyCode = companyCode;
}
public User addFssc(String CompanyName, String sysCode) {
FsscSystem fsscSystem = new FsscSystem(CompanyName, sysCode);
this.addFsscSystemToList(fsscSystem);
return this;
}
public User addXNFssc(String loadUrl, PostRequest postRequest) {
FsscSystem fsscSystem = new FsscSystem(XN_FSSC_NAME, XN_FSSC, postRequest.getReDirectUrl(loadUrl + generateXNFsscUrlPath()));
this.addFsscSystemToList(fsscSystem);
@ -110,7 +116,8 @@ public class User implements Serializable {
this.addFsscSystemToList(fsscSystem);
return this;
}
public User addJTFssc(String companyName,String loadUrl, PostRequest postRequest) {
public User addJTFssc(String companyName, String loadUrl, PostRequest postRequest) {
FsscSystem fsscSystem = new FsscSystem(companyName, FSSC, postRequest.getReDirectUrl(loadUrl + generateFsscUrlPath()));
this.addFsscSystemToList(fsscSystem);
return this;

View File

@ -0,0 +1,58 @@
package com.chint.domain.factoriy.order_record;
import cn.hutool.core.bean.BeanUtil;
import com.chint.domain.aggregates.order.order_record.OrderCarRecord;
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.OrderTrainRecord;
import lombok.Data;
@Data
public class OrderRecordBasic {
// 数据来源商旅平台
private String trvaleSysType;
// 对应所属系统
private String belongSysType;
// 订单号
private String orderNo;
// 消费明细唯一标识
private String detailId;
// 核算企业id
private String accountCompanyId;
// 核算企业名称
private String accountCompanyName;
// 申请单号
private String receiptsNum;
// 行程编号
private String scheduleNum;
// 预订人Code
private String bookingUserCode;
// 预订人姓名
private String bookingName;
// 预订人电话
private String bookingUserPhone;
// 资源供应商
private String supplier;
// 超标原因
private String overStandardReason;
// 项目订单号
private String projectOrderNo;
// 成本中心
private String offlineCcomyCode;
public OrderCarRecord carRecord() {
return BeanUtil.copyProperties(this, OrderCarRecord.class);
}
public OrderFlightRecord flightRecord() {
return BeanUtil.copyProperties(this, OrderFlightRecord.class);
}
public OrderHotelRecord hotelRecord() {
return BeanUtil.copyProperties(this, OrderHotelRecord.class);
}
public OrderTrainRecord trainRecord() {
return BeanUtil.copyProperties(this, OrderTrainRecord.class);
}
}

View File

@ -0,0 +1,16 @@
package com.chint.domain.factoriy.order_record;
import com.chint.domain.aggregates.order.*;
public interface OrderRecordExtensionFactory {
CarOrderDetail createCarOrderRecord(Object carOrderDetailData);
TrainOrderDetail createTrainOrderRecord(Object trainOrderDetailData);
FlightOrderDetail createFlightOrderRecord(Object flightOrderDetailData);
HotelOrderDetail createHotelOrderRecord(Object hotelOrderDetailData);
}

View File

@ -1,8 +1,61 @@
package com.chint.domain.factoriy.order_record;
import com.chint.domain.aggregates.order.ApproveOrderNo;
import com.chint.domain.aggregates.order.RouteOrder;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import static com.chint.infrastructure.constant.BelongSystemConstant.*;
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
@Component
public class OrderRecordFactory {
@Autowired
private UserRepository userRepository;
public OrderRecordBasic buildWithRouteOrder(RouteOrder routeOrder) {
routeOrder.reloadStatus();
OrderRecordBasic orderRecordBasic = new OrderRecordBasic();
//完成身份信息
String userId = routeOrder.getUserId();
User user = userRepository.findByUserEmployeeNo(userId);
orderRecordBasic.setBookingUserCode(user.getEmployeeNo());
orderRecordBasic.setBookingName(user.getName());
orderRecordBasic.setBookingUserPhone(user.getPhoneNumber());
//配置供应商信息
String supplierName = routeOrder.getSupplierName();
if (supplierName.equals(SUPPLIER_C_TRIP)) {
orderRecordBasic.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP);
} else {
orderRecordBasic.setTrvaleSysType(TRAVAL_SYS_TYPE_LY);
}
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
if (approveOrderNo != null) {
orderRecordBasic.setAccountCompanyId(approveOrderNo.getAccountCompanyCode());
orderRecordBasic.setAccountCompanyName(approveOrderNo.getAccountCompanyName());
orderRecordBasic.setProjectOrderNo(approveOrderNo.getProjectName());
String sysCode = routeOrder.getApproveOrderNo().getSysCode();
if (sysCode != null) {
if (sysCode.equals(BELONG_SYS_CODE_FSSC)) {
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_FSSC);
}
if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) {
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_H3BPM);
}
if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) {
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_XNFSSC);
}
if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) {
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_ANFSSC);
}
}
}
return orderRecordBasic;
}
}

View File

@ -0,0 +1,9 @@
package com.chint.domain.repository;
import com.chint.domain.aggregates.order.order_record.OrderCarRecord;
import java.util.List;
public interface OrderCarRecordRepository {
List<OrderCarRecord> saveAll(List<OrderCarRecord> orderCarRecordList);
}

View File

@ -0,0 +1,9 @@
package com.chint.domain.repository;
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
import java.util.List;
public interface OrderFlightRecordRepository {
List<OrderFlightRecord> saveAll(List<OrderFlightRecord> orderFlightRecordList);
}

View File

@ -0,0 +1,9 @@
package com.chint.domain.repository;
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
import java.util.List;
public interface OrderHotelRecordRepository {
List<OrderHotelRecord> saveAll(List<OrderHotelRecord> orderHotelRecordList);
}

View File

@ -0,0 +1,10 @@
package com.chint.domain.repository;
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
import com.chint.domain.aggregates.order.order_record.OrderTrainRecord;
import java.util.List;
public interface OrderTrainRecordRepository {
List<OrderTrainRecord> saveAll(List<OrderTrainRecord> orderTrainRecordList);
}

View File

@ -3,6 +3,7 @@ package com.chint.domain.service;
import com.chint.domain.aggregates.system.JTCompany;
import com.chint.domain.repository.JTCompanyRepository;
import com.chint.domain.repository.SystemCodeRepository;
import jakarta.annotation.PostConstruct;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -18,6 +19,9 @@ public class JTCompanyDomainService {
@Autowired
private JTCompanyRepository jtCompanyRepository;
@Autowired
private SystemCodeRepository systemCodeRepository;
private Set<JTCompany> companyBlackList = new HashSet<>();
@ -33,7 +37,7 @@ public class JTCompanyDomainService {
if (companyName != null) {
boolean contains = companyBlackList.stream().map(JTCompany::getCompanyName).toList().contains(companyName);
//如果找不到的话 再次查询数据进行一次查找
if(!contains){
if (!contains) {
companyBlackList.addAll(jtCompanyRepository.findAll());
contains = companyBlackList.stream().map(JTCompany::getCompanyName).toList().contains(companyName);
}
@ -50,4 +54,9 @@ public class JTCompanyDomainService {
}
return false;
}
public String findSystemCodeByCompanyCode(String companyCode) {
JTCompany byCompanyCode = jtCompanyRepository.findByCompanyCode(companyCode);
return systemCodeRepository.findById(byCompanyCode.getSystemCodeId()).getSystemCode();
}
}

View File

@ -53,7 +53,6 @@ public class LegDomainService {
}
}
if (lastOrderStatus.equals(ORDER_EVENT_CANCEL_NAME)) {
LegEvent legEvent = legEventFactory.creatLegEvent(LEG_EVENT_CANCEL);
leg.addEvent(legEvent);

View File

@ -2,9 +2,12 @@ package com.chint.domain.service;
import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.domain.aggregates.order.RouteOrder;
import com.chint.domain.aggregates.order.order_record.OrderCarRecord;
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.OrderTrainRecord;
import com.chint.domain.factoriy.order_detail.OrderDetailFactory;
import com.chint.domain.repository.OrderDetailRepository;
import com.chint.domain.repository.RouteRepository;
import com.chint.domain.repository.*;
import com.chint.domain.service.order_search.OrderSearchSelector;
import com.chint.domain.service.supplier.OrderDataAdapterSelector;
import com.chint.domain.value_object.OrderLegData;
@ -36,6 +39,19 @@ public class OrderDetailDomainService {
@Autowired
private OrderDataAdapterSelector orderDataAdapterSelector;
@Autowired
private OrderCarRecordRepository orderCarRecordRepository;
@Autowired
private OrderHotelRecordRepository orderHotelRecordRepository;
@Autowired
private OrderFlightRecordRepository orderFlightRecordRepository;
@Autowired
private OrderTrainRecordRepository orderTrainRecordRepository;
public void syncOrderDetailStatus(List<OrderLegData> orderLegDataList) {
for (OrderLegData orderLegData : orderLegDataList) {
orderDetailRepository.findByOrderNo(orderLegData.getOutOrderNo()).ifPresent(
@ -67,4 +83,18 @@ public class OrderDetailDomainService {
syncOrderDetailStatus(orderLegDataList);
return true;
}
public List<OrderCarRecord> saveCarOrderRecordBatch(List<OrderCarRecord> orderCarRecordList) {
return orderCarRecordRepository.saveAll(orderCarRecordList);
}
public List<OrderFlightRecord> saveFlightOrderRecordBatch(List<OrderFlightRecord> orderFlightRecordList) {
return orderFlightRecordRepository.saveAll(orderFlightRecordList);
}
public List<OrderTrainRecord> saveTrainOrderRecordBatch(List<OrderTrainRecord> orderTrainRecordList) {
return orderTrainRecordRepository.saveAll(orderTrainRecordList);
}
public List<OrderHotelRecord> saveHotelOrderRecordBatch(List<OrderHotelRecord> orderHotelRecordList) {
return orderHotelRecordRepository.saveAll(orderHotelRecordList);
}
}

View File

@ -162,6 +162,8 @@ public class OrderDomainService {
return list;
}
@ListenTo(command = "OrderCreateCommand", order = 0)
public RouteOrder createOrder(OrderCreateCommand command) {
User user = command.getUser();
@ -628,4 +630,5 @@ public class OrderDomainService {
}
}
}
}

View File

@ -112,7 +112,6 @@ public class LegEventHandler implements LegEventService {
//保存提交审批所提供的资料
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
approveOrderNo.setActualOrderNo(data.getActualOrderNo());
// approveOrderNo.setAccountCompany(data.getAccountCompany());
approveOrderNo.setInstructions(data.getInstructions());
approveOrderNo.setCreator(data.getCreator());
approveOrderNo.setAccountCompanyCode(data.getAccountCompanyCode());

View File

@ -0,0 +1,22 @@
package com.chint.infrastructure.repository;
import com.chint.domain.aggregates.order.order_record.OrderCarRecord;
import com.chint.domain.repository.OrderCarRecordRepository;
import com.chint.infrastructure.repository.jdbc.JdbcOrderCarRecordRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.List;
@Repository
public class OrderCarRecordRepositoryImpl implements OrderCarRecordRepository {
@Autowired
private JdbcOrderCarRecordRepository orderCarRecordRepository;
@Override
public List<OrderCarRecord> saveAll(List<OrderCarRecord> orderCarRecordList) {
List<OrderCarRecord> res = new ArrayList<>();
orderCarRecordRepository.saveAll(orderCarRecordList).forEach(res::add);
return res;
}
}

View File

@ -0,0 +1,24 @@
package com.chint.infrastructure.repository;
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
import com.chint.domain.repository.OrderFlightRecordRepository;
import com.chint.infrastructure.repository.jdbc.JdbcOrderFlightRecordRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.List;
@Repository
public class OrderFlightRecordRepositoryImpl implements OrderFlightRecordRepository {
@Autowired
private JdbcOrderFlightRecordRepository jdbcOrderFlightRecordRepository;
@Override
public List<OrderFlightRecord> saveAll(List<OrderFlightRecord> orderFlightRecordList) {
List<OrderFlightRecord> res = new ArrayList<>();
jdbcOrderFlightRecordRepository.saveAll(orderFlightRecordList).forEach(res::add);
return res;
}
}

View File

@ -0,0 +1,25 @@
package com.chint.infrastructure.repository;
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
import com.chint.domain.repository.OrderHotelRecordRepository;
import com.chint.infrastructure.repository.jdbc.JdbcOrderFlightRecordRepository;
import com.chint.infrastructure.repository.jdbc.JdbcOrderHotelRecordRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.List;
@Repository
public class OrderHotelRecordRepositoryImpl implements OrderHotelRecordRepository {
@Autowired
private JdbcOrderHotelRecordRepository jdbcOrderHotelRecordRepository;
@Override
public List<OrderHotelRecord> saveAll(List<OrderHotelRecord> orderHotelRecordList) {
List<OrderHotelRecord> res = new ArrayList<>();
jdbcOrderHotelRecordRepository.saveAll(orderHotelRecordList).forEach(res::add);
return res;
}
}

View File

@ -0,0 +1,24 @@
package com.chint.infrastructure.repository;
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
import com.chint.domain.aggregates.order.order_record.OrderTrainRecord;
import com.chint.domain.repository.OrderTrainRecordRepository;
import com.chint.infrastructure.repository.jdbc.JdbcOrderHotelRecordRepository;
import com.chint.infrastructure.repository.jdbc.JdbcOrderTrainRecordRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.List;
@Repository
public class OrderTrainRecordRepositoryImpl implements OrderTrainRecordRepository {
@Autowired
private JdbcOrderTrainRecordRepository jdbcOrderTrainRecordRepository;
@Override
public List<OrderTrainRecord> saveAll(List<OrderTrainRecord> orderTrainRecordList) {
List<OrderTrainRecord> res = new ArrayList<>();
jdbcOrderTrainRecordRepository.saveAll(orderTrainRecordList).forEach(res::add);
return res;
}
}

View File

@ -5,13 +5,9 @@ import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.repository.SystemCodeRepository;
import com.chint.infrastructure.repository.jdbc.JdbcSystemCodeRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Repository;
import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
@Repository
public class SystemCodeRepositoryImpl implements SystemCodeRepository {
@ -31,6 +27,6 @@ public class SystemCodeRepositoryImpl implements SystemCodeRepository {
@Override
public SystemCode findById(Long id) {
return jdbcSystemCodeRepository.findById(id).orElseThrow(() -> new NotFoundException(NOT_FOUND));
return jdbcSystemCodeRepository.findById(id).orElseThrow(() -> new NotFoundException("该产业公司不在实施范围内"));
}
}

View File

@ -0,0 +1,9 @@
package com.chint.infrastructure.repository.jdbc;
import com.chint.domain.aggregates.order.order_record.OrderCarRecord;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface JdbcOrderCarRecordRepository extends CrudRepository<OrderCarRecord,Long> {
}

View File

@ -0,0 +1,9 @@
package com.chint.infrastructure.repository.jdbc;
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface JdbcOrderFlightRecordRepository extends CrudRepository<OrderFlightRecord,Long> {
}

View File

@ -0,0 +1,9 @@
package com.chint.infrastructure.repository.jdbc;
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface JdbcOrderHotelRecordRepository extends CrudRepository<OrderHotelRecord,Long> {
}

View File

@ -0,0 +1,9 @@
package com.chint.infrastructure.repository.jdbc;
import com.chint.domain.aggregates.order.order_record.OrderTrainRecord;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface JdbcOrderTrainRecordRepository extends CrudRepository<OrderTrainRecord,Long> {
}

View File

@ -3,7 +3,6 @@ package com.chint.interfaces.rest.user;
import com.chint.domain.aggregates.standards.Ranks;
import com.chint.domain.aggregates.standards.StaffRank;
import com.chint.domain.aggregates.system.JTCompany;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.JTCompanyRepository;
import com.chint.domain.repository.StaffRankRepository;
@ -21,11 +20,10 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import static com.chint.infrastructure.constant.RankConstant.*;
import static com.chint.infrastructure.constant.RankConstant.DEFAULT_RANK_NAME;
import static com.chint.infrastructure.constant.RankConstant.JT_COMPANY_CODE;
@Slf4j
@ -120,13 +118,16 @@ public class UserHttpRequestImpl implements UserHttpRequest {
getDataFromUserSFData(user, userData);
if (user.getCompanyCode().equals(XN_COMPANY_CODE)) {
user.addXNFssc(FSSC_LOAD_URL, postRequest);
}
//如果用户的公司编码属于集团 那么加入集团财务共享跳转地址
if (jtCompanyDomainService.ifCompanyInJT(null, userData.getCompany())) {
user.addJTFssc(userData.getCompany_cn(), FSSC_LOAD_URL, postRequest);
}
String sysCode = jtCompanyDomainService.findSystemCodeByCompanyCode(user.getCompanyCode());
user.addFssc(userData.getCompany_cn(), sysCode);
// if (user.getCompanyCode().equals(XN_COMPANY_CODE)) {
// user.addXNFssc(FSSC_LOAD_URL, postRequest);
// }
// //如果用户的公司编码属于集团 那么加入集团财务共享跳转地址
// if (jtCompanyDomainService.ifCompanyInJT(null, userData.getCompany())) {
// user.addJTFssc(userData.getCompany_cn(), FSSC_LOAD_URL, postRequest);
// }
return user;
}
@ -164,25 +165,31 @@ public class UserHttpRequestImpl implements UserHttpRequest {
}
private void processSpecialCompanies(List<UserDataDTO> userDataDTOS, User user) {
Set<String> companyCodes = userDataDTOS.stream()
.map(UserDataDTO::getCompany)
.collect(Collectors.toSet());
List<String> inJtCompanyCodes = companyCodes
.stream()
.filter(code -> jtCompanyDomainService.ifCompanyInJT(null, code))
List<UserDataDTO> list = userDataDTOS.stream()
.filter(it -> jtCompanyDomainService.ifCompanyInJT(null, it.getCompany()))
.toList();
for (String inJtCompanyCode : inJtCompanyCodes) {
JTCompany byCompanyCode = jtCompanyRepository.findByCompanyCode(inJtCompanyCode);
user.addJTFssc(byCompanyCode.getCompanyName(), FSSC_LOAD_URL, postRequest);
}
if (companyCodes.contains(XN_COMPANY_CODE)) {
user.addXNFssc(FSSC_LOAD_URL, postRequest);
}
list.forEach(it -> user.addFssc(it.getCompany_cn(),
jtCompanyDomainService.findSystemCodeByCompanyCode(it.getCompany())));
// Set<String> companyCodes = userDataDTOS.stream()
// .map(UserDataDTO::getCompany)
// .collect(Collectors.toSet());
//
//
// List<String> inJtCompanyCodes = companyCodes
// .stream()
// .filter(code -> jtCompanyDomainService.ifCompanyInJT(null, code))
// .toList();
//
// for (String inJtCompanyCode : inJtCompanyCodes) {
// JTCompany byCompanyCode = jtCompanyRepository.findByCompanyCode(inJtCompanyCode);
// user.addJTFssc(byCompanyCode.getCompanyName(), FSSC_LOAD_URL, postRequest);
// }
//
// if (companyCodes.contains(XN_COMPANY_CODE)) {
// user.addXNFssc(FSSC_LOAD_URL, postRequest);
// }
}
private User getDataFromUserSFData(User user, UserDataDTO userData) {