修改职级代码
This commit is contained in:
parent
42946a89c6
commit
44c7cb1845
|
@ -1,5 +1,6 @@
|
||||||
package com.chint.application.commands;
|
package com.chint.application.commands;
|
||||||
|
|
||||||
|
import com.chint.domain.aggregates.user.User;
|
||||||
import com.chint.domain.value_object.UserLoginParam;
|
import com.chint.domain.value_object.UserLoginParam;
|
||||||
import com.chint.infrastructure.echo_framework.command.Command;
|
import com.chint.infrastructure.echo_framework.command.Command;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -8,10 +9,10 @@ import lombok.EqualsAndHashCode;
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
public class OrderCreateCommand extends Command {
|
public class OrderCreateCommand extends Command {
|
||||||
private UserLoginParam loginParam;
|
private User user;
|
||||||
|
|
||||||
public OrderCreateCommand of(UserLoginParam loginParam) {
|
public OrderCreateCommand of(User user) {
|
||||||
this.loginParam = loginParam;
|
this.user = user;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,4 @@ public class OrderController {
|
||||||
orderApplicationService.deleteLegToOrder(deleteLegData);
|
orderApplicationService.deleteLegToOrder(deleteLegData);
|
||||||
return Result.Success(SUCCESS);
|
return Result.Success(SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class LoginController {
|
||||||
throw new OrderException("companycode 不能为空");
|
throw new OrderException("companycode 不能为空");
|
||||||
}
|
}
|
||||||
//发送创建行程订单命令
|
//发送创建行程订单命令
|
||||||
Command.of(OrderCreateCommand.class).of(userLoginParam).sendToQueue();
|
Command.of(OrderCreateCommand.class).of(BaseContext.getCurrentUser()).sendToQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
//异步执行更新用户信息到同程
|
//异步执行更新用户信息到同程
|
||||||
|
|
|
@ -18,6 +18,7 @@ import com.chint.domain.value_object.*;
|
||||||
import com.chint.infrastructure.util.BaseContext;
|
import com.chint.infrastructure.util.BaseContext;
|
||||||
import com.chint.infrastructure.util.PageResult;
|
import com.chint.infrastructure.util.PageResult;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
@ -53,30 +54,75 @@ public class OrderQuery {
|
||||||
}
|
}
|
||||||
|
|
||||||
public PageResult<RouteOrderPageRes> pageQuery(OrderQueryData queryData) {
|
public PageResult<RouteOrderPageRes> pageQuery(OrderQueryData queryData) {
|
||||||
|
|
||||||
|
//执行筛选分页查询
|
||||||
|
List<Integer> approvalStatusCodes = queryData.getApprovalStatusCodes();
|
||||||
|
List<Integer> legTypes = queryData.getLegTypes();
|
||||||
|
if (!approvalStatusCodes.isEmpty() || !legTypes.isEmpty()) {
|
||||||
|
Integer pageNum = queryData.getPageNum();
|
||||||
|
Integer pageSize = queryData.getPageSize();
|
||||||
|
List<RouteOrder> routeOrders = routeRepository.findByActualOrderNoNotNull();
|
||||||
|
if (!approvalStatusCodes.isEmpty()) {
|
||||||
|
routeOrders = routeOrders.stream()
|
||||||
|
.filter(routeOrder -> approvalStatusCodes.contains(routeOrder.getApprovalStatusCode()))
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
if (!legTypes.isEmpty()) {
|
||||||
|
routeOrders = routeOrders.stream()
|
||||||
|
.filter(routeOrder -> {
|
||||||
|
List<Integer> list = new ArrayList<>(routeOrder.getLegItems().stream().map(Leg::getLegType).toList());
|
||||||
|
return list.retainAll(legTypes);
|
||||||
|
})
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
int total = routeOrders.size();
|
||||||
|
List<RouteOrderPageRes> orders = routeOrders
|
||||||
|
.stream()
|
||||||
|
.skip((long) (pageNum - 1) * pageSize)
|
||||||
|
.limit(pageSize)
|
||||||
|
.map(OrderQuery::getRouteOrderPageRes)
|
||||||
|
.toList();
|
||||||
|
return new PageResult<>(total, orders);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (queryData.getOrderNo() != null) {
|
||||||
|
Page<RouteOrder> byOrderNoFuzzy = routeRepository.findByOrderNoFuzzy(queryData);
|
||||||
|
return new PageResult<>(byOrderNoFuzzy.getTotalElements(),
|
||||||
|
byOrderNoFuzzy
|
||||||
|
.getContent()
|
||||||
|
.stream()
|
||||||
|
.map(OrderQuery::getRouteOrderPageRes)
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//执行普通分页查询
|
||||||
PageResult<RouteOrder> routeOrderPageResult = routeRepository.pageQuery(queryData);
|
PageResult<RouteOrder> routeOrderPageResult = routeRepository.pageQuery(queryData);
|
||||||
routeOrderPageResult.getRecords().forEach(order -> {
|
routeOrderPageResult.getRecords().forEach(order -> {
|
||||||
orderDomainService.queryLocation(order.getLegItems());
|
orderDomainService.queryLocation(order.getLegItems());
|
||||||
});
|
});
|
||||||
User currentUser = BaseContext.getCurrentUser();
|
|
||||||
List<RouteOrderPageRes> routeOrderPageRes = routeOrderPageResult
|
List<RouteOrderPageRes> routeOrderPageRes = routeOrderPageResult
|
||||||
.getRecords()
|
.getRecords()
|
||||||
.stream()
|
.stream()
|
||||||
.map(routeOrder -> {
|
.map(OrderQuery::getRouteOrderPageRes)
|
||||||
RouteOrderPageRes res = BeanUtil.copyProperties(routeOrder.reloadStatus(), RouteOrderPageRes.class);
|
|
||||||
List<LocationRes> locationRes = routeOrder.getLegItems()
|
|
||||||
.stream()
|
|
||||||
.flatMap(leg -> Stream.of(leg.getOriginLocation(), leg.getDestinationLocation()))
|
|
||||||
.map(LocationRes::copyFrom)
|
|
||||||
.distinct()
|
|
||||||
.toList();
|
|
||||||
res.setLocationResList(locationRes);
|
|
||||||
res.setUserName(currentUser.getName());
|
|
||||||
return res;
|
|
||||||
})
|
|
||||||
.toList();
|
.toList();
|
||||||
return new PageResult<>(routeOrderPageResult.getTotal(), routeOrderPageRes);
|
return new PageResult<>(routeOrderPageResult.getTotal(), routeOrderPageRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static RouteOrderPageRes getRouteOrderPageRes(RouteOrder routeOrder) {
|
||||||
|
User currentUser = BaseContext.getCurrentUser();
|
||||||
|
RouteOrderPageRes res = BeanUtil.copyProperties(routeOrder.reloadStatus(), RouteOrderPageRes.class);
|
||||||
|
List<LocationRes> locationRes = routeOrder.getLegItems()
|
||||||
|
.stream()
|
||||||
|
.flatMap(leg -> Stream.of(leg.getOriginLocation(), leg.getDestinationLocation()))
|
||||||
|
.map(LocationRes::copyFrom)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
res.setLocationResList(locationRes);
|
||||||
|
res.setUserName(currentUser.getName());
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
public RouteOrder queryById(Long routeId) {
|
public RouteOrder queryById(Long routeId) {
|
||||||
RouteOrder routeOrder = routeRepository.queryById(routeId);
|
RouteOrder routeOrder = routeRepository.queryById(routeId);
|
||||||
orderDomainService.queryLocation(routeOrder.getLegItems());
|
orderDomainService.queryLocation(routeOrder.getLegItems());
|
||||||
|
|
|
@ -41,6 +41,8 @@ public class RouteOrder extends BaseEntity {
|
||||||
private LocalDateTime bookingTime;
|
private LocalDateTime bookingTime;
|
||||||
private Long userId;
|
private Long userId;
|
||||||
private String supplierName;
|
private String supplierName;
|
||||||
|
//差标等级
|
||||||
|
private String standardLevel;
|
||||||
//审批订单号
|
//审批订单号
|
||||||
@Embedded.Nullable
|
@Embedded.Nullable
|
||||||
private ApproveOrderNo approveOrderNo;
|
private ApproveOrderNo approveOrderNo;
|
||||||
|
|
|
@ -45,7 +45,8 @@ public class RouteOrderFactory implements OrderFactory {
|
||||||
@Override
|
@Override
|
||||||
public RouteOrder createRoute(OrderCreateCommand command) {
|
public RouteOrder createRoute(OrderCreateCommand command) {
|
||||||
User currentUser = BaseContext.getCurrentUser();
|
User currentUser = BaseContext.getCurrentUser();
|
||||||
UserLoginParam loginParam = command.getLoginParam();
|
User user = command.getUser();
|
||||||
|
UserLoginParam loginParam = user.getUserLoginParam();
|
||||||
RouteOrder routeOrder = new RouteOrder();
|
RouteOrder routeOrder = new RouteOrder();
|
||||||
routeOrder.setRouteOrderNo(OrderNo.generate());
|
routeOrder.setRouteOrderNo(OrderNo.generate());
|
||||||
//根据项目需求,需要保存假审批订单号,真审批订单号 ,创建的时候保存假审批订单号
|
//根据项目需求,需要保存假审批订单号,真审批订单号 ,创建的时候保存假审批订单号
|
||||||
|
|
|
@ -3,6 +3,9 @@ package com.chint.domain.repository;
|
||||||
import com.chint.domain.aggregates.order.RouteOrder;
|
import com.chint.domain.aggregates.order.RouteOrder;
|
||||||
import com.chint.domain.value_object.OrderQueryData;
|
import com.chint.domain.value_object.OrderQueryData;
|
||||||
import com.chint.infrastructure.util.PageResult;
|
import com.chint.infrastructure.util.PageResult;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface RouteRepository {
|
public interface RouteRepository {
|
||||||
RouteOrder queryById(Long orderId);
|
RouteOrder queryById(Long orderId);
|
||||||
|
@ -14,9 +17,12 @@ public interface RouteRepository {
|
||||||
RouteOrder findByActualOrderNoAndSysCode(String actualOrderNo,String sysCode);
|
RouteOrder findByActualOrderNoAndSysCode(String actualOrderNo,String sysCode);
|
||||||
|
|
||||||
RouteOrder findByOrderNo(String orderNo);
|
RouteOrder findByOrderNo(String orderNo);
|
||||||
|
Page<RouteOrder> findByOrderNoFuzzy(OrderQueryData orderQueryData);
|
||||||
|
|
||||||
|
|
||||||
RouteOrder save(RouteOrder routeOrder);
|
RouteOrder save(RouteOrder routeOrder);
|
||||||
|
|
||||||
PageResult<RouteOrder> pageQuery(OrderQueryData orderQueryData);
|
PageResult<RouteOrder> pageQuery(OrderQueryData orderQueryData);
|
||||||
|
|
||||||
|
List<RouteOrder> findByActualOrderNoNotNull();
|
||||||
}
|
}
|
|
@ -5,6 +5,5 @@ import com.chint.domain.aggregates.user.User;
|
||||||
public interface UserRepository {
|
public interface UserRepository {
|
||||||
User findById(Long id);
|
User findById(Long id);
|
||||||
User findByUserEmployeeNo(Long employeeNo);
|
User findByUserEmployeeNo(Long employeeNo);
|
||||||
|
|
||||||
User save(User user);
|
User save(User user);
|
||||||
}
|
}
|
|
@ -18,6 +18,7 @@ import com.chint.domain.value_object.ApprovalLegData;
|
||||||
import com.chint.domain.value_object.UserLoginParam;
|
import com.chint.domain.value_object.UserLoginParam;
|
||||||
import com.chint.infrastructure.echo_framework.annotation.ListenTo;
|
import com.chint.infrastructure.echo_framework.annotation.ListenTo;
|
||||||
import com.chint.infrastructure.util.BaseContext;
|
import com.chint.infrastructure.util.BaseContext;
|
||||||
|
import com.chint.interfaces.rest.user.UserHttpRequest;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -46,6 +47,9 @@ public class OrderDomainService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderDetailRepository orderDetailRepository;
|
private OrderDetailRepository orderDetailRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserHttpRequest userHttpRequest;
|
||||||
|
|
||||||
public RouteOrder saveOrder(RouteOrder routeOrder) {
|
public RouteOrder saveOrder(RouteOrder routeOrder) {
|
||||||
return routeRepository.save(routeOrder);
|
return routeRepository.save(routeOrder);
|
||||||
}
|
}
|
||||||
|
@ -60,13 +64,13 @@ public class OrderDomainService {
|
||||||
|
|
||||||
@ListenTo(command = "OrderCreateCommand", order = 0)
|
@ListenTo(command = "OrderCreateCommand", order = 0)
|
||||||
public RouteOrder createOrder(OrderCreateCommand command) {
|
public RouteOrder createOrder(OrderCreateCommand command) {
|
||||||
UserLoginParam loginParam = command.getLoginParam();
|
User user = command.getUser();
|
||||||
User byUserEmployeeNo = userRepository.findByUserEmployeeNo(Long.valueOf(loginParam.getSfno()));
|
UserLoginParam loginParam = user.getUserLoginParam();
|
||||||
return Optional.ofNullable(routeRepository
|
return Optional.ofNullable(routeRepository
|
||||||
.findByFakeOrderNoAndSysCode(loginParam.getBillcode(), loginParam.getSyscode()))
|
.findByFakeOrderNoAndSysCode(loginParam.getBillcode(), loginParam.getSyscode()))
|
||||||
.orElseGet(() -> {
|
.orElseGet(() -> {
|
||||||
BaseContext.setCurrentUser(byUserEmployeeNo);
|
|
||||||
RouteOrder order = routeOrderFactory.createRoute(command);
|
RouteOrder order = routeOrderFactory.createRoute(command);
|
||||||
|
order.setStandardLevel(user.getStandardLevel());
|
||||||
ApprovalEvent approvalEvent = routeOrderFactory.createApprovalEvent(APPROVAL_EVENT_PREPARE);
|
ApprovalEvent approvalEvent = routeOrderFactory.createApprovalEvent(APPROVAL_EVENT_PREPARE);
|
||||||
order.addApprovalEvent(approvalEvent);
|
order.addApprovalEvent(approvalEvent);
|
||||||
this.saveOrder(order);
|
this.saveOrder(order);
|
||||||
|
@ -75,7 +79,6 @@ public class OrderDomainService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ListenTo(command = "OrderApprovalCommand", order = 0)
|
@ListenTo(command = "OrderApprovalCommand", order = 0)
|
||||||
public void approvalOrder(OrderApprovalCommand command) {
|
public void approvalOrder(OrderApprovalCommand command) {
|
||||||
ApprovalLegData data = command.getData();
|
ApprovalLegData data = command.getData();
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.chint.application.commands.*;
|
||||||
import com.chint.domain.aggregates.order.*;
|
import com.chint.domain.aggregates.order.*;
|
||||||
import com.chint.domain.aggregates.user.User;
|
import com.chint.domain.aggregates.user.User;
|
||||||
import com.chint.domain.exceptions.CommandException;
|
import com.chint.domain.exceptions.CommandException;
|
||||||
|
import com.chint.domain.exceptions.OrderException;
|
||||||
import com.chint.domain.factoriy.leg_event.LegEventFactory;
|
import com.chint.domain.factoriy.leg_event.LegEventFactory;
|
||||||
import com.chint.domain.factoriy.order.RouteOrderFactory;
|
import com.chint.domain.factoriy.order.RouteOrderFactory;
|
||||||
import com.chint.domain.factoriy.order_detail.OrderDetailFactory;
|
import com.chint.domain.factoriy.order_detail.OrderDetailFactory;
|
||||||
|
@ -65,7 +66,9 @@ public class LegEventHandler implements LegEventService {
|
||||||
public void approveLeg(LegApprovalCommand command) {
|
public void approveLeg(LegApprovalCommand command) {
|
||||||
ApproveLegData data = command.getData();
|
ApproveLegData data = command.getData();
|
||||||
RouteOrder routeOrder = routeRepository.findByFakeOrderNoAndSysCode(data.getFakeOrderNo(), data.getSysCode()).reloadStatus();
|
RouteOrder routeOrder = routeRepository.findByFakeOrderNoAndSysCode(data.getFakeOrderNo(), data.getSysCode()).reloadStatus();
|
||||||
|
if (routeOrder.getLegItems().isEmpty()) {
|
||||||
|
throw new OrderException(LEG_ERROR);
|
||||||
|
}
|
||||||
if (routeOrder.getOrderStatus().equals(ORDER_STATUS_PREPARE)) {
|
if (routeOrder.getOrderStatus().equals(ORDER_STATUS_PREPARE)) {
|
||||||
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
|
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
|
||||||
approveOrderNo.setActualOrderNo(data.getActualOrderNo());
|
approveOrderNo.setActualOrderNo(data.getActualOrderNo());
|
||||||
|
|
|
@ -2,10 +2,9 @@ package com.chint.domain.service.order_sync;
|
||||||
|
|
||||||
import com.chint.domain.aggregates.order.Leg;
|
import com.chint.domain.aggregates.order.Leg;
|
||||||
import com.chint.domain.aggregates.order.RouteOrder;
|
import com.chint.domain.aggregates.order.RouteOrder;
|
||||||
import com.chint.domain.aggregates.user.User;
|
|
||||||
import com.chint.domain.repository.CityRepository;
|
import com.chint.domain.repository.CityRepository;
|
||||||
|
import com.chint.domain.repository.UserRepository;
|
||||||
import com.chint.domain.service.OrderDomainService;
|
import com.chint.domain.service.OrderDomainService;
|
||||||
import com.chint.infrastructure.util.BaseContext;
|
|
||||||
import com.chint.interfaces.rest.ctrip.CTripApprovalRequest;
|
import com.chint.interfaces.rest.ctrip.CTripApprovalRequest;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.approval.ApprovalRequest;
|
import com.chint.interfaces.rest.ctrip.dto.approval.ApprovalRequest;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.approval.ApprovalResult;
|
import com.chint.interfaces.rest.ctrip.dto.approval.ApprovalResult;
|
||||||
|
@ -15,6 +14,7 @@ import com.chint.interfaces.rest.ctrip.dto.approval.hotel.HotelEndorsementDetail
|
||||||
import com.chint.interfaces.rest.ctrip.dto.approval.quick.CarQuickEndorsementDetail;
|
import com.chint.interfaces.rest.ctrip.dto.approval.quick.CarQuickEndorsementDetail;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.approval.quick.RankInfo;
|
import com.chint.interfaces.rest.ctrip.dto.approval.quick.RankInfo;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.approval.train.TrainEndorsementDetail;
|
import com.chint.interfaces.rest.ctrip.dto.approval.train.TrainEndorsementDetail;
|
||||||
|
import com.chint.interfaces.rest.user.UserHttpRequest;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@ -37,6 +37,12 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderDomainService orderDomainService;
|
private OrderDomainService orderDomainService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserHttpRequest userHttpRequest;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserRepository userRepository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean syncSupplierOrder(RouteOrder order) {
|
public boolean syncSupplierOrder(RouteOrder order) {
|
||||||
System.out.println("开始同步协程订单");
|
System.out.println("开始同步协程订单");
|
||||||
|
@ -54,31 +60,32 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
|
||||||
}
|
}
|
||||||
|
|
||||||
private ApprovalRequest getApprovalRequestParam(RouteOrder order) {
|
private ApprovalRequest getApprovalRequestParam(RouteOrder order) {
|
||||||
User currentUser = BaseContext.getCurrentUser();
|
// RankInfo rankInfo = RankInfo.of(order.getStandardLevel());
|
||||||
RankInfo rankInfo = RankInfo.of(currentUser.getStandardLevel());
|
RankInfo rankInfo = RankInfo.of("测试职级");
|
||||||
|
String employeeNo = String.valueOf(order.getUserId());
|
||||||
ApprovalRequest approvalRequestParam = ApprovalRequest
|
ApprovalRequest approvalRequestParam = ApprovalRequest
|
||||||
.buildApproval(order.getRouteOrderNo(), String.valueOf(currentUser.getEmployeeNo()), rankInfo);
|
.buildApproval(order.getRouteOrderNo(), String.valueOf(employeeNo), rankInfo);
|
||||||
Map<Integer, List<Leg>> collect = orderDomainService.queryLocation(order.getLegItems())
|
Map<Integer, List<Leg>> collect = orderDomainService.queryLocation(order.getLegItems())
|
||||||
.stream().collect(Collectors.groupingBy(Leg::getLegType));
|
.stream().collect(Collectors.groupingBy(Leg::getLegType));
|
||||||
collect.forEach((k, v) -> {
|
collect.forEach((k, v) -> {
|
||||||
switch (k) {
|
switch (k) {
|
||||||
case LEG_TYPE_TRAIN -> approvalRequestParam.withTrain(generateTrainList(v));
|
case LEG_TYPE_TRAIN -> approvalRequestParam.withTrain(generateTrainList(v, employeeNo));
|
||||||
case LEG_TYPE_HOTEL -> approvalRequestParam.withHotel(generateHotelList(v));
|
case LEG_TYPE_HOTEL -> approvalRequestParam.withHotel(generateHotelList(v, employeeNo));
|
||||||
case LEG_TYPE_AIRPLANE -> approvalRequestParam.withAir(generateFilghtList(v));
|
case LEG_TYPE_AIRPLANE -> approvalRequestParam.withAir(generateFilghtList(v, employeeNo));
|
||||||
case LEG_TYPE_TAXI -> approvalRequestParam.withQuickCar(generateCarList(v));
|
case LEG_TYPE_TAXI -> approvalRequestParam.withQuickCar(generateCarList(v, employeeNo));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return approvalRequestParam;
|
return approvalRequestParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<HotelEndorsementDetail> generateHotelList(List<Leg> legs) {
|
private List<HotelEndorsementDetail> generateHotelList(List<Leg> legs, String employeeNo) {
|
||||||
List<HotelEndorsementDetail> hotelList = new ArrayList<>();
|
List<HotelEndorsementDetail> hotelList = new ArrayList<>();
|
||||||
legs.forEach(leg -> {
|
legs.forEach(leg -> {
|
||||||
hotelList.add(
|
hotelList.add(
|
||||||
HotelEndorsementDetail.of(List.of(
|
HotelEndorsementDetail.of(List.of(
|
||||||
cityRepository.findByCityName(leg.getOriginLocation().getLocationName()).getCity()
|
cityRepository.findByCityName(leg.getOriginLocation().getLocationName()).getCity()
|
||||||
))
|
))
|
||||||
.passenger(PassengerDetail.of(String.valueOf(BaseContext.getCurrentUser().getEmployeeNo())))
|
.passenger(PassengerDetail.of(employeeNo))
|
||||||
.starTime(leg.getStartTime())
|
.starTime(leg.getStartTime())
|
||||||
.endTime(leg.getEndTime())
|
.endTime(leg.getEndTime())
|
||||||
);
|
);
|
||||||
|
@ -86,7 +93,7 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
|
||||||
return hotelList;
|
return hotelList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<FlightEndorsementDetail> generateFilghtList(List<Leg> legs) {
|
private List<FlightEndorsementDetail> generateFilghtList(List<Leg> legs, String employeeNo) {
|
||||||
List<FlightEndorsementDetail> filghtList = new ArrayList<>();
|
List<FlightEndorsementDetail> filghtList = new ArrayList<>();
|
||||||
legs.forEach(leg -> {
|
legs.forEach(leg -> {
|
||||||
filghtList.add(
|
filghtList.add(
|
||||||
|
@ -95,7 +102,7 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
|
||||||
), List.of(
|
), List.of(
|
||||||
cityRepository.findByCityName(leg.getDestinationLocation().getLocationName()).getCity()
|
cityRepository.findByCityName(leg.getDestinationLocation().getLocationName()).getCity()
|
||||||
))
|
))
|
||||||
.passenger(PassengerDetail.of(String.valueOf(BaseContext.getCurrentUser().getEmployeeNo())))
|
.passenger(PassengerDetail.of(employeeNo))
|
||||||
.starTime(leg.getStartTime())
|
.starTime(leg.getStartTime())
|
||||||
.endTime(leg.getEndTime())
|
.endTime(leg.getEndTime())
|
||||||
);
|
);
|
||||||
|
@ -103,7 +110,7 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
|
||||||
return filghtList;
|
return filghtList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<TrainEndorsementDetail> generateTrainList(List<Leg> legs) {
|
private List<TrainEndorsementDetail> generateTrainList(List<Leg> legs, String employeeNo) {
|
||||||
List<TrainEndorsementDetail> trainList = new ArrayList<>();
|
List<TrainEndorsementDetail> trainList = new ArrayList<>();
|
||||||
legs.forEach(leg -> {
|
legs.forEach(leg -> {
|
||||||
trainList.add(
|
trainList.add(
|
||||||
|
@ -111,7 +118,7 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
|
||||||
cityRepository.findByCityName(leg.getOriginLocation().getLocationName()).getCity()
|
cityRepository.findByCityName(leg.getOriginLocation().getLocationName()).getCity()
|
||||||
), List.of(
|
), List.of(
|
||||||
cityRepository.findByCityName(leg.getDestinationLocation().getLocationName()).getCity()
|
cityRepository.findByCityName(leg.getDestinationLocation().getLocationName()).getCity()
|
||||||
)).passenger(PassengerDetail.of(String.valueOf(BaseContext.getCurrentUser().getEmployeeNo())))
|
)).passenger(PassengerDetail.of(employeeNo))
|
||||||
.starTime(leg.getStartTime())
|
.starTime(leg.getStartTime())
|
||||||
.endTime(leg.getEndTime())
|
.endTime(leg.getEndTime())
|
||||||
);
|
);
|
||||||
|
@ -119,13 +126,13 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
|
||||||
return trainList;
|
return trainList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<CarQuickEndorsementDetail> generateCarList(List<Leg> legs) {
|
private List<CarQuickEndorsementDetail> generateCarList(List<Leg> legs, String employeeNo) {
|
||||||
List<CarQuickEndorsementDetail> carList = new ArrayList<>();
|
List<CarQuickEndorsementDetail> carList = new ArrayList<>();
|
||||||
legs.forEach(leg -> {
|
legs.forEach(leg -> {
|
||||||
carList.add(
|
carList.add(
|
||||||
CarQuickEndorsementDetail.of(List.of(
|
CarQuickEndorsementDetail.of(List.of(
|
||||||
cityRepository.findByCityName(leg.getOriginLocation().getLocationName()).getCity()
|
cityRepository.findByCityName(leg.getOriginLocation().getLocationName()).getCity()
|
||||||
)).passenger(PassengerDetail.of(String.valueOf(BaseContext.getCurrentUser().getEmployeeNo())))
|
)).passenger(PassengerDetail.of(employeeNo))
|
||||||
.starTime(leg.getStartTime())
|
.starTime(leg.getStartTime())
|
||||||
.endTime(leg.getEndTime())
|
.endTime(leg.getEndTime())
|
||||||
);
|
);
|
||||||
|
|
|
@ -4,12 +4,15 @@ package com.chint.domain.value_object;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
public class OrderQueryData extends BaseQuery {
|
public class OrderQueryData extends BaseQuery {
|
||||||
private Long routeId;
|
private Long routeId;
|
||||||
|
|
||||||
private String billcode;
|
private String billcode;
|
||||||
|
|
||||||
private String sysCode;
|
private String sysCode;
|
||||||
|
private List<Integer> approvalStatusCodes;
|
||||||
|
private List<Integer> legTypes;
|
||||||
|
private String orderNo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ public class Constant {
|
||||||
public static final String INVALID_REQUEST = "无效的请求";
|
public static final String INVALID_REQUEST = "无效的请求";
|
||||||
public static final String ACCESS_DENIED = "访问被拒绝";
|
public static final String ACCESS_DENIED = "访问被拒绝";
|
||||||
public static final String SERVER_ERROR = "服务器错误";
|
public static final String SERVER_ERROR = "服务器错误";
|
||||||
|
public static final String LEG_ERROR = "行程错误";
|
||||||
|
|
||||||
// 数据相关消息
|
// 数据相关消息
|
||||||
public static final String DATA_ALREADY_EXISTS = "数据已存在";
|
public static final String DATA_ALREADY_EXISTS = "数据已存在";
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class LocationRepositoryImpl implements LocationRepository {
|
||||||
return PageResult.totalPageNum(res.getTotalElements(), res.toList());
|
return PageResult.totalPageNum(res.getTotalElements(), res.toList());
|
||||||
}
|
}
|
||||||
if (locationParam.getLevel() != null) {
|
if (locationParam.getLevel() != null) {
|
||||||
Page<Location> res = jdbcLocationRepository.findAllByLevel(locationParam.getLevel(), pageResult);
|
Page<Location> res = jdbcLocationRepository.findAllByLevel(Integer.valueOf(locationParam.getLevel().toString()), pageResult);
|
||||||
return PageResult.totalPageNum(res.getTotalElements(), res.toList());
|
return PageResult.totalPageNum(res.getTotalElements(), res.toList());
|
||||||
}
|
}
|
||||||
if (locationParam.getParentLocationId() != null) {
|
if (locationParam.getParentLocationId() != null) {
|
||||||
|
|
|
@ -38,8 +38,8 @@ public class RouteRepositoryImpl implements RouteRepository {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RouteOrder findByActualOrderNoAndSysCode(String actualOrderNo,String sysCode) {
|
public RouteOrder findByActualOrderNoAndSysCode(String actualOrderNo, String sysCode) {
|
||||||
return jdbcRouteRepository.findByApproveOrderNo_ActualOrderNoAndApproveOrderNo_SysCode(actualOrderNo,sysCode);
|
return jdbcRouteRepository.findByApproveOrderNo_ActualOrderNoAndApproveOrderNo_SysCode(actualOrderNo, sysCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -47,6 +47,16 @@ public class RouteRepositoryImpl implements RouteRepository {
|
||||||
return jdbcRouteRepository.findByRouteOrderNo(orderNo);
|
return jdbcRouteRepository.findByRouteOrderNo(orderNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<RouteOrder> findByOrderNoFuzzy(OrderQueryData orderQueryData) {
|
||||||
|
PageRequest sort = PageRequest
|
||||||
|
.of(orderQueryData.getPageNum() - 1, orderQueryData.getPageSize(), Sort.by("sort"));
|
||||||
|
User currentUser = BaseContext.getCurrentUser();
|
||||||
|
return jdbcRouteRepository
|
||||||
|
.findByCreateUserAndRouteOrderNoContaining(currentUser.getUserId().toString()
|
||||||
|
, orderQueryData.getOrderNo(), sort);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RouteOrder save(RouteOrder routeOrder) {
|
public RouteOrder save(RouteOrder routeOrder) {
|
||||||
return jdbcRouteRepository.save(routeOrder);
|
return jdbcRouteRepository.save(routeOrder);
|
||||||
|
@ -63,4 +73,10 @@ public class RouteRepositoryImpl implements RouteRepository {
|
||||||
orders.forEach(RouteOrder::reloadStatus);
|
orders.forEach(RouteOrder::reloadStatus);
|
||||||
return new PageResult<>(byUserId.getTotalElements(), orders);
|
return new PageResult<>(byUserId.getTotalElements(), orders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RouteOrder> findByActualOrderNoNotNull() {
|
||||||
|
User currentUser = BaseContext.getCurrentUser();
|
||||||
|
return jdbcRouteRepository.findByCreateUserAndApproveOrderNo_ActualOrderNoNotNull(currentUser.getUserId().toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,9 @@ public class BeforeSaveCallbackImpl implements BeforeSaveCallback<BaseEntity> {
|
||||||
entity.setCreateUser(BaseContext.getCurrentUser().getUserId().toString());
|
entity.setCreateUser(BaseContext.getCurrentUser().getUserId().toString());
|
||||||
}
|
}
|
||||||
entity.setUpdateTime(LocalDateTime.now());
|
entity.setUpdateTime(LocalDateTime.now());
|
||||||
entity.setUpdateUser(BaseContext.getCurrentUser().getUserId().toString());
|
if (BaseContext.getCurrentUser() != null) {
|
||||||
|
entity.setUpdateUser(BaseContext.getCurrentUser().getUserId().toString());
|
||||||
|
}
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,7 +16,7 @@ public interface JdbcLocationRepository extends CrudRepository<Location, Long> {
|
||||||
|
|
||||||
Page<Location> findAllByParentLocationId(Long parentLocationId, Pageable pageable);
|
Page<Location> findAllByParentLocationId(Long parentLocationId, Pageable pageable);
|
||||||
|
|
||||||
Page<Location> findAllByLevel(Long level, Pageable pageable);
|
Page<Location> findAllByLevel(Integer level, Pageable pageable);
|
||||||
|
|
||||||
List<Location> findByFirstPinYin(String firstPinYin);
|
List<Location> findByFirstPinYin(String firstPinYin);
|
||||||
List<Location> findByLocationNameContaining(String locationName);
|
List<Location> findByLocationNameContaining(String locationName);
|
||||||
|
|
|
@ -3,10 +3,11 @@ package com.chint.infrastructure.repository.jdbc;
|
||||||
import com.chint.domain.aggregates.order.RouteOrder;
|
import com.chint.domain.aggregates.order.RouteOrder;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.jdbc.repository.query.Query;
|
|
||||||
import org.springframework.data.repository.CrudRepository;
|
import org.springframework.data.repository.CrudRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface JdbcRouteRepository extends CrudRepository<RouteOrder, Long> {
|
public interface JdbcRouteRepository extends CrudRepository<RouteOrder, Long> {
|
||||||
Page<RouteOrder> findByCreateUser(String userId, Pageable pageable);
|
Page<RouteOrder> findByCreateUser(String userId, Pageable pageable);
|
||||||
|
@ -21,4 +22,7 @@ public interface JdbcRouteRepository extends CrudRepository<RouteOrder, Long> {
|
||||||
|
|
||||||
RouteOrder findByRouteOrderNo(String routeOrderNo);
|
RouteOrder findByRouteOrderNo(String routeOrderNo);
|
||||||
|
|
||||||
|
List<RouteOrder> findByCreateUserAndApproveOrderNo_ActualOrderNoNotNull(String createUser);
|
||||||
|
|
||||||
|
Page<RouteOrder> findByCreateUserAndRouteOrderNoContaining(String createUser, String routeOrderNo, Pageable pageable);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,8 @@ public class UserHttpRequestImpl implements UserHttpRequest {
|
||||||
}
|
}
|
||||||
Ranks ranks = rankDomainService.queryRanks(rankName, user.getCompanyCode());
|
Ranks ranks = rankDomainService.queryRanks(rankName, user.getCompanyCode());
|
||||||
if (ranks != null) {
|
if (ranks != null) {
|
||||||
user.setStandardLevel(ranks.getStandardLevel());
|
// user.setStandardLevel(ranks.getStandardLevel());
|
||||||
|
user.setStandardLevel("测试职级");
|
||||||
}
|
}
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +93,7 @@ public class UserHttpRequestImpl implements UserHttpRequest {
|
||||||
}.getType();
|
}.getType();
|
||||||
if (result.getData() != null) {
|
if (result.getData() != null) {
|
||||||
List<UserDataDTO> fromJson = gson.fromJson(result.getData().toString(), type);
|
List<UserDataDTO> fromJson = gson.fromJson(result.getData().toString(), type);
|
||||||
// UserDataDTO userDataDTO = fromJson.get(0);
|
// UserDataDTO userDataDTO = fromJson.get(0);
|
||||||
String companyCode = user.getCompanyCode();
|
String companyCode = user.getCompanyCode();
|
||||||
if (companyCode == null) {
|
if (companyCode == null) {
|
||||||
companyCode = BaseContext.getCurrentUser().getUserLoginParam().getCompanyCode();
|
companyCode = BaseContext.getCurrentUser().getUserLoginParam().getCompanyCode();
|
||||||
|
|
|
@ -34,12 +34,12 @@ class RouteApplicationTests {
|
||||||
userHttpRequest.loadUserInfo(user);
|
userHttpRequest.loadUserInfo(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
@Test
|
||||||
void loginSign() {
|
void loginSign() {
|
||||||
String sfno = "220322120";
|
String sfno = "230615020";
|
||||||
String syscode = "FFSC";
|
String syscode = "FFSC";
|
||||||
String billcode = "";
|
String billcode = "ABC10337191351";
|
||||||
String companycode = "";
|
String companycode = "A30000001";
|
||||||
String sec = "Superdandan";
|
String sec = "Superdandan";
|
||||||
String timespan = "987654321";
|
String timespan = "987654321";
|
||||||
String s = Digest.md5(sfno + syscode + billcode + companycode + sec + timespan);
|
String s = Digest.md5(sfno + syscode + billcode + companycode + sec + timespan);
|
||||||
|
@ -76,5 +76,11 @@ class RouteApplicationTests {
|
||||||
routeRepository.deleteById(17L);
|
routeRepository.deleteById(17L);
|
||||||
routeRepository.deleteById(18L);
|
routeRepository.deleteById(18L);
|
||||||
routeRepository.deleteById(19L);
|
routeRepository.deleteById(19L);
|
||||||
|
routeRepository.deleteById(19L);
|
||||||
|
routeRepository.deleteById(19L);
|
||||||
|
routeRepository.deleteById(19L);
|
||||||
|
routeRepository.deleteById(19L);
|
||||||
|
routeRepository.deleteById(19L);
|
||||||
|
routeRepository.deleteById(19L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue