|
@@ -13,8 +13,10 @@ import com.qmrb.system.pojo.form.BarninRecordForm;
|
|
|
import com.qmrb.system.pojo.vo.BarninRecordVO;
|
|
|
import com.qmrb.system.pojo.query.BarninRecordQuery;
|
|
|
import com.qmrb.system.mapper.BarninRecordMapper;
|
|
|
+import com.qmrb.system.service.IBarnRecordService;
|
|
|
import com.qmrb.system.service.IBarninRecordService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import cn.hutool.core.lang.Assert;
|
|
@@ -38,6 +40,8 @@ import java.util.stream.Collectors;
|
|
|
public class BarninRecordServiceImpl extends ServiceImpl<BarninRecordMapper, BarninRecord> implements IBarninRecordService {
|
|
|
|
|
|
private final BarninRecordConverter converter;
|
|
|
+ @Autowired
|
|
|
+ private IBarnRecordService barnRecordService;
|
|
|
|
|
|
/**
|
|
|
* 分页查询
|
|
@@ -111,7 +115,7 @@ public class BarninRecordServiceImpl extends ServiceImpl<BarninRecordMapper, Bar
|
|
|
.filter(id -> id != null)
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
- // 删除数据库中存在这些 id 的数据
|
|
|
+ // 删除数据库中存在这些 id 的数据 插入停车入场记录
|
|
|
if (!CollectionUtil.isEmpty(idsToDelete)) {
|
|
|
this.removeByIds(idsToDelete);
|
|
|
}
|
|
@@ -119,8 +123,21 @@ public class BarninRecordServiceImpl extends ServiceImpl<BarninRecordMapper, Bar
|
|
|
BarninRecord barninRecord = new BarninRecord();
|
|
|
BeanUtil.copyProperties(barninRecordForm, barninRecord);
|
|
|
saveList.add(barninRecord);
|
|
|
+ // 更新停车记录表 根据placeNo,carNumber,inTime定位该条数据
|
|
|
+ List<BarnRecord> equalList = barnRecordService.list(new LambdaQueryWrapper<BarnRecord>()
|
|
|
+ .eq(BarnRecord::getPlaceNo, barninRecordForm.getPlaceNo())
|
|
|
+ .eq(BarnRecord::getCarNumber, barninRecordForm.getCarNumber())
|
|
|
+ .eq(BarnRecord::getInTime, barninRecordForm.getInTime())
|
|
|
+ );
|
|
|
+ if (CollectionUtil.isEmpty(equalList)) {
|
|
|
+ // 如果不存在,则更新停车记录
|
|
|
+ BarnRecord barnRecord = new BarnRecord();
|
|
|
+ BeanUtil.copyProperties(barninRecordForm, barnRecord,"id");
|
|
|
+ barnRecordService.save(barnRecord);
|
|
|
+ }
|
|
|
}
|
|
|
boolean saveFlag = this.saveBatch(saveList);
|
|
|
+
|
|
|
return list;
|
|
|
}
|
|
|
|