添加car模块,实现停车场管理业务,停车记录,汽车管理CRUD业务

master
Miku 1 year ago
parent a61fd6b3b4
commit 3e5c003f60

@ -0,0 +1,135 @@
package com.smart.module.car.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.smart.common.model.PageBean;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
/**
* app_car
*/
/**
* app_car
*/
@Data // 使用Lombok插件自动生成getter、setter等方法
@Entity // 声明该类为实体类
@Table(name = "app_car_manage") // 指定实体类对应的数据库表名为app_car_manage
public class CarManage extends PageBean implements Serializable {
@Id // 声明该属性为主键
@GeneratedValue(strategy = GenerationType.IDENTITY) // 设置主键生成策略为自增
@Column(name = "id", nullable = false, length = 20) // 指定该属性对应数据库表中的id列非空且长度为20
private Long id;
/**
*
*/
@Column(name = "name", length = 500) // 指定该属性对应数据库表中的name列长度为500
private String name;
/**
* ID
*/
@Column(name = "org_id", nullable = false, length = 20) // 指定该属性对应数据库表中的org_id列非空且长度为20
private Long orgId;
/**
*
*/
@Column(name = "org_name", length = 500) // 指定该属性对应数据库表中的org_name列长度为500
private String orgName;
/**
* ID
*/
@Column(name = "park_manage_id", nullable = false, length = 20)
private Long parkManageId;
/**
*
*/
@Column(name = "park_manage_name", length = 500)
private String parkManageName;
/**
*
*/
@Column(name = "plate_number", length = 100)
private String plateNumber;
/**
*
*/
@Column(name = "gender", length = 1)
private String gender;
/**
*
*/
@Column(name = "nickname", length = 100)
private String nickname;
/**
*
*/
@Column(name = "mobile", length = 20)
private String mobile;
/**
*
*/
@Column(name = "parking_lot", length = 100)
private String parkingLot;
/**
* 0 1VIP 2
*/
@Column(name = "type", length = 4)
private Short type;
/**
* 0 1
*/
@Column(name = "status", length = 4)
private Short status;
/**
*
*/
@Column(name = "remark", length = 200)
private String remark;
/**
*
*/
@Column(name = "validity_time")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Timestamp validityTime;
/**
*
*/
@Column(name = "gmt_create")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") // 该属性在序列化为JSON时按指定格式进行格式化
private Timestamp gmtCreate;
/**
*
*/
@Column(name = "gmt_modified")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Timestamp gmtModified;
/**
* id
*/
@Column(name = "user_id_create")// 指定该属性对应数据库表中的user_id_create列
private Long userIdCreate;
}

@ -0,0 +1,102 @@
package com.smart.module.car.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.smart.common.config.BigDecimalSerialize;
import com.smart.common.model.PageBean;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;
/**
* app_car_park_manage
*/
@Data // 使用Lombok插件自动生成getter、setter等方法
@Entity // 声明该类为实体类
@Table(name = "app_car_park_manage") // 指定实体类对应的数据库表名为app_car_park_manage
public class CarParkManage extends PageBean implements Serializable {
@Id // 声明该属性为主键
@GeneratedValue(strategy = GenerationType.IDENTITY) // 设置主键生成策略为自增
@Column(name = "id", nullable = false, length = 20) // 指定该属性对应数据库表中的id列非空且长度为20
private Long id;
/**
*
*/
@Column(name = "name", length = 500) // 指定该属性对应数据库表中的name列长度为500
private String name;
/**
*
*/
@Column(name = "org_id", nullable = false, length = 20) // 指定该属性对应数据库表中的org_id列非空且长度为20
private Long orgId;
/**
*
*/
@Column(name = "org_name", length = 500) // 指定该属性对应数据库表中的org_name列长度为500
private String orgName;
/**
* 0 1
*/
@Column(name = "status", length = 4) // 指定该属性对应数据库表中的status列长度为4
private Short status;
/**
*
*/
@Column(name = "parking_space_number") // 指定该属性对应数据库表中的parking_space_number列
private Integer parkingSpaceNumber;
/**
*
*/
@Column(name = "free_time") // 指定该属性对应数据库表中的free_time列
private Integer freeTime;
/**
*
*/
@Column(name = "time_unit") // 指定该属性对应数据库表中的time_unit列
private Integer timeUnit;
/**
*
*/
@JsonSerialize(using = BigDecimalSerialize.class) // 对BigDecimal类型的字段进行序列化时使用自定义的BigDecimalSerialize类进行处理
@Column(name = "unit_cost", scale = 2, precision = 18) // 指定该属性对应数据库表中的unit_cost列其精度为18位小数点后保留2位
private BigDecimal unitCost;
/**
*
*/
@JsonSerialize(using = BigDecimalSerialize.class) // 对BigDecimal类型的字段进行序列化时使用自定义的BigDecimalSerialize类进行处理
@Column(name = "max_money", scale = 2, precision = 18) // 指定该属性对应数据库表中的max_money列其精度为18位小数点后保留2位
private BigDecimal maxMoney;
/**
*
*/
@Column(name = "gmt_create")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") // 该属性在序列化为JSON时按指定格式进行格式化
private Timestamp gmtCreate;
/**
*
*/
@Column(name = "gmt_modified")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") // 该属性在序列化为JSON时按指定格式进行格式化
private Timestamp gmtModified;
/**
* id
*/
@Column(name = "user_id_create") // 指定该属性对应数据库表中的user_id_create列
private Long userIdCreate;
}

@ -0,0 +1,89 @@
package com.smart.module.car.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.smart.common.config.BigDecimalSerialize;
import com.smart.common.model.PageBean;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;
/**
* app_car_parking_record
*/
@Data // 使用Lombok插件自动生成getter、setter等方法
@Entity // 声明该类为实体类
@Table(name = "app_car_parking_record") // 指定实体类对应的数据库表名为app_car_parking_record
public class CarParkingRecord extends PageBean implements Serializable {
@Id // 声明该属性为主键
@GeneratedValue(strategy = GenerationType.IDENTITY) // 设置主键生成策略为自增
@Column(name = "id", nullable = false, length = 20) // 指定该属性对应数据库表中的id列非空且长度为20
private Long id;
/**
*
*/
@Column(name = "order_no", length = 500) // 指定该属性对应数据库表中的order_no列长度为500
private String orderNo;
/**
*
*/
@Column(name = "org_id", nullable = false, length = 20) // 指定该属性对应数据库表中的org_id列非空且长度为20
private Long orgId;
/**
*
*/
@Column(name = "org_name", length = 500) // 指定该属性对应数据库表中的org_name列长度为500
private String orgName;
/**
*
*/
@Column(name = "park_manage_id", nullable = false, length = 20) // 指定该属性对应数据库表中的park_manage_id列非空且长度为20
private Long parkManageId;
/**
*
*/
@Column(name = "park_manage_name", length = 500) // 指定该属性对应数据库表中的park_manage_name列长度为500
private String parkManageName;
/**
*
*/
@Column(name = "plate_number", length = 100) // 指定该属性对应数据库表中的plate_number列长度为100
private String plateNumber;
/**
* 0 1VIP 2
*/
@Column(name = "type", length = 4) // 指定该属性对应数据库表中的type列长度为4
private Short type;
/**
*
*/
@Column(name = "gmt_into")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") // 该属性在序列化为JSON时按指定格式进行格式化
private Timestamp gmtInto;
/**
*
*/
@Column(name = "gmt_out")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") // 该属性在序列化为JSON时按指定格式进行格式化
private Timestamp gmtOut;
/**
*
*/
@JsonSerialize(using = BigDecimalSerialize.class) // 对BigDecimal类型的字段进行序列化时使用自定义的BigDecimalSerialize类进行处理
@Column(name = "cost", scale = 2, precision = 18) // 指定该属性对应数据库表中的cost列其精度为18位小数点后保留2位
private BigDecimal cost;
}

@ -0,0 +1,10 @@
package com.smart.module.car.repository;
import com.smart.module.car.entity.CarManage;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository// 声明该类为仓库类
public interface CarManageRepository extends JpaRepository<CarManage, Long> {
}

@ -0,0 +1,10 @@
package com.smart.module.car.repository;
import com.smart.module.car.entity.CarParkingRecord;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository// 声明该类为仓库类
public interface CarParkingRecordRepository extends JpaRepository<CarParkingRecord, Long> {
}

@ -0,0 +1,10 @@
package com.smart.module.car.repository;
import com.smart.module.car.entity.CarParkManage;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository// 声明该类为仓库类
public interface ParkManageRepository extends JpaRepository<CarParkManage, Long> {
}

@ -0,0 +1,47 @@
package com.smart.module.car.service;
import com.smart.common.model.Result;
import com.smart.common.util.ExcelExport;
import com.smart.module.car.entity.CarManage;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import java.io.IOException;
/**
*
*/
public interface CarManageService {
/**
*
* @param entity
* @return
*/
Result save(CarManage entity);
/**
*
* @param entity
* @return
*/
Result list(CarManage entity);
/**
* ID
* @param plateNumber
* @param parkManageId ID
* @return
*/
CarManage getByPlateNumber(String plateNumber, Long parkManageId);
/**
* Excel
* @param orgId ID
* @param parkManageId ID
* @return Excel
* @throws IOException
* @throws InvalidFormatException
*/
ExcelExport exportData(Long orgId, Long parkManageId) throws IOException, InvalidFormatException;
}

@ -0,0 +1,33 @@
package com.smart.module.car.service;
import com.smart.common.model.Result;
import com.smart.module.car.entity.CarParkingRecord;
/**
*
*/
public interface CarParkingRecordService {
/**
*
* @param entity
* @return
*/
Result save(CarParkingRecord entity);
/**
*
* @param entity
* @return
*/
Result list(CarParkingRecord entity);
/**
*
* @param plateNumber
* @param parkManageId
* @return
*/
CarParkingRecord getByPlateNumber(String plateNumber,Long parkManageId);
}

@ -0,0 +1,34 @@
package com.smart.module.car.service;
import com.smart.common.model.Result;
import com.smart.module.car.entity.CarParkManage;
import java.util.List;
import java.util.Map;
/**
*
*/
public interface ParkManageService {
/**
*
* @param entity
* @return
*/
Result save(CarParkManage entity);
/**
*
* @param entity
* @return
*/
Result list(CarParkManage entity);
/**
*
* @param entity
* @return
*/
List<Map<String,Object>> select(CarParkManage entity);
}

@ -0,0 +1,145 @@
package com.smart.module.car.service.impl;
import cn.hutool.core.io.FileUtil;
import com.smart.common.constant.SystemConstant;
import com.smart.common.dynamicquery.DynamicQuery;
import com.smart.common.model.PageBean;
import com.smart.common.model.Result;
import com.smart.common.util.DateUtils;
import com.smart.common.util.ExcelExport;
import com.smart.common.util.ShiroUtils;
import com.smart.module.car.entity.CarManage;
import com.smart.module.car.repository.CarManageRepository;
import com.smart.module.car.service.CarManageService;
import com.smart.module.sys.entity.SysUser;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ClassUtils;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Timestamp;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@Service
public class CarManageServiceImpl implements CarManageService {
@Autowired
private DynamicQuery dynamicQuery; // 动态查询工具类
@Autowired
private CarManageRepository carManageRepository; // 汽车管理的数据访问层接口
// 保存汽车管理信息并刷新到数据库
@Override
@Transactional(rollbackFor=Exception.class)
public Result save(CarManage entity) {
if(entity.getId()==null){
entity.setGmtCreate(DateUtils.getTimestamp()); // 设置创建时间为当前时间
entity.setGmtModified(entity.getGmtCreate());
}else{
entity.setGmtModified(DateUtils.getTimestamp()); // 设置修改时间为当前时间
}
carManageRepository.saveAndFlush(entity); // 保存并刷新实体对象到数据库
return Result.ok("保存成功");
}
// 查询汽车管理列表
@Override
public Result list(CarManage entity) {
String nativeSql = "SELECT COUNT(*) FROM app_car_manage ";
nativeSql += common(entity); // 构建通用的 SQL 条件语句
Long count = dynamicQuery.nativeQueryCount(nativeSql); // 执行原生查询,统计总数
PageBean<CarManage> data = new PageBean<>();
if(count>0){
nativeSql = "SELECT * FROM app_car_manage ";
nativeSql += common(entity);
nativeSql += " ORDER BY gmt_create desc";
Pageable pageable = PageRequest.of(entity.getPageNo(),entity.getPageSize()); // 构建分页请求对象
List<CarManage> list = dynamicQuery.nativeQueryPagingList(CarManage.class,pageable,nativeSql); // 执行分页查询
data = new PageBean(list,count); // 构建分页结果对象
}
return Result.ok(data);
}
// 根据车牌号和停车场ID获取汽车管理信息
@Override
public CarManage getByPlateNumber(String plateNumber, Long parkManageId) {
String nativeSql = "SELECT * FROM app_car_manage WHERE plate_number=? AND park_manage_id=? ";
CarManage carManage =
dynamicQuery.nativeQuerySingleResult(CarManage.class,nativeSql,plateNumber,parkManageId); // 执行原生查询,获取单个对象
return carManage;
}
// 导出数据至 Excel
@Override
@Transactional(readOnly = true)
public ExcelExport exportData(Long orgId,Long parkManageId) throws IOException, InvalidFormatException {
SysUser user = ShiroUtils.getUserEntity();
Map<String, Integer> dataMap = new LinkedHashMap<>();
dataMap.put("org_name", ExcelExport.CELL_ALIGN_LEFT); // 设置列名与对齐方式的映射关系
dataMap.put("park_manage_name", ExcelExport.CELL_ALIGN_LEFT);
dataMap.put("plate_number", ExcelExport.CELL_ALIGN_LEFT);
dataMap.put("nickname", ExcelExport.CELL_ALIGN_LEFT);
dataMap.put("type", ExcelExport.CELL_ALIGN_LEFT);
dataMap.put("status", ExcelExport.CELL_ALIGN_LEFT);
dataMap.put("validity_time", ExcelExport.CELL_ALIGN_LEFT);
String nativeSql = "SELECT org_name,park_manage_name,plate_number,nickname,(CASE TYPE WHEN 0 THEN '包月车' ELSE '免费车' END) type ,(CASE STATUS WHEN 0 THEN '禁用' ELSE '正常' END) status,validity_time FROM app_car_manage WHERE 1=1";
List<Map<String, Object>> list;
if(ShiroUtils.isHasRole(SystemConstant.ROLE_ADMIN)){
if(orgId!=null){
nativeSql +=" AND org_id="+orgId;
}
}else{
nativeSql +=" AND org_id="+user.getOrgId();
}
if(parkManageId!=null){
nativeSql +=" AND park_manage_id=?";
list = dynamicQuery.nativeQueryListMap(nativeSql,parkManageId); // 执行原生查询,获取多个对象的列表
}else{
list = dynamicQuery.nativeQueryListMap(nativeSql);
}
/**
*
*/
InputStream stream = ClassUtils.getDefaultClassLoader()
.getResourceAsStream("static/excelTemplate/carManageExport.xls");
ExcelExport excelExport = new ExcelExport(
FileUtil.writeFromStream(stream, new File("excelTemplate/carManageExport.xls")), 1); // 创建 Excel 导出工具类对象
excelExport.setDataList(list, dataMap, false, ""); // 设置导出数据和列名与对齐方式的映射关系
return excelExport; // 返回 Excel 导出工具类对象
}
// 构建通用的 SQL 条件语句
public String common(CarManage entity){
String description = entity.getDescription();
String commonSql = " WHERE 1=1 ";
if(StringUtils.isNotBlank(description)){
commonSql += " AND name like '"+description+"%' ";
}
if(ShiroUtils.isHasRole(SystemConstant.ROLE_ADMIN)){
if(entity.getOrgId()!=null){
commonSql +=" AND org_id="+entity.getOrgId();
}
}else{
Long orgId = ShiroUtils.getUserEntity().getOrgId();
commonSql +=" AND org_id="+orgId;
}
if(entity.getParkManageId()!=null){
commonSql +=" AND park_manage_id="+entity.getParkManageId();
}
return commonSql;
}
}

@ -0,0 +1,102 @@
package com.smart.module.car.service.impl;
import com.smart.common.constant.SystemConstant;
import com.smart.common.dynamicquery.DynamicQuery;
import com.smart.common.model.PageBean;
import com.smart.common.model.Result;
import com.smart.common.util.DateUtils;
import com.smart.common.util.ShiroUtils;
import com.smart.module.car.entity.CarParkingRecord;
import com.smart.module.car.repository.CarParkingRecordRepository;
import com.smart.module.car.service.CarParkingRecordService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
*
*/
@Service
public class CarParkingRecordServiceImpl implements CarParkingRecordService {
@Autowired
private DynamicQuery dynamicQuery;
@Autowired
private CarParkingRecordRepository carParkingRecordRepository;
@Override
@Transactional(rollbackFor=Exception.class)
public Result save(CarParkingRecord entity) {
carParkingRecordRepository.saveAndFlush(entity);
return Result.ok("保存成功");
}
/**
*
* @param entity
* @return
*/
@Override
public Result list(CarParkingRecord entity) {
String nativeSql = "SELECT COUNT(*) FROM app_car_parking_record ";
nativeSql += common(entity);
Long count = dynamicQuery.nativeQueryCount(nativeSql);
PageBean<CarParkingRecord> data = new PageBean<>();
if(count>0){
nativeSql = "SELECT * FROM app_car_parking_record ";
nativeSql += common(entity);
nativeSql += " ORDER BY gmt_into desc";
Pageable pageable = PageRequest.of(entity.getPageNo(),entity.getPageSize());//分页查询
List<CarParkingRecord> list =
dynamicQuery.nativeQueryPagingList(CarParkingRecord.class,pageable,nativeSql);
data = new PageBean(list,count);
}
return Result.ok(data);
}
/**
*
* @param plateNumber
* @param parkManageId
* @return
*/
@Override
public CarParkingRecord getByPlateNumber(String plateNumber, Long parkManageId) {
String nativeSql = "SELECT * FROM app_car_parking_record WHERE plate_number=? AND park_manage_id=? AND gmt_out is null";
return dynamicQuery.nativeQuerySingleResult(CarParkingRecord.class,nativeSql,plateNumber,parkManageId);
}
/**
* SQL
* @param entity
* @return
*/
public String common(CarParkingRecord entity){
String description = entity.getDescription();
String commonSql = " WHERE 1=1";
if(StringUtils.isNotBlank(description)){
commonSql += " AND plate_number like '"+description+"%' ";
}
if(ShiroUtils.isHasRole(SystemConstant.ROLE_ADMIN)){
if(entity.getOrgId()!=null){
commonSql +=" AND org_id="+entity.getOrgId();
}
}else{
Long orgId = ShiroUtils.getUserEntity().getOrgId();
commonSql +=" AND org_id="+orgId;
}
if(entity.getParkManageId()!=null){
commonSql +=" AND park_manage_id="+entity.getParkManageId();
}
return commonSql;
}
}

@ -0,0 +1,90 @@
package com.smart.module.car.service.impl;
import com.smart.common.constant.SystemConstant;
import com.smart.common.dynamicquery.DynamicQuery;
import com.smart.common.model.PageBean;
import com.smart.common.model.Result;
import com.smart.common.util.DateUtils;
import com.smart.common.util.ShiroUtils;
import com.smart.module.car.entity.CarParkManage;
import com.smart.module.car.repository.ParkManageRepository;
import com.smart.module.car.service.ParkManageService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@Service // 服务注解,表示该类为一个服务类
public class ParkManageServiceImpl implements ParkManageService {
// 自动装配动态查询工具类和停车场仓库类
@Autowired
private DynamicQuery dynamicQuery;
@Autowired
private ParkManageRepository parkManageRepository;
// 保存停车场信息的方法
@Override
@Transactional(rollbackFor=Exception.class) // 添加事务注解,表示该方法需要事务支持
public Result save(CarParkManage entity) {
// 判断是新增还是更新停车场信息
if(entity.getId()==null){
entity.setGmtCreate(DateUtils.getTimestamp()); // 设置创建时间
entity.setGmtModified(entity.getGmtCreate()); // 设置修改时间
}else{
entity.setGmtModified(DateUtils.getTimestamp()); // 设置修改时间
}
parkManageRepository.saveAndFlush(entity); // 保存停车场信息到数据库
return Result.ok("保存成功"); // 返回操作结果
}
// 查询停车场信息列表的方法
@Override
public Result list(CarParkManage entity) {
String nativeSql = "SELECT COUNT(*) FROM app_car_park_manage "; // 构建查询总数的 SQL 语句
nativeSql += common(entity); // 拼接公共查询条件
Long count = dynamicQuery.nativeQueryCount(nativeSql); // 查询符合条件的停车场信息总数
PageBean<CarParkManage> data = new PageBean<>(); // 创建分页实体类对象
if(count>0){
nativeSql = "SELECT * FROM app_car_park_manage "; // 构建查询数据的 SQL 语句
nativeSql += common(entity); // 拼接公共查询条件
nativeSql += "ORDER BY gmt_create desc"; // 按创建时间倒序排序
Pageable pageable = PageRequest.of(entity.getPageNo(),entity.getPageSize()); // 创建分页请求对象
List<CarParkManage> list = dynamicQuery.nativeQueryPagingList(CarParkManage.class,pageable,nativeSql); // 分页查询符合条件的停车场信息列表
data = new PageBean(list,count); // 设置查询结果到分页实体类对象中
}
return Result.ok(data); // 返回查询结果
}
// 获取停车场信息下拉列表的方法
@Override
@Transactional(readOnly = true) // 添加只读事务注解,表示该方法不进行数据修改操作
public List<Map<String,Object>> select(CarParkManage entity) {
String nativeSql = "SELECT id,name FROM app_car_park_manage WHERE 1=1"; // 构建查询 SQL 语句
if(ShiroUtils.isHasRole(SystemConstant.ROLE_ADMIN)){ // 判断当前用户是否具有管理员角色
if(entity.getOrgId()!=null){
nativeSql +=" AND org_id="+entity.getOrgId(); // 根据组织机构ID查询对应的停车场信息
}
}else{
Long orgId = ShiroUtils.getUserEntity().getOrgId(); // 获取当前登录用户的组织机构ID
nativeSql +=" AND org_id="+orgId; // 根据当前登录用户的组织机构ID查询对应的停车场信息
}
return dynamicQuery.nativeQueryListMap(nativeSql); // 执行查询并返回停车场ID和名称的列表数据
}
// 辅助方法,拼接公共查询条件
public String common(CarParkManage entity){
String description = entity.getDescription(); // 获取停车场名称的查询条件
String commonSql = "";
if(StringUtils.isNotBlank(description)){
commonSql += "WHERE name like '"+description+"%' "; // 根据停车场名称模糊查询
}
return commonSql;
}
}

@ -0,0 +1,88 @@
package com.smart.module.car.web;
import com.smart.common.model.Result;
import com.smart.common.util.ExcelExport;
import com.smart.module.car.entity.CarManage;
import com.smart.module.car.repository.CarManageRepository;
import com.smart.module.car.service.CarManageService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
*
*/
@RestController
@RequestMapping("/car/manage")
public class CarManageController {
@Autowired
private CarManageService carManageService;
@Autowired
private CarManageRepository carManageRepository;
/**
*
*/
@PostMapping("list")
@RequiresRoles(value={"admin","orgAdmin"},logical = Logical.OR)
public Result list(CarManage entity){
return carManageService.list(entity);
}
/**
* ID
*/
@PostMapping("get")
@RequiresRoles(value={"admin","orgAdmin"},logical = Logical.OR)
public Result get(Long id){
CarManage entity =
carManageRepository.findById(id).orElse(new CarManage());
return Result.ok(entity);
}
/**
*
*/
@PostMapping("save")
@RequiresRoles(value={"admin","orgAdmin"},logical = Logical.OR)
public Result save(@RequestBody CarManage entity){
return carManageService.save(entity);
}
/**
* ID
*/
@PostMapping("delete")
@RequiresRoles(value={"admin","orgAdmin"},logical = Logical.OR)
public Result delete(Long id){
carManageRepository.deleteById(id);
return Result.ok();
}
/**
* Excel
*/
@PostMapping("export")
@RequiresRoles(value={"admin","orgAdmin"},logical = Logical.OR)
public void export(Long orgId,Long parkManageId,HttpServletRequest request, HttpServletResponse response){
try{
ExcelExport excelExport = carManageService.exportData(orgId,parkManageId);
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
excelExport.writeTemplate(response, request,
"车辆信息-" + sdf.format(new Date()) + ".xls");
}catch (Exception e){
e.printStackTrace();
}
}
}

@ -0,0 +1,46 @@
package com.smart.module.car.web;
import com.smart.common.model.Result;
import com.smart.module.car.entity.CarParkingRecord;
import com.smart.module.car.repository.CarParkingRecordRepository;
import com.smart.module.car.service.CarParkingRecordService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
*
*/
@RestController
@RequestMapping("/car/parkingRecord")
public class CarParkingRecordController {
@Autowired
private CarParkingRecordService carParkingRecordService;
@Autowired
private CarParkingRecordRepository carParkingRecordRepository;
/**
*
*/
@PostMapping("list")
@RequiresRoles(value={"admin","orgAdmin"},logical = Logical.OR)
public Result list(CarParkingRecord entity){
return carParkingRecordService.list(entity);
}
/**
* ID
*/
@PostMapping("get")
@RequiresRoles(value={"admin","orgAdmin"},logical = Logical.OR)
public Result get(Long id){
CarParkingRecord entity =
carParkingRecordRepository.findById(id).orElse(new CarParkingRecord());
return Result.ok(entity);
}
}

@ -0,0 +1,91 @@
package com.smart.module.car.web;
import com.smart.common.model.Result;
import com.smart.common.util.OrderUtils;
import com.smart.module.car.entity.CarParkManage;
import com.smart.module.car.repository.ParkManageRepository;
import com.smart.module.car.service.ParkManageService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
*
*/
@RestController
@RequestMapping("/car/parkManage")
public class ParkManageController {
@Autowired
private ParkManageService parkManageService;
// 注入停车场管理服务,用于业务处理
@Autowired
private ParkManageRepository parkManageRepository;
// 注入停车场管理仓库,用于查询停车场信息
/**
*
*/
@PostMapping("list")
@RequiresRoles(value={"admin","orgAdmin"},logical = Logical.OR)
public Result list(CarParkManage entity){
return parkManageService.list(entity);
}
// 返回停车场列表信息的接口,需要管理员或组织管理员角色权限
/**
* id
*/
@PostMapping("get")
@RequiresRoles(value={"admin","orgAdmin"},logical = Logical.OR)
public Result get(Long id){
CarParkManage carParkManage =
parkManageRepository.findById(id).orElse(new CarParkManage());
return Result.ok(carParkManage);
}
// 根据停车场id获取停车场信息的接口需要管理员或组织管理员角色权限
/**
*
*/
@PostMapping("save")
@RequiresRoles(value={"admin","orgAdmin"},logical = Logical.OR)
public Result save(@RequestBody CarParkManage entity){
return parkManageService.save(entity);
}
// 保存停车场信息的接口,需要管理员或组织管理员角色权限
/**
*
*/
@PostMapping("delete")
@RequiresRoles(value={"admin","orgAdmin"},logical = Logical.OR)
public Result delete(Long id){
parkManageRepository.deleteById(id);
return Result.ok();
}
// 删除停车场信息的接口,需要管理员或组织管理员角色权限
/**
*
*/
@PostMapping("/select")
@RequiresRoles(value={"admin","orgAdmin"},logical = Logical.OR)
public Result select(CarParkManage entity){
List<Map<String,Object>> list = parkManageService.select(entity);
return Result.ok(list);
}
// 返回停车场列表信息的接口,需要管理员或组织管理员角色权限
}

@ -0,0 +1,204 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="common/head :: head(links)"/>
<body>
<div class="ok-body" id="app" v-cloak>
<template>
<i-form label-colon ref="checkForm" :model="entity" :rules="ruleValidate" :label-width="120">
<i-row>
<i-col span="12">
<form-item prop="orgName" label="请选择单位">
<span @click="selectOrg()">
<i-input readonly v-model="entity.orgName" placeholder="请选择单位"></i-input>
</span>
</form-item>
</i-col>
<i-col span="12">
<form-item prop="parkManageName" label="请选择停车场">
<span @click="selectPark()">
<i-input readonly v-model="entity.parkManageName" placeholder="请选择停车场"></i-input>
</span>
</form-item>
</i-col>
</i-row>
<i-row>
<i-col span="12">
<form-item prop="nickname" label="车主姓名">
<i-input v-model="entity.nickname" placeholder="请输入车主姓名"></i-input>
</form-item>
</i-col>
<i-col span="12">
<form-item prop="mobile" label="手机号">
<i-input v-model="entity.mobile" placeholder="请输入手机号"></i-input>
</form-item>
</i-col>
</i-row>
<i-row>
<i-col span="12">
<form-item prop="gender" label="性别">
<radio-group v-model="entity.gender">
<radio v-for="item in genderList" :label="item.value" :key="item.value">{{item.label}}</radio>
</radio-group>
</form-item>
</i-col>
<i-col span="12">
<form-item prop="plateNumber" label="车牌号">
<i-input v-model="entity.plateNumber" placeholder="请输入车牌号"></i-input>
</form-item>
</i-col>
</i-row>
<i-row>
<i-col span="12">
<form-item prop="parkingLot" label="车位号">
<i-input v-model="entity.parkingLot" placeholder="请输入车位号"></i-input>
</form-item>
</i-col>
<i-col span="12">
<form-item prop="type" label="类型">
<radio-group v-model="entity.type">
<radio v-for="item in typeList" :label="item.value" :key="item.value">{{item.label}}</radio>
</radio-group>
</form-item>
</i-col>
</i-row>
<i-row>
<i-col span="12">
<form-item prop="validityTime" label="有效期至">
<Date-Picker v-model="entity.validityTime" type="datetime" format="yyyy-MM-dd" placeholder="有效期至" style="width: 200px"></Date-Picker>
</form-item>
</i-col>
<i-col span="12">
<form-item prop="status" label="状态">
<radio-group v-model="entity.status">
<radio v-for="item in statusList" :label="item.value" :key="item.value">{{item.label}}</radio>
</radio-group>
</form-item>
</i-col>
</i-row>
</i-form>
</template>
</div>
<div th:replace="common/foot :: foot(script)"></div>
<script th:inline="none">
var vm = new Vue({
el: '#app',
data:{
entity:{
status:1,
orgName:'',
orgId:null,
parkManageId:null,
parkManageName:''
},
roleName:"",
typeList:[{"label":"包月车","value":0},{"label":"VIP免费车","value":1},{"label":"临时车","value":2}],
genderList:[{"label":"男","value":"1"},{"label":"女","value":"0"}],
statusList:[{"label":"正常","value":1},{"label":"禁用","value":0}],
ruleValidate : {
orgName: [
{ required: true, message: '不能为空', trigger: 'change' }
],
parkManageName: [
{ required: true, message: '不能为空', trigger: 'change'}
],
nickname: [
{ required: true, message: '不能为空', trigger: 'blur'}
],
mobile: [
{ required: true, message: '不能为空', trigger: 'blur'}
],
gender: [
{ required: true, message: '不能为空', trigger: 'blur'}
],
parkingLot: [
{ required: true, message: '不能为空', trigger: 'blur'}
],
plateNumber: [
{ required: true, message: '不能为空', trigger: 'blur'}
],
type: [
{ required: true, message: '不能为空', trigger: 'change',type: 'number' }
],
status: [
{ required: true, message: '不能为空', trigger: 'change',type: 'number' }
],
validityTime: [
{ required: true, message: '不能为空', trigger: 'change',type: 'date' }
],
},
okUtils:null,
okLayer:null
},
methods: {
load : function(){
layui.use(["okUtils", "okLayer"], function () {
vm.okUtils = layui.okUtils;
vm.okLayer = layui.okLayer;
if(vm.entity.id!=undefined){
vm.okUtils.ajaxCloud({
url:"/car/manage/get",
param : {id:vm.entity.id},
close : false,
success : function(result) {
vm.entity = result.msg;
}
});
}
});
},
acceptClick : function(dialog){
vm.$refs.checkForm.validate(function(valid){
if (valid) {
vm.okUtils.ajaxCloud({
url:"/car/manage/save",
param : vm.entity,
json:true,
success : function(result) {
vm.okLayer.msg.greenTick(result.msg)
dialog.load();
}
});
}
});
},
selectOrg : function(){
vm.okUtils.dialogOpen({
title: '选择合作单位',
id:'org',
url: "car/carManage/org.html",
scroll : true,
width: '300px',
height: '500px',
success : function(dialog) {
},
yes : function(dialog) {
dialog.vm.acceptClick(vm);
}
});
},
selectPark : function(){
vm.okUtils.dialogOpen({
title: '选择停车场',
id:'org',
url: "car/carManage/park.html",
scroll : true,
width: '300px',
height: '500px',
success : function(dialog) {
},
yes : function(dialog) {
dialog.vm.acceptClick(vm);
}
});
}
},
created: function() {
}
});
</script>
</body>
</html>

@ -0,0 +1,240 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="common/head :: head(link)"/>
<body>
<div id="app" class="ok-body" v-cloak>
<!--模糊搜索区域-->
<template>
<div style="margin-bottom: 8px;margin-top: 8px;">
<i-select @on-change="listParkManage" placeholder="请选择合作单位" v-model="entity.orgId" style="width:200px">
<i-option v-for="item in orgList" :value="item.orgId" :key="item.orgId">{{ item.name }}</i-option>
</i-select>
<i-select placeholder="请选择停车场" v-model="entity.parkManageId" style="width:200px">
<i-option v-for="item in parkManageList" :value="item.id" :key="item.id">{{ item.name }}</i-option>
</i-select>
<i-input placeholder="输入内容" v-model="entity.description" style="width: 200px"></i-input>
<i-button type="primary" icon="ios-search" @click="load()">搜索</i-button>
<i-button type="primary" icon="ios-redo" @click="reload()" >重置</i-button>
<i-button type="primary" icon="md-cloud-download" @click="exportData()" >导出数据</i-button>
<i-button type="primary" style="float:right;" icon="md-add" @click="add()">新增</i-button>
</div>
</template>
<template>
<i-table size="small" :columns="tableTitle" :data="tableData">
<template slot-scope="tableScope" slot="action">
<i-button type="primary" size="small" icon="md-create" ghost class="table-btn" @click="edit(tableScope.row)">修改</i-button>
<i-button type="primary" size="small" icon="md-trash" ghost class="table-btn" @click="remove(tableScope.row)">删除</i-button>
<!-- <i-button v-if="tableScope.row.type==0" type="primary" size="small" icon="md-card" ghost class="table-btn" @click="renew(tableScope.row)">续费</i-button>-->
<i-button type="primary" size="small" icon="md-trash" ghost class="table-btn" @click="renew(tableScope.row)">续费</i-button>
</template>
</i-table>
<br>
<Page style="float: right;" :current="entity.pageNo" :total="tableSize" :page-size="entity.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" show-elevator show-sizer show-total></Page>
</template>
<form id="exportForm" style="display: none;" method="post">
<input name="orgId" v-model="entity.orgId" >
<input name="parkManageId" v-model="entity.parkManageId" >
</form>
</div>
<div th:replace="common/foot :: foot(script)"></div>
<script th:inline="none">
layui.use(["okUtils", "okLayer"], function () {
var okUtils = layui.okUtils;
var okLayer = layui.okLayer;
var $ = layui.jquery;
var vm = new Vue({
el: '#app',
data: function(){
var that = this;
return {
tableTitle : [{
title: '序号',
width : 80,
render: function(h, params) {
return h('span', params.index + (that.entity.pageNo- 1) * that.entity.pageSize + 1);
}
},{
key : "orgName",
title : "所属单位",
minWidth:150
},{
key : "parkManageName",
title : "停车场",
minWidth:150
},{
key : "plateNumber",
title : "车牌号",
width:150
},{
key : "nickname",
title : "车主姓名",
width:150
},{
key : "gender",
title : "性别",
width : 80,
render: function(h, params) {
return h('span', params.row.gender==0?'女':'男');
}
},{
key : "status",
title : "状态",
width : 80,
render: function(h, params) {
return h('span', params.row.status==0?'禁用':'正常');
}
},{
key : "type",
title : "类型",
width : 120,
render: function(h, params) {
if(params.row.type==2){
return h('span','临时车');
}else{
return h('span', params.row.type==0?'包月车':'VIP免费车');
}
}
},{
key : "validityTime",
title : "有效期至",
minWidth:150
},{
title : '操作',
key : 'action',
minWidth : 250,
fixed : 'right',
align : 'left',
slot:'action'
} ],
tableData : [],
entity : {
pageSize : 10,
pageNo : 1,
description:'',
orgId:null
},
tableSize : 50,
orgList:[],
parkManageList:[]
}
},
methods: {
load : function() {
var that = this;
okUtils.ajaxCloud({
url:"/car/manage/list",
param : that.entity,
success : function(result) {
that.tableData = result.msg.pageData;
that.tableSize = result.msg.totalCount;
}
});
},
listOrg : function() {
var that = this;
okUtils.ajaxCloud({
url:"/sys/org/select",
success : function(result) {
that.orgList = result.msg;
}
});
},
listParkManage : function() {
var that = this;
okUtils.ajaxCloud({
url:"/car/parkManage/select",
param : {'orgId':vm.entity.orgId},
success : function(result) {
that.parkManageList = result.msg;
}
});
},
reload : function(){
vm.entity.pageSize = 10;
vm.entity.pageNo = 1;
vm.entity.description = '';
vm.entity.orgId = null;
vm.entity.parkManageId = null;
this.load();
},
changePage : function(pageNo) {
vm.entity.pageNo = pageNo;
vm.load();
},
changePageSize : function(pageSize) {
vm.entity.pageSize = pageSize;
vm.load();
},
edit : function(entity) {
okUtils.dialogOpen({
title: '修改',
url: "car/carManage/form.html",
scroll : true,
width: '50%',
height: '65%',
success : function(dialog) {
dialog.vm.entity.id = entity.id;
dialog.vm.load();
},
yes : function(dialog) {
dialog.vm.acceptClick(vm);
}
});
},
add:function(){
okUtils.dialogOpen({
title: '新增',
url: "car/carManage/form.html",
scroll : true,
width: '50%',
height: '65%',
success : function(dialog) {
dialog.vm.load();
},
yes : function(dialog) {
dialog.vm.acceptClick(vm);
}
});
},
remove:function(entity) {
okLayer.confirm("确定要删除吗?", function () {
okUtils.ajaxCloud({
url:"/car/manage/delete",
param : {id: entity.id},
success : function(result) {
okLayer.msg.greenTick(result.msg);
vm.load();
}
});
})
},
renew:function(entity){
okUtils.dialogOpen({
title: '续费',
url: "car/carManage/renew.html",
scroll : true,
width: '50%',
height: '65%',
success : function(dialog) {
dialog.vm.entity.id = entity.id;
dialog.vm.load();
},
yes : function(dialog) {
dialog.vm.acceptClick(vm);
}
});
},exportData: function () {
$("#exportForm").attr("action", "/car/manage/export");
$("#exportForm").submit();
}
},
created: function() {
this.load()
this.listOrg();
}
})
});
</script>
</body>
</html>

@ -0,0 +1,71 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" th:href="@{/lib/ztree/css/metroStyle/metroStyle.css}">
</head>
<body>
<div class="ok-body" id="app" v-cloak>
<div id="treePanel" style="overflow: auto;">
<ul id="orgTree" class="ztree"></ul>
</div>
</div>
<div th:replace="common/foot :: foot(jquery、tree)"></div>
<script th:inline="none">
var setting = {
data : {
simpleData : {
enable : true,
idKey : "orgId",
pIdKey : "parentId",
rootPId : "0"
},
key : {
url : "nourl"
}
},
callback : {
onClick : function(event, treeId, treeNode) {
vm.parentId = treeNode.orgId;
vm.parentName = treeNode.name;
}
}
};
var vm = new Vue({
el: '#app',
data:{
okUtils:null,
okLayer:null,
orgId:null,
parentName:null
},
methods: {
tree : function() {
vm.okUtils.ajaxCloud({
url:"/sys/org/select",
param : {parentId: vm.parentId},
close:false,
success : function(result) {
$.fn.zTree.init($("#orgTree"), setting, result.msg);
}
});
},
acceptClick : function(dialog){
dialog.entity.orgId = vm.parentId;
dialog.entity.orgName = vm.parentName;
vm.okUtils.dialogClose();
}
},
created: function() {
var that = this;
layui.use(["okUtils", "okLayer"], function () {
that.okUtils = layui.okUtils;
that.okLayer = layui.okLayer;
that.tree();
});
}
});
</script>
</body>
</html>

@ -0,0 +1,71 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" th:href="@{/lib/ztree/css/metroStyle/metroStyle.css}">
</head>
<body>
<div class="ok-body" id="app" v-cloak>
<div id="treePanel" style="overflow: auto;">
<ul id="orgTree" class="ztree"></ul>
</div>
</div>
<div th:replace="common/foot :: foot(jquery、tree)"></div>
<script th:inline="none">
var setting = {
data : {
simpleData : {
enable : true,
idKey : "id",
pIdKey : "parentId",
rootPId : "0"
},
key : {
url : "nourl"
}
},
callback : {
onClick : function(event, treeId, treeNode) {
vm.id = treeNode.id;
vm.name = treeNode.name;
}
}
};
var vm = new Vue({
el: '#app',
data:{
okUtils:null,
okLayer:null,
id:null,
name:null
},
methods: {
tree : function() {
vm.okUtils.ajaxCloud({
url:"/car/parkManage/select",
param : {parentId: vm.parentId},
close:false,
success : function(result) {
$.fn.zTree.init($("#orgTree"), setting, result.msg);
}
});
},
acceptClick : function(dialog){
dialog.entity.parkManageId = vm.id;
dialog.entity.parkManageName = vm.name;
vm.okUtils.dialogClose();
}
},
created: function() {
var that = this;
layui.use(["okUtils", "okLayer"], function () {
that.okUtils = layui.okUtils;
that.okLayer = layui.okLayer;
that.tree();
});
}
});
</script>
</body>
</html>

@ -0,0 +1,132 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="common/head :: head(links)"/>
<body>
<div class="ok-body" id="app" v-cloak>
<template>
<i-form label-colon ref="checkForm" :model="entity" :rules="ruleValidate" :label-width="120">
<i-row>
<i-col span="12">
<form-item label="车主">
{{entity.nickname}}
</form-item>
</i-col>
<i-col span="12">
<form-item label="手机号">
{{entity.mobile}}
</form-item>
</i-col>
</i-row>
<i-row>
<i-col span="12">
<form-item label="车牌号">
{{entity.plateNumber}}
</form-item>
</i-col>
<i-col span="12">
<form-item label="车位号">
{{entity.parkingLot}}
</form-item>
</i-col>
</i-row>
<i-row>
<i-col span="12">
<form-item prop="type" label="支付方式">
<radio-group v-model="entity.type">
<radio v-for="item in payType" :label="item.value" :key="item.value">{{item.label}}</radio>
</radio-group>
</form-item>
</i-col>
<i-col span="12">
<form-item prop="totalFee" label="金额">
<i-input v-model="entity.totalFee" placeholder="请输入金额"></i-input>
</form-item>
</i-col>
</i-row>
<i-row>
<i-col span="12">
<form-item prop="validityTime" label="有效期至">
<Date-Picker v-model="entity.validityTime" type="datetime" format="yyyy-MM-dd" placeholder="有效期至" style="width: 200px"></Date-Picker>
</form-item>
</i-col>
</i-row>
<i-row>
<i-col span="24">
<form-item label="备注">
<i-input maxlength="200" v-model="entity.remark" type="textarea" :autosize="{minRows: 2,maxRows: 5}" placeholder="请输入备注"></i-input>
</form-item>
</i-col>
</i-row>
</i-form>
</template>
</div>
<div th:replace="common/foot :: foot(script)"></div>
<script th:inline="none">
var vm = new Vue({
el: '#app',
data:{
entity:{
status:1,
orgName:'',
orgId:null,
parkManageId:null,
parkManageName:''
},
payType:[{"label":"微信","value":0},{"label":"支付宝","value":1},{"label":"其它","value":2}],
roleName:"",
ruleValidate : {
totalFee: [
{ required: true, message: '不能为空', trigger: 'blur'}
],
type: [
{ required: true, message: '不能为空', trigger: 'change',type: 'number' }
],
validityTime: [
{ required: true, message: '不能为空', trigger: 'change',type: 'date' }
],
},
okUtils:null,
okLayer:null
},
methods: {
load : function(){
layui.use(["okUtils", "okLayer"], function () {
vm.okUtils = layui.okUtils;
vm.okLayer = layui.okLayer;
if(vm.entity.id!=undefined){
vm.okUtils.ajaxCloud({
url:"/car/manage/get",
param : {id:vm.entity.id},
close : false,
success : function(result) {
vm.entity = result.msg;
vm.entity.remark = "";
}
});
}
});
},
acceptClick : function(dialog){
vm.entity.carId = vm.entity.id;
vm.$refs.checkForm.validate(function(valid){
if (valid) {
vm.okUtils.ajaxCloud({
url:"/car/manage/renew",
param : vm.entity,
json:true,
success : function(result) {
vm.okLayer.msg.greenTick(result.msg)
dialog.load();
}
});
}
});
}
},
created: function() {
}
});
</script>
</body>
</html>

@ -0,0 +1,140 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="common/head :: head(links)"/>
<body>
<div class="ok-body" id="app" v-cloak>
<template>
<i-form label-colon ref="checkForm" :model="entity" :rules="ruleValidate" :label-width="140">
<form-item prop="name" label="停车场名称">
<i-input maxlength="20" v-model="entity.name" placeholder="请输入停车场名称"></i-input>
</form-item>
<form-item prop="orgName" label="单位名称">
<span @click="selectOrg()">
<i-input readonly v-model="entity.orgName" placeholder="请选择单位"></i-input>
</span>
</form-item>
<form-item prop="parkingSpaceNumber" label="停车位数量">
<input-number v-model="entity.parkingSpaceNumber" placeholder="请输入停车位数量"></input-number>
</form-item>
<form-item prop="freeTime" label="免费时长(分钟)">
<input-number v-model="entity.freeTime" placeholder="请输入免费时长"></input-number>
</form-item>
<form-item prop="timeUnit" label="计时单元">
<input-number v-model="entity.timeUnit" placeholder="请输入计时单元"></input-number>
</form-item>
<form-item prop="unitCost" label="单元费用">
<i-input v-model="entity.unitCost" placeholder="请输入计时单元"></i-input>
</form-item>
<form-item prop="maxMoney" label="最大收费金额">
<i-input v-model="entity.maxMoney" placeholder="请输入最大收费金额"></i-input>
</form-item>
<form-item label="状态">
<radio-group v-model="entity.status">
<radio v-for="item in statusList" :label="item.value" :key="item.value">{{item.label}}</radio>
</radio-group>
</form-item>
</i-form>
</template>
</div>
<div th:replace="common/foot :: foot(script)"></div>
<script th:inline="none">
var vm = new Vue({
el: '#app',
data:{
entity:{
status:1,
orgName:'',
orgId:null,
parkingSpaceNumber:null,
freeTime:null,
timeUnit:null,
unitCost:null,
maxMoney:null
},
roleName:"",
statusList:[{"label":"正常","value":1},{"label":"禁用","value":0}],
ruleValidate : {
name: [
{ required: true, message: '不能为空', trigger: 'blur' }
],
parkingSpaceNumber: [
{ required: true, message: '不能为空', trigger: 'blur',type: 'number'}
],
freeTime: [
{ required: true, message: '不能为空', trigger: 'blur',type: 'number'}
],
timeUnit: [
{ required: true, message: '不能为空', trigger: 'blur',type: 'number'}
],
unitCost: [
{ required: true, message: '不能为空', trigger: 'blur'},
{ type: 'string', pattern:/^\d+(\.\d{0,2})?$/, message: '必须是数字, 最多保留两位小数', trigger: 'blur'}
],
maxMoney: [
{ required: true, message: '不能为空', trigger: 'blur'},
{ type: 'string', pattern:/^\d+(\.\d{0,2})?$/, message: '必须是数字, 最多保留两位小数', trigger: 'blur'}
],
orgName: [
{ required: true, message: '请选择机构', trigger: 'change' }
]
},
okUtils:null,
okLayer:null
},
methods: {
load : function(){
layui.use(["okUtils", "okLayer"], function () {
vm.okUtils = layui.okUtils;
vm.okLayer = layui.okLayer;
if(vm.entity.id!=undefined){
vm.okUtils.ajaxCloud({
url:"/car/parkManage/get",
param : {id:vm.entity.id},
close : false,
success : function(result) {
vm.entity = result.msg;
}
});
}
});
},
acceptClick : function(dialog){
vm.$refs.checkForm.validate(function(valid){
if (valid) {
vm.okUtils.ajaxCloud({
url:"/car/parkManage/save",
param : vm.entity,
json:true,
success : function(result) {
vm.okLayer.msg.greenTick(result.msg)
dialog.load();
}
});
}
});
},
selectOrg : function(){
vm.okUtils.dialogOpen({
title: '选择机构',
id:'org',
url: "sys/user/org.html",
scroll : true,
width: '300px',
height: '500px',
success : function(dialog) {
},
yes : function(dialog) {
dialog.vm.acceptClick(vm);
}
});
}
},
created: function() {
}
});
</script>
</body>
</html>

@ -0,0 +1,177 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="common/head :: head(link)"/>
<body>
<div id="app" class="ok-body" v-cloak>
<!--模糊搜索区域-->
<template>
<div style="margin-bottom: 8px;margin-top: 8px;">
<i-input placeholder="输入内容" v-model="entity.description" style="width: 300px"></i-input>
<i-button type="primary" icon="ios-search" @click="load()">搜索</i-button>
<i-button type="primary" icon="ios-redo" @click="reload()" >重置</i-button>
<i-button type="primary" style="float:right;" icon="md-add" @click="add()">新增</i-button>
</div>
</template>
<template>
<i-table size="small" :columns="tableTitle" :data="tableData">
<template slot-scope="tableScope" slot="action">
<i-button type="primary" size="small" icon="md-create" ghost class="table-btn" @click="edit(tableScope.row)">修改</i-button>
<i-button type="primary" size="small" icon="md-trash" ghost class="table-btn" @click="remove(tableScope.row)">删除</i-button>
<i-button type="primary" size="small" icon="md-card" ghost class="table-btn" @click="payConfig(tableScope.row)">支付配置</i-button>
</template>
</i-table>
<br>
<Page style="float: right;" :current="entity.pageNo" :total="tableSize" :page-size="entity.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" show-elevator show-sizer show-total></Page>
</template>
</div>
<div th:replace="common/foot :: foot(script)"></div>
<script th:inline="none">
layui.use(["okUtils", "okLayer"], function () {
var okUtils = layui.okUtils;
var okLayer = layui.okLayer;
var vm = new Vue({
el: '#app',
data: function(){
var that = this;
return {
tableTitle : [{
title: '序号',
minWidth : 80,
render: function(h, params) {
return h('span', params.index + (that.entity.pageNo- 1) * that.entity.pageSize + 1);
}
},{
key : "name",
title : "停车场名称",
minWidth:150
},{
key : "parkingSpaceNumber",
title : "车位总数",
minWidth:100
},{
key : "freeTime",
title : "免费时长",
minWidth:150
},{
key : "timeUnit",
title : "计时单元",
minWidth:150
},{
key : "unitCost",
title : "单元费用",
minWidth:150
},{
key : "gmtCreate",
title : "创建时间",
minWidth:150
},{
title : '操作',
key : 'action',
minWidth : 320,
fixed : 'right',
align : 'center',
slot:'action'
} ],
tableData : [],
entity : {
pageSize : 10,
pageNo : 1,
description:''
},
tableSize : 50,
}
},
methods: {
load : function() {
var that = this;
okUtils.ajaxCloud({
url:"/car/parkManage/list",
param : that.entity,
success : function(result) {
that.tableData = result.msg.pageData;
that.tableSize = result.msg.totalCount;
}
});
},
reload : function(){
vm.entity.pageSize = 10;
vm.entity.pageNo = 1;
vm.entity.description = '';
this.load();
},
changePage : function(pageNo) {
vm.entity.pageNo = pageNo;
vm.load();
},
changePageSize : function(pageSize) {
vm.entity.pageSize = pageSize;
vm.load();
},
edit : function(entity) {
okUtils.dialogOpen({
title: '修改',
url: "car/parkManage/form.html",
scroll : true,
width: '40%',
height: '90%',
success : function(dialog) {
dialog.vm.entity.id = entity.id;
dialog.vm.load();
},
yes : function(dialog) {
dialog.vm.acceptClick(vm);
}
});
},
add:function(){
okUtils.dialogOpen({
title: '新增',
url: "car/parkManage/form.html",
scroll : true,
width: '40%',
height: '90%',
success : function(dialog) {
dialog.vm.load();
},
yes : function(dialog) {
dialog.vm.acceptClick(vm);
}
});
},
remove:function(entity) {
okLayer.confirm("确定要删除吗?", function () {
okUtils.ajaxCloud({
url:"/car/parkManage/delete",
param : {id: entity.id},
success : function(result) {
okLayer.msg.greenTick(result.msg);
vm.load();
}
});
})
},
payConfig:function(entity){
okUtils.dialogOpen({
title: '支付配置',
url: "car/parkManage/payConfig.html",
scroll : true,
width: '40%',
height: '50%',
success : function(dialog) {
dialog.vm.entity.carParkId = entity.id;
dialog.vm.load();
},
yes : function(dialog) {
dialog.vm.acceptClick(vm);
}
});
},
},
created: function() {
this.load()
}
})
});
</script>
</body>
</html>

@ -0,0 +1,71 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" th:href="@{/lib/ztree/css/metroStyle/metroStyle.css}">
</head>
<body>
<div class="ok-body" id="app" v-cloak>
<div id="treePanel" style="overflow: auto;">
<ul id="orgTree" class="ztree"></ul>
</div>
</div>
<div th:replace="common/foot :: foot(jquery、tree)"></div>
<script th:inline="none">
var setting = {
data : {
simpleData : {
enable : true,
idKey : "orgId",
pIdKey : "parentId",
rootPId : "0"
},
key : {
url : "nourl"
}
},
callback : {
onClick : function(event, treeId, treeNode) {
vm.parentId = treeNode.orgId;
vm.parentName = treeNode.name;
}
}
};
var vm = new Vue({
el: '#app',
data:{
okUtils:null,
okLayer:null,
orgId:null,
parentName:null
},
methods: {
tree : function() {
vm.okUtils.ajaxCloud({
url:"/sys/org/select",
param : {parentId: vm.parentId},
close:false,
success : function(result) {
$.fn.zTree.init($("#orgTree"), setting, result.msg);
}
});
},
acceptClick : function(dialog){
dialog.user.orgId = vm.parentId;
dialog.user.orgName = vm.parentName;
vm.okUtils.dialogClose();
}
},
created: function() {
var that = this;
layui.use(["okUtils", "okLayer"], function () {
that.okUtils = layui.okUtils;
that.okLayer = layui.okLayer;
that.tree();
});
}
});
</script>
</body>
</html>

@ -0,0 +1,82 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="common/head :: head(links)"/>
<body>
<div class="ok-body" id="app" v-cloak>
<template>
<i-form label-colon ref="checkForm" :model="entity" :rules="ruleValidate" :label-width="140">
<form-item prop="mchId" label="支付申请">
https://dwz.cn/mPQmSPss
</form-item>
<form-item prop="mchId" label="商户号">
<i-input maxlength="20" v-model="entity.mchId" placeholder="请输入商户号"></i-input>
</form-item>
<form-item prop="secretKey" label="秘钥">
<i-input v-model="entity.secretKey" placeholder="请输秘钥"></i-input>
</form-item>
</i-form>
</template>
</div>
<div th:replace="common/foot :: foot(script)"></div>
<script th:inline="none">
var vm = new Vue({
el: '#app',
data:{
entity:{
},
ruleValidate : {
mchId: [
{ required: true, message: '不能为空', trigger: 'blur' }
],
secretKey: [
{ required: true, message: '不能为空', trigger: 'blur'}
],
},
okUtils:null,
okLayer:null
},
methods: {
load : function(){
layui.use(["okUtils", "okLayer"], function () {
vm.okUtils = layui.okUtils;
vm.okLayer = layui.okLayer;
if(vm.entity.carParkId!=undefined){
vm.okUtils.ajaxCloud({
url:"/pay/config/getByCarParkId",
param : {carParkId:vm.entity.carParkId},
close : false,
success : function(result) {
if(result.msg!=null){
vm.entity = result.msg;
}
}
});
}
});
},
acceptClick : function(dialog){
vm.$refs.checkForm.validate(function(valid){
if (valid) {
vm.okUtils.ajaxCloud({
url:"/pay/config/save",
param : vm.entity,
json:true,
success : function(result) {
vm.okLayer.msg.greenTick(result.msg)
dialog.load();
}
});
}
});
},
},
created: function() {
}
});
</script>
</body>
</html>

@ -0,0 +1,196 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="common/head :: head(link)"/>
<body>
<div id="app" class="ok-body" v-cloak>
<!--模糊搜索区域-->
<template>
<div style="margin-bottom: 8px;margin-top: 8px;">
<i-input placeholder="输入内容" v-model="entity.description" style="width: 150px"></i-input>
<i-select @on-change="listParkManage" placeholder="请选择合作单位" v-model="entity.orgId" style="width:150px">
<i-option v-for="item in orgList" :value="item.orgId" :key="item.orgId">{{ item.name }}</i-option>
</i-select>
<i-select placeholder="请选择停车场" v-model="entity.parkManageId" style="width:150px">
<i-option v-for="item in parkManageList" :value="item.id" :key="item.id">{{ item.name }}</i-option>
</i-select>
<Date-Picker type="datetimerange" format="yyyy-MM-dd HH:mm" placeholder="请选择进场时间" style="width: 280px"></Date-Picker>
<Date-Picker type="datetimerange" format="yyyy-MM-dd HH:mm" placeholder="请选择出场时间" style="width: 280px"></Date-Picker>
<i-button type="primary" icon="ios-search" @click="load()">搜索</i-button>
<i-button type="primary" icon="ios-redo" @click="reload()" >重置</i-button>
</div>
</template>
<template>
<i-table size="small" :columns="tableTitle" :data="tableData">
<template slot-scope="tableScope" slot="action">
<i-button type="primary" size="small" icon="md-create" ghost class="table-btn" @click="edit(tableScope.row)">修改</i-button>
<i-button type="primary" size="small" icon="md-trash" ghost class="table-btn" @click="remove(tableScope.row)">删除</i-button>
</template>
</i-table>
<br>
<Page style="float: right;" :current="entity.pageNo" :total="tableSize" :page-size="entity.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" show-elevator show-sizer show-total></Page>
</template>
</div>
<div th:replace="common/foot :: foot(script)"></div>
<script th:inline="none">
layui.use(["okUtils", "okLayer"], function () {
var okUtils = layui.okUtils;
var okLayer = layui.okLayer;
var vm = new Vue({
el: '#app',
data: function(){
var that = this;
return {
tableTitle : [{
title: '序号',
width : 80,
render: function(h, params) {
return h('span', params.index + (that.entity.pageNo- 1) * that.entity.pageSize + 1);
}
},{
key : "parkManageName",
title : "停车场",
minWidth:200
},{
key : "plateNumber",
title : "车牌号",
minWidth:150
},{
key : "type",
title : "类型",
minWidth : 120,
render: function(h, params) {
var name = "临时车";
if(params.row.type==0){
name = '包月车';
}else if(params.row.type==1){
name = 'VIP免费车';
}else if(params.row.type==2){
name = "临时车"
}
return h('span', name);
}
},{
key : "gmtInto",
title : "入场时间",
minWidth:200
},{
key : "gmtOut",
title : "出场时间",
minWidth:200
},{
key : "cost",
title : "收费金额(元)",
minWidth:200
} ],
tableData : [],
entity : {
pageSize : 10,
pageNo : 1,
description:'',
orgId:null
},
tableSize : 50,
orgList:[],
parkManageList:[]
}
},
methods: {
load : function() {
var that = this;
okUtils.ajaxCloud({
url:"/car/parkingRecord/list",
param : that.entity,
success : function(result) {
that.tableData = result.msg.pageData;
that.tableSize = result.msg.totalCount;
}
});
},
listOrg : function() {
var that = this;
okUtils.ajaxCloud({
url:"/sys/org/select",
success : function(result) {
that.orgList = result.msg;
}
});
},
listParkManage : function() {
var that = this;
okUtils.ajaxCloud({
url:"/car/parkManage/select",
param : {'orgId':vm.entity.orgId},
success : function(result) {
that.parkManageList = result.msg;
}
});
},
reload : function(){
vm.entity.pageSize = 10;
vm.entity.pageNo = 1;
vm.entity.description = '';
vm.entity.orgId = null;
vm.entity.parkManageId = null;
this.load();
},
changePage : function(pageNo) {
vm.entity.pageNo = pageNo;
vm.load();
},
changePageSize : function(pageSize) {
vm.entity.pageSize = pageSize;
vm.load();
},
edit : function(entity) {
okUtils.dialogOpen({
title: '修改',
url: "car/carManage/form.html",
scroll : true,
width: '50%',
height: '95%',
success : function(dialog) {
dialog.vm.entity.id = entity.id;
dialog.vm.load();
},
yes : function(dialog) {
dialog.vm.acceptClick(vm);
}
});
},
add:function(){
okUtils.dialogOpen({
title: '新增',
url: "car/carManage/form.html",
scroll : true,
width: '50%',
height: '95%',
success : function(dialog) {
dialog.vm.load();
},
yes : function(dialog) {
dialog.vm.acceptClick(vm);
}
});
},
remove:function(entity) {
okLayer.confirm("确定要删除吗?", function () {
okUtils.ajaxCloud({
url:"/car/manage/delete",
param : {id: entity.id},
success : function(result) {
okLayer.msg.greenTick(result.msg);
vm.load();
}
});
})
}
},
created: function() {
this.load()
this.listOrg();
}
})
});
</script>
</body>
</html>
Loading…
Cancel
Save