diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileCameraInfoController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileCameraInfoController.java new file mode 100644 index 000000000..959d19d39 --- /dev/null +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileCameraInfoController.java @@ -0,0 +1,98 @@ +package com.jsowell.web.controller.pile; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.jsowell.common.annotation.Log; +import com.jsowell.common.core.controller.BaseController; +import com.jsowell.common.core.domain.AjaxResult; +import com.jsowell.common.enums.BusinessType; +import com.jsowell.pile.domain.PileCameraInfo; +import com.jsowell.pile.service.IPileCameraInfoService; +import com.jsowell.common.util.poi.ExcelUtil; +import com.jsowell.common.core.page.TableDataInfo; + +/** + * 【请填写功能名称】Controller + * + * @author jsowell + * @date 2023-12-09 + */ +@RestController +@RequestMapping("/pile/info") +public class PileCameraInfoController extends BaseController { + @Autowired + private IPileCameraInfoService pileCameraInfoService; + + /** + * 查询【请填写功能名称】列表 + */ + @PreAuthorize("@ss.hasPermi('pile:info:list')") + @GetMapping("/list") + public TableDataInfo list(PileCameraInfo pileCameraInfo) { + startPage(); + List list = pileCameraInfoService.selectPileCameraInfoList(pileCameraInfo); + return getDataTable(list); + } + + /** + * 导出【请填写功能名称】列表 + */ + @PreAuthorize("@ss.hasPermi('pile:info:export')") + @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, PileCameraInfo pileCameraInfo) { + List list = pileCameraInfoService.selectPileCameraInfoList(pileCameraInfo); + ExcelUtil util = new ExcelUtil(PileCameraInfo.class); + util.exportExcel(response, list, "【请填写功能名称】数据"); + } + + /** + * 获取【请填写功能名称】详细信息 + */ + @PreAuthorize("@ss.hasPermi('pile:info:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return AjaxResult.success(pileCameraInfoService.selectPileCameraInfoById(id)); + } + + /** + * 新增【请填写功能名称】 + */ + @PreAuthorize("@ss.hasPermi('pile:info:add')") + @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody PileCameraInfo pileCameraInfo) { + return toAjax(pileCameraInfoService.insertPileCameraInfo(pileCameraInfo)); + } + + /** + * 修改【请填写功能名称】 + */ + @PreAuthorize("@ss.hasPermi('pile:info:edit')") + @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody PileCameraInfo pileCameraInfo) { + return toAjax(pileCameraInfoService.updatePileCameraInfo(pileCameraInfo)); + } + + /** + * 删除【请填写功能名称】 + */ + @PreAuthorize("@ss.hasPermi('pile:info:remove')") + @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(pileCameraInfoService.deletePileCameraInfoByIds(ids)); + } +} diff --git a/jsowell-admin/src/main/resources/application-dev.yml b/jsowell-admin/src/main/resources/application-dev.yml index d069fd943..01a6c12db 100644 --- a/jsowell-admin/src/main/resources/application-dev.yml +++ b/jsowell-admin/src/main/resources/application-dev.yml @@ -36,10 +36,10 @@ spring: druid: # 主库数据源 master: - #url: jdbc:mysql://192.168.2.2:3306/jsowell_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 - #username: jsowell_dev - url: jdbc:mysql://192.168.2.2:3306/jsowell_prd_copy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 - username: jsowell_prd_copy + url: jdbc:mysql://192.168.2.2:3306/jsowell_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: jsowell_dev +# url: jdbc:mysql://192.168.2.2:3306/jsowell_prd_copy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 +# username: jsowell_prd_copy password: 123456 # 从库数据源 slave: diff --git a/jsowell-common/src/main/java/com/jsowell/common/constant/CacheConstants.java b/jsowell-common/src/main/java/com/jsowell/common/constant/CacheConstants.java index d8d10ae74..401fa75f5 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/constant/CacheConstants.java +++ b/jsowell-common/src/main/java/com/jsowell/common/constant/CacheConstants.java @@ -194,6 +194,11 @@ public class CacheConstants { */ public static final String YCBC_TOKEN_BY_OPERATORID = "yong_cheng_bo_che_token_by_operatorId:"; + /** + * 相机拍摄入场/出场照片 + */ + public static final String CAMERA_IMAGE_BY_PLATE_NUMBER = "CAMERA_IMAGE_BY_PLATE_NUMBER_"; + /** * 桩硬件故障 */ diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/domain/PileCameraInfo.java b/jsowell-pile/src/main/java/com/jsowell/pile/domain/PileCameraInfo.java new file mode 100644 index 000000000..36ac43619 --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/domain/PileCameraInfo.java @@ -0,0 +1,206 @@ +package com.jsowell.pile.domain; + +import com.jsowell.common.annotation.Excel; +import com.jsowell.common.core.domain.BaseEntity; +import lombok.Builder; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 【请填写功能名称】对象 pile_camera_info + * + * @author jsowell + * @date 2023-12-09 + */ +@Builder +public class PileCameraInfo extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * $column.columnComment + */ + private Long id; + + /** + * 设备名称 + */ + @Excel(name = "设备名称") + private String deviceName; + + /** + * 设备IP地址 + */ + @Excel(name = "设备IP地址") + private String deviceIp; + + /** + * 设备sn号 + */ + @Excel(name = "设备sn号") + private String deviceSn; + + /** + * 车牌号 + */ + @Excel(name = "车牌号") + private String plateNumber; + + /** + * 车位状态 + * 01:入场;02:在场;04:出场;08:空场;10:车位异常(=="跨车位报警"和"视频遮挡"时==);20:延迟上报出场(预留);40:合并出入场(预留);80:预入场(预留);100:预出场(预留);200:入场修正(预留) + */ + @Excel(name = "车位状态 01:入场;02:在场;04:出场;08:空场;10:车位异常(=='跨车位报警'和'视频遮挡'时==);20:延迟上报出场(预留);40:合并出入场(预留);80:预入场(预留);100:预出场(预留);200:入场修正(预留)") + private String parkingState; + + /** + * 车位id + */ + @Excel(name = "车位id") + private Integer zoneId; + + /** + * 车位名 + */ + @Excel(name = "车位名") + private String zoneName; + + /** + * 车牌颜色(0:未知;1:蓝色;2:黄色;3:白色;4:黑色;5:绿色;) + */ + @Excel(name = "车牌颜色", readConverterExp = "0=:未知;1:蓝色;2:黄色;3:白色;4:黑色;5:绿色;") + private Integer color; + + /** + * 车牌类型(0:未知车牌;1:蓝牌小汽车;2:黑牌小汽车;3:单排黄牌;4:双排黄牌(大车尾牌,农用车);5:警车车牌;6:武警车牌;7:个性化车牌;8:单排军车牌; + * 9:双排军车牌;10:使馆车牌;11:香港进出中国大陆车牌;12:农用车牌;13:教练车牌;14:澳门进出中国大陆车牌;15:双层武警车牌;16:武警总队车牌;17:双层武警总队车牌;18:民航车牌;19:新能源车牌;20:新能源车牌大;21:应急;22:领馆 + * ) + */ + @Excel(name = "车牌类型", readConverterExp = "0=:未知车牌;1:蓝牌小汽车;2:黑牌小汽车;3:单排黄牌;4:双排黄牌(大车尾牌,农用车);5:警车车牌;6:武警车牌;7:个性化车牌;8:单排军车牌; 9:双排军车牌;10:使馆车牌;11:香港进出中国大陆车牌;12:农用车牌;13:教练车牌;14:澳门进出中国大陆车牌;15:双层武警车牌;16:武警总队车牌;17:双层武警总队车牌;18:民航车牌;19:新能源车牌;20:新能源车牌大;21:应急;22:领馆 ") + private Integer plateType; + + /** + * 图片base64编码 + */ + @Excel(name = "图片base64编码") + private String image; + + /** + * $column.columnComment + */ + private String delFlag; + + public void setId(Long id) { + this.id = id; + } + + public Long getId() { + return id; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + public String getDeviceName() { + return deviceName; + } + + public void setDeviceIp(String deviceIp) { + this.deviceIp = deviceIp; + } + + public String getDeviceIp() { + return deviceIp; + } + + public void setDeviceSn(String deviceSn) { + this.deviceSn = deviceSn; + } + + public String getDeviceSn() { + return deviceSn; + } + + public void setPlateNumber(String plateNumber) { + this.plateNumber = plateNumber; + } + + public String getPlateNumber() { + return plateNumber; + } + + public void setParkingState(String parkingState) { + this.parkingState = parkingState; + } + + public String getParkingState() { + return parkingState; + } + + public void setZoneId(Integer zoneId) { + this.zoneId = zoneId; + } + + public Integer getZoneId() { + return zoneId; + } + + public void setZoneName(String zoneName) { + this.zoneName = zoneName; + } + + public String getZoneName() { + return zoneName; + } + + public void setColor(Integer color) { + this.color = color; + } + + public Integer getColor() { + return color; + } + + public void setPlateType(Integer plateType) { + this.plateType = plateType; + } + + public Integer getPlateType() { + return plateType; + } + + public void setImage(String image) { + this.image = image; + } + + public String getImage() { + return image; + } + + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + public String getDelFlag() { + return delFlag; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.JSON_STYLE) + .append("id", getId()) + .append("deviceName", getDeviceName()) + .append("deviceIp", getDeviceIp()) + .append("deviceSn", getDeviceSn()) + .append("plateNumber", getPlateNumber()) + .append("parkingState", getParkingState()) + .append("zoneId", getZoneId()) + .append("zoneName", getZoneName()) + .append("color", getColor()) + .append("plateType", getPlateType()) + .append("image", getImage()) + .append("createTime", getCreateTime()) + .append("delFlag", getDelFlag()) + .toString(); + } +} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/dto/camera/CameraIdentifyResultsDTO.java b/jsowell-pile/src/main/java/com/jsowell/pile/dto/camera/CameraIdentifyResultsDTO.java index ebdf84caa..4b00fdeee 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/dto/camera/CameraIdentifyResultsDTO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/dto/camera/CameraIdentifyResultsDTO.java @@ -81,20 +81,7 @@ public class CameraIdentifyResultsDTO { @JSONField(name = "product_h") private ProductH productH; - /** - * 车位信息对象 - */ - private Parking parking; - /** - * 车牌信息对象 - */ - private Plate plate; - - /** - * 识别信息对象 - */ - private Reco reco; @Data @@ -208,6 +195,22 @@ public class CameraIdentifyResultsDTO { @JSONField(name = "car_pos") private CarPos carPos; + /** + * 车位信息对象 + */ + private Parking parking; + + /** + * 车牌信息对象 + */ + private Plate plate; + + /** + * 识别信息对象 + */ + private Reco reco; + + @Data private static class CarPos{ /** @@ -224,32 +227,10 @@ public class CameraIdentifyResultsDTO { */ private Integer pos; } - } - - @Data - public static class Parking{ - private Loc loc; @Data - private static class Loc{ - - /** - * 坐标点 - */ - @JSONField(name = "point") - private List pointList; - - /** - * 坐标点个数 - */ - @JSONField(name = "point_num") - private Integer pointNum; - - /** - * 标点坐标系尺寸 - */ - @JSONField(name = "reco_zone_size_factor") - private RecoZoneSizeFactor recoZoneSizeFactor; + public static class Parking{ + private Loc loc; /** * 车位状态 @@ -280,117 +261,144 @@ public class CameraIdentifyResultsDTO { @JSONField(name = "zone_name") private String zoneName; - @Data - private static class Point{ - // 点x坐标 - private Integer x; - // 点y坐标 - private Integer y; - } - - @Data - private static class RecoZoneSizeFactor{ - /** - * 坐标点坐标系尺寸高度 - */ - @JSONField(name = "factor_h") - private Integer factorH; + private static class Loc{ /** - * 坐标点坐标系尺寸宽度 + * 坐标点 */ - @JSONField(name = "factor_w") - private Integer factorW; + @JSONField(name = "point") + private List pointList; + + /** + * 坐标点个数 + */ + @JSONField(name = "point_num") + private Integer pointNum; + + /** + * 标点坐标系尺寸 + */ + @JSONField(name = "reco_zone_size_factor") + private RecoZoneSizeFactor recoZoneSizeFactor; + + @Data + private static class Point{ + // 点x坐标 + private Integer x; + // 点y坐标 + private Integer y; + } + + @Data + private static class RecoZoneSizeFactor{ + /** + * 坐标点坐标系尺寸高度 + */ + @JSONField(name = "factor_h") + private Integer factorH; + + /** + * 坐标点坐标系尺寸宽度 + */ + @JSONField(name = "factor_w") + private Integer factorW; + } } } + + @Data + public static class Plate{ + /** + * 车牌颜色 + * + * 0:未知; + * 1:蓝色; + * 2:黄色; + * 3:白色; + * 4:黑色; + * 5:绿色; + */ + private Integer color; + + // 车牌置信度 + private Integer confidence; + private Loc loc; + + /** + * 车牌 + * UTF8后再BASE64编码 + * 如果有车牌:真实车牌号 + * 如果有车无牌:无牌车 + * 如果无车无牌:__无__ + * 非机动车:非机动车 + */ + private String plate; + + /** + * 车牌类型 + * + * 0:未知车牌 + * 1:蓝牌小汽车 + * 2:黑牌小汽车 + * 3:单排黄牌 + * 4:双排黄牌(大车尾牌,农用车) + * 5:警车车牌 + * 6:武警车牌 + * 7:个性化车牌 + * 8:单排军车牌 + * 9:双排军车牌 + * 10:使馆车牌 + * 11:香港进出中国大陆车牌 + * 12:农用车牌 + * 13:教练车牌 + * 14:澳门进出中国大陆车牌 + * 15:双层武警车牌 + * 16:武警总队车牌 + * 17:双层武警总队车牌 + * 18:民航车牌 + * 19:新能源车牌 + * 20:新能源车牌大 + * 21:应急 + * 22:领馆 + */ + private Integer type; + } + + @Data + private static class Reco{ + + /** + * 识别组id + */ + @JSONField(name = "group_id") + private Integer groupId; + + /** + * 识别标志 + */ + @JSONField(name = "reco_flag") + private Integer recoFlag; + + /** + * 识别id + */ + @JSONField(name = "reco_id") + private Integer recoId; + + /** + * 识别时间(字符串格式时间) + */ + @JSONField(name = "reco_time") + private String recoTime; + } } - @Data - public static class Plate{ - /** - * 车牌颜色 - * - * 0:未知; - * 1:蓝色; - * 2:黄色; - * 3:白色; - * 4:黑色; - * 5:绿色; - */ - private Integer color; - // 车牌置信度 - private Integer confidence; - private Loc loc; - /** - * 车牌 - * UTF8后再BASE64编码 - * 如果有车牌:真实车牌号 - * 如果有车无牌:无牌车 - * 如果无车无牌:__无__ - * 非机动车:非机动车 - */ - private String plate; - /** - * 车牌类型 - * - * 0:未知车牌 - * 1:蓝牌小汽车 - * 2:黑牌小汽车 - * 3:单排黄牌 - * 4:双排黄牌(大车尾牌,农用车) - * 5:警车车牌 - * 6:武警车牌 - * 7:个性化车牌 - * 8:单排军车牌 - * 9:双排军车牌 - * 10:使馆车牌 - * 11:香港进出中国大陆车牌 - * 12:农用车牌 - * 13:教练车牌 - * 14:澳门进出中国大陆车牌 - * 15:双层武警车牌 - * 16:武警总队车牌 - * 17:双层武警总队车牌 - * 18:民航车牌 - * 19:新能源车牌 - * 20:新能源车牌大 - * 21:应急 - * 22:领馆 - */ - private Integer type; - } - @Data - public static class Reco{ - /** - * 识别组id - */ - @JSONField(name = "group_id") - private Integer groupId; - - /** - * 识别标志 - */ - @JSONField(name = "reco_flag") - private Integer recoFlag; - - /** - * 识别id - */ - @JSONField(name = "reco_id") - private Integer recoId; - - /** - * 识别时间(字符串格式时间) - */ - @JSONField(name = "reco_time") - private String recoTime; - } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileCameraInfoMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileCameraInfoMapper.java new file mode 100644 index 000000000..bc15b1333 --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileCameraInfoMapper.java @@ -0,0 +1,63 @@ +package com.jsowell.pile.mapper; + +import java.util.List; + +import com.jsowell.pile.domain.PileCameraInfo; +import org.springframework.stereotype.Repository; + +/** + * 【请填写功能名称】Mapper接口 + * + * @author jsowell + * @date 2023-12-09 + */ +@Repository +public interface PileCameraInfoMapper { + /** + * 查询【请填写功能名称】 + * + * @param id 【请填写功能名称】主键 + * @return 【请填写功能名称】 + */ + public PileCameraInfo selectPileCameraInfoById(Long id); + + /** + * 查询【请填写功能名称】列表 + * + * @param pileCameraInfo 【请填写功能名称】 + * @return 【请填写功能名称】集合 + */ + public List selectPileCameraInfoList(PileCameraInfo pileCameraInfo); + + /** + * 新增【请填写功能名称】 + * + * @param pileCameraInfo 【请填写功能名称】 + * @return 结果 + */ + public int insertPileCameraInfo(PileCameraInfo pileCameraInfo); + + /** + * 修改【请填写功能名称】 + * + * @param pileCameraInfo 【请填写功能名称】 + * @return 结果 + */ + public int updatePileCameraInfo(PileCameraInfo pileCameraInfo); + + /** + * 删除【请填写功能名称】 + * + * @param id 【请填写功能名称】主键 + * @return 结果 + */ + public int deletePileCameraInfoById(Long id); + + /** + * 批量删除【请填写功能名称】 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deletePileCameraInfoByIds(Long[] ids); +} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileCameraInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileCameraInfoService.java new file mode 100644 index 000000000..d26ee68a2 --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileCameraInfoService.java @@ -0,0 +1,61 @@ +package com.jsowell.pile.service; + +import java.util.List; + +import com.jsowell.pile.domain.PileCameraInfo; + +/** + * 【请填写功能名称】Service接口 + * + * @author jsowell + * @date 2023-12-09 + */ +public interface IPileCameraInfoService { + /** + * 查询【请填写功能名称】 + * + * @param id 【请填写功能名称】主键 + * @return 【请填写功能名称】 + */ + public PileCameraInfo selectPileCameraInfoById(Long id); + + /** + * 查询【请填写功能名称】列表 + * + * @param pileCameraInfo 【请填写功能名称】 + * @return 【请填写功能名称】集合 + */ + public List selectPileCameraInfoList(PileCameraInfo pileCameraInfo); + + /** + * 新增【请填写功能名称】 + * + * @param pileCameraInfo 【请填写功能名称】 + * @return 结果 + */ + public int insertPileCameraInfo(PileCameraInfo pileCameraInfo); + + /** + * 修改【请填写功能名称】 + * + * @param pileCameraInfo 【请填写功能名称】 + * @return 结果 + */ + public int updatePileCameraInfo(PileCameraInfo pileCameraInfo); + + /** + * 批量删除【请填写功能名称】 + * + * @param ids 需要删除的【请填写功能名称】主键集合 + * @return 结果 + */ + public int deletePileCameraInfoByIds(Long[] ids); + + /** + * 删除【请填写功能名称】信息 + * + * @param id 【请填写功能名称】主键 + * @return 结果 + */ + public int deletePileCameraInfoById(Long id); +} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileCameraInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileCameraInfoServiceImpl.java new file mode 100644 index 000000000..7a263da55 --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileCameraInfoServiceImpl.java @@ -0,0 +1,89 @@ +package com.jsowell.pile.service.impl; + +import java.util.List; + +import com.jsowell.common.util.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.jsowell.pile.mapper.PileCameraInfoMapper; +import com.jsowell.pile.domain.PileCameraInfo; +import com.jsowell.pile.service.IPileCameraInfoService; + +/** + * 【请填写功能名称】Service业务层处理 + * + * @author jsowell + * @date 2023-12-09 + */ +@Service +public class PileCameraInfoServiceImpl implements IPileCameraInfoService { + @Autowired + private PileCameraInfoMapper pileCameraInfoMapper; + + /** + * 查询【请填写功能名称】 + * + * @param id 【请填写功能名称】主键 + * @return 【请填写功能名称】 + */ + @Override + public PileCameraInfo selectPileCameraInfoById(Long id) { + return pileCameraInfoMapper.selectPileCameraInfoById(id); + } + + /** + * 查询【请填写功能名称】列表 + * + * @param pileCameraInfo 【请填写功能名称】 + * @return 【请填写功能名称】 + */ + @Override + public List selectPileCameraInfoList(PileCameraInfo pileCameraInfo) { + return pileCameraInfoMapper.selectPileCameraInfoList(pileCameraInfo); + } + + /** + * 新增【请填写功能名称】 + * + * @param pileCameraInfo 【请填写功能名称】 + * @return 结果 + */ + @Override + public int insertPileCameraInfo(PileCameraInfo pileCameraInfo) { + pileCameraInfo.setCreateTime(DateUtils.getNowDate()); + return pileCameraInfoMapper.insertPileCameraInfo(pileCameraInfo); + } + + /** + * 修改【请填写功能名称】 + * + * @param pileCameraInfo 【请填写功能名称】 + * @return 结果 + */ + @Override + public int updatePileCameraInfo(PileCameraInfo pileCameraInfo) { + return pileCameraInfoMapper.updatePileCameraInfo(pileCameraInfo); + } + + /** + * 批量删除【请填写功能名称】 + * + * @param ids 需要删除的【请填写功能名称】主键 + * @return 结果 + */ + @Override + public int deletePileCameraInfoByIds(Long[] ids) { + return pileCameraInfoMapper.deletePileCameraInfoByIds(ids); + } + + /** + * 删除【请填写功能名称】信息 + * + * @param id 【请填写功能名称】主键 + * @return 结果 + */ + @Override + public int deletePileCameraInfoById(Long id) { + return pileCameraInfoMapper.deletePileCameraInfoById(id); + } +} diff --git a/jsowell-pile/src/main/resources/mapper/pile/PileCameraInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/PileCameraInfoMapper.xml new file mode 100644 index 000000000..6543a7cb4 --- /dev/null +++ b/jsowell-pile/src/main/resources/mapper/pile/PileCameraInfoMapper.xml @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + select id, + device_name, + device_ip, + device_sn, + plate_number, + parking_state, + zone_id, + zone_name, + color, + plate_type, + image, + create_time, + del_flag + from pile_camera_info + + + + + + + + insert into pile_camera_info + + + device_name, + + + device_ip, + + + device_sn, + + + plate_number, + + + parking_state, + + + zone_id, + + + zone_name, + + + color, + + + plate_type, + + + image, + + + create_time, + + + del_flag, + + + + + #{deviceName}, + + + #{deviceIp}, + + + #{deviceSn}, + + + #{plateNumber}, + + + #{parkingState}, + + + #{zoneId}, + + + #{zoneName}, + + + #{color}, + + + #{plateType}, + + + #{image}, + + + #{createTime}, + + + #{delFlag}, + + + + + + update pile_camera_info + + + device_name = #{deviceName}, + + + device_ip = #{deviceIp}, + + + device_sn = #{deviceSn}, + + + plate_number = #{plateNumber}, + + + parking_state = #{parkingState}, + + + zone_id = #{zoneId}, + + + zone_name = #{zoneName}, + + + color = #{color}, + + + plate_type = #{plateType}, + + + image = #{image}, + + + create_time = #{createTime}, + + + del_flag = #{delFlag}, + + + where id = #{id} + + + + delete + from pile_camera_info + where id = #{id} + + + + delete + from pile_camera_info where id in + + #{id} + + + \ No newline at end of file diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/camera/service/CameraService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/camera/service/CameraService.java index 968bfe2d5..cfb4e3d7c 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/camera/service/CameraService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/camera/service/CameraService.java @@ -1,16 +1,20 @@ package com.jsowell.thirdparty.camera.service; +import cn.hutool.core.codec.Base64; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; +import com.jsowell.common.constant.CacheConstants; import com.jsowell.common.core.redis.RedisCache; +import com.jsowell.common.util.DateUtils; +import com.jsowell.common.util.StringUtils; +import com.jsowell.pile.domain.PileCameraInfo; import com.jsowell.pile.dto.camera.CameraIdentifyResultsDTO; +import com.jsowell.pile.service.IPileCameraInfoService; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.ArrayList; import java.util.List; -import java.util.concurrent.TimeUnit; /** * 相机管理系统 Service @@ -24,22 +28,120 @@ public class CameraService { @Autowired private RedisCache redisCache; + @Autowired + private IPileCameraInfoService pileCameraInfoService; + public void receiveIdentifyResults(JSONObject jsonObject) { + // 区分入场和出场 + // Integer parking_state = jsonObject.getJSONObject("parking").getInteger("parking_state"); + // if (parking_state == 1) { + // // 入场 + // String parkingState = "ENTRY"; + // vehicleEntry(jsonObject, parkingState); + // } + // if (parking_state == 2) { + // // 在场 + // } + // if (parking_state == 4) { + // // 出场 + // } + saveInfo2DataBase(jsonObject); + + } + + /** + * 车辆入场 + * @param jsonObject + */ + private void vehicleEntry(JSONObject jsonObject, String parkingState) { + // 先将车牌图片信息存入缓存 + // boolean result = saveCarPicture2Redis(jsonObject, parkingState); + + // 将信息存数据库 + saveInfo2DataBase(jsonObject); + } + + private boolean saveInfo2DataBase(JSONObject jsonObject) { + // 车牌信息 + CameraIdentifyResultsDTO.ProductH.Plate plate = JSONObject.parseObject(jsonObject.getJSONObject("product_h").getJSONObject("plate").toJSONString(), + CameraIdentifyResultsDTO.ProductH.Plate.class); + if (plate == null) { + return false; + } + // 停车位信息 + CameraIdentifyResultsDTO.ProductH.Parking parking = JSONObject.parseObject(jsonObject.getJSONObject("product_h").getJSONObject("parking").toJSONString(), + CameraIdentifyResultsDTO.ProductH.Parking.class); + if (parking == null) { + return false; + } + // 设备信息 + CameraIdentifyResultsDTO.DeviceInfo deviceInfo = JSONObject.parseObject(jsonObject.getJSONObject("device_info").toJSONString(), + CameraIdentifyResultsDTO.DeviceInfo.class); + if (deviceInfo == null) { + return false; + } // 获取背景图片 JSONArray bgImgs = jsonObject.getJSONArray("bg_img"); List bgImgList = bgImgs.toList(CameraIdentifyResultsDTO.BgImg.class); if (CollectionUtils.isEmpty(bgImgList)) { - return; + return false; + } + // Base64解密 + String plateNumber = Base64.decodeStr(plate.getPlate()); + String zoneName = Base64.decodeStr(parking.getZoneName()); + + for (CameraIdentifyResultsDTO.BgImg bgImg : bgImgList) { + PileCameraInfo pileCameraInfo = PileCameraInfo.builder() + .deviceName(deviceInfo.getDevName()) + .deviceIp(deviceInfo.getIp()) + .deviceSn(deviceInfo.getSn()) + .plateNumber(plateNumber) + .parkingState(String.valueOf(parking.getParkingState())) + .zoneId(parking.getZoneId()) + .zoneName(zoneName) + .color(plate.getColor()) + .plateType(plate.getType()) + .image(bgImg.getImage()) + + .build(); + // 插入数据库 + pileCameraInfoService.insertPileCameraInfo(pileCameraInfo); + } + + return true; + } + + + + + /** + * 将车辆图片信息存入缓存 + * @param jsonObject + */ + private boolean saveCarPicture2Redis(JSONObject jsonObject, String parkingState) { + // 获取车牌号 + String plateNumber = jsonObject.getJSONObject("plate").getString("plate"); + if (StringUtils.isBlank(plateNumber)) { + return false; + } + // 获取背景图片 + JSONArray bgImgs = jsonObject.getJSONArray("bg_img"); + List bgImgList = bgImgs.toList(CameraIdentifyResultsDTO.BgImg.class); + if (CollectionUtils.isEmpty(bgImgList)) { + return false; } for (CameraIdentifyResultsDTO.BgImg bgImg : bgImgList) { String image = bgImg.getImage(); // 图片的 base64 编码 - String key = bgImg.getKey(); // 索引id - String redisKey = "receiveCameraImageByKey_" + key; - // 根据索引id存入缓存 - redisCache.setCacheObject(redisKey, image, 10, TimeUnit.HOURS); + // String key = bgImg.getKey(); // 索引id + // key: 前缀 + 车牌号 + 日期 + 入场/出场状态 + String redisKey = CacheConstants.CAMERA_IMAGE_BY_PLATE_NUMBER + plateNumber + "_" + DateUtils.getDate() + "_" + parkingState; + // 存入缓存 + // TODO 暂时永久保存 + redisCache.setCacheObject(redisKey, image); } - + return true; } + }