新增自动下线逻辑
This commit is contained in:
parent
00f9642f2b
commit
3ba58dc671
|
|
@ -55,6 +55,9 @@ public class InitLoadDataService extends ApplicationAvailabilityBean {
|
|||
@Resource
|
||||
private CouponsRepository couponsRepository;
|
||||
|
||||
@Resource
|
||||
private CarConfigRepository carConfigRepository;
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(AvailabilityChangeEvent<?> event) {
|
||||
super.onApplicationEvent(event);
|
||||
|
|
@ -116,7 +119,25 @@ public class InitLoadDataService extends ApplicationAvailabilityBean {
|
|||
coupons.setStatus(StatusEnum.DELETE.getCode());
|
||||
}
|
||||
couponsRepository.saveAllAndFlush(couponsList);
|
||||
List<CarConfig> carConfigs = carConfigRepository.findAll();
|
||||
for (CarConfig carConfig : carConfigs) {
|
||||
if (carConfig.getStartDownTime() == null && carConfig.getEndDownTime() == null
|
||||
&& CAR_MAP.get(carConfig.getCarId()).getCarStatus() == 2) {
|
||||
Car car = CAR_MAP.get(carConfig.getCarId());
|
||||
car.setCarStatus(1);
|
||||
carRepository.save(car);
|
||||
} else if (System.currentTimeMillis() >= carConfig.getStartDownTime().getTime() && System.currentTimeMillis() < carConfig.getEndDownTime().getTime()
|
||||
&& CAR_MAP.get(carConfig.getCarId()).getCarStatus() == 1) {
|
||||
Car car = CAR_MAP.get(carConfig.getCarId());
|
||||
car.setCarStatus(2);
|
||||
carRepository.save(car);
|
||||
} else if (System.currentTimeMillis() >= carConfig.getEndDownTime().getTime()
|
||||
&& CAR_MAP.get(carConfig.getCarId()).getCarStatus() == 2) {
|
||||
Car car = CAR_MAP.get(carConfig.getCarId());
|
||||
car.setCarStatus(1);
|
||||
carRepository.save(car);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.linln.admin.orders.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.linln.admin.orders.domain.Car;
|
||||
import com.linln.admin.orders.domain.CarConfig;
|
||||
import com.linln.admin.orders.domain.CarUser;
|
||||
import com.linln.admin.orders.domain.OrderMain;
|
||||
import com.linln.admin.orders.service.CarService;
|
||||
|
|
@ -54,6 +56,12 @@ public class CarController {
|
|||
// 获取数据列表
|
||||
Example<Car> example = Example.of(car, matcher);
|
||||
Page<Car> list = carService.getPageList(example);
|
||||
for (Car car1 : list) {
|
||||
CarConfig carConfig = carService.getCarConfig(car1.getId());
|
||||
if (carConfig != null) {
|
||||
car1.setInfo(DateUtil.formatDateTime(carConfig.getStartDownTime()) + " ~ " + DateUtil.formatDateTime(carConfig.getEndDownTime()) );
|
||||
}
|
||||
}
|
||||
|
||||
// 封装数据
|
||||
model.addAttribute("list", list.getContent());
|
||||
|
|
@ -91,6 +99,22 @@ public class CarController {
|
|||
return "/orders/car/toAddCarUserInfos";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转添加信息页面
|
||||
*/
|
||||
@GetMapping("/toCarDownInfos/{id}")
|
||||
@RequiresPermissions("orders:car:edit")
|
||||
public String toCarDownInfos(@PathVariable("id") Car car, Model model) {
|
||||
car = carService.getById(car.getId());
|
||||
CarConfig carConfig = carService.getCarConfig(car.getId());
|
||||
if (carConfig != null) {
|
||||
car.setStartDownTime(DateUtil.formatDateTime(carConfig.getStartDownTime()));
|
||||
car.setEndDownTime(DateUtil.formatDateTime(carConfig.getEndDownTime()));
|
||||
}
|
||||
model.addAttribute("car", car);
|
||||
return "/orders/car/toCarDownInfos";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转添加信息页面
|
||||
*/
|
||||
|
|
@ -137,6 +161,16 @@ public class CarController {
|
|||
carService.saveCarUser(carUser);
|
||||
return ResultVoUtil.SAVE_SUCCESS;
|
||||
}
|
||||
/**
|
||||
* 保存添加/修改的数据
|
||||
*/
|
||||
@PostMapping("/saveCarDownInfo")
|
||||
@RequiresPermissions({"orders:car:add", "orders:car:edit"})
|
||||
@ResponseBody
|
||||
public ResultVo saveCarDownInfo(Car car) {
|
||||
carService.saveCarDownInfo(car);
|
||||
return ResultVoUtil.SAVE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存添加/修改的数据
|
||||
|
|
|
|||
|
|
@ -0,0 +1,111 @@
|
|||
package com.linln.admin.orders.controller;
|
||||
|
||||
import com.linln.admin.orders.domain.RechargeInfos;
|
||||
import com.linln.admin.orders.service.RechargeService;
|
||||
import com.linln.admin.orders.validator.RechargeValid;
|
||||
import com.linln.common.enums.StatusEnum;
|
||||
import com.linln.common.utils.EntityBeanUtil;
|
||||
import com.linln.common.utils.ResultVoUtil;
|
||||
import com.linln.common.utils.StatusUtil;
|
||||
import com.linln.common.vo.ResultVo;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.data.domain.ExampleMatcher;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author gion
|
||||
* @date 2024/08/14
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/orders/recharge")
|
||||
public class RechargeController {
|
||||
|
||||
@Resource
|
||||
private RechargeService rechargeService;
|
||||
|
||||
/**
|
||||
* 列表页面
|
||||
*/
|
||||
@GetMapping("/index")
|
||||
@RequiresPermissions("orders:recharge:index")
|
||||
public String index(Model model, RechargeInfos rechargeInfos) {
|
||||
|
||||
// 创建匹配器,进行动态查询匹配
|
||||
ExampleMatcher matcher = ExampleMatcher.matching();
|
||||
|
||||
// 获取数据列表
|
||||
Example<RechargeInfos> example = Example.of(rechargeInfos, matcher);
|
||||
Page<RechargeInfos> list = rechargeService.getPageList(example);
|
||||
|
||||
// 封装数据
|
||||
model.addAttribute("list", list.getContent());
|
||||
model.addAttribute("page", list);
|
||||
return "/orders/recharge/index";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到添加页面
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
@RequiresPermissions("orders:recharge:add")
|
||||
public String toAdd() {
|
||||
return "/orders/recharge/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到编辑页面
|
||||
*/
|
||||
@GetMapping("/edit/{id}")
|
||||
@RequiresPermissions("orders:recharge:edit")
|
||||
public String toEdit(@PathVariable("id") RechargeInfos rechargeInfos, Model model) {
|
||||
model.addAttribute("recharge", rechargeInfos);
|
||||
return "/orders/recharge/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存添加/修改的数据
|
||||
* @param valid 验证对象
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
@RequiresPermissions({"orders:recharge:add", "orders:recharge:edit"})
|
||||
@ResponseBody
|
||||
public ResultVo save(@Validated RechargeValid valid, RechargeInfos rechargeInfos) {
|
||||
// 复制保留无需修改的数据
|
||||
if (rechargeInfos.getId() != null) {
|
||||
RechargeInfos beRechargeInfos = rechargeService.getById(rechargeInfos.getId());
|
||||
EntityBeanUtil.copyProperties(beRechargeInfos, rechargeInfos);
|
||||
}
|
||||
rechargeInfos.setCreateTime(new Date());
|
||||
rechargeInfos.setUpdateTime(new Date());
|
||||
// 保存数据
|
||||
rechargeService.save(rechargeInfos);
|
||||
return ResultVoUtil.SAVE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置一条或者多条数据的状态
|
||||
*/
|
||||
@RequestMapping("/status/{param}")
|
||||
@RequiresPermissions("orders:recharge:status")
|
||||
@ResponseBody
|
||||
public ResultVo status(
|
||||
@PathVariable("param") String param,
|
||||
@RequestParam(value = "ids", required = false) List<Long> ids) {
|
||||
// 更新状态
|
||||
StatusEnum statusEnum = StatusUtil.getStatusEnum(param);
|
||||
if (rechargeService.updateStatus(statusEnum, ids)) {
|
||||
return ResultVoUtil.success(statusEnum.getMessage() + "成功");
|
||||
} else {
|
||||
return ResultVoUtil.error(statusEnum.getMessage() + "失败,请重新操作");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -43,6 +43,21 @@ public class Car implements Serializable {
|
|||
// 数据状态
|
||||
private Byte status = StatusEnum.OK.getCode();
|
||||
|
||||
//车辆状态 1在线 2下线
|
||||
private Integer carStatus;
|
||||
|
||||
@Transient
|
||||
private String info;
|
||||
|
||||
|
||||
@Transient
|
||||
private String startDownTime;
|
||||
|
||||
@Transient
|
||||
private String endDownTime;
|
||||
|
||||
|
||||
|
||||
//护理人员列表
|
||||
@Transient
|
||||
private List<Users> users;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
package com.linln.admin.orders.domain;
|
||||
|
||||
import com.linln.common.enums.StatusEnum;
|
||||
import com.linln.common.utils.StatusUtil;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.Where;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.annotation.LastModifiedDate;
|
||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author gion
|
||||
* @date 2024/04/29
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name="car_config")
|
||||
@EntityListeners(AuditingEntityListener.class)
|
||||
@Where(clause = StatusUtil.NOT_DELETE)
|
||||
public class CarConfig implements Serializable {
|
||||
// 主键ID
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
// 车牌号
|
||||
private Long carId;
|
||||
// 开始下线时间
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date startDownTime;
|
||||
// 结束下线时间
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date endDownTime;
|
||||
@CreatedDate
|
||||
private Date createDate;
|
||||
@LastModifiedDate
|
||||
private Date updateDate;
|
||||
// 数据状态
|
||||
private Byte status = StatusEnum.OK.getCode();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.linln.admin.orders.domain;
|
||||
|
||||
import com.linln.common.enums.StatusEnum;
|
||||
import com.linln.common.utils.StatusUtil;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.Where;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.annotation.LastModifiedDate;
|
||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author gion
|
||||
* @date 2024/04/29
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name="recharge_infos")
|
||||
@EntityListeners(AuditingEntityListener.class)
|
||||
@Where(clause = StatusUtil.NOT_DELETE)
|
||||
public class RechargeInfos implements Serializable {
|
||||
// 主键ID
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
//名称
|
||||
private String name;
|
||||
//描述
|
||||
@Column(name = "`desc`")
|
||||
private String desc;
|
||||
//支付金额
|
||||
private String price;
|
||||
//赠送金额
|
||||
private String givePrice;
|
||||
//类型 1储值 2押金
|
||||
private Integer type;
|
||||
//赠送描述
|
||||
private String give;
|
||||
//到账金额
|
||||
private String rechargePrice;
|
||||
|
||||
// 订单创建时间
|
||||
@CreatedDate
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
@CreatedDate
|
||||
private Date createDate;
|
||||
@LastModifiedDate
|
||||
private Date updateDate;
|
||||
// 数据状态
|
||||
private Byte status = StatusEnum.OK.getCode();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.linln.admin.orders.repository;
|
||||
|
||||
import com.linln.admin.orders.domain.CarConfig;
|
||||
import com.linln.modules.system.repository.BaseRepository;
|
||||
|
||||
/**
|
||||
* @author gion
|
||||
* @date 2024/04/29
|
||||
*/
|
||||
public interface CarConfigRepository extends BaseRepository<CarConfig, Long> {
|
||||
|
||||
CarConfig findFirstByCarId(Long carId);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.linln.admin.orders.repository;
|
||||
|
||||
import com.linln.admin.orders.domain.RechargeInfos;
|
||||
import com.linln.modules.system.repository.BaseRepository;
|
||||
|
||||
/**
|
||||
* @author gion
|
||||
* @date 2024/04/29
|
||||
*/
|
||||
public interface RechargeInfosRepository extends BaseRepository<RechargeInfos, Long> {
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.linln.admin.orders.service;
|
||||
|
||||
import com.linln.admin.orders.domain.Car;
|
||||
import com.linln.admin.orders.domain.CarConfig;
|
||||
import com.linln.admin.orders.domain.CarUser;
|
||||
import com.linln.admin.users.domain.Users;
|
||||
import com.linln.common.enums.StatusEnum;
|
||||
|
|
@ -46,4 +47,8 @@ public interface CarService {
|
|||
void delCarUser(long carId, long uid);
|
||||
|
||||
void saveCarUser(CarUser carUser);
|
||||
|
||||
void saveCarDownInfo(Car car);
|
||||
|
||||
CarConfig getCarConfig(Long id);
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.linln.admin.orders.service;
|
||||
|
||||
import com.linln.admin.orders.domain.RechargeInfos;
|
||||
import com.linln.common.enums.StatusEnum;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author gion
|
||||
* @date 2024/08/14
|
||||
*/
|
||||
public interface RechargeService {
|
||||
|
||||
/**
|
||||
* 获取分页列表数据
|
||||
* @param example 查询实例
|
||||
* @return 返回分页数据
|
||||
*/
|
||||
Page<RechargeInfos> getPageList(Example<RechargeInfos> example);
|
||||
|
||||
/**
|
||||
* 根据ID查询数据
|
||||
* @param id 主键ID
|
||||
*/
|
||||
RechargeInfos getById(Long id);
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
* @param coupons 实体对象
|
||||
*/
|
||||
RechargeInfos save(RechargeInfos coupons);
|
||||
|
||||
/**
|
||||
* 状态(启用,冻结,删除)/批量状态处理
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
Boolean updateStatus(StatusEnum statusEnum, List<Long> idList);
|
||||
}
|
||||
|
|
@ -1,7 +1,11 @@
|
|||
package com.linln.admin.orders.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.linln.admin.orders.domain.Car;
|
||||
import com.linln.admin.orders.domain.CarConfig;
|
||||
import com.linln.admin.orders.domain.CarUser;
|
||||
import com.linln.admin.orders.repository.CarConfigRepository;
|
||||
import com.linln.admin.orders.repository.CarRepository;
|
||||
import com.linln.admin.orders.repository.CarUserRepository;
|
||||
import com.linln.admin.orders.service.CarService;
|
||||
|
|
@ -17,6 +21,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -36,6 +41,9 @@ public class CarServiceImpl implements CarService {
|
|||
@Resource
|
||||
private UsersRepository usersRepository;
|
||||
|
||||
@Resource
|
||||
private CarConfigRepository carConfigRepository;
|
||||
|
||||
/**
|
||||
* 根据ID查询数据
|
||||
* @param id 主键ID
|
||||
|
|
@ -99,4 +107,40 @@ public class CarServiceImpl implements CarService {
|
|||
public void saveCarUser(CarUser carUser) {
|
||||
carUserRepository.save(carUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarConfig getCarConfig(Long id) {
|
||||
return carConfigRepository.findFirstByCarId(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveCarDownInfo(Car car) {
|
||||
CarConfig carConfig = carConfigRepository.findFirstByCarId(car.getId());
|
||||
if (carConfig == null) {
|
||||
carConfig = new CarConfig();
|
||||
carConfig.setStatus((byte) 1);
|
||||
if (StrUtil.isNotBlank(car.getStartDownTime())) {
|
||||
carConfig.setStartDownTime(DateUtil.parse(car.getStartDownTime()));
|
||||
}
|
||||
if (StrUtil.isNotBlank(car.getEndDownTime())) {
|
||||
carConfig.setEndDownTime(DateUtil.parse(car.getEndDownTime()));
|
||||
}
|
||||
carConfig.setCarId(car.getId());
|
||||
carConfig.setCreateDate(new Date());
|
||||
carConfig.setUpdateDate(new Date());
|
||||
} else {
|
||||
if (StrUtil.isNotBlank(car.getStartDownTime())) {
|
||||
carConfig.setStartDownTime(DateUtil.parse(car.getStartDownTime()));
|
||||
} else {
|
||||
carConfig.setStartDownTime(null);
|
||||
}
|
||||
if (StrUtil.isNotBlank(car.getEndDownTime())) {
|
||||
carConfig.setEndDownTime(DateUtil.parse(car.getEndDownTime()));
|
||||
} else {
|
||||
carConfig.setStartDownTime(null);
|
||||
}
|
||||
carConfig.setUpdateDate(new Date());
|
||||
}
|
||||
carConfigRepository.save(carConfig);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
package com.linln.admin.orders.service.impl;
|
||||
|
||||
import com.linln.admin.orders.domain.RechargeInfos;
|
||||
import com.linln.admin.orders.repository.RechargeInfosRepository;
|
||||
import com.linln.admin.orders.service.RechargeService;
|
||||
import com.linln.common.data.PageSort;
|
||||
import com.linln.common.enums.StatusEnum;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author gion
|
||||
* @date 2024/08/14
|
||||
*/
|
||||
@Service
|
||||
public class RechargeServiceImpl implements RechargeService {
|
||||
|
||||
@Resource
|
||||
private RechargeInfosRepository rechargeInfosRepository;
|
||||
|
||||
/**
|
||||
* 根据ID查询数据
|
||||
* @param id 主键ID
|
||||
*/
|
||||
@Override
|
||||
public RechargeInfos getById(Long id) {
|
||||
return rechargeInfosRepository.findById(id).orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页列表数据
|
||||
* @param example 查询实例
|
||||
* @return 返回分页数据
|
||||
*/
|
||||
@Override
|
||||
public Page<RechargeInfos> getPageList(Example<RechargeInfos> example) {
|
||||
// 创建分页对象
|
||||
PageRequest page = PageSort.pageRequest("createTime", Sort.Direction.DESC);
|
||||
return rechargeInfosRepository.findAll(example, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
* @param rechargeInfos 实体对象
|
||||
*/
|
||||
@Override
|
||||
public RechargeInfos save(RechargeInfos rechargeInfos) {
|
||||
return rechargeInfosRepository.save(rechargeInfos);
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态(启用,冻结,删除)/批量状态处理
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateStatus(StatusEnum statusEnum, List<Long> idList) {
|
||||
return rechargeInfosRepository.updateStatus(statusEnum.getCode(), idList) > 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.linln.admin.orders.validator;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author gion
|
||||
* @date 2024/08/14
|
||||
*/
|
||||
@Data
|
||||
public class RechargeValid implements Serializable {
|
||||
@NotEmpty(message = "充值活动名称不能为空")
|
||||
private String name;
|
||||
@NotEmpty(message = "充值活动描述不能为空")
|
||||
private String desc;
|
||||
@NotEmpty(message = "支付金额不能为空")
|
||||
private String price;
|
||||
@NotEmpty(message = "到账金额不能为空")
|
||||
private String rechargePrice;
|
||||
}
|
||||
|
|
@ -53,9 +53,12 @@
|
|||
</th>
|
||||
<th>主键ID</th>
|
||||
<th>车牌号</th>
|
||||
<th>车辆状态</th>
|
||||
<th>下线时间段</th>
|
||||
<th>护理人员信息</th>
|
||||
<th>车辆排单列表</th>
|
||||
<th>添加护理人员</th>
|
||||
<th>车辆下线设置</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
@ -65,6 +68,9 @@
|
|||
<i class="layui-icon layui-icon-ok"></i></label></td>
|
||||
<td th:text="${item.id}">主键ID</td>
|
||||
<td th:text="${item.carNo}">车牌号</td>
|
||||
<td th:if="${item.carStatus == 1 || item.carStatus == null}">上线</td>
|
||||
<td th:if="${item.carStatus == 2}">下线</td>
|
||||
<td th:text="${item.info}">下线时间段</td>
|
||||
<td>
|
||||
<a class="open-popup" data-title="护理人员信息" th:attr="data-url=@{'/orders/car/toCarUserInfos/'+${item.id}}" data-size="auto" href="#">护理人员信息</a>
|
||||
</td>
|
||||
|
|
@ -75,6 +81,9 @@
|
|||
<a class="open-popup" data-title="添加护理人员" th:attr="data-url=@{'/orders/car/toAddCarUserInfos/'+${item.id}}" data-size="auto" href="#">添加护理人员</a>
|
||||
</td>
|
||||
<td>
|
||||
<a class="open-popup" data-title="车辆下线管理" th:attr="data-url=@{'/orders/car/toCarDownInfos/'+${item.id}}" data-size="auto" href="#">车辆下线管理</a>
|
||||
</td>
|
||||
<td>
|
||||
<!-- <a class="open-popup" data-title="设置区域服务时间" th:attr="data-url=@{'/orders/car/toUpdateAreaTime/'+${item.id}}" data-size="auto" href="#">设置区域服务时间</a>-->
|
||||
<a class="open-popup" data-title="编辑车辆" th:attr="data-url=@{'/orders/car/edit/'+${item.id}}" data-size="auto" href="#">编辑</a>
|
||||
<a class="open-popup" data-title="详细信息" th:attr="data-url=@{'/orders/car/detail/'+${item.id}}" data-size="800,600" href="#">详细</a>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-form timo-compile">
|
||||
<form th:action="@{/orders/car/saveCarDownInfo}">
|
||||
<input type="hidden" name="id" th:if="${car}" th:value="${car.id}">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">车牌号</label>
|
||||
<div class="layui-input-inline">
|
||||
<input class="layui-input" type="text" name="carNo" readonly th:value="${car?.carNo}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">下线开始时间</label>
|
||||
<div class="layui-input-inline">
|
||||
<input class="layui-input" type="text" id="startDownTime" name="startDownTime" placeholder="请输入下线开始时间" th:value="${car?.startDownTime}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">下线结束时间</label>
|
||||
<div class="layui-input-inline">
|
||||
<input class="layui-input" type="text" id="endDownTime" name="endDownTime" placeholder="请输入下线结束时间" th:value="${car?.endDownTime}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item timo-finally">
|
||||
<button class="layui-btn ajax-submit"><i class="fa fa-check-circle"></i> 保存</button>
|
||||
<button class="layui-btn btn-secondary close-popup"><i class="fa fa-times-circle"></i> 关闭</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script th:replace="/common/template :: script"></script>
|
||||
<script>
|
||||
layui.use(['laydate'], function () {
|
||||
var laydate = layui.laydate;
|
||||
// 渲染
|
||||
laydate.render({
|
||||
elem: '#startDownTime',
|
||||
type: 'datetime'
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#endDownTime',
|
||||
type: 'datetime'
|
||||
});
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-form timo-compile">
|
||||
<form th:action="@{/orders/recharge/save}">
|
||||
<input type="hidden" name="id" th:if="${recharge}" th:value="${recharge.id}">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">充值活动名称</label>
|
||||
<div class="layui-input-inline">
|
||||
<input class="layui-input" type="text" name="name" placeholder="请输入充值活动名称" th:value="${recharge?.name}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">充值活动描述</label>
|
||||
<div class="layui-input-inline">
|
||||
<input class="layui-input" type="text" name="desc" placeholder="请输入充值活动描述" th:value="${recharge?.desc}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">支付金额</label>
|
||||
<div class="layui-input-inline">
|
||||
<input class="layui-input" type="text" name="price" placeholder="请输入支付金额" th:value="${recharge?.price}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">赠送金额</label>
|
||||
<div class="layui-input-inline">
|
||||
<input class="layui-input" type="text" value="0" name="givePrice" placeholder="请输入赠送金额" th:value="${recharge?.givePrice}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">充值到账金额</label>
|
||||
<div class="layui-input-inline">
|
||||
<input class="layui-input" type="text" name="rechargePrice" placeholder="请输入充值到账金额" th:value="${recharge?.rechargePrice}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">充值类型</label>
|
||||
<div class="layui-input-inline">
|
||||
<select class="timo-search-select" name="type" mo:dict="RECHARGE_TYPE" mo-selected="${recharge?.type}"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">赠送描述</label>
|
||||
<div class="layui-input-inline">
|
||||
<input class="layui-input" type="text" value="无" name="give" placeholder="赠送描述" th:value="${recharge?.give}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item timo-finally">
|
||||
<button class="layui-btn ajax-submit"><i class="fa fa-check-circle"></i> 保存</button>
|
||||
<button class="layui-btn btn-secondary close-popup"><i class="fa fa-times-circle"></i> 关闭</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script th:replace="/common/template :: script"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:mo="http://www.thymeleaf.org">
|
||||
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
|
||||
</head>
|
||||
<body class="timo-layout-page">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header timo-card-header">
|
||||
<span><i class="fa fa-bars"></i> 充值管理</span>
|
||||
<i class="layui-icon layui-icon-refresh refresh-btn"></i>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-row timo-card-screen">
|
||||
<div class="pull-right screen-btn-group">
|
||||
<button class="layui-btn open-popup" data-title="添加充值商品" th:attr="data-url=@{/orders/recharge/add}" data-size="auto">
|
||||
<i class="fa fa-plus"></i> 添加</button>
|
||||
<div class="btn-group">
|
||||
<button class="layui-btn">操作<span class="caret"></span></button>
|
||||
<dl class="layui-nav-child layui-anim layui-anim-upbit">
|
||||
<dd><a class="ajax-status" th:href="@{/orders/coupons/status/delete}">删除</a></dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="timo-table-wrap">
|
||||
<table class="layui-table timo-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="timo-table-checkbox">
|
||||
<label class="timo-checkbox"><input type="checkbox">
|
||||
<i class="layui-icon layui-icon-ok"></i></label>
|
||||
</th>
|
||||
<th>充值ID</th>
|
||||
<th>充值名称</th>
|
||||
<th>充值描述</th>
|
||||
<th>金额</th>
|
||||
<th>赠送金额</th>
|
||||
<th>充值到账金额</th>
|
||||
<th>类型</th>
|
||||
<th>赠送描述</th>
|
||||
<th>创建时间</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="item:${list}">
|
||||
<td><label class="timo-checkbox"><input type="checkbox" th:value="${item.id}">
|
||||
<i class="layui-icon layui-icon-ok"></i></label></td>
|
||||
<td th:text="${item.id}">充值ID</td>
|
||||
<td th:text="${item.name}">充值名称</td>
|
||||
<td th:text="${item.desc}">充值描述</td>
|
||||
<td th:text="${item.price}">金额</td>
|
||||
<td th:text="${item.givePrice}">赠送金额</td>
|
||||
<td th:text="${item.rechargePrice}">充值到账金额</td>
|
||||
<td th:text="${#dicts.rechargeType(item.type)}">类型</td>
|
||||
<td th:text="${item.give}">赠送描述</td>
|
||||
<td th:text="${item.createTime}">创建时间</td>
|
||||
<td>
|
||||
<a class="open-popup" data-title="编辑优惠券" th:attr="data-url=@{'/orders/recharge/edit/'+${item.id}}" data-size="auto" href="#">编辑</a>
|
||||
<a class="ajax-get" data-msg="您是否确认删除" th:href="@{/orders/recharge/status/delete(ids=${item.id})}">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div th:replace="/common/fragment :: page"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script th:replace="/common/template :: script"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -250,6 +250,14 @@ public class DictUtil {
|
|||
String label = "PAY_ORDER_STATUS";
|
||||
return DictUtil.keyValue(label, String.valueOf(status));
|
||||
}
|
||||
/**
|
||||
* 封装数据状态字典
|
||||
* @param status 状态
|
||||
*/
|
||||
public static String rechargeType(Byte status){
|
||||
String label = "RECHARGE_TYPE";
|
||||
return DictUtil.keyValue(label, String.valueOf(status));
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除缓存中指定的数据
|
||||
|
|
|
|||
Loading…
Reference in New Issue