兴安优化车辆包兼容
This commit is contained in:
@@ -2,6 +2,7 @@ package com.dcsoft.system.vehicle.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.dcsoft.common.core.utils.StringUtils;
|
||||
import com.dcsoft.common.core.utils.poi.ExcelUtil;
|
||||
import com.dcsoft.common.core.web.controller.BaseController;
|
||||
import com.dcsoft.common.core.web.domain.AjaxResult;
|
||||
@@ -11,17 +12,20 @@ import com.dcsoft.common.log.enums.BusinessType;
|
||||
import com.dcsoft.common.security.annotation.RequiresPermissions;
|
||||
import com.dcsoft.common.security.utils.SecurityUtils;
|
||||
import com.dcsoft.system.vehicle.domain.CarInfo;
|
||||
import com.dcsoft.system.vehicle.domain.CarPark;
|
||||
import com.dcsoft.system.vehicle.domain.CarParkItem;
|
||||
import com.dcsoft.system.vehicle.domain.CarParkRecord;
|
||||
import com.dcsoft.system.vehicle.service.ICarInfoService;
|
||||
import com.dcsoft.system.vehicle.service.ICarParkItemService;
|
||||
import com.dcsoft.system.vehicle.service.ICarParkRecordService;
|
||||
import com.dcsoft.system.vehicle.service.ICarParkService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -44,6 +48,9 @@ public class CarInfoController extends BaseController
|
||||
@Autowired
|
||||
private ICarParkItemService carParkItemService;
|
||||
|
||||
@Autowired
|
||||
private ICarParkService carParkService;
|
||||
|
||||
/**
|
||||
* 查询车辆信息列表
|
||||
*/
|
||||
@@ -118,13 +125,18 @@ public class CarInfoController extends BaseController
|
||||
//保存车辆授权
|
||||
//根据车场查询车辆
|
||||
if (carInfo.getParkId() != null) {
|
||||
List<Long> list = new ArrayList<>();
|
||||
CarPark park = carParkService.selectCarParkById(carInfo.getParkId());
|
||||
list.add(carInfo.getParkId());
|
||||
list.add(park.getParentId());
|
||||
|
||||
CarParkItem carParkItem = new CarParkItem();
|
||||
carParkItem.setParkId(carInfo.getParkId());
|
||||
carParkItem.setParkIds(list);
|
||||
List<CarParkItem> itemList = carParkItemService.selectCarParkItemList(carParkItem);
|
||||
for (CarParkItem a : itemList) {
|
||||
CarParkRecord carParkRecord = new CarParkRecord();
|
||||
carParkRecord.setCustomerId(carInfo.getCustomerId());
|
||||
carParkRecord.setParkId(carInfo.getParkId());
|
||||
carParkRecord.setParkId(a.getParkId());
|
||||
carParkRecord.setEquipmentId(a.getEquipmentId());
|
||||
carParkRecordService.insertCarParkRecord(carParkRecord);
|
||||
}
|
||||
@@ -138,22 +150,30 @@ public class CarInfoController extends BaseController
|
||||
@RequiresPermissions("system:carInfo:edit")
|
||||
@Log(title = "车辆信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody CarInfo carInfo)
|
||||
{
|
||||
if(!checkPlateNumberFormat(carInfo.getPlate())){
|
||||
public AjaxResult edit(@RequestBody CarInfo carInfo) {
|
||||
if (!StrUtil.equals("2", carInfo.getCarType()) && !checkPlateNumberFormat(carInfo.getPlate())) {
|
||||
return AjaxResult.error("车牌号不正确!");
|
||||
}
|
||||
if (StringUtils.equals("1", carInfo.getTimeSegEnable()) && StringUtils.isBlank(carInfo.getSegTime())) {
|
||||
return AjaxResult.error("已启用时间段,时间段不能为空!");
|
||||
}
|
||||
|
||||
//根据车场查询车辆
|
||||
if(carInfo.getParkId()!=null){
|
||||
if (carInfo.getParkId() != null) {
|
||||
//删除车辆授权
|
||||
carParkRecordService.deleteCarParkRecordByCustomerId(carInfo.getCustomerId());
|
||||
CarParkItem carParkItem=new CarParkItem();
|
||||
carParkItem.setParkId(carInfo.getParkId());
|
||||
List<CarParkItem> itemList=carParkItemService.selectCarParkItemList(carParkItem);
|
||||
for(CarParkItem a:itemList){
|
||||
CarParkRecord carParkRecord=new CarParkRecord();
|
||||
|
||||
List<Long> list = new ArrayList<>();
|
||||
CarPark park = carParkService.selectCarParkById(carInfo.getParkId());
|
||||
list.add(carInfo.getParkId());
|
||||
list.add(park.getParentId());
|
||||
CarParkItem carParkItem = new CarParkItem();
|
||||
carParkItem.setParkIds(list);
|
||||
List<CarParkItem> itemList = carParkItemService.selectCarParkItemList(carParkItem);
|
||||
for (CarParkItem a : itemList) {
|
||||
CarParkRecord carParkRecord = new CarParkRecord();
|
||||
carParkRecord.setCustomerId(carInfo.getCustomerId());
|
||||
carParkRecord.setParkId(carInfo.getParkId());
|
||||
carParkRecord.setParkId(a.getParkId());
|
||||
carParkRecord.setEquipmentId(a.getEquipmentId());
|
||||
carParkRecordService.insertCarParkRecord(carParkRecord);
|
||||
|
||||
@@ -213,7 +233,7 @@ public class CarInfoController extends BaseController
|
||||
}
|
||||
|
||||
public boolean checkPlateNumberFormat(String content) {
|
||||
String pattern = "([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼]{1}(([A-HJ-Z]{1}[A-HJ-NP-Z0-9]{5})|([A-HJ-Z]{1}(([DF]{1}[A-HJ-NP-Z0-9]{1}[0-9]{4})|([0-9]{5}[DF]{1})))|([A-HJ-Z]{1}[A-D0-9]{1}[0-9]{3}警)))|([0-9]{6}使)|((([沪粤川云桂鄂陕蒙藏黑辽渝]{1}A)|鲁B|闽D|蒙E|蒙H)[0-9]{4}领)|(WJ[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼·•]{1}[0-9]{4}[TDSHBXJ0-9]{1})|([VKHBSLJNGCE]{1}[A-DJ-PR-TVY]{1}[0-9]{5})";
|
||||
String pattern = "([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼]{1}(([A-HJ-Z]{1}[A-HJ-NP-Z0-9]{5})|([A-HJ-Z]{1}(([ADF]{1}[A-HJ-NP-Z0-9]{1}[0-9]{4})|([0-9]{5}[ADF]{1})))|([A-HJ-Z]{1}[A-D0-9]{1}[0-9]{3}警)))|([0-9]{6}使)|((([沪粤川云桂鄂陕蒙藏黑辽渝]{1}A)|鲁B|闽D|蒙E|蒙H)[0-9]{4}领)|(WJ[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼·•]{1}[0-9]{4}[TDSHBXJ0-9]{1})|([VKHBSLJNGCE]{1}[A-DJ-PR-TVY]{1}[0-9]{5})";
|
||||
return Pattern.matches(pattern, content);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,17 @@ public class CarParkController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询车场信息下拉数据
|
||||
*/
|
||||
@RequiresPermissions("system:carPark:list")
|
||||
@GetMapping("/getCarParkSelect/{id}")
|
||||
public AjaxResult getCarParkSelect(@PathVariable("id") Long id)
|
||||
{
|
||||
List<CarPark> list = carParkService.getCarParkSelect(id);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出车场信息列表
|
||||
*/
|
||||
|
||||
@@ -69,6 +69,7 @@ public class CarInfo extends BaseEntity
|
||||
private String sync;
|
||||
|
||||
private Long parkId;
|
||||
|
||||
@Excel(name = "所属员工",sort = 9)
|
||||
private String peopleName;
|
||||
|
||||
@@ -84,7 +85,7 @@ public class CarInfo extends BaseEntity
|
||||
private String remark;
|
||||
private String carType;
|
||||
|
||||
@Excel(name = "所属单位",sort = 8,readConverterExp = "1=锦盛化工,2=锦亿科技,3=锦泽化工,4=锋盛环保,5=锦鑫化工,6=锦鑫稀材,7=锦盛电厂,8=锦桂科技,9=晟锦科技,10=锦淳公司")
|
||||
@Excel(name = "所属单位", sort = 8, readConverterExp = "1=兴安化工,2=兴安镓业")
|
||||
private String unit;
|
||||
|
||||
public Long getParkId() {
|
||||
|
||||
@@ -31,6 +31,15 @@ public class CarPark extends BaseEntity
|
||||
|
||||
private String spaceName;
|
||||
|
||||
/** 上级车场(一并下发车场)*/
|
||||
private Long parentId;
|
||||
|
||||
/** 上级车场(一并下发车场)*/
|
||||
private String parentIdName;
|
||||
|
||||
/** 满车位自动锁杆:0:不锁,1:锁 */
|
||||
private Integer autoLock;
|
||||
|
||||
/** 车位总数 */
|
||||
@Excel(name = "车位总数")
|
||||
private Long carsNum;
|
||||
@@ -41,6 +50,30 @@ public class CarPark extends BaseEntity
|
||||
|
||||
private List<CarParkItem> itemList = new ArrayList<CarParkItem>();
|
||||
|
||||
public String getParentIdName() {
|
||||
return parentIdName;
|
||||
}
|
||||
|
||||
public void setParentIdName(String parentIdName) {
|
||||
this.parentIdName = parentIdName;
|
||||
}
|
||||
|
||||
public Long getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Long parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public Integer getAutoLock() {
|
||||
return autoLock;
|
||||
}
|
||||
|
||||
public void setAutoLock(Integer autoLock) {
|
||||
this.autoLock = autoLock;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
|
||||
@@ -5,6 +5,8 @@ import com.dcsoft.common.core.web.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车场设备信息对象 car_park_item
|
||||
*
|
||||
@@ -26,12 +28,23 @@ public class CarParkItem extends BaseEntity
|
||||
@Excel(name = "车场id")
|
||||
private Long parkId;
|
||||
|
||||
/** 车场ids */
|
||||
private List<Long> parkIds;
|
||||
|
||||
/** 通道方向 */
|
||||
@Excel(name = "通道方向")
|
||||
private String way;
|
||||
|
||||
private String area;
|
||||
|
||||
public List<Long> getParkIds() {
|
||||
return parkIds;
|
||||
}
|
||||
|
||||
public void setParkIds(List<Long> parkIds) {
|
||||
this.parkIds = parkIds;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
|
||||
@@ -73,4 +73,8 @@ public interface CarParkMapper
|
||||
public int selectCarInfo(@Param("id") Long id,@Param("flag") String flag);
|
||||
|
||||
public CarPark selectCarParkByName(String name);
|
||||
|
||||
List<CarPark> selectByIds(@Param("list") List<Long> collect);
|
||||
|
||||
List<CarPark> getCarParkSelect(Long id);
|
||||
}
|
||||
|
||||
@@ -59,4 +59,6 @@ public interface ICarParkService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCarParkById(Long id);
|
||||
|
||||
List<CarPark> getCarParkSelect(Long id);
|
||||
}
|
||||
|
||||
@@ -223,110 +223,103 @@ public class CarInfoServiceImpl implements ICarInfoService
|
||||
/**
|
||||
* 导入用户数据
|
||||
*
|
||||
* @param userList 用户数据列表
|
||||
* @param userList 用户数据列表
|
||||
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
|
||||
* @param operName 操作用户
|
||||
* @param operName 操作用户
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String importData(List<CarInfo> userList, boolean isUpdateSupport, String operName)
|
||||
{
|
||||
if (StringUtils.isNull(userList) || userList.size() == 0)
|
||||
{
|
||||
public String importData(List<CarInfo> userList, boolean isUpdateSupport, String operName) {
|
||||
if (StringUtils.isNull(userList) || userList.size() == 0) {
|
||||
throw new ServiceException("导入用户数据不能为空!");
|
||||
}
|
||||
int successNum = 0;
|
||||
int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
int i=0;
|
||||
for (CarInfo user : userList)
|
||||
{
|
||||
int i = 0;
|
||||
for (CarInfo user : userList) {
|
||||
i++;
|
||||
try
|
||||
{
|
||||
try {
|
||||
// 验证车牌是否合格
|
||||
if(!checkPlateNumberFormat(user.getPlate())){
|
||||
if (!checkPlateNumberFormat(user.getPlate())) {
|
||||
failureNum++;
|
||||
failureMsg.append("<br/>" + failureNum + "、车牌信息 " + user.getPlate() + "格式错误");
|
||||
}else{
|
||||
// 验证是否存在这个用户
|
||||
CarInfo u = carInfoMapper.selectCarInfoByCarNo(user.getPlate());
|
||||
SysPeople people=peopleMapper.selectSysPeopleByUserName(user.getPeopleName());
|
||||
if(people!=null){
|
||||
user.setPeopleId(people.getId());
|
||||
}
|
||||
CarPark carPark=carParkMapper.selectCarParkByName(user.getParkName());
|
||||
if(carPark!=null){
|
||||
user.setParkId(carPark.getId());
|
||||
}
|
||||
if (StringUtils.isNull(u))
|
||||
{
|
||||
user.setCarType("0");
|
||||
user.setCreateBy(operName);
|
||||
this.insertCarInfo(user);
|
||||
//保存车辆授权
|
||||
//根据车场查询车辆
|
||||
if(user.getParkId()!=null){
|
||||
CarParkItem carParkItem=new CarParkItem();
|
||||
carParkItem.setParkId(user.getParkId());
|
||||
List<CarParkItem> itemList=carParkItemMapper.selectCarParkItemList(carParkItem);
|
||||
for(CarParkItem a:itemList){
|
||||
CarParkRecord carParkRecord=new CarParkRecord();
|
||||
carParkRecord.setCustomerId(user.getCustomerId());
|
||||
carParkRecord.setParkId(user.getParkId());
|
||||
carParkRecord.setEquipmentId(a.getEquipmentId());
|
||||
carParkRecordMapper.insertCarParkRecord(carParkRecord);
|
||||
}
|
||||
} else {
|
||||
// 验证是否存在这个用户
|
||||
CarInfo u = carInfoMapper.selectCarInfoByCarNo(user.getPlate());
|
||||
SysPeople people = peopleMapper.selectSysPeopleByUserName(user.getPeopleName());
|
||||
if (people != null) {
|
||||
user.setPeopleId(people.getId());
|
||||
}
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、车牌信息 " + user.getPlate() + " 导入成功");
|
||||
}
|
||||
else if (isUpdateSupport)
|
||||
{
|
||||
user.setCarType("0");
|
||||
user.setCustomerId(u.getCustomerId());
|
||||
user.setUpdateBy(operName);
|
||||
this.updateCarInfo(user);
|
||||
//根据车场查询车辆
|
||||
if(user.getParkId()!=null){
|
||||
//删除车辆授权
|
||||
carParkRecordMapper.deleteCarParkRecordByCustomerId(user.getCustomerId());
|
||||
CarParkItem carParkItem=new CarParkItem();
|
||||
carParkItem.setParkId(user.getParkId());
|
||||
List<CarParkItem> itemList=carParkItemMapper.selectCarParkItemList(carParkItem);
|
||||
for(CarParkItem a:itemList){
|
||||
CarParkRecord carParkRecord=new CarParkRecord();
|
||||
carParkRecord.setCustomerId(user.getCustomerId());
|
||||
carParkRecord.setParkId(user.getParkId());
|
||||
carParkRecord.setEquipmentId(a.getEquipmentId());
|
||||
carParkRecordMapper.insertCarParkRecord(carParkRecord);
|
||||
}
|
||||
CarPark carPark = carParkMapper.selectCarParkByName(user.getParkName());
|
||||
if (carPark != null) {
|
||||
user.setParkId(carPark.getId());
|
||||
}
|
||||
if (StringUtils.isNull(u)) {
|
||||
user.setCarType("0");
|
||||
user.setCreateBy(operName);
|
||||
this.insertCarInfo(user);
|
||||
//保存车辆授权
|
||||
//根据车场查询车辆
|
||||
if (user.getParkId() != null) {
|
||||
List<Long> list = new ArrayList<>();
|
||||
list.add(user.getParkId());
|
||||
list.add(carPark.getParentId());
|
||||
CarParkItem carParkItem = new CarParkItem();
|
||||
carParkItem.setParkIds(list);
|
||||
List<CarParkItem> itemList = carParkItemMapper.selectCarParkItemList(carParkItem);
|
||||
for (CarParkItem a : itemList) {
|
||||
CarParkRecord carParkRecord = new CarParkRecord();
|
||||
carParkRecord.setCustomerId(user.getCustomerId());
|
||||
carParkRecord.setParkId(a.getParkId());
|
||||
carParkRecord.setEquipmentId(a.getEquipmentId());
|
||||
carParkRecordMapper.insertCarParkRecord(carParkRecord);
|
||||
}
|
||||
}
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、车牌信息 " + user.getPlate() + " 导入成功");
|
||||
} else if (isUpdateSupport) {
|
||||
user.setCarType("0");
|
||||
user.setCustomerId(u.getCustomerId());
|
||||
user.setUpdateBy(operName);
|
||||
this.updateCarInfo(user);
|
||||
//根据车场查询车辆
|
||||
if (user.getParkId() != null) {
|
||||
//删除车辆授权
|
||||
carParkRecordMapper.deleteCarParkRecordByCustomerId(user.getCustomerId());
|
||||
|
||||
List<Long> list = new ArrayList<>();
|
||||
list.add(user.getParkId());
|
||||
list.add(carPark.getParentId());
|
||||
CarParkItem carParkItem = new CarParkItem();
|
||||
carParkItem.setParkIds(list);
|
||||
List<CarParkItem> itemList = carParkItemMapper.selectCarParkItemList(carParkItem);
|
||||
for (CarParkItem a : itemList) {
|
||||
CarParkRecord carParkRecord = new CarParkRecord();
|
||||
carParkRecord.setCustomerId(user.getCustomerId());
|
||||
carParkRecord.setParkId(a.getParkId());
|
||||
carParkRecord.setEquipmentId(a.getEquipmentId());
|
||||
carParkRecordMapper.insertCarParkRecord(carParkRecord);
|
||||
}
|
||||
}
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、车牌信息 " + user.getPlate() + " 更新成功");
|
||||
} else {
|
||||
failureNum++;
|
||||
failureMsg.append("<br/>" + failureNum + "、车牌信息 " + user.getPlate() + " 已存在");
|
||||
}
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、车牌信息 " + user.getPlate() + " 更新成功");
|
||||
}
|
||||
else
|
||||
{
|
||||
failureNum++;
|
||||
failureMsg.append("<br/>" + failureNum + "、车牌信息 " + user.getPlate() + " 已存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、车牌信息 " + user.getPlate() + " 导入失败:";
|
||||
failureMsg.append(msg + e.getMessage());
|
||||
}
|
||||
}
|
||||
if (failureNum > 0)
|
||||
{
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
@@ -337,8 +330,8 @@ public class CarInfoServiceImpl implements ICarInfoService
|
||||
return carInfoMapper.selectCarInfoByPlate(plate);
|
||||
}
|
||||
|
||||
public boolean checkPlateNumberFormat(String content) {
|
||||
String pattern = "([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼]{1}(([A-HJ-Z]{1}[A-HJ-NP-Z0-9]{5})|([A-HJ-Z]{1}(([DF]{1}[A-HJ-NP-Z0-9]{1}[0-9]{4})|([0-9]{5}[DF]{1})))|([A-HJ-Z]{1}[A-D0-9]{1}[0-9]{3}警)))|([0-9]{6}使)|((([沪粤川云桂鄂陕蒙藏黑辽渝]{1}A)|鲁B|闽D|蒙E|蒙H)[0-9]{4}领)|(WJ[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼·•]{1}[0-9]{4}[TDSHBXJ0-9]{1})|([VKHBSLJNGCE]{1}[A-DJ-PR-TVY]{1}[0-9]{5})";
|
||||
public static boolean checkPlateNumberFormat(String content) {
|
||||
String pattern = "([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼]{1}(([A-HJ-Z]{1}[A-HJ-NP-Z0-9]{5})|([A-HJ-Z]{1}(([ADF]{1}[A-HJ-NP-Z0-9]{1}[0-9]{4})|([0-9]{5}[ADF]{1})))|([A-HJ-Z]{1}[A-D0-9]{1}[0-9]{3}警)))|([0-9]{6}使)|((([沪粤川云桂鄂陕蒙藏黑辽渝]{1}A)|鲁B|闽D|蒙E|蒙H)[0-9]{4}领)|(WJ[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼·•]{1}[0-9]{4}[TDSHBXJ0-9]{1})|([VKHBSLJNGCE]{1}[A-DJ-PR-TVY]{1}[0-9]{5})";
|
||||
return Pattern.matches(pattern, content);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.dcsoft.system.vehicle.service.impl;
|
||||
|
||||
import com.dcsoft.common.core.utils.CollUtil;
|
||||
import com.dcsoft.common.core.utils.DateUtils;
|
||||
import com.dcsoft.system.vehicle.domain.CarPark;
|
||||
import com.dcsoft.system.vehicle.mapper.CarParkMapper;
|
||||
@@ -7,7 +8,9 @@ import com.dcsoft.system.vehicle.service.ICarParkService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 车场信息Service业务层处理
|
||||
@@ -40,9 +43,22 @@ public class CarParkServiceImpl implements ICarParkService
|
||||
* @return 车场信息
|
||||
*/
|
||||
@Override
|
||||
public List<CarPark> selectCarParkList(CarPark carPark)
|
||||
{
|
||||
return carParkMapper.selectCarParkList(carPark);
|
||||
public List<CarPark> selectCarParkList(CarPark carPark) {
|
||||
List<CarPark> carParks = carParkMapper.selectCarParkList(carPark);
|
||||
|
||||
List<Long> collect = carParks.stream().map(CarPark::getParentId).filter(parentId -> parentId != 0).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(collect)) {
|
||||
List<CarPark> parkList = carParkMapper.selectByIds(collect);
|
||||
for (CarPark park : parkList) {
|
||||
for (CarPark carPark1 : carParks) {
|
||||
if (park.getId().equals(carPark1.getParentId())) {
|
||||
carPark1.setParentIdName(park.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return carParks;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,4 +110,9 @@ public class CarParkServiceImpl implements ICarParkService
|
||||
{
|
||||
return carParkMapper.deleteCarParkById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CarPark> getCarParkSelect(Long id) {
|
||||
return carParkMapper.getCarParkSelect(id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user