智能停——基于云计算的停车服务平台(续)

本文详细介绍了基于云计算的智能停车平台中的StationOrderServiceImpl和UserInfoServiceImpl两个核心服务的实现,包括用户信息的增删改查以及停车订单的相关操作。此外,还展示了如AddressDTO、CarDTO等数据传输对象的定义,以及Mapper接口如AddressMapper、UserInfoMapper的使用,这些接口用于数据库的交互。整个系统利用Spring Boot和MyBatis框架进行开发,实现了停车服务的智能化和数据管理。
摘要由CSDN通过智能技术生成

StationOrderServiceImpl
package com.cloud.station.service.impl;

import com.cloud.station.mapper.StationOrderMapper;
import com.cloud.station.pojo.DepotInfo;
import com.cloud.station.pojo.StationOrder;
import com.cloud.station.service.DepotInfoService;
import com.cloud.station.service.StationOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service(“stationOrderService”)
public class StationOrderServiceImpl implements StationOrderService {

@Autowired
DepotInfoService depotInfoService;
@Autowired
StationOrderMapper stationOrderMapper;
/**
 * 添加车牌
 *
 * @param carNumber
 * @return
 */
@Override
public Integer addByCarNum(Long stationId,String carNumber) {
    StationOrder stationOrder = new StationOrder();
    stationOrder.setStationId(stationId);
    stationOrder.setCarNum(carNumber);
    stationOrder.setCreateTime(new Date().getTime());
    stationOrder.setEndTime(0L);
    stationOrder.setState(StationOrder.UNDO);

    //如果存在
    StationOrder stationOrder_ = getByStationIdAndCarNuber(stationId,carNumber);
    if(stationOrder_!=null)return 0;

    try {
        return stationOrderMapper.insert(stationOrder);
    } catch (Exception e) {
        return 0;
    }
}

/**
 * 更新实体
 *
 * @param stationOrder
 * @return
 */
@Override
public Integer update(StationOrder stationOrder) {
    try {
        return stationOrderMapper.update(stationOrder);
    } catch (Exception e) {
        return 0;
    }
}

/**
 * 根据车牌查询
 *
 * @param carNum
 * @return
 */
@Override
public StationOrder getByCarNumber(String carNum) {
    StationOrder stationOrder = new StationOrder();
    stationOrder.setCarNum(carNum);

    try {
        return (StationOrder) stationOrderMapper.find(stationOrder).get(0);
    } catch (Exception e) {
        return null;
    }

}

/**
 * 根据停车场ID和车牌查询
 *
 * @param stationId
 * @param carNum
 * @return
 */
@Override
public StationOrder getByStationIdAndCarNuber(Long stationId, String carNum) {
    try {
        return stationOrderMapper.findByStationIdAndCarNuber(stationId,carNum);
    } catch (Exception e) {
        return null;
    }
}

/**
 * 查看历史信息
 *
 * @param carNum
 * @return
 */
@Override
public List<StationOrder> getHistory(String carNum) {
    StationOrder stationOrder = new StationOrder();
    stationOrder.setCarNum(carNum);
    try {
        return stationOrderMapper.find(stationOrder);
    } catch (Exception e) {
        return null;
    }
}

}

UserInfoServiceImpl
package com.cloud.station.service.impl;

import org.apache.catalina.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cloud.station.base.impl.BaseServiceImpl;
import com.cloud.station.mapper.UserInfoMapper;
import com.cloud.station.pojo.UserInfo;
import com.cloud.station.service.UserInfoService;

import java.util.List;

@Service(“userInfoService”)
public class UserInfoServiceImpl extends BaseServiceImpl implements
UserInfoService {

@Autowired
private UserInfoMapper userInfoMapper;

/**
* 插入一条用户信息记录
* @param userInfo 实体
* @return Integer
*/
@Override
public Integer save(UserInfo userInfo) {
try{
Integer result = userInfoMapper.insert(userInfo);
return result;
}catch(Exception e){
return 0;//插入用户信息出现异常,返回0.
}
}

/**
* 更具主键查询一条记录
*
* @param obj 主键
* @return 对象实体
* @
*/
@Override
public Object findByPrimaryKey(Object obj) {
try {
return (UserInfo) userInfoMapper.findByPrimaryKey(obj);
} catch (Exception e) {
return null;
}
}

/**
* 根据名称精确查找
*
* @param name 名称
* @return
* @
*/
@Override
public List findByName(String name) {
try {
return userInfoMapper.findByName(name);
} catch (Exception e) {
return null;
}
}

/**
* 更新一条记录
*
* @param entity 实体
* @return 影响记录条数
* @
*/
@Override
public Integer update(Object entity) {
try {
return userInfoMapper.update(entity);
} catch (Exception e) {
return 0;
}
}

/**************************************
* userInfoService
***********************************/
/

* 根据用户名查询密码
* @param account
* @return
*/
@Override
public String getPasswordByAccount(String account) {
try{
String password = userInfoMapper.findPasswordByAccount(account);
return password;
}catch(Exception e){
return null;
}
}

/**
* 根据用户名查询对象
* @param account
* @return
*/
@Override
public UserInfo getUserInfoByAccount(String account) {
try{
UserInfo userInfo = userInfoMapper.findByAccount(account);
return userInfo;
}catch(Exception e){
return null;
}
}

/**
* 分页查询
*
* @param skip 跳过记录数
* @param limit 每页记录查询条数
* @return 集合
* @
*/
@Override
public List findByPage(Integer skip, Integer limit) {
try {
return userInfoMapper.findByPage((skip-1)*limit,limit);
} catch (Exception e) {
return null;
}
}

/**
* 统计总记录条数
*
* @return 总记录数
* @
*/
@Override
public Long count() {
try {
return userInfoMapper.count();
} catch (Exception e) {
return 0L;
}
}
}

POJO类
dto
AddressDTO
package com.cloud.station.pojo.dto;

/**

  • 地址信息DTO类
    */
    public class AddressDTO {
    private double lat;//目标地址经度
    private double lng;//目标地址纬度
    private double distance;//目标地址覆盖半径(米)
    private double step;//增量幅度

    private Long sid;//首选停车场ID

    private int page;//当前页码
    private int limit;//每页数据条数

    public double getLat() {
    return lat;
    }

    public void setLat(double lat) {
    this.lat = lat;
    }

    public double getLng() {
    return lng;
    }

    public void setLng(double lng) {
    this.lng = lng;
    }

    public double getDistance() {
    return distance;
    }

    public void setDistance(double distance) {
    this.distance = distance;
    }

    public int getPage() {
    return page;
    }

    public void setPage(int page) {
    this.page = page;
    }

    public int getLimit() {
    return limit;
    }

    public void setLimit(int limit) {
    this.limit = limit;
    }

    public double getStep() {
    return step;
    }

    public void setStep(double step) {
    this.step = step;
    }

    public Long getSid() {
    return sid;
    }

    public void setSid(Long sid) {
    this.sid = sid;
    }
    }

CarDTO
package com.cloud.station.pojo.dto;

import com.fasterxml.jackson.annotation.JsonInclude;

/**

  • 车辆类
    */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public class CarDTO {

    private String number;//车牌号码
    private Long startTime;//初始时间
    private Long endTime;//结束时间
    private Long stationId;//停车场ID

    public String getNumber() {
    return number;
    }

    public void setNumber(String number) {
    this.number = number;
    }

    public Long getStartTime() {
    return startTime;
    }

    public void setStartTime(Long startTime) {
    this.startTime = startTime;
    }

    public Long getEndTime() {
    return endTime;
    }

    public void setEndTime(Long endTime) {
    this.endTime = endTime;
    }

    public Long getStationId() {
    return stationId;
    }

    public void setStationId(Long stationId) {
    this.stationId = stationId;
    }
    }

MapAddressDTO
package com.cloud.station.pojo.dto;

import com.cloud.station.pojo.Address;

/**

  • 地图地址DTO
    */
    public class MapAddressDTO extends Address{

    //街道编号
    private String citycode;

    private String neighborhood;

    //街
    private String street;

    //道
    private String township;

    public String getCitycode() {
    return citycode;
    }

    public void setCitycode(String citycode) {
    this.citycode = citycode;
    }

    public String getNeighborhood() {
    return neighborhood;
    }

    public void setNeighborhood(String neighborhood) {
    this.neighborhood = neighborhood;
    }

    public String getStreet() {
    return street;
    }

    public void setStreet(String street) {
    this.street = street;
    }

    public String getTownship() {
    return township;
    }

    public void setTownship(String township) {
    this.township = township;
    }

    @Override
    public String toString() {
    return “MapAddressDTO{” +
    “citycode=’” + citycode + ‘’’ +
    “, neighborhood=’” + neighborhood + ‘’’ +
    “, street=’” + street + ‘’’ +
    “, township=’” + township + ‘’’ +
    ‘}’;
    }
    }

Position
package com.cloud.station.pojo.dto;

/**

  • 区域坐标(经纬度)
    */
    public class Position {

    /**

    • 中心点边界点的经纬度
      */
      private double leftTopLat;
      private double leftTopLng;

    private double rightTopLat;
    private double rightTopLng;

    private double leftBottomLat;
    private double leftBottomLng;

    private double rightBottomLat;
    private double rightBottomLng;

    //中心点经纬度
    private double centerLat;
    private double centerLng;

    public double getLeftTopLat() {
    return leftTopLat;
    }

    public void setLeftTopLat(double leftTopLat) {
    this.leftTopLat = leftTopLat;
    }

    public double getLeftTopLng() {
    return leftTopLng;
    }

    public void setLeftTopLng(double leftTopLng) {
    this.leftTopLng = leftTopLng;
    }

    public double getRightTopLat() {
    return rightTopLat;
    }

    public void setRightTopLat(double rightTopLat) {
    this.rightTopLat = rightTopLat;
    }

    public double getRightTopLng() {
    return rightTopLng;
    }

    public void setRightTopLng(double rightTopLng) {
    this.rightTopLng = rightTopLng;
    }

    public double getLeftBottomLat() {
    return leftBottomLat;
    }

    public void setLeftBottomLat(double leftBottomLat) {
    this.leftBottomLat = leftBottomLat;
    }

    public double getLeftBottomLng() {
    return leftBottomLng;
    }

    public void setLeftBottomLng(double leftBottomLng) {
    this.leftBottomLng = leftBottomLng;
    }

    public double getRightBottomLat() {
    return rightBottomLat;
    }

    public void setRightBottomLat(double rightBottomLat) {
    this.rightBottomLat = rightBottomLat;
    }

    public double getRightBottomLng() {
    return rightBottomLng;
    }

    public void setRightBottomLng(double rightBottomLng) {
    this.rightBottomLng = rightBottomLng;
    }

    public double getCenterLat() {
    return centerLat;
    }

    public void setCenterLat(double centerLat) {
    this.centerLat = centerLat;
    }

    public double getCenterLng() {
    return centerLng;
    }

    public void setCenterLng(double centerLng) {
    this.centerLng = centerLng;
    }

    @Override
    public String toString() {
    return “Position{” +
    “leftTopLat=” + leftTopLat +
    “, leftTopLng=” + leftTopLng +
    “, rightTopLng=” + rightTopLng +
    “, leftBottomLat=” + leftBottomLat +
    ‘}’;
    }
    }

StationStateDTO
package com.cloud.station.pojo.dto;

import com.cloud.station.pojo.DepotInfo;

public class StationStateDTO {

private Long stationId;//停车场ID

private Integer left;//车位剩余数量

private Long lastTime;//最近更新时间
public Long getStationId() {
    return stationId;
}

public void setStationId(Long stationId) {
    this.stationId = stationId;
}

public Integer getLeft() {
    return left;
}

public void setLeft(Integer left) {
    this.left = left;
}

public Long getLastTime() {
    return lastTime;
}

public void setLastTime(Long lastTime) {
    this.lastTime = lastTime;
}

}

StepFare
package com.cloud.station.pojo.dto;

/**

  • 梯步区间类

  • 整个区间费用=(t1-t0)moneyunit
    */
    public class StepFare {

    //时间t0
    private int t0;

    //时间t1
    private int t1;

    //价格
    private float money;

    //小时数
    private float unit;

    public int getT0() {
    return t0;
    }

    /**

    • 整个区间的费用
    • @return
      */
      public float calc(){
      return (this.t1-this.t0)this.moneythis.unit;
      }

    public void setT0(int t0) {
    this.t0 = t0;
    }

    public int getT1() {
    return t1;
    }

    public void setT1(int t1) {
    this.t1 = t1;
    }

    public float getMoney() {
    return money;
    }

    public void setMoney(float money) {
    this.money = money;
    }

    public float getUnit() {
    return unit;
    }

    public void setUnit(float unit) {
    this.unit = unit;
    }
    }

ex
FriendEx
package com.cloud.station.pojo.ex;

import com.cloud.station.pojo.UserInfo;

public class FriendEx extends UserInfo{

//关系 默认是陌生人
private Integer relative;

//好友添加时间
private Long addTime;

public Integer getRelative() {
    return relative;
}

public void setRelative(Integer relative) {
    this.relative = relative;
}

public Long getAddTime() {
    return addTime;
}

public void setAddTime(Long addTime) {
    this.addTime = addTime;
}

}

StationOrderUser
package com.cloud.station.pojo.ex;

import com.cloud.station.pojo.UserInfo;
import com.fasterxml.jackson.annotation.JsonInclude;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class StationOrderUser extends UserInfo{

//订单创建时间
private Long orderCreateTime;

//订单提价时间
private Long orderEndTime;

//订单的状态
private Integer orderState;

}

UserBlackListEx
package com.cloud.station.pojo.ex;

import com.cloud.station.pojo.CarNumberBlacklist;
import com.cloud.station.pojo.UserInfo;

public class UserBlackListEx extends CarNumberBlacklist {

private UserInfo userInfo;

public UserInfo getUserInfo() {
    return userInfo;
}

public void setUserInfo(UserInfo userInfo) {
    this.userInfo = userInfo;
}

}

Address
package com.cloud.station.pojo;

import com.fasterxml.jackson.annotation.JsonInclude;

import java.io.Serializable;

//地址信息类
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Address implements Serializable{
//主键
private Long id;

//省
private String provice;

//市
private String city;

//县
private String country;

//村
private String village;

//描述
private String desc;

//创建时间
private Long createTime;

//停车场管理员ID
private Long adminDepotId;

public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getProvice() {
return provice;
}
public void setProvice(String provice) {
this.provice = provice;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getVillage() {
return village;
}
public void setVillage(String village) {
this.village = village;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
public Long getAdminDepotId() {
return adminDepotId;
}
public void setAdminDepotId(Long adminDepotId) {
this.adminDepotId = adminDepotId;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}

@Override
public String toString() {
return “Address{” +
“id=” + id +
“, provice=’” + provice + ‘’’ +
“, city=’” + city + ‘’’ +
“, country=’” + country + ‘’’ +
“, village=’” + village + ‘’’ +
“, desc=’” + desc + ‘’’ +
“, createTime=” + createTime +
“, adminDepotId=” + adminDepotId +
‘}’;
}
}

AdminInfo
package com.cloud.station.pojo;

import com.fasterxml.jackson.annotation.JsonInclude;

//系统管理员类
@JsonInclude(JsonInclude.Include.NON_NULL)
public class AdminInfo {
//主键
private Long id;

//管理员帐号
private String account;

//密码,加密处理
private String pwd;

//创建时间
private Long createTime;

public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getPwd() {
return pwd;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}

}

Application
package com.cloud.station.pojo;

/**

  • 应用实体
    */
    public class Application {

    //主键
    private Long id;

    //应用名称
    private String name;

    //应用描述
    private String desc;

    //应用ID号
    private String appKey;

    //应用密钥
    private String appSecrte;

    //停车场管理员ID
    private String adminId;

    public Long getId() {
    return id;
    }

    public void setId(Long id) {
    this.id = id;
    }

    public String getName() {
    return name;
    }

    public void setName(String name) {
    this.name = name;
    }

    public String getDesc() {
    return desc;
    }

    public void setDesc(String desc) {
    this.desc = desc;
    }

    public String getAppKey() {
    return appKey;
    }

    public void setAppKey(String appKey) {
    this.appKey = appKey;
    }

    public String getAppSecrte() {
    return appSecrte;
    }

    public void setAppSecrte(String appSecrte) {
    this.appSecrte = appSecrte;
    }

    public String getAdminId() {
    return adminId;
    }

    public void setAdminId(String adminId) {
    this.adminId = adminId;
    }
    }

CarInfo
package com.cloud.station.pojo;

/**

  • 车牌实体
    */
    public class CarInfo {

    //ID
    private Long id;

    //车牌
    private String carNumber;

    //当前使用者ID(0:车主)
    private Long currentUsed;

    //车主ID
    private Long userId;

    //车牌类别
    private String carNumberType;

    //车辆牌照
    private String photo;

    //车辆品牌
    private String carType;

    //车辆型号
    private String carXH;

    //车辆年份
    private Integer carYear;

    //车身颜色
    private String carColor;

    //识别号码
    private String code;

    public Long getId() {
    return id;
    }

    public void setId(Long id) {
    this.id = id;
    }

    public String getCarNumber() {
    return carNumber;
    }

    public void setCarNumber(String carNumber) {
    this.carNumber = carNumber;
    }

    public Long getCurrentUsed() {
    return currentUsed;
    }

    public void setCurrentUsed(Long currentUsed) {
    this.currentUsed = currentUsed;
    }

    public Long getUserId() {
    return userId;
    }

    public void setUserId(Long userId) {
    this.userId = userId;
    }

    public String getCarNumberType() {
    return carNumberType;
    }

    public void setCarNumberType(String carNumberType) {
    this.carNumberType = carNumberType;
    }

    public String getPhoto() {
    return photo;
    }

    public void setPhoto(String photo) {
    this.photo = photo;
    }

    public String getCarType() {
    return carType;
    }

    public void setCarType(String carType) {
    this.carType = carType;
    }

    public String getCarXH() {
    return carXH;
    }

    public void setCarXH(String carXH) {
    this.carXH = carXH;
    }

    public Integer getCarYear() {
    return carYear;
    }

    public void setCarYear(Integer carYear) {
    this.carYear = carYear;
    }

    public String getCarColor() {
    return carColor;
    }

    public void setCarColor(String carColor) {
    this.carColor = carColor;
    }

    public String getCode() {
    return code;
    }

    public void setCode(String code) {
    this.code = code;
    }

    @Override
    public String toString() {
    return “CarInfo{” +
    “id=” + id +
    “, carNumber=’” + carNumber + ‘’’ +
    “, currentUsed=” + currentUsed +
    “, userId=” + userId +
    “, carNumberType=’” + carNumberType + ‘’’ +
    “, photo=’” + photo + ‘’’ +
    “, carType=’” + carType + ‘’’ +
    “, carXH=’” + carXH + ‘’’ +
    “, carYear=” + carYear +
    “, carColor=’” + carColor + ‘’’ +
    “, code=’” + code + ‘’’ +
    ‘}’;
    }
    }

CarNumberBlacklist
package com.cloud.station.pojo;

import java.util.Date;

/*
*用户黑名单类
*/
public class CarNumberBlacklist {
//自增主键
private Long id;
//车牌号
private String carNum;
//使用用户的id
private Long userId;
//欠费金额
private float oweAmount=0.0f;

      掌握基于腾讯人工智能(AI)的车牌识别技术,使用车牌识别技术实现一个完整的停车场管理系统,项目包括网页调用摄像头拍照,车牌拍照识别,上传车牌图片识别,用户管理,车辆管理(临时车与包月车),车辆出场,入场管理,停车费收费管理,按照临时车或包月车自动计算停车费,系统参数设置,修改用户密码及安全退出等功能,该系统采用Jsp技术,使用SSM框架,Mysql数据库,ajax技术及人工智能等相关技术实现。重要通知:本课程根据腾讯AI车牌识别新接口,更新了新接口源代码,发布程序,购买了课程的同学可以下载新程序,包括(运行程序及源代码),更新时间:2021-2-17项目开发技术:java,jsp,mysql,MyBatis,SpringMVC,jquery,ajax,json项目运行环境:jdk1.7及以上版本,tomcat6.0及以上版本,mysql5.5及以上版本项目开发工具: 本项目开发工具是Eclipse,也支持myEclipse,Intellij Idea等其他版本开发工具相关课程学习顺序本校课程是培养JAVA软件工程师及JSP WEB网络应用程序开发,android工程师的全套课程,课程学习顺序如下:JAVA初级工程师:    1、计算机基础    2、HTML语言基础    3、C语言从入门到精通+贪吃蛇游戏    4、贪吃蛇游戏    5、SQL SERVER数据库基础    6、JAVA从入门到精通+推箱子游戏+QQ即时通讯软件    7、推箱子游戏;    8、仿QQ即时通讯软件;JAVA中级工程师:    9、SQLSERVER数据库高级    10、SQLSERVER从入门到精通(基础+高级)              11、JavaScript从入门到精通,    12、JSP从入门到精通+点餐系统,    13、JSP从入门到精通+在线视频学习教育平台,    14、JSP从入门到精通+大型电商平台;    15、XML从入门到精通,    16、数据结构(JAVA版),JAVA高级工程师:    17、Oracle数据库从入门到精通,    18、ajax+jquery从入门到精通,    19、EasyUI从入门到精通,SSH框架:    20、Struts2从入门到精通课程,    21、Hibernate从入门到精通课程,    22、Spring从入门到精通课程;    23、Echarts从入门到精通,    24、Excel基于POI的导入导出工作流框架:    25、Activiti流程框架从入门到精通    26、JBPM流程框架从入门到精通SSM框架:    27、MyBatis从入门到精通    28、Spring MVC从入门到精通面试题:    29、职业生涯规划及面试题集锦商业项目:    30、微信公众号在线支付系统    31、微信生活缴费在线支付系统    32、支付宝生活缴费在线支付系统    33、在线考试系统    34、手机订餐管理系统,    35、CRM客户关系管理系统    36、大型房地产CRM销售管理系统    37、CMPP2,CMPP3移动网关系统人工智能:    38、人脸识别在线考试系统    39、人脸识别系统项目实战    40、车牌识别系统项目实战    41、身份证识别系统项目实战    42、营业执照识别系统项目实战          43、名片识别管理系统
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值