兴安优化车辆包兼容

This commit is contained in:
zc
2025-12-16 09:38:31 +08:00
parent 55de6e5446
commit 865f90ca2a
20 changed files with 373 additions and 138 deletions

View File

@@ -15,11 +15,11 @@ spring:
discovery: discovery:
# 服务注册地址 # 服务注册地址
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
# namespace: xa namespace: xa
config: config:
# 配置中心地址 # 配置中心地址
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
# namespace: xa namespace: xa
# 配置文件格式 # 配置文件格式
file-extension: yml file-extension: yml
# 共享配置 # 共享配置

View File

@@ -15,11 +15,11 @@ spring:
discovery: discovery:
# 服务注册地址 # 服务注册地址
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
# namespace: xa namespace: xa
config: config:
# 配置中心地址 # 配置中心地址
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
# namespace: xa namespace: xa
# 配置文件格式 # 配置文件格式
file-extension: yml file-extension: yml
# 共享配置 # 共享配置

View File

@@ -13,24 +13,19 @@ import com.dcsoft.common.core.utils.file.FileUtils;
import com.dcsoft.common.redis.service.RedisService; import com.dcsoft.common.redis.service.RedisService;
import com.dcsoft.file.service.IFaceService; import com.dcsoft.file.service.IFaceService;
import com.dcsoft.file.service.ISysFileService; import com.dcsoft.file.service.ISysFileService;
import com.dcsoft.file.utils.FileUploadUtils; import com.dcsoft.file.utils.*;
import com.dcsoft.file.utils.ImageToBase64Utils;
import com.dcsoft.file.utils.MinioUtil;
import com.dcsoft.file.utils.PictureUtils;
import com.dcsoft.system.api.domain.SysFile; import com.dcsoft.system.api.domain.SysFile;
import io.minio.MinioClient; import io.minio.MinioClient;
import io.minio.RemoveObjectArgs; import io.minio.RemoveObjectArgs;
import net.coobird.thumbnailator.Thumbnails; import net.coobird.thumbnailator.Thumbnails;
import net.coobird.thumbnailator.geometry.Positions;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.File; import java.io.File;
@@ -164,6 +159,27 @@ public class SysFileController {
} }
} }
@PostMapping("uploadMinioCarBase64")
public R<SysFile> uploadMinioCarBase64(@RequestBody JSONObject data) {
try {
String url = data.getString("url");
if(StringUtils.isEmpty(url)){
return R.fail("图片地址不能为空");
}
MultipartFile file = Base64ToMultipartFileUtil.convertToMultipartFile(url);
String fileNames = FileUploadUtils.uploadMinio(file, this.bucketName2, file.getName());
SysFile sysFile = new SysFile();
sysFile.setName(FileUtils.getName(fileNames));
fileNames = fileNames.replace(miniourl, miniogwurl);
sysFile.setUrl(fileNames);
return R.ok(sysFile);
} catch (Exception e) {
log.error("上传文件失败", e);
return R.fail(e.getMessage());
}
}
/** /**
* 文件上传请求 * 文件上传请求
@@ -293,29 +309,16 @@ public class SysFileController {
@PostMapping("uploadMinio1") @PostMapping("uploadMinio1")
public R<SysFile> uploadMinio1(MultipartFile file, String fileName) { public R<SysFile> uploadMinio1(MultipartFile file, String fileName) {
try { try {
//判断压缩图片 try {
if ((1024 * 1024 * 0.1) <= file.getSize()) { // 裁剪图片为640*480
// 小于 1M 的 String originalFilename = file.getOriginalFilename();
try { File newFile = new File(originalFilename);
String fileNames1 = file.getOriginalFilename(); Thumbnails.of(file.getInputStream()).crop(Positions.CENTER).size(480, 640).toFile(newFile);
File newFile = new File(fileNames1);
if ((1024 * 1024 * 0.1) <= file.getSize() && file.getSize() <= (1024 * 1024)) { file = PictureUtils.getMultipartFile(newFile);
Thumbnails.of(file.getInputStream()).scale(1f).outputQuality(0.4f).toFile(newFile); newFile.delete();
} } catch (IOException e) {
// 1 - 2M 的 throw new RuntimeException(e);
else if ((1024 * 1024) < file.getSize() && file.getSize() <= (1024 * 1024 * 2)) {
Thumbnails.of(file.getInputStream()).scale(1f).outputQuality(0.2f).toFile(newFile);
}
// 2M 以上的
else if ((1024 * 1024 * 2) < file.getSize()) {
Thumbnails.of(file.getInputStream()).scale(1f).outputQuality(0.1f).toFile(newFile);
}
// 转为 MultipartFile
file = PictureUtils.getMultipartFile(newFile);
newFile.delete();
} catch (IOException e) {
throw new RuntimeException(e);
}
} }
initFlowRules(); initFlowRules();
//上传前进行人脸检测 //上传前进行人脸检测

View File

@@ -0,0 +1,77 @@
package com.dcsoft.file.utils;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.util.Base64;
public class Base64MultipartFile implements MultipartFile {
private final byte[] fileContent;
private final String fileName;
private final String contentType;
public Base64MultipartFile(String base64Data, String fileName) {
// 清理Base64数据
String cleanedBase64 = base64Data.contains(",")
? base64Data.substring(base64Data.indexOf(",") + 1)
: base64Data;
this.fileContent = Base64.getDecoder().decode(cleanedBase64);
this.fileName = fileName;
this.contentType = extractContentType(base64Data);
}
private String extractContentType(String base64Data) {
if (base64Data.startsWith("data:image/jpeg")) {
return "image/jpeg";
} else if (base64Data.startsWith("data:image/png")) {
return "image/png";
} else if (base64Data.startsWith("data:image/gif")) {
return "image/gif";
}
return "application/octet-stream";
}
@Override
public String getName() {
return "file";
}
@Override
public String getOriginalFilename() {
return fileName;
}
@Override
public String getContentType() {
return contentType;
}
@Override
public boolean isEmpty() {
return fileContent == null || fileContent.length == 0;
}
@Override
public long getSize() {
return fileContent.length;
}
@Override
public byte[] getBytes() throws IOException {
return fileContent;
}
@Override
public InputStream getInputStream() throws IOException {
return new ByteArrayInputStream(fileContent);
}
@Override
public void transferTo(File dest) throws IOException, IllegalStateException {
try (FileOutputStream fos = new FileOutputStream(dest)) {
fos.write(fileContent);
}
}
}

View File

@@ -0,0 +1,28 @@
package com.dcsoft.file.utils;
import org.springframework.web.multipart.MultipartFile;
public class Base64ToMultipartFileUtil {
public static MultipartFile convertToMultipartFile(String base64Data, String fileName) {
return new Base64MultipartFile(base64Data, fileName);
}
/**
* 自动生成文件名
*/
public static MultipartFile convertToMultipartFile(String base64Data) {
String fileName = generateFileName(base64Data);
return convertToMultipartFile(base64Data, fileName);
}
private static String generateFileName(String base64Data) {
String extension = ".jpg";
if (base64Data.startsWith("data:image/png")) {
extension = ".png";
} else if (base64Data.startsWith("data:image/gif")) {
extension = ".gif";
}
return "image_" + System.currentTimeMillis() + extension;
}
}

View File

@@ -42,6 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d') and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if> </if>
</where> </where>
group by create_time desc
</select> </select>
<select id="selectJobLogAll" resultMap="SysJobLogResult"> <select id="selectJobLogAll" resultMap="SysJobLogResult">

View File

@@ -2,6 +2,7 @@ package com.dcsoft.system.vehicle.controller;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; 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.utils.poi.ExcelUtil;
import com.dcsoft.common.core.web.controller.BaseController; import com.dcsoft.common.core.web.controller.BaseController;
import com.dcsoft.common.core.web.domain.AjaxResult; 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.annotation.RequiresPermissions;
import com.dcsoft.common.security.utils.SecurityUtils; import com.dcsoft.common.security.utils.SecurityUtils;
import com.dcsoft.system.vehicle.domain.CarInfo; 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.CarParkItem;
import com.dcsoft.system.vehicle.domain.CarParkRecord; import com.dcsoft.system.vehicle.domain.CarParkRecord;
import com.dcsoft.system.vehicle.service.ICarInfoService; import com.dcsoft.system.vehicle.service.ICarInfoService;
import com.dcsoft.system.vehicle.service.ICarParkItemService; import com.dcsoft.system.vehicle.service.ICarParkItemService;
import com.dcsoft.system.vehicle.service.ICarParkRecordService; import com.dcsoft.system.vehicle.service.ICarParkRecordService;
import com.dcsoft.system.vehicle.service.ICarParkService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@@ -44,6 +48,9 @@ public class CarInfoController extends BaseController
@Autowired @Autowired
private ICarParkItemService carParkItemService; private ICarParkItemService carParkItemService;
@Autowired
private ICarParkService carParkService;
/** /**
* 查询车辆信息列表 * 查询车辆信息列表
*/ */
@@ -118,13 +125,18 @@ public class CarInfoController extends BaseController
//保存车辆授权 //保存车辆授权
//根据车场查询车辆 //根据车场查询车辆
if (carInfo.getParkId() != null) { 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 carParkItem = new CarParkItem();
carParkItem.setParkId(carInfo.getParkId()); carParkItem.setParkIds(list);
List<CarParkItem> itemList = carParkItemService.selectCarParkItemList(carParkItem); List<CarParkItem> itemList = carParkItemService.selectCarParkItemList(carParkItem);
for (CarParkItem a : itemList) { for (CarParkItem a : itemList) {
CarParkRecord carParkRecord = new CarParkRecord(); CarParkRecord carParkRecord = new CarParkRecord();
carParkRecord.setCustomerId(carInfo.getCustomerId()); carParkRecord.setCustomerId(carInfo.getCustomerId());
carParkRecord.setParkId(carInfo.getParkId()); carParkRecord.setParkId(a.getParkId());
carParkRecord.setEquipmentId(a.getEquipmentId()); carParkRecord.setEquipmentId(a.getEquipmentId());
carParkRecordService.insertCarParkRecord(carParkRecord); carParkRecordService.insertCarParkRecord(carParkRecord);
} }
@@ -138,22 +150,30 @@ public class CarInfoController extends BaseController
@RequiresPermissions("system:carInfo:edit") @RequiresPermissions("system:carInfo:edit")
@Log(title = "车辆信息", businessType = BusinessType.UPDATE) @Log(title = "车辆信息", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody CarInfo carInfo) public AjaxResult edit(@RequestBody CarInfo carInfo) {
{ if (!StrUtil.equals("2", carInfo.getCarType()) && !checkPlateNumberFormat(carInfo.getPlate())) {
if(!checkPlateNumberFormat(carInfo.getPlate())){
return AjaxResult.error("车牌号不正确!"); 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()); carParkRecordService.deleteCarParkRecordByCustomerId(carInfo.getCustomerId());
CarParkItem carParkItem=new CarParkItem();
carParkItem.setParkId(carInfo.getParkId()); List<Long> list = new ArrayList<>();
List<CarParkItem> itemList=carParkItemService.selectCarParkItemList(carParkItem); CarPark park = carParkService.selectCarParkById(carInfo.getParkId());
for(CarParkItem a:itemList){ list.add(carInfo.getParkId());
CarParkRecord carParkRecord=new CarParkRecord(); 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.setCustomerId(carInfo.getCustomerId());
carParkRecord.setParkId(carInfo.getParkId()); carParkRecord.setParkId(a.getParkId());
carParkRecord.setEquipmentId(a.getEquipmentId()); carParkRecord.setEquipmentId(a.getEquipmentId());
carParkRecordService.insertCarParkRecord(carParkRecord); carParkRecordService.insertCarParkRecord(carParkRecord);
@@ -213,7 +233,7 @@ public class CarInfoController extends BaseController
} }
public boolean checkPlateNumberFormat(String content) { 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); return Pattern.matches(pattern, content);
} }

View File

@@ -45,6 +45,17 @@ public class CarParkController extends BaseController
return getDataTable(list); 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);
}
/** /**
* 导出车场信息列表 * 导出车场信息列表
*/ */

View File

@@ -69,6 +69,7 @@ public class CarInfo extends BaseEntity
private String sync; private String sync;
private Long parkId; private Long parkId;
@Excel(name = "所属员工",sort = 9) @Excel(name = "所属员工",sort = 9)
private String peopleName; private String peopleName;
@@ -84,7 +85,7 @@ public class CarInfo extends BaseEntity
private String remark; private String remark;
private String carType; 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; private String unit;
public Long getParkId() { public Long getParkId() {

View File

@@ -31,6 +31,15 @@ public class CarPark extends BaseEntity
private String spaceName; private String spaceName;
/** 上级车场(一并下发车场)*/
private Long parentId;
/** 上级车场(一并下发车场)*/
private String parentIdName;
/** 满车位自动锁杆0不锁1锁 */
private Integer autoLock;
/** 车位总数 */ /** 车位总数 */
@Excel(name = "车位总数") @Excel(name = "车位总数")
private Long carsNum; private Long carsNum;
@@ -41,6 +50,30 @@ public class CarPark extends BaseEntity
private List<CarParkItem> itemList = new ArrayList<CarParkItem>(); 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) public void setId(Long id)
{ {
this.id = id; this.id = id;

View File

@@ -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.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.List;
/** /**
* 车场设备信息对象 car_park_item * 车场设备信息对象 car_park_item
* *
@@ -26,12 +28,23 @@ public class CarParkItem extends BaseEntity
@Excel(name = "车场id") @Excel(name = "车场id")
private Long parkId; private Long parkId;
/** 车场ids */
private List<Long> parkIds;
/** 通道方向 */ /** 通道方向 */
@Excel(name = "通道方向") @Excel(name = "通道方向")
private String way; private String way;
private String area; private String area;
public List<Long> getParkIds() {
return parkIds;
}
public void setParkIds(List<Long> parkIds) {
this.parkIds = parkIds;
}
public void setId(Long id) public void setId(Long id)
{ {
this.id = id; this.id = id;

View File

@@ -73,4 +73,8 @@ public interface CarParkMapper
public int selectCarInfo(@Param("id") Long id,@Param("flag") String flag); public int selectCarInfo(@Param("id") Long id,@Param("flag") String flag);
public CarPark selectCarParkByName(String name); public CarPark selectCarParkByName(String name);
List<CarPark> selectByIds(@Param("list") List<Long> collect);
List<CarPark> getCarParkSelect(Long id);
} }

View File

@@ -59,4 +59,6 @@ public interface ICarParkService
* @return 结果 * @return 结果
*/ */
public int deleteCarParkById(Long id); public int deleteCarParkById(Long id);
List<CarPark> getCarParkSelect(Long id);
} }

View File

@@ -223,110 +223,103 @@ public class CarInfoServiceImpl implements ICarInfoService
/** /**
* 导入用户数据 * 导入用户数据
* *
* @param userList 用户数据列表 * @param userList 用户数据列表
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据 * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
* @param operName 操作用户 * @param operName 操作用户
* @return 结果 * @return 结果
*/ */
@Override @Override
public String importData(List<CarInfo> userList, boolean isUpdateSupport, String operName) public String importData(List<CarInfo> userList, boolean isUpdateSupport, String operName) {
{ if (StringUtils.isNull(userList) || userList.size() == 0) {
if (StringUtils.isNull(userList) || userList.size() == 0)
{
throw new ServiceException("导入用户数据不能为空!"); throw new ServiceException("导入用户数据不能为空!");
} }
int successNum = 0; int successNum = 0;
int failureNum = 0; int failureNum = 0;
StringBuilder successMsg = new StringBuilder(); StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder(); StringBuilder failureMsg = new StringBuilder();
int i=0; int i = 0;
for (CarInfo user : userList) for (CarInfo user : userList) {
{
i++; i++;
try try {
{
// 验证车牌是否合格 // 验证车牌是否合格
if(!checkPlateNumberFormat(user.getPlate())){ if (!checkPlateNumberFormat(user.getPlate())) {
failureNum++; failureNum++;
failureMsg.append("<br/>" + failureNum + "、车牌信息 " + user.getPlate() + "格式错误"); failureMsg.append("<br/>" + failureNum + "、车牌信息 " + user.getPlate() + "格式错误");
}else{ } else {
// 验证是否存在这个用户 // 验证是否存在这个用户
CarInfo u = carInfoMapper.selectCarInfoByCarNo(user.getPlate()); CarInfo u = carInfoMapper.selectCarInfoByCarNo(user.getPlate());
SysPeople people=peopleMapper.selectSysPeopleByUserName(user.getPeopleName()); SysPeople people = peopleMapper.selectSysPeopleByUserName(user.getPeopleName());
if(people!=null){ if (people != null) {
user.setPeopleId(people.getId()); 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);
}
} }
successNum++; CarPark carPark = carParkMapper.selectCarParkByName(user.getParkName());
successMsg.append("<br/>" + successNum + "、车牌信息 " + user.getPlate() + " 导入成功"); if (carPark != null) {
} user.setParkId(carPark.getId());
else if (isUpdateSupport) }
{ if (StringUtils.isNull(u)) {
user.setCarType("0"); user.setCarType("0");
user.setCustomerId(u.getCustomerId()); user.setCreateBy(operName);
user.setUpdateBy(operName); this.insertCarInfo(user);
this.updateCarInfo(user); //保存车辆授权
//根据车场查询车辆 //根据车场查询车辆
if(user.getParkId()!=null){ if (user.getParkId() != null) {
//删除车辆授权 List<Long> list = new ArrayList<>();
carParkRecordMapper.deleteCarParkRecordByCustomerId(user.getCustomerId()); list.add(user.getParkId());
CarParkItem carParkItem=new CarParkItem(); list.add(carPark.getParentId());
carParkItem.setParkId(user.getParkId()); CarParkItem carParkItem = new CarParkItem();
List<CarParkItem> itemList=carParkItemMapper.selectCarParkItemList(carParkItem); carParkItem.setParkIds(list);
for(CarParkItem a:itemList){ List<CarParkItem> itemList = carParkItemMapper.selectCarParkItemList(carParkItem);
CarParkRecord carParkRecord=new CarParkRecord(); for (CarParkItem a : itemList) {
carParkRecord.setCustomerId(user.getCustomerId()); CarParkRecord carParkRecord = new CarParkRecord();
carParkRecord.setParkId(user.getParkId()); carParkRecord.setCustomerId(user.getCustomerId());
carParkRecord.setEquipmentId(a.getEquipmentId()); carParkRecord.setParkId(a.getParkId());
carParkRecordMapper.insertCarParkRecord(carParkRecord); 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 } catch (Exception e) {
{
failureNum++;
failureMsg.append("<br/>" + failureNum + "、车牌信息 " + user.getPlate() + " 已存在");
}
}
}
catch (Exception e)
{
failureNum++; failureNum++;
String msg = "<br/>" + failureNum + "、车牌信息 " + user.getPlate() + " 导入失败:"; String msg = "<br/>" + failureNum + "、车牌信息 " + user.getPlate() + " 导入失败:";
failureMsg.append(msg + e.getMessage()); failureMsg.append(msg + e.getMessage());
} }
} }
if (failureNum > 0) if (failureNum > 0) {
{
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new ServiceException(failureMsg.toString()); throw new ServiceException(failureMsg.toString());
} } else {
else
{
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
} }
return successMsg.toString(); return successMsg.toString();
@@ -337,8 +330,8 @@ public class CarInfoServiceImpl implements ICarInfoService
return carInfoMapper.selectCarInfoByPlate(plate); return carInfoMapper.selectCarInfoByPlate(plate);
} }
public boolean checkPlateNumberFormat(String content) { public static 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); return Pattern.matches(pattern, content);
} }

View File

@@ -1,5 +1,6 @@
package com.dcsoft.system.vehicle.service.impl; package com.dcsoft.system.vehicle.service.impl;
import com.dcsoft.common.core.utils.CollUtil;
import com.dcsoft.common.core.utils.DateUtils; import com.dcsoft.common.core.utils.DateUtils;
import com.dcsoft.system.vehicle.domain.CarPark; import com.dcsoft.system.vehicle.domain.CarPark;
import com.dcsoft.system.vehicle.mapper.CarParkMapper; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* 车场信息Service业务层处理 * 车场信息Service业务层处理
@@ -40,9 +43,22 @@ public class CarParkServiceImpl implements ICarParkService
* @return 车场信息 * @return 车场信息
*/ */
@Override @Override
public List<CarPark> selectCarParkList(CarPark carPark) public List<CarPark> selectCarParkList(CarPark carPark) {
{ List<CarPark> carParks = carParkMapper.selectCarParkList(carPark);
return 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); return carParkMapper.deleteCarParkById(id);
} }
@Override
public List<CarPark> getCarParkSelect(Long id) {
return carParkMapper.getCarParkSelect(id);
}
} }

View File

@@ -124,7 +124,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="enable != null">enable = #{enable},</if> <if test="enable != null">enable = #{enable},</if>
<if test="plate != null and plate != ''">plate = #{plate},</if> <if test="plate != null and plate != ''">plate = #{plate},</if>
<if test="timeSegEnable != null and timeSegEnable != ''">time_seg_enable = #{timeSegEnable},</if> <if test="timeSegEnable != null and timeSegEnable != ''">time_seg_enable = #{timeSegEnable},</if>
<if test="segTime != null">seg_time = #{segTime},</if> seg_time = #{segTime},
<if test="needAlarm != null">need_alarm = #{needAlarm},</if> <if test="needAlarm != null">need_alarm = #{needAlarm},</if>
<if test="vehicleCode != null">vehicle_code = #{vehicleCode},</if> <if test="vehicleCode != null">vehicle_code = #{vehicleCode},</if>
<if test="vehicleComment != null">vehicle_comment = #{vehicleComment},</if> <if test="vehicleComment != null">vehicle_comment = #{vehicleComment},</if>

View File

@@ -21,6 +21,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where> <where>
<if test="equipmentId != null "> and equipment_id = #{equipmentId}</if> <if test="equipmentId != null "> and equipment_id = #{equipmentId}</if>
<if test="parkId != null "> and park_id = #{parkId}</if> <if test="parkId != null "> and park_id = #{parkId}</if>
<if test="parkIds != null and parkIds.size() > 0"> and park_id in
<foreach item="id" collection="parkIds" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="way != null and way != ''"> and way = #{way}</if> <if test="way != null and way != ''"> and way = #{way}</if>
</where> </where>
</select> </select>

View File

@@ -16,11 +16,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="spaceName" column="space_name" /> <result property="spaceName" column="space_name" />
<result property="autoLock" column="auto_lock" />
<result property="parentId" column="parent_id" />
</resultMap> </resultMap>
<sql id="selectCarParkVo"> <sql id="selectCarParkVo">
select cp.id, cp.name, cp.space_id, cp.cars_num, cp.surplus_num, cp.remark, cp.create_by, cp.create_time, select cp.id, cp.name, cp.space_id, cp.cars_num, cp.surplus_num, cp.remark, cp.create_by, cp.create_time,
cp.update_by, cp.update_time,ss.name space_name cp.update_by, cp.update_time,ss.name space_name,cp.auto_lock,cp.parent_id
from car_park cp from car_park cp
left join sys_space ss on cp.space_id=ss.id left join sys_space ss on cp.space_id=ss.id
@@ -51,6 +53,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="parentId != null">parent_id,</if>
<if test="autoLock != null">auto_lock,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if> <if test="id != null">#{id},</if>
@@ -63,6 +67,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="parentId != null">#{parentId},</if>
<if test="autoLock != null">#{autoLock},</if>
</trim> </trim>
</insert> </insert>
@@ -78,6 +84,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if> <if test="updateTime != null">update_time = #{updateTime},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="autoLock != null">auto_lock = #{autoLock},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
@@ -122,4 +130,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where cp.name = #{name} where cp.name = #{name}
</select> </select>
<select id="selectByIds" resultType="com.dcsoft.system.vehicle.domain.CarPark">
select cp.id, cp.name, cp.space_id, cp.cars_num, cp.surplus_num, cp.remark,cp.auto_lock,cp.parent_id
from car_park cp
where cp.id in
<foreach item="id" collection="list" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<select id="getCarParkSelect" resultType="com.dcsoft.system.vehicle.domain.CarPark">
select cp.id, cp.name
from car_park cp
where cp.id != #{id}
</select>
</mapper> </mapper>

View File

@@ -20,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select cpg.id, cpg.park_id, cpg.area, cpg.license, cpg.join_time, cpg.sn,cp.name park_name,se.name equipment_name,HOUR(TIMEDIFF(NOW(),cpg.join_time)) AS time_long select cpg.id, cpg.park_id, cpg.area, cpg.license, cpg.join_time, cpg.sn,cp.name park_name,se.name equipment_name,HOUR(TIMEDIFF(NOW(),cpg.join_time)) AS time_long
from car_pass_gather cpg from car_pass_gather cpg
left join car_park cp on cp.id=cpg.park_id left join car_park cp on cp.id=cpg.park_id
left join sys_equipment se on se.sequence=cpg.sn left join sys_equipment se on se.sequence=cpg.sn and se.product_id = 4
</sql> </sql>
<select id="selectCarPassGatherList" parameterType="CarPassGather" resultMap="CarPassGatherResult"> <select id="selectCarPassGatherList" parameterType="CarPassGather" resultMap="CarPassGatherResult">

View File

@@ -28,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select cpr.id, cpr.park_id, cpr.unique_no, cpr.direction, cpr.license, cpr.pass_time, cpr.trigger_type, cpr.color_type, select cpr.id, cpr.park_id, cpr.unique_no, cpr.direction, cpr.license, cpr.pass_time, cpr.trigger_type, cpr.color_type,
cpr.car_color, cpr.url, cpr.data_type, cpr.sn,cpi.way,cp.name park_name,se.name equipment_name,ci.unit,cpr.type cpr.car_color, cpr.url, cpr.data_type, cpr.sn,cpi.way,cp.name park_name,se.name equipment_name,ci.unit,cpr.type
from car_pass_record cpr from car_pass_record cpr
left join sys_equipment se on cpr.sn=se.sequence left join sys_equipment se on cpr.sn=se.sequence and se.product_id = 4
left join car_park_item cpi on cpi.equipment_id=se.id left join car_park_item cpi on cpi.equipment_id=se.id
left join car_park cp on cp.id=cpi.park_id left join car_park cp on cp.id=cpi.park_id
left join car_info ci on cpr.license=ci.plate left join car_info ci on cpr.license=ci.plate