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;//停车场IDpublic 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;