7个文件已修改
6个文件已添加
253 ■■■■■ 已修改文件
src/main/java/com/boying/controller/BarrierController.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/BarrierOpenLogController.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/OutParkController.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/ParkController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/phone/YCPayController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/entity/BarrierOpenLog.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/entity/EnterPark.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/entity/vo/BarrierVo.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/mapper/BarrierOpenLogMapper.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/service/BarrierOpenLogService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/service/OutParkService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/service/impl/BarrierOpenLogServiceImpl.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/service/impl/OutParkServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/BarrierController.java
@@ -5,7 +5,9 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.boying.common.R;
import com.boying.entity.Barrier;
import com.boying.entity.BarrierOpenLog;
import com.boying.entity.OutPark;
import com.boying.service.BarrierOpenLogService;
import com.boying.service.BarrierService;
import com.boying.service.OutParkService;
import com.boying.service.ParkService;
@@ -28,6 +30,7 @@
public class BarrierController {
    private final BarrierService barrierService;
    private final BarrierOpenLogService barrierOpenLogService;
    private final OutParkService outParkService;
    private final ParkService parkService;
    private StringRedisTemplate redisTemplate;
@@ -113,7 +116,7 @@
    @PostMapping("openBarrier")
    public Object openBarrier(Long barrierId,Integer type) {
    public Object openBarrier(Long barrierId,Integer type,String carNo,String remark) {
        Barrier b=  barrierService.getById(barrierId);
        if (b==null) {
            return R.failed("未找到该道闸");
@@ -127,6 +130,12 @@
               try {
                   String jsonValue = JSON.toJSONString(b);
                   redisTemplate.opsForValue().set("barrier-"+b.getCode(), jsonValue);
                   BarrierOpenLog barrierOpenLog = new BarrierOpenLog();
                   barrierOpenLog.setCarNo(carNo);
                   barrierOpenLog.setRemark(remark);
                   barrierOpenLog.setParkId(b.getParkId());
                   barrierOpenLog.setType(b.getType());
                   barrierOpenLogService.save(barrierOpenLog);
               } catch (Exception e) {
                   e.printStackTrace();
               }
@@ -148,6 +157,12 @@
                   try {
                       String jsonValue = JSON.toJSONString(b);
                       redisTemplate.opsForValue().set("barrier-"+b.getCode(), jsonValue);
                       BarrierOpenLog barrierOpenLog = new BarrierOpenLog();
                       barrierOpenLog.setCarNo(carNo);
                       barrierOpenLog.setRemark(remark);
                       barrierOpenLog.setParkId(b.getParkId());
                       barrierOpenLog.setType(b.getType());
                       barrierOpenLogService.save(barrierOpenLog);
                   } catch (Exception e) {
                       e.printStackTrace();
                   }
@@ -160,6 +175,12 @@
                   try {
                       String jsonValue = JSON.toJSONString(b);
                       redisTemplate.opsForValue().set("barrier-"+b.getCode(), jsonValue);
                       BarrierOpenLog barrierOpenLog = new BarrierOpenLog();
                       barrierOpenLog.setCarNo(carNo);
                       barrierOpenLog.setRemark(remark);
                       barrierOpenLog.setParkId(b.getParkId());
                       barrierOpenLog.setType(b.getType());
                       barrierOpenLogService.save(barrierOpenLog);
                   } catch (Exception e) {
                       e.printStackTrace();
                   }
src/main/java/com/boying/controller/BarrierOpenLogController.java
New file
@@ -0,0 +1,43 @@
package com.boying.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.boying.common.R;
import com.boying.entity.Barrier;
import com.boying.entity.BarrierOpenLog;
import com.boying.entity.OutPark;
import com.boying.service.BarrierOpenLogService;
import com.boying.service.BarrierService;
import com.boying.service.OutParkService;
import com.boying.service.ParkService;
import lombok.RequiredArgsConstructor;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.List;
@RestController
@RequestMapping("ffzf/barrierOpenLog")
@RequiredArgsConstructor
public class BarrierOpenLogController {
    private final BarrierOpenLogService barrierOpenLogService;
    @PostMapping("findPage")
    public Object findPage(Page page, Integer parkId,String carNo) {
        QueryWrapper<BarrierOpenLog> wrapper = new QueryWrapper<>();
        wrapper.lambda()
                .eq(parkId != null,BarrierOpenLog::getParkId,parkId)
                .eq(StringUtils.isNotBlank(carNo),BarrierOpenLog::getCarNo,carNo);
        Page page1 = barrierOpenLogService.page(page, wrapper);
        return R.ok(page1);
    }
}
src/main/java/com/boying/controller/OutParkController.java
@@ -332,10 +332,34 @@
        enterPark.setParkId(parkId);
        enterPark.setBarrierId(list.get(0).getId());
        enterPark.setStatus(0);
        enterPark.setIsAdd(1);
        enterPark.setIsPay(0);
        enterPark.setImgId(null);
        enterParkService.saveOrUpdate(enterPark);
        return R.ok("修改成功");
        OutPark outPark = null;
        QueryWrapper<OutPark> wrapper1 = new QueryWrapper<>();
        wrapper1.lambda()
                .eq(OutPark::getParkId,parkId)
                .eq(OutPark::getCarNo,carNo)
                .ge(OutPark::getCreateTime,enterPark.getCreateTime())
                .ne(OutPark::getStatus,1);
        List<OutPark> list1 = outParkService.list(wrapper1);
        if(list1 !=null&&list1.size()>0){
            outPark  = list1.get(0);
            outPark.setEnterTime(enterPark.getCreateTime());
            long l = outPark.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli() - enterPark.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli();
            outPark.setTime(l/(1000*60));
            try {
                outPark.setPrice(costRuleService.getMoney(parkId, outPark.getEnterTime(), outPark.getCreateTime(), 1));
            }catch (Exception e){
                e.printStackTrace();
            }
            outParkService.saveOrUpdate(outPark);
            return R.ok(null,"修改出场记录成功");
        }else {
            return R.ok(null,"新增入场记录成功");
        }
    }
src/main/java/com/boying/controller/ParkController.java
@@ -113,7 +113,7 @@
            Park byId1 = parkService.getById(id);
            String num = redisTemplate.opsForValue().get("car_park_" +  byId1.getId());
            try {
                if(StringUtils.isNotBlank(num)){
                if(StringUtils.isBlank(num)){
                    num = "0";
                }
                byId1.setCarNum(Integer.parseInt(num));
src/main/java/com/boying/controller/phone/YCPayController.java
@@ -164,7 +164,7 @@
            return R.ok(1,"订单已提交支付请求");
        }
        if(StringUtils.isBlank(outPark.getPayCode())){
            OutPark by10min = outParkService.findBy10min(outPark.getCarNo(), outPark.getParkId(), outPark.getCreateTime());
            OutPark by10min = outParkService.findBy10min(outPark.getCarNo(), outPark.getParkId(), outPark.getCreateTime(),outPark.getId());
            if(by10min !=null){
                return R.ok(1,"订单已提交支付请求");
            }else {
src/main/java/com/boying/entity/BarrierOpenLog.java
New file
@@ -0,0 +1,50 @@
package com.boying.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.boying.common.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Transient;
/**
 * @author kdq
 * @version 1.0.0
 * @ClassName BarrierOpenLog.java
 * @Description TODO
 * @createTime 2024年04月09日 10:26:00
 */
@Data
@TableName("barrier_open_log")
@javax.persistence.Table(name = "barrier_open_log")
@Entity
@org.hibernate.annotations.Table(appliesTo = "barrier_open_log", comment = "手动开闸日志表")
@ApiModel(value = "手动开闸日志表")
public class BarrierOpenLog extends BaseEntity<Barrier> {
    @ApiModelProperty(value = "停车场id")
    @Column(columnDefinition = "int comment '停车场id'")
    private Integer parkId;
    @ApiModelProperty(value = "出入")
    @Column(columnDefinition = "int comment '出入 0/出 1/入'")
    private int type;
    @ApiModelProperty(value = "车牌号")
    @Column(columnDefinition = "varchar(100) comment '车牌号'")
    private String carNo;
    @ApiModelProperty(value = "备注")
    @Column(columnDefinition = "varchar(100) comment '备注'")
    private String remark;
    @Transient
    @TableField(exist = false)
    private String parkName;
}
src/main/java/com/boying/entity/EnterPark.java
@@ -51,6 +51,10 @@
    @Column(columnDefinition = "int comment '是否支付'")
    private Integer isPay;
    @ApiModelProperty(value = "是否接口新增")
    @Column(columnDefinition = "int comment '是否接口新增'")
    private Integer isAdd;
    private double price;
src/main/java/com/boying/entity/vo/BarrierVo.java
New file
@@ -0,0 +1,26 @@
package com.boying.entity.vo;
import com.boying.common.BaseEntity;
import com.boying.entity.Barrier;
import com.boying.entity.BarrierOpenLog;
import io.swagger.annotations.ApiModelProperty;
import javax.persistence.Column;
/**
 * @author kdq
 * @version 1.0.0
 * @ClassName BarrierVo.java
 * @Description TODO
 * @createTime 2024年04月09日 14:37:00
 */
public class BarrierVo extends BarrierOpenLog {
    private String code;
    private String code2;
    private int status;
    private int type2;
}
src/main/java/com/boying/mapper/BarrierOpenLogMapper.java
New file
@@ -0,0 +1,17 @@
package com.boying.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.boying.entity.Barrier;
import com.boying.entity.BarrierOpenLog;
import org.apache.ibatis.annotations.Mapper;
/**
 * @author kdq
 * @version 1.0.0
 * @ClassName BarrierMapper.java
 * @Description TODO
 * @createTime 2022年11月20日 22:26:00
 */
@Mapper
public interface BarrierOpenLogMapper extends BaseMapper<BarrierOpenLog> {
}
src/main/java/com/boying/service/BarrierOpenLogService.java
New file
@@ -0,0 +1,15 @@
package com.boying.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.boying.entity.Barrier;
import com.boying.entity.BarrierOpenLog;
/**
 * @author kdq
 * @version 1.0.0
 * @ClassName BarrierService.java
 * @Description TODO
 * @createTime 2022年11月20日 22:25:00
 */
public interface BarrierOpenLogService extends IService<BarrierOpenLog> {
}
src/main/java/com/boying/service/OutParkService.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.boying.entity.OutPark;
import com.boying.entity.Statistic;
import io.swagger.models.auth.In;
import java.time.LocalDateTime;
import java.util.List;
@@ -43,8 +44,8 @@
    OutPark findByOrderId(String txnOrderId);
    OutPark findBy5min(String carNo, Integer parkId, LocalDateTime dateTime);
    OutPark findBy10min(String carNo, Integer parkId, LocalDateTime dateTime);
    OutPark findBy5min2(String carNo, Integer parkId, LocalDateTime dateTime);
    OutPark findBy10min(String carNo, Integer parkId, LocalDateTime dateTime, Integer outParkId);
}
src/main/java/com/boying/service/impl/BarrierOpenLogServiceImpl.java
New file
@@ -0,0 +1,37 @@
package com.boying.service.impl;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.boying.entity.Barrier;
import com.boying.entity.BarrierOpenLog;
import com.boying.entity.EnterPark;
import com.boying.entity.OutPark;
import com.boying.mapper.*;
import com.boying.service.BarrierOpenLogService;
import com.boying.service.BarrierService;
import com.boying.util.StringUtil;
import lombok.AllArgsConstructor;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import java.time.ZoneId;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
 * @author kdq
 * @version 1.0.0
 * @ClassName BarrierServiceImpl.java
 * @Description TODO
 * @createTime 2022年11月20日 22:25:00
 */
@Service
@AllArgsConstructor
public class BarrierOpenLogServiceImpl extends ServiceImpl<BarrierOpenLogMapper, BarrierOpenLog> implements BarrierOpenLogService {
}
src/main/java/com/boying/service/impl/OutParkServiceImpl.java
@@ -213,7 +213,7 @@
        return null;
    }
    @Override
    public OutPark findBy10min(String carNo, Integer parkId,LocalDateTime dateTime) {
    public OutPark findBy10min(String carNo, Integer parkId,LocalDateTime dateTime,Integer outParkId) {
        LocalDateTime localDateTime = dateTime.minusMinutes(10);
        QueryWrapper<OutPark> wrapper = new QueryWrapper<>();
        wrapper.lambda()
@@ -221,6 +221,7 @@
                .eq(OutPark::getParkId,parkId)
                .ge(OutPark::getCreateTime,localDateTime)
                .ge(OutPark::getPrice,0)
                .ne(OutPark::getId,outParkId)
                .isNotNull(OutPark::getPayCode)
                .isNotNull(OutPark::getEnterTime);
        List<OutPark> outParks = outParkMapper.selectList(wrapper);