| | |
| | | |
| | | @Autowired |
| | | private ITDriverServiceService tDriverServiceService; |
| | | |
| | | @Autowired |
| | | private ITCarService tCarService; |
| | | |
| | | @Autowired |
| | | private ITCarServiceService tCarServiceService; |
| | | |
| | | @Value("${pushMinistryOfTransport}") |
| | | private boolean pushMinistryOfTransport; |
| | |
| | | // 4. 删除分公司直属司机的对应经营业务记录 |
| | | deleteDriverServices(companyId, null, cancelledServiceTypes); |
| | | |
| | | // 5. 删除加盟商司机的对应经营业务记录 |
| | | // 5. 删除分公司直属车辆的对应经营业务记录 |
| | | deleteCarServices(companyId, null, cancelledServiceTypes); |
| | | |
| | | // 6. 删除加盟商司机和车辆的对应经营业务记录 |
| | | List<Integer> franchiseeIds = franchiseeList.stream() |
| | | .map(TCompany::getId) |
| | | .collect(Collectors.toList()); |
| | |
| | | if (!franchiseeIds.isEmpty()) { |
| | | for (Integer franchiseeId : franchiseeIds) { |
| | | deleteDriverServices(null, franchiseeId, cancelledServiceTypes); |
| | | deleteCarServices(null, franchiseeId, cancelledServiceTypes); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 删除车辆的经营业务记录 |
| | | * @param companyId 分公司ID(查询直属车辆时使用) |
| | | * @param franchiseeId 加盟商ID(查询加盟商车辆时使用) |
| | | * @param serviceTypes 要删除的业务类型列表 |
| | | */ |
| | | private void deleteCarServices(Integer companyId, Integer franchiseeId, List<Integer> serviceTypes) { |
| | | Wrapper<TCar> wrapper = new EntityWrapper<TCar>().ne("state", 2); |
| | | |
| | | if (companyId != null) { |
| | | // 查询分公司直属车辆(companyId匹配且franchiseeId为空或0) |
| | | wrapper.eq("companyId", companyId) |
| | | .andNew() |
| | | .isNull("franchiseeId") |
| | | .or() |
| | | .eq("franchiseeId", 0); |
| | | } else if (franchiseeId != null) { |
| | | // 查询加盟商车辆 |
| | | wrapper.eq("franchiseeId", franchiseeId); |
| | | } else { |
| | | return; |
| | | } |
| | | |
| | | List<TCar> cars = tCarService.selectList(wrapper); |
| | | |
| | | for (TCar car : cars) { |
| | | tCarServiceService.delete( |
| | | new EntityWrapper<TCarService>() |
| | | .eq("carId", car.getId()) |
| | | .in("type", serviceTypes) |
| | | ); |
| | | } |
| | | } |
| | | |
| | | } |