兴安优化提交
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.dcsoft.system.vehicle.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.dcsoft.common.core.utils.poi.ExcelUtil;
|
||||
import com.dcsoft.common.core.web.controller.BaseController;
|
||||
@@ -104,20 +105,24 @@ public class CarInfoController extends BaseController
|
||||
@RequiresPermissions("system:carInfo:add")
|
||||
@Log(title = "车辆信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody CarInfo carInfo)
|
||||
{
|
||||
public AjaxResult add(@RequestBody CarInfo carInfo) {
|
||||
if (!StrUtil.equals("2", carInfo.getCarType()) && !checkPlateNumberFormat(carInfo.getPlate())) {
|
||||
return AjaxResult.error("车牌号不正确!");
|
||||
}
|
||||
int i=carInfoService.insertCarInfo(carInfo);
|
||||
CarInfo car = carInfoService.selectCarInfoByPlate(carInfo.getPlate());
|
||||
if (ObjectUtil.isNotEmpty(car)) {
|
||||
return AjaxResult.error("车牌号已存在,不可重复添加!");
|
||||
}
|
||||
|
||||
int i = carInfoService.insertCarInfo(carInfo);
|
||||
//保存车辆授权
|
||||
//根据车场查询车辆
|
||||
if(carInfo.getParkId()!=null){
|
||||
CarParkItem carParkItem=new CarParkItem();
|
||||
if (carInfo.getParkId() != null) {
|
||||
CarParkItem carParkItem = new CarParkItem();
|
||||
carParkItem.setParkId(carInfo.getParkId());
|
||||
List<CarParkItem> itemList=carParkItemService.selectCarParkItemList(carParkItem);
|
||||
for(CarParkItem a:itemList){
|
||||
CarParkRecord carParkRecord=new CarParkRecord();
|
||||
List<CarParkItem> itemList = carParkItemService.selectCarParkItemList(carParkItem);
|
||||
for (CarParkItem a : itemList) {
|
||||
CarParkRecord carParkRecord = new CarParkRecord();
|
||||
carParkRecord.setCustomerId(carInfo.getCustomerId());
|
||||
carParkRecord.setParkId(carInfo.getParkId());
|
||||
carParkRecord.setEquipmentId(a.getEquipmentId());
|
||||
|
||||
@@ -61,4 +61,6 @@ public interface CarInfoMapper
|
||||
public int deleteCarInfoByCustomerIds(Long[] customerIds);
|
||||
|
||||
public CarInfo selectCarInfoByCarNo(String plate);
|
||||
|
||||
CarInfo selectCarInfoByPlate(String plate);
|
||||
}
|
||||
|
||||
@@ -74,4 +74,6 @@ public interface ICarInfoService
|
||||
public int selectCarInfo(Long id,String flag);
|
||||
|
||||
String importData(List<CarInfo> userList, boolean updateSupport, String operName);
|
||||
|
||||
CarInfo selectCarInfoByPlate(String plate);
|
||||
}
|
||||
|
||||
@@ -332,6 +332,11 @@ public class CarInfoServiceImpl implements ICarInfoService
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarInfo selectCarInfoByPlate(String plate) {
|
||||
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})";
|
||||
return Pattern.matches(pattern, content);
|
||||
|
||||
@@ -107,7 +107,7 @@ public class VisCarryStuffController extends BaseController {
|
||||
@Value("${app.deptId:228}")
|
||||
private String appDeptId;
|
||||
|
||||
@Value("${app.watermarkUrl:http://81.68.71.142:9000/others/gz/111.png}")
|
||||
@Value("${app.watermarkUrl:http://81.68.71.142:9000/others/gz/gz.png}")
|
||||
private String watermarkUrl;
|
||||
|
||||
@Autowired
|
||||
@@ -565,6 +565,10 @@ public class VisCarryStuffController extends BaseController {
|
||||
});
|
||||
}
|
||||
|
||||
//查询申请二维码
|
||||
CheckCodeVo checkCodeVo = visCarryStuffService.selectStuffCheckCode(id);
|
||||
String code = checkCodeVo.getCode();
|
||||
|
||||
// 创建PDF文档
|
||||
Document document = new Document(new RectangleReadOnly(842F, 595F));
|
||||
document.setMargins(60, 60, 72, 72);
|
||||
@@ -572,13 +576,9 @@ public class VisCarryStuffController extends BaseController {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
PdfWriter writer = PdfWriter.getInstance(document, baos);
|
||||
|
||||
// 添加水印事件处理器(只有保安部门才可添加水印)
|
||||
LoginUser user = SecurityUtils.getLoginUser();
|
||||
SysUser sysUser = sysUserService.selectUserById(user.getUserid());
|
||||
if (ObjectUtil.isNotNull(sysUser) && StringUtils.equals(appDeptId, String.valueOf(sysUser.getDeptId()))) {
|
||||
// 添加水印事件处理器
|
||||
PdfWatermark pdfWatermark = new PdfWatermark(watermarkUrl);
|
||||
writer.setPageEvent(pdfWatermark);
|
||||
}
|
||||
|
||||
document.open();
|
||||
|
||||
@@ -700,34 +700,6 @@ public class VisCarryStuffController extends BaseController {
|
||||
return cell;
|
||||
}
|
||||
|
||||
// 水印处理类
|
||||
/*private static class PdfWatermark extends PdfPageEventHelper {
|
||||
@Override
|
||||
public void onEndPage(PdfWriter writer, Document document) {
|
||||
try {
|
||||
// 加载公章图片
|
||||
Image seal = Image.getInstance("http://81.68.71.142:9000/others/gz/111.png");
|
||||
|
||||
// 设置水印位置(右下角)
|
||||
float x = document.right() - seal.getScaledWidth() - 50;
|
||||
float y = document.bottom() + 50;
|
||||
|
||||
// 设置透明度
|
||||
PdfContentByte canvas = writer.getDirectContentUnder();
|
||||
seal.setAbsolutePosition(x, y);
|
||||
seal.scaleAbsolute(100, 100); // 调整大小
|
||||
canvas.saveState();
|
||||
PdfGState gs = new PdfGState();
|
||||
gs.setFillOpacity(0.5f); // 设置透明度
|
||||
canvas.setGState(gs);
|
||||
canvas.addImage(seal);
|
||||
canvas.restoreState();
|
||||
} catch (Exception e) {
|
||||
log.error("添加水印异常:", e);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -162,5 +162,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where ci.plate = #{plate} and ci.del_flag=0
|
||||
limit 1
|
||||
</select>
|
||||
<select id="selectCarInfoByPlate" resultMap="CarInfoResult">
|
||||
select
|
||||
*
|
||||
from car_info
|
||||
where plate = #{plate}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user