物资采购联系单新增优化和车辆管理增加GPS绑定、增加轨迹功能

This commit is contained in:
2025-11-12 20:09:10 +08:00
parent 4b3a56eb5f
commit 1f233c142a
30 changed files with 436 additions and 10 deletions

View File

@ -13,6 +13,7 @@ import lombok.RequiredArgsConstructor;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.dromara.cailiaoshebei.domain.bo.BusMrpBaseReq;
import org.dromara.cailiaoshebei.domain.bo.RemainingReq;
import org.dromara.cailiaoshebei.domain.dto.BusMrpDto;
import org.dromara.cailiaoshebei.domain.dto.BusMrpExportDto;
@ -75,6 +76,15 @@ public class BusMrpBaseController extends BaseController {
return busMrpBaseService.queryPageList(bo, pageQuery);
}
/**
* 查询物资-批次需求计划基础信息列表
*/
// @SaCheckPermission("cailiaoshebei:mrpBase:getListByName")
@GetMapping("/getListByName")
public R<List<BusMrpBaseVo>> getListByName(BusMrpBaseReq req) {
return R.ok(busMrpBaseService.getListByName(req));
}
/**
* 导出物资-批次需求计划基础信息列表
*/

View File

@ -0,0 +1,37 @@
package org.dromara.cailiaoshebei.domain.bo;
import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.cailiaoshebei.domain.BusMrpBase;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import java.io.Serializable;
import java.time.LocalDate;
/**
* 物资-批次需求计划基础信息业务对象 bus_mrp_base
*
* @author Lion Li
* @date 2025-08-13
*/
@Data
public class BusMrpBaseReq implements Serializable {
/**
* 项目ID
*/
private Long projectId;
/**
* 计划编号
*/
private String name;
}

View File

@ -146,6 +146,11 @@ public class BusMaterialbatchdemandplanVo implements Serializable {
*/
private BigDecimal tenderQuantity;
/**
* 已使用数量
*/
private BigDecimal useQuantity;
}

View File

@ -1,5 +1,6 @@
package org.dromara.cailiaoshebei.service;
import org.dromara.cailiaoshebei.domain.bo.BusMrpBaseReq;
import org.dromara.cailiaoshebei.domain.dto.BusMrpDto;
import org.dromara.cailiaoshebei.domain.dto.BusMrpExportDto;
import org.dromara.cailiaoshebei.domain.vo.BusMrpBaseVo;
@ -87,4 +88,6 @@ public interface IBusMrpBaseService extends IService<BusMrpBase>{
* 获取物资已有数量
*/
Map<String, Object> remaining(Long projectId,Long limitListId,Long mrpBaseId);
List<BusMrpBaseVo> getListByName(BusMrpBaseReq req);
}

View File

@ -7,9 +7,11 @@ import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.dromara.cailiaoshebei.controller.constant;
import org.dromara.cailiaoshebei.domain.BusCailiaoshebeiPici;
import org.dromara.cailiaoshebei.domain.BusPlanDocAssociation;
import org.dromara.cailiaoshebei.domain.bo.BusMaterialbatchdemandplanAddReq;
import org.dromara.cailiaoshebei.service.IBusCailiaoshebeiPiciService;
import org.dromara.cailiaoshebei.service.IBusMaterialsorderService;
import org.dromara.cailiaoshebei.service.IBusPlanDocAssociationService;
import org.dromara.common.core.domain.event.ProcessDeleteEvent;
import org.dromara.common.core.domain.event.ProcessEvent;
import org.dromara.common.core.domain.event.ProcessTaskEvent;
@ -79,6 +81,9 @@ public class BusMaterialbatchdemandplanServiceImpl extends ServiceImpl<BusMateri
@Lazy
@Autowired
private IBusBillofquantitiesLimitListService busBillofquantitiesLimitListService;
@Lazy
@Autowired
private IBusPlanDocAssociationService busPlanDocAssociationService;
/**
* 查询物资-批次需求计划
@ -119,18 +124,30 @@ public class BusMaterialbatchdemandplanServiceImpl extends ServiceImpl<BusMateri
result.getRecords().stream().filter(vo -> {
return hashSet.contains(vo.getSuppliespriceId()); // 仅保留 Set 中存在的数据
}).forEach(item->{
if (map.containsKey(item.getId())) {
item.setTenderQuantity(map.get(item.getId()));
if (map.containsKey(item.getSuppliespriceId())) {
item.setTenderQuantity(map.get(item.getSuppliespriceId()));
}
});
}
result.getRecords().forEach(vo -> {
if (vo.getSuppliespricePid() != null){
for (BusMaterialbatchdemandplanVo vo : result.getRecords()) {
List<BusPlanDocAssociation> busPlanDocAssociations = busPlanDocAssociationService.getBaseMapper().selectList(new LambdaQueryWrapper<BusPlanDocAssociation>().eq(BusPlanDocAssociation::getPlanId, vo.getId()));
BigDecimal useQuantity = BigDecimal.ZERO;
if (busPlanDocAssociations != null && !busPlanDocAssociations.isEmpty()) {
useQuantity = busPlanDocAssociations.stream()
// 提取每个item的demandQuantity若为null则用0替代
.map(item -> Optional.ofNullable(item.getDemandQuantity()).orElse(BigDecimal.ZERO))
// 累加初始值0累加器为两个BigDecimal相加
.reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal subtract = vo.getDemandQuantity().subtract(useQuantity);
vo.setUseQuantity(subtract.compareTo(BigDecimal.ZERO) >0 ? subtract: BigDecimal.ZERO);
}
if (vo.getSuppliespricePid() != null) {
BusBillofquantitiesLimitList billofquantities = busBillofquantitiesLimitListService.getById(vo.getSuppliespricePid());
vo.setSuppliespricePname(billofquantities.getName());
}
});
}
return TableDataInfo.build(result);
}

View File

@ -6,13 +6,16 @@ import cn.hutool.core.convert.Convert;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.dromara.cailiaoshebei.domain.BusMaterialbatchdemandplan;
import org.dromara.cailiaoshebei.domain.BusPlanDocAssociation;
import org.dromara.cailiaoshebei.domain.bo.BusMaterialbatchdemandplanBo;
import org.dromara.cailiaoshebei.domain.bo.BusMrpBaseReq;
import org.dromara.cailiaoshebei.domain.dto.BusMaterialbatchdemandplanExportDto;
import org.dromara.cailiaoshebei.domain.dto.BusMrpDto;
import org.dromara.cailiaoshebei.domain.dto.BusMrpExportDto;
import org.dromara.cailiaoshebei.domain.vo.BusMaterialbatchdemandplanVo;
import org.dromara.cailiaoshebei.domain.vo.BusMrpVo;
import org.dromara.cailiaoshebei.service.IBusMaterialbatchdemandplanService;
import org.dromara.cailiaoshebei.service.IBusPlanDocAssociationService;
import org.dromara.common.core.domain.event.ProcessDeleteEvent;
import org.dromara.common.core.domain.event.ProcessEvent;
import org.dromara.common.core.domain.event.ProcessTaskEvent;
@ -61,6 +64,8 @@ public class BusMrpBaseServiceImpl extends ServiceImpl<BusMrpBaseMapper, BusMrpB
private final IBusMaterialbatchdemandplanService planservice;
private final IBusPlanDocAssociationService planDocAssociationService;
private final IBusBillofquantitiesLimitListService busBillofquantitiesService;
private final IBusTenderPlanningLimitListService tenderPlanningLimitListService;
@ -328,6 +333,38 @@ public class BusMrpBaseServiceImpl extends ServiceImpl<BusMrpBaseMapper, BusMrpB
return map;
}
@Override
public List<BusMrpBaseVo> getListByName(BusMrpBaseReq req) {
if (req.getName() == null || req.getName().isEmpty()) {
return null;
}
List<BusMaterialbatchdemandplan> busMaterialbatchdemandplans = planservice.getBaseMapper().selectList(new LambdaQueryWrapper<BusMaterialbatchdemandplan>()
.eq(BusMaterialbatchdemandplan::getProjectId, req.getProjectId())
.like(BusMaterialbatchdemandplan::getName, req.getName()));
Iterator<BusMaterialbatchdemandplan> iterator = busMaterialbatchdemandplans.iterator();
Set<Long> mrpIds = new HashSet<>();
while (iterator.hasNext()){
BusMaterialbatchdemandplan next = iterator.next();
List<BusPlanDocAssociation> busPlanDocAssociations = planDocAssociationService.getBaseMapper().selectList(new LambdaQueryWrapper<BusPlanDocAssociation>()
.eq(BusPlanDocAssociation::getProjectId, req.getProjectId())
.eq(BusPlanDocAssociation::getPlanId, next.getId()));
BigDecimal demandQuantity = BigDecimal.ZERO;
busPlanDocAssociations.forEach(busPlanDocAssociation -> {
demandQuantity.add(busPlanDocAssociation.getDemandQuantity());
});
if (demandQuantity.compareTo(next.getDemandQuantity()) >= 0) {
iterator.remove();
}else {
mrpIds.add(next.getMrpBaseId());
}
}
if (mrpIds.isEmpty()){
return null;
}
return baseMapper.selectVoList(new LambdaQueryWrapper<BusMrpBase>()
.eq(BusMrpBase::getStatus,BusinessStatusEnum.FINISH.getStatus()).in(BusMrpBase::getId,mrpIds));
}
/**
* 总体流程监听(例如: 草稿,撤销,退回,作废,终止,已完成,单任务完成等)
* 正常使用只需#processEvent.flowCode=='leave1'

View File

@ -92,6 +92,11 @@ public class GpsEquipmentController extends BaseController {
return gpsEquipmentService.queryPageList(bo, pageQuery);
}
@GetMapping("/getListToVehicle")
public R<List<GpsEquipmentVo>> getListToVehicle(GpsEquipmentBo bo) {
return R.ok(gpsEquipmentService.getListToVehicle(bo));
}
/**
* 查询GPS设备用户列表

View File

@ -48,6 +48,14 @@ public class GpsEquipmentSonController extends BaseController {
return gpsEquipmentSonService.queryPageList(bo, pageQuery);
}
/**
* 车辆获取gps设备轨迹列表数据
*/
@GetMapping("/getVehicleList")
public R<List<GpsEquipmentSonVo>> getVehicleList(GpsEquipmentSonBo bo) {
return R.ok(gpsEquipmentSonService.getVehicleList(bo));
}
/**
* 查询GPS设备定位信息列表
*/

View File

@ -115,4 +115,9 @@ public class GpsEquipmentSon extends BaseEntity {
private Long projectId;
/**
* 车辆出行记录id
*/
private Long tripId;
}

View File

@ -132,4 +132,9 @@ public class GpsEquipmentSonBo extends BaseEntity {
*/
private LocalDateTime endTime;
/**
* 车辆出行记录id
*/
private Long tripId;
}

View File

@ -154,5 +154,10 @@ public class GpsEquipmentSonVo implements Serializable {
*/
private String modelId;
/**
* 车辆出行记录id
*/
private Long tripId;
}

View File

@ -106,4 +106,6 @@ public interface IGpsEquipmentService extends IService<GpsEquipment>{
List<GpsEquipmentSonVo> getUeClientList(LocalDateTime startOfDay, LocalDateTime now);
List<GpsEquipmentSonVo> getUeUserListByProjectId(LocalDateTime startOfDay, LocalDateTime now);
List<GpsEquipmentVo> getListToVehicle(GpsEquipmentBo bo);
}

View File

@ -85,4 +85,6 @@ public interface IGpsEquipmentSonService extends IService<GpsEquipmentSon>{
List<GpsEquipmentSonVo> getUeClientList(LocalDateTime startOfDay, LocalDateTime now);
List<GpsEquipmentSonVo> getUeUserListByProjectId(LocalDateTime startOfDay, LocalDateTime now);
List<GpsEquipmentSonVo> getVehicleList(GpsEquipmentSonBo bo);
}

View File

@ -6,8 +6,10 @@ import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.dromara.vehicle.domain.VehVehicleInfo;
import org.dromara.vehicle.domain.vo.VehVehicleInfoVo;
import org.dromara.vehicle.service.IVehVehicleInfoService;
import org.dromara.vehicle.service.IVehVehicleTripService;
import org.dromara.websocket.websocket.service.InitOnStartWebSocketServer;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.MapstructUtils;
@ -74,6 +76,8 @@ public class GpsEquipmentServiceImpl extends ServiceImpl<GpsEquipmentMapper, Gps
private ISysUserService userService;
@Autowired
private IVehVehicleInfoService iVehVehicleInfoService;
@Autowired
private IVehVehicleTripService iVehVehicleTripService;
/**
* 查询GPS设备详细
@ -251,10 +255,16 @@ public class GpsEquipmentServiceImpl extends ServiceImpl<GpsEquipmentMapper, Gps
gpsEquipmentSon.setClientId(gpsEquipment.getClientId());
if (equipment != null && equipment.getUserId() != null) {
gpsEquipmentSon.setUserId(equipment.getUserId());
if (1==equipment.getClientType()){
Long tripId = iVehVehicleTripService.getTripId(equipment.getUserId());
gpsEquipmentSon.setTripId(tripId);
}
}
gpsEquipmentSonService.insertByBo(gpsEquipmentSon);
//TODO 后续创建websocket长连接发送信息
//保存到redis如果存在则更新存活时间
// --------------------------
@ -427,6 +437,9 @@ public class GpsEquipmentServiceImpl extends ServiceImpl<GpsEquipmentMapper, Gps
gpsManmachine.setClientId(bo.getClientId());
gpsManmachine.setUserId(bo.getUserId());
gpsManmachine.setType(bo.getClientType()== 1 ? 1:2);
if (bo.getClientType() == 1){
iVehVehicleInfoService.update(new LambdaUpdateWrapper<VehVehicleInfo>().set(VehVehicleInfo::getClientId,bo.getClientId()).eq(VehVehicleInfo::getId,bo.getUserId()));
}
return gpsManmachineMapper.insert(gpsManmachine) > 0;
}
@ -434,6 +447,10 @@ public class GpsEquipmentServiceImpl extends ServiceImpl<GpsEquipmentMapper, Gps
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean unbindManmachine(GpsEquipmentBo bo) {
GpsEquipmentVo gpsEquipmentVo = baseMapper.selectVoById(bo.getId());
if (gpsEquipmentVo.getClientType() == 1){
iVehVehicleInfoService.update(new LambdaUpdateWrapper<VehVehicleInfo>().set(VehVehicleInfo::getClientId,null).eq(VehVehicleInfo::getId,gpsEquipmentVo.getUserId()));
}
baseMapper.update(new LambdaUpdateWrapper<GpsEquipment>()
.set(GpsEquipment::getUserId,null)
.set(GpsEquipment::getClientType,null)
@ -556,5 +573,16 @@ public class GpsEquipmentServiceImpl extends ServiceImpl<GpsEquipmentMapper, Gps
return gpsEquipmentSonService.getUeUserListByProjectId(startOfDay,now);
}
@Override
public List<GpsEquipmentVo> getListToVehicle(GpsEquipmentBo bo) {
return baseMapper.selectVoList(new LambdaQueryWrapper<GpsEquipment>()
.nested(q ->
q.eq(GpsEquipment::getProjectId, bo.getProjectId())
.or()
.isNull(GpsEquipment::getProjectId)
)
.isNull(GpsEquipment::getUserId).isNotNull(GpsEquipment::getClientId));
}
}

View File

@ -221,4 +221,22 @@ public class GpsEquipmentSonServiceImpl extends ServiceImpl<GpsEquipmentSonMappe
public List<GpsEquipmentSonVo> getUeUserListByProjectId(LocalDateTime startOfDay, LocalDateTime now) {
return baseMapper.getUeUserListByProjectId(startOfDay,now);
}
@Override
public List<GpsEquipmentSonVo> getVehicleList(GpsEquipmentSonBo bo) {
if (bo.getProjectId() == null) {
throw new ServiceException("项目id不能为空");
}
if (bo.getUserId() == null) {
throw new ServiceException("车辆id不能为空");
}
if (bo.getStartTime() == null || bo.getEndTime() == null) {
throw new ServiceException("开始时间和结算时间不能为空!!!");
}
return baseMapper.selectVoList(new LambdaQueryWrapper<GpsEquipmentSon>()
.eq(GpsEquipmentSon::getProjectId,bo.getProjectId())
.eq(GpsEquipmentSon::getUserId,bo.getUserId())
.eq(bo.getTripId() != null,GpsEquipmentSon::getTripId,bo.getTripId())
.between(GpsEquipmentSon::getCreateTime,bo.getStartTime(),bo.getEndTime()));
}
}

View File

@ -15,6 +15,7 @@ import org.dromara.cailiaoshebei.domain.BusCailiaoshebeiPici;
import org.dromara.common.core.domain.event.ProcessEvent;
import org.dromara.system.service.ISysOssService;
import org.dromara.tender.domain.TenderSupplierInput;
import org.dromara.tender.domain.bo.TenderSupplierInputReq;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
@ -60,6 +61,15 @@ public class TenderSupplierInputController extends BaseController {
return tenderSupplierInputService.queryPageList(bo, pageQuery);
}
/**
* 根据材料名获取供应商列表
*/
// @SaCheckPermission("supplierInput:supplierInput:getListByName")
@GetMapping("/getListByName")
public R<List<TenderSupplierInputVo>> getListByName(TenderSupplierInputReq req) {
return R.ok(tenderSupplierInputService.getListByName(req));
}
/**
* 查询供应商入库列表
*/

View File

@ -0,0 +1,36 @@
package org.dromara.tender.domain.bo;
import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.tender.domain.TenderSupplierInput;
import java.io.Serializable;
/**
* 供应商入库业务对象 tender_supplier_input
*
* @author Lion Li
* @date 2025-08-20
*/
@Data
public class TenderSupplierInputReq implements Serializable {
/**
* 项目Id
*/
private Long projectId;
/**
* 材料名称
*/
private String name;
}

View File

@ -1,5 +1,6 @@
package org.dromara.tender.service;
import org.dromara.tender.domain.bo.TenderSupplierInputReq;
import org.dromara.tender.domain.vo.TenderSupplierInputVo;
import org.dromara.tender.domain.bo.TenderSupplierInputBo;
import org.dromara.tender.domain.TenderSupplierInput;
@ -74,4 +75,6 @@ ITenderSupplierInputService extends IService<TenderSupplierInput>{
List<TenderSupplierInputVo> getList(TenderSupplierInputBo bo);
boolean importData(List<TenderSupplierInputVo> tenderSupplierInputVos, Long projectId);
List<TenderSupplierInputVo> getListByName(TenderSupplierInputReq req);
}

View File

@ -389,12 +389,12 @@ public class BusBiddingPlanServiceImpl extends ServiceImpl<BusBiddingPlanMapper,
return map;
}
//获取该供应商的所有材料
List<BusTenderPlanningLimitList> busTenderPlanningLimitLists = busTenderPlanningLimitListMapper.selectList(new LambdaQueryWrapper<BusTenderPlanningLimitList>().in(BusTenderPlanningLimitList::getBiddingPlanId, bplanIdds));
List<BusTenderPlanningLimitList> busTenderPlanningLimitLists = busTenderPlanningLimitListMapper.selectList(new LambdaQueryWrapper<BusTenderPlanningLimitList>().isNotNull(BusTenderPlanningLimitList::getNum).in(BusTenderPlanningLimitList::getBiddingPlanId, bplanIdds));
for (BusTenderPlanningLimitList v : busTenderPlanningLimitLists) {
if (!map.containsKey(v.getId())) {
map.put(v.getId(), v.getNum());
if (!map.containsKey(v.getLimitListId())) {
map.put(v.getLimitListId(), v.getNum());
}else {
map.put(v.getId(), map.get(v.getId()).add(v.getNum()));
map.put(v.getLimitListId(), map.get(v.getLimitListId()).add(v.getNum()));
}
}
return map;

View File

@ -17,8 +17,17 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.dromara.system.domain.vo.SysOssVo;
import org.dromara.system.service.ISysOssService;
import org.dromara.tender.domain.BusBiddingPlan;
import org.dromara.tender.domain.BusBillofquantitiesLimitList;
import org.dromara.tender.domain.BusTenderPlanningLimitList;
import org.dromara.tender.domain.bo.TenderSupplierInputReq;
import org.dromara.tender.mapper.BusTenderPlanningLimitListMapper;
import org.dromara.tender.service.IBusBiddingPlanService;
import org.dromara.tender.service.IBusBillofquantitiesLimitListService;
import org.dromara.tender.service.IBusTenderPlanningLimitListService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.dromara.tender.domain.bo.TenderSupplierInputBo;
import org.dromara.tender.domain.vo.TenderSupplierInputVo;
@ -45,6 +54,16 @@ public class TenderSupplierInputServiceImpl extends ServiceImpl<TenderSupplierIn
private final TenderSupplierInputMapper baseMapper;
@Autowired private ISysOssService ossService;
@Autowired
@Lazy
private IBusTenderPlanningLimitListService busTenderPlanningLimitListService;
@Autowired
@Lazy
private IBusBillofquantitiesLimitListService billofquantitiesLimitListService;
@Autowired
@Lazy
private IBusBiddingPlanService busBiddingPlanService;
/**
* 查询供应商入库
@ -247,6 +266,49 @@ public class TenderSupplierInputServiceImpl extends ServiceImpl<TenderSupplierIn
return baseMapper.insertBatch(tenderSupplierInputs);
}
@Override
public List<TenderSupplierInputVo> getListByName(TenderSupplierInputReq req) {
if (req.getName() == null || req.getName().isEmpty()) {
return null;
}
//查询限价一览表中物资限价一览中物资名包含req.getName()的物资
List<BusBillofquantitiesLimitList> busBillofquantitiesLimitLists = billofquantitiesLimitListService.getBaseMapper()
.selectList(new LambdaQueryWrapper<BusBillofquantitiesLimitList>()
.eq(BusBillofquantitiesLimitList::getProjectId, req.getProjectId())
.eq(BusBillofquantitiesLimitList::getType, 3)
.like(BusBillofquantitiesLimitList::getName, req.getName()));
if (busBillofquantitiesLimitLists.isEmpty()) {
return null;
}
Set<Long> b = new HashSet<>();
busBillofquantitiesLimitLists.forEach(billofquantitiesLimitList -> {b.add(billofquantitiesLimitList.getId());});
if (b.isEmpty()){
return null;
}
//通过物资限价一览id获取到对应的招标计划id
List<BusTenderPlanningLimitList> busTenderPlanningLimitLists = busTenderPlanningLimitListService.getBaseMapper().selectList(new LambdaQueryWrapper<BusTenderPlanningLimitList>().isNotNull(BusTenderPlanningLimitList::getNum).in(BusTenderPlanningLimitList::getLimitListId, b));
if (busTenderPlanningLimitLists.isEmpty()) {
return null;
}
//通过招标计划id找到对应招标计划并获取到对应供应商id
Set<Long> planIds = new HashSet<>();
busTenderPlanningLimitLists.forEach(tenderPlanningLimitList -> {planIds.add(tenderPlanningLimitList.getBiddingPlanId());});
if (planIds.isEmpty()) {
return null;
}
List<BusBiddingPlan> busBiddingPlans = busBiddingPlanService.getBaseMapper().selectList(new LambdaQueryWrapper<BusBiddingPlan>().in(BusBiddingPlan::getId, planIds));
if (busBiddingPlans.isEmpty()) {
return null;
}
//通过供应商id获取供应商列表
Set<Long> tenderSupplierIds = new HashSet<>();
busBiddingPlans.forEach(biddingPlan -> {tenderSupplierIds.add(biddingPlan.getWinningBidderId());});
if (tenderSupplierIds.isEmpty()) {
return null;
}
return baseMapper.selectVoByIds(tenderSupplierIds);
}
/**
* 总体流程监听(例如: 草稿,撤销,退回,作废,终止,已完成,单任务完成等)

View File

@ -89,6 +89,23 @@ public class VehVehicleInfoController extends BaseController {
return toAjax(vehVehicleInfoService.insertByBo(bo));
}
/**
* 车辆绑定gps设备
*/
// @SaCheckPermission("vehicle:vehicleInfo:bindClient")
@PostMapping("/bindClient")
public R<Void> bindClient(@RequestBody VehVehicleInfoBo bo) {
return toAjax(vehVehicleInfoService.bindClient(bo));
}
/**
* 车辆解绑gps设备
*/
// @SaCheckPermission("vehicle:vehicleInfo:bindClient")
@PostMapping("/unBindClient")
public R<Void> unBindClient(@RequestBody VehVehicleInfoBo bo) {
return toAjax(vehVehicleInfoService.unBindClient(bo));
}
/**
* 修改车辆信息
*/

View File

@ -145,4 +145,9 @@ public class VehVehicleInfo extends BaseEntity {
*/
private String remark;
/**
* gps定位设备id
*/
private String clientId;
}

View File

@ -154,5 +154,9 @@ public class VehVehicleInfoBo extends BaseEntity {
*/
private String remark;
/**
* gps定位设备id
*/
private String clientId;
}

View File

@ -181,5 +181,10 @@ public class VehVehicleInfoVo implements Serializable {
@ExcelProperty(value = "备注")
private String remark;
/**
* gps定位设备id
*/
private String clientId;
}

View File

@ -18,4 +18,5 @@ public interface VehVehicleTripMapper extends BaseMapperPlus<VehVehicleTrip, Veh
Page<VehVehicleTripVo> selectVehicleTripPage(@Param("page") Page<VehVehicleTrip> page,
@Param("req") VehVehicleTripQueryReq req);
Long getTripId(@Param("id") Long id);
}

View File

@ -67,4 +67,18 @@ public interface IVehVehicleInfoService extends IService<VehVehicleInfo>{
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
* 车辆绑定gps设备
* @param bo
* @return
*/
int bindClient(VehVehicleInfoBo bo);
/**
* 车辆解绑gps设备
* @param bo
* @return
*/
int unBindClient(VehVehicleInfoBo bo);
}

View File

@ -100,4 +100,11 @@ public interface IVehVehicleTripService extends IService<VehVehicleTrip> {
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
* 根据车辆id获取最新行程id
* @param id
* @return
*/
Long getTripId(Long id);
}

View File

@ -1,21 +1,30 @@
package org.dromara.vehicle.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.gps.domain.GpsEquipment;
import org.dromara.gps.domain.GpsManmachine;
import org.dromara.gps.service.IGpsEquipmentService;
import org.dromara.gps.service.IGpsManmachineService;
import org.dromara.vehicle.domain.VehVehicleInfo;
import org.dromara.vehicle.domain.bo.VehVehicleInfoBo;
import org.dromara.vehicle.domain.vo.VehVehicleInfoVo;
import org.dromara.vehicle.mapper.VehVehicleInfoMapper;
import org.dromara.vehicle.service.IVehVehicleInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Collection;
import java.util.List;
@ -33,6 +42,14 @@ import java.util.Map;
public class VehVehicleInfoServiceImpl extends ServiceImpl<VehVehicleInfoMapper, VehVehicleInfo>
implements IVehVehicleInfoService {
@Autowired
@Lazy
private IGpsEquipmentService gpsEquipmentService;
@Autowired
@Lazy
private IGpsManmachineService gpsManmachineService;
/**
* 查询车辆信息
*
@ -150,4 +167,46 @@ public class VehVehicleInfoServiceImpl extends ServiceImpl<VehVehicleInfoMapper,
}
return baseMapper.deleteByIds(ids) > 0;
}
@Override
@Transactional(rollbackFor = Exception.class)
public int bindClient(VehVehicleInfoBo bo) {
Long count = gpsEquipmentService.getBaseMapper().selectCount(new LambdaQueryWrapper<GpsEquipment>()
.eq(GpsEquipment::getClientId, bo.getClientId()).isNotNull(GpsEquipment::getUserId));
if (count > 0) {
throw new ServiceException("该设备已绑定!");
}
GpsEquipment gpsEquipment = gpsEquipmentService.getBaseMapper().selectOne(new LambdaQueryWrapper<GpsEquipment>()
.eq(GpsEquipment::getClientId, bo.getClientId()));
gpsEquipment.setClientType(1);
gpsEquipment.setUserId(bo.getId());
gpsEquipment.setProjectId(bo.getProjectId());
gpsEquipmentService.updateById(gpsEquipment);
GpsManmachine gpsManmachine = new GpsManmachine();
gpsManmachine.setClientId(bo.getClientId());
gpsManmachine.setUserId(bo.getId());
gpsManmachineService.save(gpsManmachine);
return baseMapper.update(new LambdaUpdateWrapper<VehVehicleInfo>().set(VehVehicleInfo::getClientId, bo.getClientId()).eq(VehVehicleInfo::getId,bo.getId()));
}
@Override
@Transactional(rollbackFor = Exception.class)
public int unBindClient(VehVehicleInfoBo bo) {
GpsEquipment gpsEquipment = gpsEquipmentService.getBaseMapper().selectOne(new LambdaQueryWrapper<GpsEquipment>()
.eq(GpsEquipment::getClientId, bo.getClientId())
.eq(GpsEquipment::getUserId, bo.getId())
.eq(GpsEquipment::getProjectId, bo.getProjectId())
.eq(GpsEquipment::getClientType, 1));
if (gpsEquipment == null) {
throw new ServiceException("找不到该车辆绑定的设备!");
}
gpsEquipmentService.update(new LambdaUpdateWrapper<GpsEquipment>()
.set(GpsEquipment::getUserId,null)
.set(GpsEquipment::getProjectId,null)
.eq(GpsEquipment::getId,gpsEquipment.getId()));
gpsManmachineService.getBaseMapper().delete(new LambdaQueryWrapper<GpsManmachine>()
.eq(GpsManmachine::getClientId, bo.getClientId())
.eq(GpsManmachine::getUserId, bo.getId()));
return baseMapper.update(new LambdaUpdateWrapper<VehVehicleInfo>().set(VehVehicleInfo::getClientId,null).eq(VehVehicleInfo::getId,bo.getId()));
}
}

View File

@ -471,6 +471,11 @@ public class VehVehicleTripServiceImpl extends ServiceImpl<VehVehicleTripMapper,
return this.removeBatchByIds(ids);
}
@Override
public Long getTripId(Long id) {
return baseMapper.getTripId(id);
}
/**
* 构建用户行程及其对应申请的展示列表
*

View File

@ -113,6 +113,17 @@
ORDER BY t.total_score DESC
</select>
<select id="getTripId" resultType="java.lang.Long">
SELECT
id
FROM
veh_vehicle_trip
WHERE
vehicle_id = #{id}
ORDER BY
create_time DESC
LIMIT 1
</select>
</mapper>