kongdeqiang
2024-09-26 da9a4f7ad988c452f3a356989eaf7a6c06ae5032
fix:合并代码
25个文件已修改
2768 ■■■■ 已修改文件
src/main/java/com/boying/controller/BarrierController.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/BarrierOpenLogController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/CostRuleController.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/EnterParkController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/FileInfo2Controller.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/FileInfoController.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/LedShowController.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/OrderRecordController.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/StatisticController.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/StreetController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/TicketBlackController.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/UserController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/ViolationTypeController.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/WhiteListController.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/car/MqttSample.java 132 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/car/MqttSample2.java 138 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/car/PlateServlet2.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/car/PlateServlet3.java 2034 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/car/PushCallback.java 88 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/car/ServerMQTT.java 186 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/phone/NoticeController.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/phone/PayController.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/phone/TicketController.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/phone/UpdateAppController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/phone/YCPayController.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/BarrierController.java
@@ -13,8 +13,7 @@
import com.boying.service.OutParkService;
import com.boying.service.ParkService;
import com.boying.util.RedisJsonUtil;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.annotations.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.PostMapping;
@@ -31,7 +30,6 @@
@RestController
@RequestMapping("ffzf/barrier")
@RequiredArgsConstructor
@Tag(description = "ffzf/barrier" , name = "道闸接口" )
public class BarrierController {
    private final BarrierService barrierService;
@@ -42,7 +40,7 @@
    @PostMapping("findPage")
    @Operation(summary = "根据停车场分页查询道闸" , description = "根据停车场分页查询道闸" )
   // @Operation(summary = "根据停车场分页查询道闸" , description = "根据停车场分页查询道闸" )
    public Object findPage(Page page, String parkId) {
        QueryWrapper<Barrier> wrapper = new QueryWrapper<>();
        wrapper.lambda()
@@ -60,7 +58,7 @@
    }
    @PostMapping("save")
    @Operation(summary = "新增道闸" , description = "新增道闸" )
   // @Operation(summary = "新增道闸" , description = "新增道闸" )
    public Object save(Barrier barrier) {
        barrier.setUpdateTime(LocalDateTime.now());
        barrierService.saveOrUpdate(barrier);
@@ -74,7 +72,7 @@
    }
    @PostMapping("delete")
    @Operation(summary = "删除道闸" , description = "删除道闸" )
    //@Operation(summary = "删除道闸" , description = "删除道闸" )
    public Object delete(Integer id) {
        Barrier byId = barrierService.getById(id);
        barrierService.removeById(id);
@@ -83,7 +81,7 @@
    }
    @PostMapping("findAll")
    @Operation(summary = "查询所有道闸(APP)" , description = "查询所有道闸(APP)" )
    //@Operation(summary = "查询所有道闸(APP)" , description = "查询所有道闸(APP)" )
    public Object findAll(Long parkId) {
        if (parkId==null) {
            return R.failed("未发现该停车场");
@@ -95,7 +93,7 @@
    }
    @PostMapping("open")
    @Operation(summary = "手动开闸(废弃)" , description = "手动开闸(废弃)" )
   // @Operation(summary = "手动开闸(废弃)" , description = "手动开闸(废弃)" )
    public Object open(Long barrierId) {
        Barrier b=  barrierService.getById(barrierId);
        if (b==null) {
@@ -114,7 +112,7 @@
    }
    @PostMapping("getByCode")
    @Operation(summary = "根据code查询道闸" , description = "根据code查询道闸" )
   // @Operation(summary = "根据code查询道闸" , description = "根据code查询道闸" )
    public Object getByCode(String code) {
        Barrier b=  barrierService.findByCode2(code);
        if (b==null) {
@@ -127,7 +125,7 @@
    @PostMapping("openBarrier")
    @Operation(summary = "手持手动开闸" , description = "手持手动开闸" )
   // @Operation(summary = "手持手动开闸" , description = "手持手动开闸" )
    public Object openBarrier(Long barrierId,Integer type,String carNo,String remark) {
        Barrier b=  barrierService.getById(barrierId);
        if (b==null) {
@@ -203,7 +201,7 @@
    }
    @PostMapping("getDisConnect")
    @Operation(summary = "设备掉线通知" , description = "设备掉线通知" )
    //@Operation(summary = "设备掉线通知" , description = "设备掉线通知" )
    public Object getDisConnect() {
        List<Map<String,Object>> resultlist = new ArrayList<>();
        String barrierCodeAll = redisTemplate.opsForValue().get("barrierCode_all");
src/main/java/com/boying/controller/BarrierOpenLogController.java
@@ -13,8 +13,8 @@
import com.boying.service.BarrierService;
import com.boying.service.OutParkService;
import com.boying.service.ParkService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.annotations.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.PostMapping;
@@ -28,7 +28,6 @@
@RestController
@RequestMapping("ffzf/barrierOpenLog")
@RequiredArgsConstructor
@Tag(description = "ffzf/barrierOpenLog" , name = "手动开闸日志" )
public class BarrierOpenLogController {
    private final BarrierOpenLogService barrierOpenLogService;
@@ -36,7 +35,6 @@
    @PostMapping("findPage")
    @Operation(summary = "分页查询" , description = "分页查询" )
    public Object findPage(Page page, Integer parkId,String carNo) {
        QueryWrapper<BarrierOpenLog> wrapper = new QueryWrapper<>();
        wrapper.lambda()
src/main/java/com/boying/controller/CostRuleController.java
@@ -13,8 +13,7 @@
import com.boying.service.ParkService;
import com.boying.util.DateUtilOther;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@@ -27,21 +26,18 @@
@RestController
@RequestMapping("ffzf/rule")
@RequiredArgsConstructor
@Tag(description = "ffzf/rule" , name = "缴费规则" )
public class CostRuleController{
    private final CostRuleService costRuleService;
    private final ParkService parkService;
    @GetMapping("test")
    @Operation(summary = "测试" , description = "测试" )
    public Object save(String start,String end) throws ParseException {
        double money = costRuleService.getMoney(4, DateUtilOther.stringToLocalDate(start,null), DateUtilOther.stringToLocalDate(end, null), 1);
        return R.ok(money);
    }
    @PostMapping("/findPage")
    @Operation(summary = "分页查询" , description = "分页查询" )
    public Object findPage(Page page,CostRule costRule) {
        QueryWrapper<CostRule> wrapper = new QueryWrapper<>();
        wrapper.lambda()
@@ -56,7 +52,6 @@
        return R.ok(page1);}
    @PostMapping("/save")
    @Operation(summary = "新增规则" , description = "新增规则" )
    public Object save(CostRule costRule) {
        costRuleService.saveOrUpdate(costRule);
        return R.ok("保存成功");
@@ -64,7 +59,6 @@
    @PostMapping("/delete")
    @Operation(summary = "删除规则" , description = "删除规则" )
    public Object delete(Long id) {
        costRuleService.removeById(id);
        return R.ok("删除成功");
src/main/java/com/boying/controller/EnterParkController.java
@@ -14,8 +14,6 @@
import com.boying.service.ParkService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
@@ -35,7 +33,6 @@
@RequiredArgsConstructor
@RequestMapping("ffzf/enterpark" )
@Api(value = "enterpark", tags = "入场表管理")
@Tag(description = "ffzf/enterpark" , name = "入场表记录" )
public class EnterParkController {
    private final EnterParkService enterParkService;
@@ -68,7 +65,6 @@
//    }
    @PostMapping("/findPage")
    @Operation(summary = "分页查询" , description = "分页查询" )
    public Object findPage(Page page, String  carNo,Integer parkId,String date) throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        if(StringUtils.isNotBlank(date)){
@@ -96,7 +92,6 @@
     */
    @ApiOperation(value = "通过id查询", notes = "通过id查询")
    @GetMapping("/{id}" )
    @Operation(summary = "根据id查询" , description = "根据id查询" )
    public R getById(@PathVariable("id" ) Integer id) {
        return R.ok(enterParkService.getById(id));
    }
@@ -108,7 +103,6 @@
     */
    @ApiOperation(value = "新增入场表", notes = "新增入场表")
    @PostMapping
    @Operation(summary = "新增入场" , description = "新增入场" )
    public R save(@RequestBody EnterPark enterPark) {
        return R.ok(enterParkService.save(enterPark));
    }
@@ -120,7 +114,6 @@
     */
    @ApiOperation(value = "修改入场表", notes = "修改入场表")
    @PutMapping
    @Operation(summary = "修改入场" , description = "修改入场" )
    public R updateById(@RequestBody EnterPark enterPark) {
        return R.ok(enterParkService.updateById(enterPark));
    }
@@ -132,7 +125,6 @@
     */
    @ApiOperation(value = "通过id删除入场表", notes = "通过id删除入场表")
    @DeleteMapping("/{id}" )
    @Operation(summary = "删除入场" , description = "删除入场" )
    public R removeById(@PathVariable Integer id) {
        return R.ok(enterParkService.removeById(id));
    }
@@ -144,7 +136,6 @@
     * @return excel 文件流
     */
    @GetMapping("/export")
    @Operation(summary = "导出入场" , description = "导出入场" )
    public List<EnterPark> export(EnterPark enterPark) {
        return enterParkService.list(Wrappers.query(enterPark));
    }
src/main/java/com/boying/controller/FileInfo2Controller.java
@@ -3,8 +3,6 @@
import com.boying.entity.FileInfo;
import com.boying.service.FileInfoService;
import io.lettuce.core.dynamic.annotation.Param;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
@@ -16,7 +14,6 @@
@RestController
@RequestMapping("ffzf/fileInfo")
@RequiredArgsConstructor
@Tag(description = "ffzf/fileInfo" , name = "文件上传接口" )
public class FileInfo2Controller {
    private final FileInfoService fileInfoService;
@@ -26,14 +23,12 @@
     * @Param downloadPath 文件路径
     */
    @GetMapping("/download/downloadZip")
    @Operation(summary = "下载zip" , description = "下载zip" )
    public void downloadZip(@Param("downloadPath") String downloadPath, HttpServletRequest request, HttpServletResponse response) {
        //下载图片
        String down = fileInfoService.downloadPathFile(downloadPath, request, response);
    }
    @PostMapping("/download/downloadZips")
    @Operation(summary = "下载多个zip" , description = "下载多个zip" )
    public void downloadZips(String fileIds, HttpServletRequest request, HttpServletResponse response) {
        List<FileInfo> fileInfoList = new ArrayList<>();
        if(fileIds.contains(",")){
@@ -51,20 +46,17 @@
        fileInfoService.downForZip(fileInfoList, request, response);
    }
    @PostMapping("/download/downloadPng")
    @Operation(summary = "下载图片" , description = "下载图片" )
    public void downloadPng(String fileId, HttpServletRequest request, HttpServletResponse response) {
        FileInfo byId = fileInfoService.getById(Integer.parseInt(fileId));
        fileInfoService.downloadPng(byId,request,response);
    }
    @GetMapping("/showImg")
    @Operation(summary = "根据路径预览图片" , description = "根据路径预览图片" )
    public void showImg( String path,HttpServletResponse response) {
        fileInfoService.getFile(path,response);
    }
    @GetMapping("/showImgById/{fileId}")
    @Operation(summary = "根据文件id预览图片" , description = "根据文件id预览图片" )
    public void showImgById(@PathVariable Long fileId,HttpServletResponse response) {
        fileInfoService.getFileById(fileId,response);
    }
src/main/java/com/boying/controller/FileInfoController.java
@@ -6,8 +6,7 @@
import com.boying.service.FileInfoService;
import io.lettuce.core.dynamic.annotation.Param;
import io.swagger.models.auth.In;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
@@ -19,7 +18,6 @@
@RestController
@RequestMapping("ffzf/fileinfo")
@RequiredArgsConstructor
@Tag(description = "ffzf/fileinfo" , name = "文件接口(已废弃)" )
public class FileInfoController {
    private final FileInfoService fileInfoService;
@@ -29,14 +27,12 @@
     * @Param downloadPath 文件路径
     */
    @GetMapping("/download/downloadZip")
    @Operation(summary = "下载zip" , description = "下载zip" )
    public void downloadZip(@Param("downloadPath") String downloadPath, HttpServletRequest request, HttpServletResponse response) {
        //下载图片
        String down = fileInfoService.downloadPathFile(downloadPath, request, response);
    }
    @PostMapping("/download/downloadZips")
    @Operation(summary = "下载多个zip" , description = "下载多个zip" )
    public void downloadZips(String fileIds, HttpServletRequest request, HttpServletResponse response) {
        List<FileInfo> fileInfoList = new ArrayList<>();
        if(fileIds.contains(",")){
@@ -54,20 +50,17 @@
        fileInfoService.downForZip(fileInfoList, request, response);
    }
    @PostMapping("/download/downloadPng")
    @Operation(summary = "下载图片" , description = "下载图片" )
    public void downloadPng(String fileId, HttpServletRequest request, HttpServletResponse response) {
        FileInfo byId = fileInfoService.getById(Integer.parseInt(fileId));
        fileInfoService.downloadPng(byId,request,response);
    }
    @GetMapping("/showImg/{filename}")
    @Operation(summary = "根据路径预览图片" , description = "根据路径预览图片" )
    public void showImg(@PathVariable String filename,HttpServletResponse response) {
        fileInfoService.getFile(filename,response);
    }
    @GetMapping("/showImgById/{fileId}")
    @Operation(summary = "根据文件id预览图片" , description = "根据文件id预览图片" )
    public void showImgById(@PathVariable Long fileId,HttpServletResponse response) {
        fileInfoService.getFileById(fileId,response);
    }
src/main/java/com/boying/controller/LedShowController.java
@@ -8,7 +8,6 @@
import com.boying.service.BarrierService;
import com.boying.service.LedShowService;
import com.boying.service.ParkService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
@@ -27,7 +26,6 @@
@RestController
@RequestMapping("ledshow")
@RequiredArgsConstructor
@Tag(description = "ledshow" , name = "led日志(已废弃)" )
public class LedShowController {
    private final LedShowService ledShowService;
src/main/java/com/boying/controller/OrderRecordController.java
@@ -16,8 +16,7 @@
import com.boying.service.UserService;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.GetMapping;
@@ -35,7 +34,6 @@
@RestController
@RequestMapping("ffzf/orderrecord")
@RequiredArgsConstructor
@Tag(description = "ffzf/orderrecord" , name = "订单接口" )
public class OrderRecordController {
    private final OrderRecordService orderRecordService;
@@ -51,7 +49,6 @@
     */
    @ApiOperation(value = "分页查询", notes = "分页查询")
    @PostMapping("/findPage" )
    @Operation(summary = "分页查询" , description = "分页查询" )
    public R getOrderRecordPage(Page page, OrderRecord orderRecord) {
        QueryWrapper<OrderRecord> wrapper = new QueryWrapper<>();
        wrapper.lambda()
@@ -76,7 +73,6 @@
    @PostMapping("/getByCarNo")
    @Operation(summary = "通过车牌号月份分页查询" , description = "通过车牌号月份分页查询" )
    public Object getByCarNo(Page page,String carNo,String month,String phone) {
        List<OrderRecordVo> recordVos = new ArrayList<>();
        QueryWrapper<OrderRecord> wrapper = new QueryWrapper<>();
@@ -105,7 +101,6 @@
    }
    @PostMapping("/findCountPage")
    @Operation(summary = "查询停车场订单金额统计" , description = "查询停车场订单金额统计" )
    public Object findCountPage(Integer parkId,String startTime,String endTime) throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        QueryWrapper<OutPark> wrapper = new QueryWrapper<>();
src/main/java/com/boying/controller/StatisticController.java
@@ -9,8 +9,7 @@
import com.boying.service.StatisticService;
import com.boying.service.StreetLogoService;
import com.boying.service.TicketBlackService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
@@ -32,7 +31,6 @@
@RestController
@RequestMapping("statistic")
@RequiredArgsConstructor
@Tag(description = "statistic" , name = "大屏统计接口" )
public class StatisticController{
    private final StatisticService statisticService;
@@ -43,7 +41,6 @@
    //指挥页面数据
    @PostMapping("/getData1")
    @Operation(summary = "查询所有泊车统计" , description = "查询所有泊车统计" )
    public Object card1() {
        List<Statistic> all = statisticService.list();
        if(all.size() >0){
@@ -54,7 +51,6 @@
    }
    @PostMapping("/getBlackRecord")
    @Operation(summary = "查询所有违法统计" , description = "查询所有违法统计" )
    public Object getList1(Page page) {
        QueryWrapper<TicketBlack> wrapper = new QueryWrapper<>();
        wrapper.lambda()
@@ -63,7 +59,6 @@
    }
    @PostMapping("/getLogo")
    @Operation(summary = "查询所有街道违章统计" , description = "查询所有街道违章统计" )
    public Object getLogo() {
        return R.ok(streetLogoService.list());
    }
src/main/java/com/boying/controller/StreetController.java
@@ -11,8 +11,6 @@
import com.boying.service.StreetReRoadService;
import com.boying.service.StreetService;
import com.boying.util.LngLatUtil;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@@ -29,7 +27,6 @@
@RestController
@RequestMapping("ffzf/street")
@RequiredArgsConstructor
@Tag(description = "ffzf/street" , name = "街道统计" )
public class StreetController {
@@ -38,7 +35,6 @@
    private final StreetLogoService streetLogoService;
    @PostMapping("/findPage")
    @Operation(summary = "分页查询" , description = "分页查询" )
    public Object findPage(Page page, Street street) {
        QueryWrapper<Street> wrapper = new QueryWrapper<>();
        wrapper.lambda()
@@ -47,7 +43,6 @@
    }
    @PostMapping("/save")
    @Operation(summary = "新增街道" , description = "新增街道" )
    public Object save(Street street) {
        QueryWrapper<Street> wrapper = new QueryWrapper<>();
        wrapper.lambda()
@@ -68,7 +63,6 @@
    }
    @PostMapping("/save2")
    @Operation(summary = "新增路" , description = "新增路" )
    public Object save2(StreetReRoad streetReRoad) {
        streetReRoadService.saveOrUpdate(streetReRoad);
        return R.ok();
@@ -76,21 +70,18 @@
    @PostMapping("/delete")
    @Operation(summary = "删除街" , description = "删除街" )
    public Object delete(Long id) {
        streetService.removeById(id);
        return R.ok();
    }
    @PostMapping("/delete2")
    @Operation(summary = "删除路" , description = "删除路" )
    public Object delete2(Long id) {
        streetReRoadService.removeById(id);
        return R.ok();
    }
    @GetMapping("/findById")
    @Operation(summary = "根据id查询(APP)" , description = "根据id查询(APP)" )
    public Object findById(Long id,int type) {
        if(type==0){
            QueryWrapper<StreetReRoad> roadQueryWrapper = new QueryWrapper<>();
@@ -119,7 +110,6 @@
    }
    @GetMapping("/findList")
    @Operation(summary = "查询所有街道和路" , description = "查询所有街道和路" )
    public Object findAll() {
        Map<String,Object> map = new HashMap<>();
        QueryWrapper<Street> wrapper = new QueryWrapper<>();
@@ -135,13 +125,11 @@
    }
    @GetMapping("/findList2")
    @Operation(summary = "查询所有街道" , description = "查询所有街道" )
    public Object findAll2() {
        return R.ok(streetService.list());
    }
    @PostMapping("findLogo")
    @Operation(summary = "查询所有街道违章" , description = "查询所有街道违章" )
    public Object findLogo(String lng ,String lat) {
        List<StreetLogo> all = streetLogoService.list();
        List<StreetLogo> all2 = new ArrayList<>();
src/main/java/com/boying/controller/TicketBlackController.java
@@ -11,8 +11,6 @@
import com.boying.util.FileUtil;
import com.boying.util.NumberToCN;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
@@ -34,7 +32,6 @@
@RestController
@RequestMapping("ffzf/ticketblack")
@RequiredArgsConstructor
@Tag(description = "ffzf/ticketblack" , name = "黑名单表接口" )
public class TicketBlackController {
@@ -46,7 +43,6 @@
    @PostMapping("findPage")
    @Operation(summary = "分页查询" , description = "分页查询" )
    public Object findPage(Page page, TicketBlack ticket){
        QueryWrapper<TicketBlack> wrapper =  new QueryWrapper<>();
        wrapper.lambda()
@@ -57,7 +53,6 @@
    }
    @PostMapping("/save")
    @Operation(summary = "新增黑名单" , description = "新增黑名单" )
    public Object save(TicketBlack ticket) throws IOException{
        QueryWrapper<TicketBlack> wrapper = new QueryWrapper<>();
        wrapper.lambda()
@@ -79,7 +74,6 @@
     */
    @ApiOperation(value = "通过id查询", notes = "通过id查询")
    @GetMapping("/{id}" )
    @Operation(summary = "通过id查询" , description = "通过id查询" )
    public R getById(@PathVariable("id" ) Integer id) {
        TicketBlack byId = ticketBlackService.getById(id);
        return R.ok(byId);
@@ -87,7 +81,6 @@
    @PostMapping("/delete")
    @Operation(summary = "删除黑名单" , description = "删除黑名单" )
    public Object delete(Long id){
        TicketBlack ticket =ticketBlackService.getById(id);
        if(ticket!=null){
@@ -101,7 +94,6 @@
    }
    @PostMapping("/updateById")
    @Operation(summary = "更新黑名单" , description = "更新黑名单" )
    public Object updateById(TicketBlack ticket){
        return R.ok( ticketBlackService.updateById(ticket));
    }
src/main/java/com/boying/controller/UserController.java
@@ -9,8 +9,6 @@
import com.boying.service.ParkService;
import com.boying.service.UserService;
import com.boying.util.LngLatUtil;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.web.bind.annotation.PostMapping;
@@ -27,14 +25,12 @@
@RestController
@RequestMapping("/ffzf/user")
@RequiredArgsConstructor
@Tag(description = "ffzf/user" , name = "用户接口" )
public class UserController{
    private final UserService userService;
    private final ParkService parkService;
    @PostMapping("/findPage")
    @Operation(summary = "分页查询" , description = "分页查询" )
    public Object findPage(User user, Page page) {
        QueryWrapper<User> wrapper = new QueryWrapper<>();
        wrapper.lambda()
@@ -43,14 +39,12 @@
    }
    @PostMapping("/findAll")
    @Operation(summary = "查询所有" , description = "查询所有" )
    public Object findAll() {
        return R.ok(userService.list());
    }
    @PostMapping("/save")
    @Operation(summary = "新增用户" , description = "新增用户" )
    public Object save(User user) {
        if(user.getId()==null){
            user.setPassword(user.getLoginName());
@@ -60,14 +54,12 @@
    }
    @PostMapping("/delete")
    @Operation(summary = "删除用户" , description = "删除用户" )
    public Object delete(Long id) {
        userService.removeById(id);
        return R.ok("删除成功");
    }
    @PostMapping("/login")
    @Operation(summary = "登录" , description = "登录" )
    public Object login(String loginName,String password,String lng,String lat) {
        if(StringUtils.isBlank(loginName)||StringUtils.isBlank(password)){
            return R.failed("用户名和密码必填");
@@ -98,7 +90,6 @@
    }
    @PostMapping("updatePassword")
    @Operation(summary = "修改密码" , description = "修改密码" )
    public Object updatePassword(Long userId,String oldPassword,String newPassword) {
        QueryWrapper<User> wrapper = new QueryWrapper<>();
        wrapper.lambda()
src/main/java/com/boying/controller/ViolationTypeController.java
@@ -6,21 +6,18 @@
import com.boying.entity.ViolationType;
import com.boying.service.ViolationTypeService;
import io.swagger.models.auth.In;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("ffzf/violationtype")
@RequiredArgsConstructor
@Tag(description = "ffzf/violationtype" , name = "违章类型接口" )
public class ViolationTypeController {
    private final ViolationTypeService violationTypeService;
    @PostMapping("/findPage")
    @Operation(summary = "分页查询" , description = "分页查询" )
    //@Operation(summary = "分页查询" , description = "分页查询" )
    public Object findPage(Page page) {
        QueryWrapper<ViolationType> wrapper = new QueryWrapper<>();
        wrapper.lambda()
@@ -29,27 +26,27 @@
    }
    @PostMapping("/save")
    @Operation(summary = "新增违章类型" , description = "新增违章类型" )
   // @Operation(summary = "新增违章类型" , description = "新增违章类型" )
    public Object save(ViolationType violationType) {
        violationTypeService.saveOrUpdate(violationType);
        return R.ok("保存成功");
    }
    @GetMapping("/{id}")
    @Operation(summary = "根据id查询" , description = "根据id查询" )
   // @Operation(summary = "根据id查询" , description = "根据id查询" )
    public Object getObj(@PathVariable Integer id) {
        return R.ok(violationTypeService.getById(id));
    }
    @PostMapping("/delete")
    @Operation(summary = "删除违章类型" , description = "删除违章类型" )
   // @Operation(summary = "删除违章类型" , description = "删除违章类型" )
    public Object delete(Long id) {
        violationTypeService.removeById(id);
        return R.ok("删除成功");
    }
    @PostMapping("/findAll")
    @Operation(summary = "查询所有" , description = "查询所有" )
    //@Operation(summary = "查询所有" , description = "查询所有" )
    public Object findAll() {
        return R.ok(violationTypeService.list());
    }
src/main/java/com/boying/controller/WhiteListController.java
@@ -8,8 +8,6 @@
import com.boying.entity.WhiteList;
import com.boying.service.ParkService;
import com.boying.service.WhiteListService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -19,14 +17,13 @@
@RestController
@RequestMapping("ffzf/whiteList")
@RequiredArgsConstructor
@Tag(description = "ffzf/whiteList" , name = "白名单接口" )
public class WhiteListController{
    private final WhiteListService whiteListService;
    private final ParkService parkService;
    @PostMapping("/findPage")
    @Operation(summary = "分页查询" , description = "分页查询" )
    //@Operation(summary = "分页查询" , description = "分页查询" )
    public Object findPage(Page page, String carNo) {
        QueryWrapper<WhiteList> wrapper = new QueryWrapper<>();
        wrapper.lambda()
@@ -42,7 +39,6 @@
    }
    @PostMapping("/findPageNew")
    @Operation(summary = "分页查询(新)" , description = "分页查询(新)" )
    public Object findPageNew(Page page, String carNo) {
        QueryWrapper<WhiteList> wrapper = new QueryWrapper<>();
        wrapper.lambda()
@@ -69,14 +65,12 @@
    }
    @PostMapping("/save")
    @Operation(summary = "新增白名单" , description = "新增白名单" )
    public Object save(WhiteList whiteList) {
        whiteListService.saveOrUpdate(whiteList);
        return R.ok("保存成功");
    }
    @PostMapping("/delete")
    @Operation(summary = "删除白名单" , description = "删除白名单" )
    public Object delete(Long id) {
        whiteListService.removeById(id);
        return R.ok("删除成功");
src/main/java/com/boying/controller/car/MqttSample.java
@@ -1,66 +1,66 @@
package com.boying.controller.car;
import org.eclipse.paho.client.mqttv3.*;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
/**
 * @author kdq
 * @version 1.0.0
 * @ClassName MqttSample.java
 * @Description TODO
 * @createTime 2024年03月19日 16:56:00
 */
public class MqttSample {
    public static void main(String[] args) throws MqttException{
        MqttSample client = new MqttSample();
        client.start();
    }
    //MQTT安装的服务器地址和端口号(本机的ip)
    public static final String HOST = "tcp://39.96.92.240:9092";
    //定义一个主题
    public static final String TOPIC = "/device/message/up/keep_alive";
    //定义MQTT的ID,可以在MQTT服务配置中指定
    private static final String clientid = "client-2";
    private MqttClient client;
    private MqttConnectOptions options;
    private String userName = "mqtt";
    private String passWord = "mqtt";
//    private ScheduledExecutorService scheduler;
    private void start() {
        try {
            // host为主机名,clientid即连接MQTT的客户端ID,一般以唯一标识符表示,MemoryPersistence设置clientid的保存形式,默认为以内存保存
            client = new MqttClient(HOST, clientid, new MemoryPersistence());
            // MQTT的连接设置
            options = new MqttConnectOptions();
            // 设置是否清空session,这里如果设置为false表示服务器会保留客户端的连接记录,这里设置为true表示每次连接到服务器都以新的身份连接
            options.setCleanSession(false);
            // 设置连接的用户名
            options.setUserName(userName);
            // 设置连接的密码
            options.setPassword(passWord.toCharArray());
            // 设置超时时间 单位为秒
            options.setConnectionTimeout(10);
            // 设置会话心跳时间 单位为秒 服务器会每隔1.5*20秒的时间向客户端发送个消息判断客户端是否在线,但这个方法并没有重连的机制
            options.setKeepAliveInterval(20);
            // 设置回调,client.setCallback就可以调用PushCallback类中的messageArrived()方法
            client.setCallback(new PushCallback());
            MqttTopic topic = client.getTopic(TOPIC);
            int qos = 2;
            //setWill方法,如果项目中需要知道客户端是否掉线可以调用该方法。设置最终端口的通知消息
            options.setWill(topic, "This is yizhu...".getBytes(), qos, true);
            client.connect(options);
            //订阅消息
            int[] Qos  = {qos};
            String[] topic1 = {TOPIC};
            client.subscribe(topic1, Qos);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
//package com.boying.controller.car;
//
//import org.eclipse.paho.client.mqttv3.*;
//import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
//
///**
// * @author kdq
// * @version 1.0.0
// * @ClassName MqttSample.java
// * @Description TODO
// * @createTime 2024年03月19日 16:56:00
// */
//public class MqttSample {
//
//    public static void main(String[] args) throws MqttException{
//        MqttSample client = new MqttSample();
//        client.start();
//    }
//    //MQTT安装的服务器地址和端口号(本机的ip)
//    public static final String HOST = "tcp://39.96.92.240:9092";
//    //定义一个主题
//    public static final String TOPIC = "/device/message/up/keep_alive";
//    //定义MQTT的ID,可以在MQTT服务配置中指定
//    private static final String clientid = "client-2";
//    private MqttClient client;
//    private MqttConnectOptions options;
//    private String userName = "mqtt";
//    private String passWord = "mqtt";
//
////    private ScheduledExecutorService scheduler;
//
//    private void start() {
//        try {
//            // host为主机名,clientid即连接MQTT的客户端ID,一般以唯一标识符表示,MemoryPersistence设置clientid的保存形式,默认为以内存保存
//            client = new MqttClient(HOST, clientid, new MemoryPersistence());
//            // MQTT的连接设置
//            options = new MqttConnectOptions();
//            // 设置是否清空session,这里如果设置为false表示服务器会保留客户端的连接记录,这里设置为true表示每次连接到服务器都以新的身份连接
//            options.setCleanSession(false);
//            // 设置连接的用户名
//            options.setUserName(userName);
//            // 设置连接的密码
//            options.setPassword(passWord.toCharArray());
//            // 设置超时时间 单位为秒
//            options.setConnectionTimeout(10);
//            // 设置会话心跳时间 单位为秒 服务器会每隔1.5*20秒的时间向客户端发送个消息判断客户端是否在线,但这个方法并没有重连的机制
//            options.setKeepAliveInterval(20);
//            // 设置回调,client.setCallback就可以调用PushCallback类中的messageArrived()方法
//            client.setCallback(new PushCallback());
//            MqttTopic topic = client.getTopic(TOPIC);
//
//            int qos = 2;
//
//            //setWill方法,如果项目中需要知道客户端是否掉线可以调用该方法。设置最终端口的通知消息
//            options.setWill(topic, "This is yizhu...".getBytes(), qos, true);
//            client.connect(options);
//            //订阅消息
//            int[] Qos  = {qos};
//            String[] topic1 = {TOPIC};
//            client.subscribe(topic1, Qos);
//
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//    }
//}
src/main/java/com/boying/controller/car/MqttSample2.java
@@ -1,69 +1,69 @@
package com.boying.controller.car;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttTopic;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
/**
 * @author kdq
 * @version 1.0.0
 * @ClassName MqttSample.java
 * @Description TODO
 * @createTime 2024年03月19日 16:56:00
 */
public class MqttSample2 {
    public static void main(String[] args) throws MqttException{
        MqttSample2 client = new MqttSample2();
        client.start();
    }
    //MQTT安装的服务器地址和端口号(本机的ip)
    public static final String HOST = "tcp://39.96.92.240:9092";
    //定义一个主题
    public static final String TOPIC = "/device/message/up/ivs_result";
    //定义MQTT的ID,可以在MQTT服务配置中指定
    private static final String clientid = "client-3";
    private MqttClient client;
    private MqttConnectOptions options;
    private String userName = "mqtt";
    private String passWord = "mqtt";
//    private ScheduledExecutorService scheduler;
    private void start() {
        try {
            // host为主机名,clientid即连接MQTT的客户端ID,一般以唯一标识符表示,MemoryPersistence设置clientid的保存形式,默认为以内存保存
            client = new MqttClient(HOST, clientid, new MemoryPersistence());
            // MQTT的连接设置
            options = new MqttConnectOptions();
            // 设置是否清空session,这里如果设置为false表示服务器会保留客户端的连接记录,这里设置为true表示每次连接到服务器都以新的身份连接
            options.setCleanSession(false);
            // 设置连接的用户名
            options.setUserName(userName);
            // 设置连接的密码
            options.setPassword(passWord.toCharArray());
            // 设置超时时间 单位为秒
            options.setConnectionTimeout(10);
            // 设置会话心跳时间 单位为秒 服务器会每隔1.5*20秒的时间向客户端发送个消息判断客户端是否在线,但这个方法并没有重连的机制
            options.setKeepAliveInterval(20);
            // 设置回调,client.setCallback就可以调用PushCallback类中的messageArrived()方法
            client.setCallback(new PushCallback());
            MqttTopic topic = client.getTopic(TOPIC);
            int qos = 2;
            //setWill方法,如果项目中需要知道客户端是否掉线可以调用该方法。设置最终端口的通知消息
            options.setWill(topic, "This is yizhu...".getBytes(), qos, true);
            client.connect(options);
            //订阅消息
            int[] Qos  = {qos};
            String[] topic1 = {TOPIC};
            client.subscribe(topic1, Qos);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
//package com.boying.controller.car;
//
//import org.eclipse.paho.client.mqttv3.MqttClient;
//import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
//import org.eclipse.paho.client.mqttv3.MqttException;
//import org.eclipse.paho.client.mqttv3.MqttTopic;
//import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
//
///**
// * @author kdq
// * @version 1.0.0
// * @ClassName MqttSample.java
// * @Description TODO
// * @createTime 2024年03月19日 16:56:00
// */
//public class MqttSample2 {
//
//    public static void main(String[] args) throws MqttException{
//        MqttSample2 client = new MqttSample2();
//        client.start();
//    }
//    //MQTT安装的服务器地址和端口号(本机的ip)
//    public static final String HOST = "tcp://39.96.92.240:9092";
//    //定义一个主题
//    public static final String TOPIC = "/device/message/up/ivs_result";
//    //定义MQTT的ID,可以在MQTT服务配置中指定
//    private static final String clientid = "client-3";
//    private MqttClient client;
//    private MqttConnectOptions options;
//    private String userName = "mqtt";
//    private String passWord = "mqtt";
//
////    private ScheduledExecutorService scheduler;
//
//    private void start() {
//        try {
//            // host为主机名,clientid即连接MQTT的客户端ID,一般以唯一标识符表示,MemoryPersistence设置clientid的保存形式,默认为以内存保存
//            client = new MqttClient(HOST, clientid, new MemoryPersistence());
//            // MQTT的连接设置
//            options = new MqttConnectOptions();
//            // 设置是否清空session,这里如果设置为false表示服务器会保留客户端的连接记录,这里设置为true表示每次连接到服务器都以新的身份连接
//            options.setCleanSession(false);
//            // 设置连接的用户名
//            options.setUserName(userName);
//            // 设置连接的密码
//            options.setPassword(passWord.toCharArray());
//            // 设置超时时间 单位为秒
//            options.setConnectionTimeout(10);
//            // 设置会话心跳时间 单位为秒 服务器会每隔1.5*20秒的时间向客户端发送个消息判断客户端是否在线,但这个方法并没有重连的机制
//            options.setKeepAliveInterval(20);
//            // 设置回调,client.setCallback就可以调用PushCallback类中的messageArrived()方法
//            client.setCallback(new PushCallback());
//            MqttTopic topic = client.getTopic(TOPIC);
//
//            int qos = 2;
//
//            //setWill方法,如果项目中需要知道客户端是否掉线可以调用该方法。设置最终端口的通知消息
//            options.setWill(topic, "This is yizhu...".getBytes(), qos, true);
//            client.connect(options);
//            //订阅消息
//            int[] Qos  = {qos};
//            String[] topic1 = {TOPIC};
//            client.subscribe(topic1, Qos);
//
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//    }
//}
src/main/java/com/boying/controller/car/PlateServlet2.java
@@ -15,9 +15,6 @@
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.sun.media.jfxmedia.track.Track;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -49,7 +46,6 @@
@Controller
@RequestMapping("/ffzf/car2")
@RequiredArgsConstructor
@Tag(description = "ffzf/car3" , name = "泊车流程接口" )
public class PlateServlet2 extends HttpServlet {
    private static final long serialVersionUID = 1L;
    @Value("${ffpark.logPath}")
@@ -150,7 +146,6 @@
    }
    @PostMapping("/status")
    @Operation(summary = "相机心跳接口" , description = "相机心跳接口" )
    public void heart(String serialno,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
        Barrier barrier = barrierService.findByCode(serialno);
        Park park = parkService.getOneById(barrier.getParkId());
@@ -251,7 +246,6 @@
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    @PostMapping("/PlateServlet")
    @Operation(summary = "车辆识别接口" , description = "车辆识别接口" )
    protected void info(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String s= "";
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss");
src/main/java/com/boying/controller/car/PlateServlet3.java
@@ -1,1017 +1,1017 @@
//package com.boying.controller.car;
//
//import cn.hutool.http.HttpRequest;
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
//import com.baomidou.mybatisplus.core.toolkit.StringUtils;
//import com.boying.common.R;
//import com.boying.common.SystemConfigProperties;
//import com.boying.entity.*;
//import com.boying.service.*;
//import com.boying.util.DateUtilOther;
//import com.boying.util.FileUtil;
//import com.boying.util.RedisJsonUtil;
//import com.boying.util.StringUtil;
//import com.google.gson.JsonObject;
//import com.google.gson.JsonParser;
//import ledshow.CodeUtil;
//import ledshow.LedBean;
//import ledshow.ResultData;
//import lombok.RequiredArgsConstructor;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.redis.core.StringRedisTemplate;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import javax.servlet.ServletException;
//import javax.servlet.http.HttpServlet;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.*;
//import java.text.ParseException;
//import java.text.SimpleDateFormat;
//import java.time.Duration;
//import java.time.LocalDateTime;
//import java.time.ZoneOffset;
//import java.util.Base64;
//import java.util.Date;
//import java.util.List;
//import java.util.concurrent.TimeUnit;
//
//
///**
// * Servlet implementation class PlateServlet
// */
//@Controller
//@RequestMapping("/ffzf/car")
//@RequiredArgsConstructor
//public class PlateServlet3 extends HttpServlet {
//    private static final long serialVersionUID = 1L;
//    private final SystemConfigProperties systemConfigProperties;
//    private final StringRedisTemplate redisTemplate;
//    private final ParkService parkService;
//    private final OutParkService outParkService;
//    private final EnterParkService enterParkService;
//    private final BarrierService barrierService;
//    private final TicketService ticketService;
//    private final CostRuleService costRuleService;
//    private final WhiteListService whiteListService;
//    private final FileInfoService fileInfoService;
//    private final TicketBlackService ticketBlackService;
//    private final OutParkLogService outParkLogService;
//   // private final RedisJsonUtil redisJsonUtil;
//    private final String LEDURL = "http://192.168.31.212:9988/LedShow/IGetResultDataAllLine";
//
//    /**
//     * 回复开闸
//     */
//    protected void open(HttpServletRequest request, HttpServletResponse response,String data) throws ServletException, IOException {
//        response.setContentType("text/json");
//        PrintWriter out = response.getWriter();
//        String aa = "{" +
//                "\"Response_AlarmInfoPlate\": {" +
//                "\"info\":\"ok\"," +
//                "\"is_pay\":\"true\"," +
//                "\"serialData\" :[" +
//                "{" +
//                "\"serialChannel\":0," +
//                "\"data\" : \"" + data + "\"," +
//                "\"dataLen\" :" + data.length() +
//                "}" +
//                "]" +
//                "}" +
//                "}";
//        out.println(aa);
//        out.flush();
//        out.close();
//    }
//
//
//    //转码
//    public static String deCode(String str) {
//        try {
//            byte[] b = str.getBytes("UTF-8");//����
//            String sa = new String(b);//����:��ʲô�ַ����������ʲô�ַ�������
//            //String sa = new String(str.getBytes());
//
//            return sa;
//        } catch (Exception e) {
//            e.printStackTrace();
//            return "";
//        }
//    }
//
//    protected void noOpen(HttpServletRequest request, HttpServletResponse response,String data) throws IOException {
//        response.setContentType("text/json");
//        PrintWriter out = response.getWriter();
//        String aa = "{" +
//                "\"Response_AlarmInfoPlate\": {" +
//                "\"serialData\" :[" +
//                "{" +
//                "\"serialChannel\":0," +
//                "\"data\" : \"" + data + "\"," +
//                "\"dataLen\" :" + data.length() +
//                "}" +
//                "]" +
//                "}" +
//                "}";
//        out.println(aa);
//        out.flush();
//        out.close();
//    }
//
//    protected void easyOpen(HttpServletRequest request, HttpServletResponse response) throws IOException {
//        response.setContentType("text/json");
//        PrintWriter out = response.getWriter();
//        out.println("{\"Response_AlarmInfoPlate\":{\"info\":\"ok\",\"content\":\"...\",\"is_pay\":\"true\"}}");
//        out.flush();
//        out.close();
//    }
//
//    protected void easyOpen2(HttpServletRequest request, HttpServletResponse response) throws IOException {
//        response.setContentType("text/json");
//        PrintWriter out = response.getWriter();
//        out.println("{\"Response_AlarmInfoPlate\":{\"ivs_ioctrl\":{\"delay\":1000,\"io\":0,\"value\":2}}}");
//        out.flush();
//        out.close();
//    }
//
//    protected void easyNoOpen(HttpServletRequest request, HttpServletResponse response) throws IOException {
//        response.setContentType("text/json");
//        PrintWriter out = response.getWriter();
//        out.println("{\"Response_AlarmInfoPlate\":{\"info\":\"error\",\"content\":\"...\",\"is_pay\":\"false\"}}");
//        out.flush();
//        out.close();
//    }
//
//    @PostMapping("/status")
//    public void heart(String serialno,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
//        Barrier barrier = barrierService.findByCode(serialno);
//        Park park = parkService.getOneById(barrier.getParkId());
//       // Park park = parkService.getById(barrier.getParkId());
//       // String redis = redisTemplate.opsForValue().get("park_up_" + park.getId());
//        String redisnum = redisTemplate.opsForValue().get("car_park_" + park.getId());
//        if(StringUtils.isBlank(redisnum)){
//            redisnum = "0";
//        }
//        if(barrier!=null){
//            if(barrier.getType2()==1){
//                //待开闸
//                if(barrier.getType() == 1){
//                    int i = Integer.parseInt(redisnum);
//                    i++;
//                    redisTemplate.opsForValue().set("car_park_" + park.getId(),Integer.toString(i),30, TimeUnit.DAYS);
//                }else if(barrier.getType() == 0){
//                    int i = Integer.parseInt(redisnum);
//                    i--;
//                    if(i<0){
//                        String s= "2."+barrier.getCarNo()+"闸机手动启动,场内停车数为"+i+"\n";
//                        writeTxt2(s);
//                        redisTemplate.opsForValue().set("car_park_" + park.getId(),"0",30, TimeUnit.DAYS);
//                        redisTemplate.opsForValue().set("park_up_" + park.getId(),"true",30, TimeUnit.DAYS);
//                    }else {
//                        String s= "2."+barrier.getCarNo()+"闸机手动启动,场内停车数为"+i+"\n";
//                        writeTxt2(s);
//                        redisTemplate.opsForValue().set("car_park_" + park.getId(),Integer.toString(i),30, TimeUnit.DAYS);
//                        redisTemplate.opsForValue().set("park_up_" + park.getId(),"true",30, TimeUnit.DAYS);
//                    }
//
//                }
//                barrier.setType2(0);
//                barrier.setUpdateTime(LocalDateTime.now());
//                barrier.setStatus(0);
//                barrier.setUpdateTime(LocalDateTime.now());
//                barrierService.saveOrUpdate(barrier);
//
//                String jsonValue = JSON.toJSONString(barrier);
//                redisTemplate.opsForValue().set("barrier-"+barrier.getCode(), jsonValue);
//                easyOpen(request,response);
//            }else {
//                //不需开闸
//                LocalDateTime now = LocalDateTime.now();
//                LocalDateTime updateTime = barrier.getUpdateTime();
//                Duration duration = Duration.between(updateTime,now);
//                long minutes = duration.toMinutes();
//                if(minutes>=2){
//                    barrier.setStatus(0);
//                    barrier.setUpdateTime(LocalDateTime.now());
//                    barrierService.saveOrUpdate(barrier);
//                }
//
//                String jsonValue = JSON.toJSONString(barrier);
//                redisTemplate.opsForValue().set("barrier-"+barrier.getCode(), jsonValue);
//                if(barrier.getType() == 0){
//                    OutPark outPark = outParkService.count4(barrier.getId());
//                    if(outPark!=null){
//                        if(barrier.getType() == 0){
//                            int i = Integer.parseInt(redisnum);
//                            i--;
//                            if(i<0){
//                                String s= "2."+outPark.getCarNo()+"缴费完成,场内停车数为"+i+"\n";
//                                writeTxt2(s);
//                                redisTemplate.opsForValue().set("car_park_" + park.getId(),"0",30, TimeUnit.DAYS);
//                                redisTemplate.opsForValue().set("park_up_" + park.getId(),"true",30, TimeUnit.DAYS);
//                            }else {
//                                String s= "2."+outPark.getCarNo()+"缴费完成,场内停车数为"+i+"\n";
//                                writeTxt2(s);
//                                redisTemplate.opsForValue().set("car_park_" + park.getId(),Integer.toString(i),30, TimeUnit.DAYS);
//                                redisTemplate.opsForValue().set("park_up_" + park.getId(),"true",30, TimeUnit.DAYS);
//                            }
//                        }
//                        outPark.setStatus2(1);
//                        outParkService.saveOrUpdate(outPark);
//                        easyOpen(request,response);
//                        OutParkLog byOutPark = outParkLogService.getByOutPark(outPark.getCarNo(), outPark.getId());
//                        byOutPark.setOpenTime(LocalDateTime.now());
//                        outParkLogService.saveOrUpdate(byOutPark);
//                        enterParkService.deleteByCarNo(outPark.getCarNo(), barrier.getParkId());
//                        redisTemplate.delete("outPark-"+outPark.getBarrierId());
//                    }
//                }
//                if(barrier.getType() == 1){
//                    boolean in = barrierService.getDateDifIn(park.getId());
//                    if(in){
//                        inLedShowDefault(park.getId(),request,response);
//                    }
//                }else if(barrier.getType() == 0){
//                    boolean out = barrierService.getDateDifOut(barrier.getId());
//                    if(out){
//                        outLedShowDefault(request,response);
//                    }
//                }
//            }
//
//        }else {
//            easyNoOpen(request,response);
//        }
//    }
//    /**
//     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
//     */
//    @PostMapping("/PlateServlet")
//    protected void info(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//        String s= "";
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss");
//        BufferedReader reader = new BufferedReader(new InputStreamReader(request.getInputStream(),"UTF-8"));
//        String str = "";
//        String lineStr = "";
//        FileInfo fileInfo = null;
//        while((str = reader.readLine()) != null){
//            lineStr += str;
//        }
//       // System.out.println("获取到的道闸推送数据为:"+lineStr);
//
//        JSONObject jsonObject1 = JSON.parseObject(lineStr);
//        JSONObject alarmInfoPlate = jsonObject1.getJSONObject("AlarmInfoPlate");
//        JSONObject result = alarmInfoPlate.getJSONObject("result");
//        JSONObject plateResult = result.getJSONObject("PlateResult");
//        String carNo = plateResult.get("license").toString();
//        String image = plateResult.get("imageFile").toString();
//        String code = alarmInfoPlate.get("serialno").toString();
//
//        try {
//            JsonParser parser=new JsonParser();
//            do {
//                JsonObject jsonObject=(JsonObject) parser.parse(lineStr);
//                if( jsonObject == null || jsonObject.isJsonNull() ) {
//                    break;
//                }
//
//                JsonObject jsonInfoPlate = jsonObject.get("AlarmInfoPlate").getAsJsonObject();
//                if( jsonInfoPlate == null || jsonInfoPlate.isJsonNull() ) {
//                    break;
//                }
//
//                JsonObject jsonResult = jsonInfoPlate.get("result").getAsJsonObject();
//                if( jsonResult == null || jsonResult.isJsonNull() ) {
//                    break;
//                }
//
//                JsonObject jsonPlateResult = jsonResult.get("PlateResult").getAsJsonObject();
//                if( jsonPlateResult == null || jsonPlateResult.isJsonNull() ) {
//                    break;
//                }
//
//                String license = jsonPlateResult.get("license").getAsString();//车牌号
//                if( license == null || license == "") {
//                    break;
//                }
//
//                String serialno = jsonInfoPlate.get("serialno").getAsString();//摄像机序列号
//                if( serialno == null || serialno == "" ) {
//                    break;
//                }
//
//
//                if(StringUtils.isNotBlank(image)){
//                    fileInfo = FileUtil.generateBase64StringToFile(image, 1,1);
//                    fileInfoService.save(fileInfo);
//                }
//
//
//                System.out.println("编号:"+serialno+"  设备识别到了:"+license);
//                String format = sdf.format(new Date());
//                s+= format+",车牌号为:"+license+",serialno为:"+code+"  ";
//
//                Barrier barrier = barrierService.findByCode(code);
//                System.out.println("查询到道闸为:"+barrier);
//                if(barrier==null){
//                    s+="查询道闸为空\n";
//                    easyNoOpen(request,response);
//                }else{
//                    if(barrier.getType()==0){
//                        outPark(license, barrier.getId(), barrier.getParkId(),request,response,fileInfo);
//                        s+=license+"-保存出场记录\n";
//                    }else{
//                        String num = redisTemplate.opsForValue().get("car_park_" +  barrier.getParkId());
//                        if(StringUtils.isBlank(num)){
//                            num = "0";
//                            redisTemplate.opsForValue().set("car_park_" + barrier.getParkId(),num,30, TimeUnit.DAYS);
//                            redisTemplate.opsForValue().set("park_up_" + barrier.getParkId(),"true",30, TimeUnit.DAYS);
//                        }
//                        Park byId = parkService.getById(barrier.getParkId());
//                        if(Integer.parseInt(num) >= byId.getNum() ){
//                            //led显示
//                            inLedFullShow(code, license,barrier.getParkId(),request,response);
//                        }else {
//                            //led显示
//                            enterPark(license,barrier.getId(),barrier.getParkId(),fileInfo);
//                            inLedShow(code, license,barrier.getParkId(),request,response);
//                            s+=license+"-保存入场记录\n";
//                        }
//                    }
//                }
//                writeTxt(s);
//            }while(false);
//        }
//        catch (Exception e) {
//            System.out.println("无入场记录");
//            s+=" ,查询场内记录异常";
//            writeTxt(s);
//            easyNoOpen(request,response);
//        }
//    }
//
//    /**
//     * 手机号入场
//     * @param
//     * @return
//     */
//    @PostMapping("/inParkByPhone" )
//    @ResponseBody
//    public Object inParkByPhone( EnterPark enterPark){
//        Barrier barrier = barrierService.getById(enterPark.getBarrierId());
//        if(barrier!=null){
//            String num = redisTemplate.opsForValue().get("car_park_" +  barrier.getParkId());
//            if(StringUtils.isBlank(num)){
//                num = "0";
//                redisTemplate.opsForValue().set("car_park_" + barrier.getParkId(),num,30, TimeUnit.DAYS);
//                redisTemplate.opsForValue().set("park_up_" + barrier.getParkId(),"true",30, TimeUnit.DAYS);
//            }
//            Park byId = parkService.getById(barrier.getParkId());
//            if(Integer.parseInt(num) >= byId.getNum() ){
//                return R.failed(null,"禁止通行,车位已满");
//            }else {
//                QueryWrapper<EnterPark> wrapper2 = new QueryWrapper<>();
//                wrapper2.lambda()
//                        .eq(EnterPark::getBarrierId,barrier.getId())
//                        .orderByDesc(EnterPark::getCreateTime)
//                        .last(" limit 1");
//                EnterPark one = enterParkService.getOne(wrapper2);
//                if(one == null){
//                    return R.failed("未查询到车辆存在");
//                }else {
//                    if(one.getCarNo().equals("无牌车")){
//                        enterPark.setCreateTime(LocalDateTime.now());
//                        QueryWrapper<Ticket> wrapper = new QueryWrapper<>();
//                        wrapper.lambda()
//                                .eq(Ticket::getCarNo,enterPark.getCarNo())
//                                .eq(Ticket::getPayStatus,1);
//                        List<Ticket> tickets = ticketService.list(wrapper);
//                        if(tickets.size()>0){
//                            enterPark.setStatus(1);//发现有违章
//                        }
//                        enterPark.setIsPay(0);
//                        enterPark.setPrice(0);
//                        enterParkService.deleteByCarNo(enterPark.getCarNo(),enterPark.getParkId());
//                        enterParkService.save(enterPark);
//                        barrier.setType2(1);
//                        barrierService.updateById(barrier);
//                        return R.ok();
//                    }else {
//                        return R.failed("非法操作");
//                    }
//                }
//            }
//        }
//        return R.failed(null,"数据异常");
//    }
//
//    /**
//     * 手机号出场
//     * @param
//     * @return
//     */
//    @PostMapping("/outParkByPhone" )
//    @ResponseBody
//    public Object outParkByPhone(String code2,String carNo){
//        Barrier byCode2 = barrierService.findByCode2(code2);
//        QueryWrapper<EnterPark> wrapper =new QueryWrapper<>();
//        wrapper.lambda()
//                .eq(EnterPark::getParkId,byCode2.getParkId())
//                .eq(EnterPark::getCarNo,carNo);
//        EnterPark one = enterParkService.getOne(wrapper);
//        if(one != null){
//            double money = 0.0;
//            String toDayHrMinSec = null;
//            OutPark outPark = new OutPark();
//            outPark.setCarNo(carNo);
//            outPark.setParkId(one.getParkId());
//            outPark.setBarrierId(byCode2.getId());
//            outPark.setCreateTime(LocalDateTime.now());
//            outPark.setCode(System.currentTimeMillis()+"");
//            System.out.println("入场记录:"+one);
//            outPark.setEnterTime(one.getCreateTime());
//            outPark.setParkName(byCode2.getName());
//            if(outPark.getTime() > 0){
//                outPark.setTimeStr(DateUtilOther.millisToDayHrMinSec(new Double(outPark.getTime()).longValue()));
//            }else {
//                outPark.setTimeStr("不足一分钟");
//            }
//            try {
//                long l = outPark.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli() - one.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli();
//                outPark.setTime(l/(1000*60));
//                toDayHrMinSec = DateUtilOther.millisToDayHrMinSec(l/(1000*60));
//                money = costRuleService.getMoney(one.getParkId(), outPark.getEnterTime(), outPark.getCreateTime(), 1);
//
//                //入场记录保存一下
//                if(one.getIsPay()==1){
//                    money = money - one.getPrice();
//                }else {
//                    one.setPrice(money);
//                    one.setIsPay(0);
//                    enterParkService.updateById(one);
//                }
//            } catch (ParseException e) {
//                e.printStackTrace();
//            }
//            outPark.setPrice(money);
//            outPark.setStatus3(findTicket(carNo));
//            outParkService.saveOrUpdate(outPark);
//            byCode2.setCarNo(carNo);
//            //led展示
//            if(toDayHrMinSec == null){
//                return R.failed("异常记录");
//            }
//            if(outPark.getPrice()==0&&outPark.getStatus3()==0){
//                System.out.println(outPark.getCarNo()+"该车不需要缴费");
//                String s= "1."+byCode2.getCarNo()+"该车不需要缴费\n";
//                writeTxt2(s);
//                byCode2.setType2(1);
//                barrierService.updateById(byCode2);
//                return R.ok(outPark);
//            }else {
//                //需要缴费或者有违章
//                System.out.println(outPark.getCarNo()+"该车需要缴费"+outPark.getPrice());
//                String s= "1."+byCode2.getCarNo()+"该车需要缴费\n";
//                writeTxt2(s);
//                barrierService.updateById(byCode2);
//                return R.ok(outPark);
//            }
//
//        }else {
//            return R.failed("未查询到入场记录");
//        }
//    }
//
//
//    private void writeTxt( String txt)
//    {
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
//        try
//        {
//            FileWriter f = new FileWriter(systemConfigProperties.getLogPath()+sdf.format(new Date())+".txt",true);
//            BufferedWriter bw=new BufferedWriter(f);
//            bw.write(txt);
//            bw.newLine();
//            bw.close();
//        }
//        catch(Exception e)
//        {
//            System.out.println("打印错误");
//        }
//    }
//
//    private void writeTxt2( String txt)
//    {
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
//        try
//        {
//            FileWriter f = new FileWriter(systemConfigProperties.getLogPath()+sdf.format(new Date())+"LED.txt",true);
//            BufferedWriter bw=new BufferedWriter(f);
//            bw.write(txt);
//            bw.newLine();
//            bw.close();
//        }
//        catch(Exception e)
//        {
//            System.out.println("打印错误");
//        }
//    }
//
//
//
//
//    public void enterPark(String carNo,Integer barrierId,Integer parkId,FileInfo fileInfo) {
//        TicketBlack black = ticketBlackService.getByCarNo(carNo, 1);
//        if(black != null){
//            System.out.println("黑名单车辆"+carNo);
//        }else {
//            enterParkService.deleteByCarNo(carNo,parkId);
//            EnterPark enterPark = new EnterPark();
//            enterPark.setIsPay(0);
//            enterPark.setPrice(0);
//            enterPark.setCarNo(carNo);
//            enterPark.setBarrierId(barrierId);
//            enterPark.setParkId(parkId);
//
//            QueryWrapper<Ticket> wrapper = new QueryWrapper<>();
//            wrapper.lambda()
//                    .eq(Ticket::getCarNo,enterPark.getCarNo())
//                    .eq(Ticket::getPayStatus,1);
//            List<Ticket> tickets = ticketService.list(wrapper);
//            if(tickets.size()>0){
//                enterPark.setStatus(1);//发现有违章
//            }
//            if(fileInfo != null){
//                enterPark.setImgId(fileInfo.getId());
//            }
//            enterParkService.saveOrUpdate(enterPark);
//            String jsonValue = JSON.toJSONString(enterPark);
//            redisTemplate.opsForValue().set("enterPark_dif_"+ parkId, jsonValue);
//
//        }
//    }
//
//    public double outPark(String carNo,Integer barrierId,Integer parkId,HttpServletRequest request, HttpServletResponse response,FileInfo fileInfo) throws ServletException, IOException {
//        double money = 0.0;
//        EnterPark enterPark = null;
//        String toDayHrMinSec = null;
//        OutPark outPark = new OutPark();
//        outPark.setCarNo(carNo);
//        outPark.setParkId(parkId);
//        outPark.setBarrierId(barrierId);
//        outPark.setCreateTime(LocalDateTime.now());
//        outPark.setCode(System.currentTimeMillis()+"");
//        List<EnterPark> byCarNo = enterParkService.findByCarNo(carNo,parkId);
//
//        if(byCarNo.size() == 0){
//            System.out.println(carNo+"未发现场内车辆");
//        }else{
//            enterPark = byCarNo.get(0);
//            System.out.println("入场记录:"+enterPark);
//            outPark.setEnterTime(enterPark.getCreateTime());
//            try {
//                long l = outPark.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli() - enterPark.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli();
//                outPark.setTime(l/(1000*60));
//                toDayHrMinSec = DateUtilOther.millisToDayHrMinSec(l/(1000*60));
//                money = costRuleService.getMoney(parkId, outPark.getEnterTime(), outPark.getCreateTime(), 1);
//
//                //入场记录保存一下
//                if(enterPark.getIsPay() != null && enterPark.getIsPay()==1){
//                    money = money - enterPark.getPrice();
//                }else {
//                    enterPark.setPrice(money);
//                    enterPark.setIsPay(0);
//                    enterParkService.updateById(enterPark);
//                }
//            } catch (ParseException e) {
//                e.printStackTrace();
//            }
//
//        }
//        //outPark.setPrice(Double.valueOf(String.format("%.1f", money)));
//        outPark.setPrice(money);
//        outPark.setStatus3(findTicket(carNo));
//        if(fileInfo != null){
//            outPark.setImgId(fileInfo.getId());
//        }
//        outParkService.saveOrUpdate(outPark);
//        Barrier barrier =barrierService.getById(barrierId);
//        barrier.setCarNo(carNo);
//        //led展示
//        if(toDayHrMinSec == null){
//            toDayHrMinSec = "入场记录异常,请联系管理员";
//        }
//        //判断是否在白名单
//        QueryWrapper<WhiteList> wrapper = new QueryWrapper<>();
//        wrapper.lambda()
//                .eq(WhiteList::getCarNo,carNo);
//        List<WhiteList> all = whiteListService.list(wrapper);
//        if(all.size() >0){
//            for(WhiteList w : all){
//                if(w.getType()==0){
//                    outLedShowYueZu(barrier.getCarNo(),"月租车",parkId,request,response,0);
//                    OutPark byCarNoAndBarrierId = outParkService.findByCarNoAndBarrierId(carNo, barrierId);
//                    byCarNoAndBarrierId.setStatus(2);
//                    byCarNoAndBarrierId.setStatus2(1);
//                    outParkService.saveOrUpdate(byCarNoAndBarrierId);
//                    barrierService.saveOrUpdate(barrier);
//                    String jsonValue2 = JSON.toJSONString(barrier);
//                    redisTemplate.opsForValue().set("barrier-"+barrier.getCode(), jsonValue2);
//                    String jsonValue = JSON.toJSONString(byCarNoAndBarrierId);
//                    redisTemplate.opsForValue().set("outPark_dif_"+ barrierId, jsonValue);
//                    return 0.0;
//                }else{
//                    if(StringUtils.isNotBlank(w.getParkIds())){
//                        if(w.getEndTime()!=null){
//                            String parkIds = w.getParkIds();
//                            String[] split = parkIds.split(",");
//                            for (String s : split) {
//                                int pid = Integer.parseInt(s);
//                                if(pid == outPark.getParkId() && System.currentTimeMillis()<w.getEndTime().getTime()){
//                                    outLedShowYueZu(barrier.getCarNo(),"月租车",parkId,request,response,0);
//                                    OutPark byCarNoAndBarrierId = outParkService.findByCarNoAndBarrierId(carNo, barrierId);
//                                    byCarNoAndBarrierId.setStatus(2);
//                                    byCarNoAndBarrierId.setStatus2(1);
//                                    outParkService.saveOrUpdate(byCarNoAndBarrierId);
//                                    barrierService.saveOrUpdate(barrier);
//                                    String jsonValue2 = JSON.toJSONString(barrier);
//                                    redisTemplate.opsForValue().set("barrier-"+barrier.getCode(), jsonValue2);
//                                    String jsonValue = JSON.toJSONString(byCarNoAndBarrierId);
//                                    redisTemplate.opsForValue().set("outPark_dif_"+ barrierId, jsonValue);
//                                    return 0.0;
//                                }
//                            }
//                        }
//                    }
//                }
//            }
//        }
//        barrierService.saveOrUpdate(barrier);
//        String jsonValue2 = JSON.toJSONString(barrier);
//        redisTemplate.opsForValue().set("barrier-"+barrier.getCode(), jsonValue2);
//        if(outPark.getPrice()==0&&outPark.getStatus3()==0){
//            System.out.println(outPark.getCarNo()+"该车不需要缴费");
//            String s= "1."+barrier.getCarNo()+"该车不需要缴费\n";
//            writeTxt2(s);
//            String jsonValue = JSON.toJSONString(outPark);
//            redisTemplate.opsForValue().set("outPark_dif_"+ barrierId, jsonValue);
//            outLedShow(outPark,barrier.getCode(),barrier.getCarNo(),outPark.getPrice(),toDayHrMinSec,barrier.getParkId(),request,response,0);
//        }else {
//            //需要缴费或者有违章
//            System.out.println(outPark.getCarNo()+"该车需要缴费"+outPark.getPrice());
//            String s= "1."+barrier.getCarNo()+"该车需要缴费\n";
//            writeTxt2(s);
//            OutParkLog byOutPark = outParkLogService.getByOutPark(outPark.getCarNo(), outPark.getId());
//            byOutPark.setOutTime(outPark.getCreateTime());
//            byOutPark.setParkId(outPark.getParkId());
//            outParkLogService.saveOrUpdate(byOutPark);
//            String jsonValue = JSON.toJSONString(outPark);
//            redisTemplate.opsForValue().set("outPark_dif_"+ barrierId, jsonValue);
//            outLedShow(outPark,barrier.getCode(),barrier.getCarNo(),outPark.getPrice(),toDayHrMinSec,barrier.getParkId(),request,response,1);
//        }
//        return money;
//    }
//
//    public int findTicket(String carNo){
//        QueryWrapper<Ticket> wrapper = new QueryWrapper<>();
//        wrapper.lambda()
//                .eq(Ticket::getCarNo,carNo)
//                .eq(Ticket::getPayStatus,1);
//        List<Ticket> tickets = ticketService.list(wrapper);
//        if(tickets.size()>0){
//            return 1;
//        }else{
//            return 0;
//        }
//    }
//
//
//    public void inLedShow(String ledId,String carNo,Integer parkId,HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//        TicketBlack black = ticketBlackService.getByCarNo(carNo, 1);
//        if(black != null){
//            LedBean ledBean = new LedBean();
//            ledBean.setcolor1(0);
//            ledBean.setcolor2(0);
//            ledBean.setcolor3(0);
//            ledBean.setcolor4(0);
//            ledBean.setcontent1(carNo);
//            ledBean.setcontent2("黑名单车辆");
//            ledBean.setcontent3("禁止驶入");
//            ledBean.setcontent4("联系管理员");
//            ledBean.setdisMode1(0);
//            ledBean.setdisMode2(0);
//            ledBean.setdisMode3(0);
//            ledBean.setdisMode4(0);
//            ledBean.setvoiceContent("黑名单车辆"+carNo+",禁止驶入");
//            ResultData resultData = CodeUtil.GetResultDataAllLine(ledBean);
//            byte[] dataX = new byte[resultData.getlenth()];
//            System.arraycopy(resultData.getdatas(),0,dataX,0,resultData.getlenth());
//            String data1 = Base64.getMimeEncoder().encodeToString(dataX) + "=";
//            data1 = data1.replaceAll("\r\n", "");
//            noOpen(request,response,data1);
//        }else {
//            String num = redisTemplate.opsForValue().get("car_park_" +  parkId);
//            if(num == null){
//                num = "0";
//            }
//            Park byId = parkService.getById(parkId);
//            int n = Integer.parseInt(num)+1;
//            redisTemplate.opsForValue().set("car_park_" + parkId,Integer.toString(n),30, TimeUnit.DAYS);
//            int i = byId.getNum() - Integer.parseInt(num);
//            if(i<0){
//                i = 0;
//            }
//            String carType = "";
//            String carDay = "";
//            Barrier barrier = barrierService.findByCode(ledId);
//            WhiteList byCarNo = whiteListService.getByCarNo(carNo);
//            if(byCarNo == null){
//                carType = "临时车";
//            }else {
//                if (byCarNo.getType() == 0){
//                    //白名单永久车辆
//                    carType = "月租车";
//                }else {
//                    //白名单固定停车场车辆
//                    if(StringUtils.isNotBlank(byCarNo.getParkIds()) && byCarNo.getParkIds().contains(barrier.getParkId()+"")){
//                        carType = "月租车";
//                        long l = (byCarNo.getEndTime().getTime() - byCarNo.getStartTime().getTime()) / (24 * 3600 * 1000);
//                        carDay = "有效期还有"+l+"天";
//                    }else {
//                        carType = "临时车";
//                    }
//                }
//            }
//            if(StringUtils.isBlank(carDay) && !carNo.equals("无牌车")){
//                carDay = "欢迎光临";
//            }else if(StringUtils.isBlank(carDay) && carNo.equals("无牌车")){
//                carDay = "拒绝驶入";
//            }
//
//            LedBean ledBean = new LedBean();
//            ledBean.setcolor1(0);
//            ledBean.setcolor2(0);
//            ledBean.setcolor3(0);
//            ledBean.setcolor4(0);
//            ledBean.setcontent1(carNo);
//            ledBean.setcontent2(carType);
//            ledBean.setcontent3(carDay);
//            ledBean.setcontent4("余位:"+i);
//            ledBean.setdisMode1(0);
//            ledBean.setdisMode2(0);
//            ledBean.setdisMode3(0);
//            ledBean.setdisMode4(0);
//            ledBean.setvoiceContent(carType+","+carNo+","+carDay);
//            ResultData resultData = CodeUtil.GetResultDataAllLine(ledBean);
//            byte[] dataX = new byte[resultData.getlenth()];
//            System.arraycopy(resultData.getdatas(),0,dataX,0,resultData.getlenth());
//            String data1 = Base64.getMimeEncoder().encodeToString(dataX) + "=";
//            data1 = data1.replaceAll("\r\n", "");
//
//            if(!carNo.equals("无牌车")){
//                open(request,response,data1);//入场开闸
//            }else {
//                noOpen(request,response,data1);
//            }
//        }
//    }
//
//    public void inLedFullShow(String ledId, String carNo, Integer parkId,HttpServletRequest request, HttpServletResponse response) throws IOException {
//        String carType = "";
//        String carDay = "";
//        Barrier barrier = barrierService.findByCode(ledId);
//        WhiteList byCarNo = whiteListService.getByCarNo(carNo);
//        if(byCarNo == null){
//            carType = "临时车";
//        }else {
//            if (byCarNo.getType() == 0){
//                //白名单永久车辆
//                carType = "月租车";
//            }else {
//                //白名单固定停车场车辆
//                if(StringUtils.isNotBlank(byCarNo.getParkIds()) && byCarNo.getParkIds().contains(barrier.getParkId()+"")){
//                    carType = "月租车";
//                }else {
//                    carType = "临时车";
//                }
//            }
//        }
//
//        LedBean ledBean = new LedBean();
//        ledBean.setcolor1(0);
//        ledBean.setcolor2(0);
//        ledBean.setcolor3(0);
//        ledBean.setcolor4(0);
//        ledBean.setcontent1(carNo);
//        ledBean.setcontent2(carType);
//        ledBean.setcontent3("车位已满");
//        ledBean.setcontent4("请驶离");
//        ledBean.setdisMode1(0);
//        ledBean.setdisMode2(0);
//        ledBean.setdisMode3(0);
//        ledBean.setdisMode4(0);
//        ledBean.setvoiceContent("车位已满,请驶离");
//        ResultData resultData = CodeUtil.GetResultDataAllLine(ledBean);
//        byte[] dataX = new byte[resultData.getlenth()];
//        System.arraycopy(resultData.getdatas(),0,dataX,0,resultData.getlenth());
//        String data1 = Base64.getMimeEncoder().encodeToString(dataX) + "=";
//        data1 = data1.replaceAll("\r\n", "");
//
//        noOpen(request,response,data1);//入场开闸
//    }
//
//    public void outLedShow(OutPark outPark,String ledId,String carNo,Double price,String timeStamp,Integer parkId,HttpServletRequest request, HttpServletResponse response,int type) throws ServletException, IOException {
//        String redisnum = redisTemplate.opsForValue().get("car_park_" + parkId);
//        Park park = parkService.getById(parkId);
//        LedBean ledBean = new LedBean();
//        ledBean.setcolor1(0);
//        ledBean.setcolor2(0);
//        ledBean.setcolor3(0);
//        ledBean.setcolor4(0);
//        ledBean.setcontent1(carNo);
//        ledBean.setcontent2("停车"+timeStamp);
//        ledBean.setcontent3("交费"+price+"元");
//        ledBean.setcontent4("禁止闯杆");
//        ledBean.setdisMode1(0);
//        ledBean.setdisMode2(1);
//        ledBean.setdisMode3(1);
//        ledBean.setdisMode4(0);
//        ledBean.setvoiceContent(carNo+"停车"+timeStamp+"交费"+price+"元");
//        ResultData resultData = CodeUtil.GetResultDataAllLine(ledBean);
//        byte[] dataX = new byte[resultData.getlenth()];
//        System.arraycopy(resultData.getdatas(),0,dataX,0,resultData.getlenth());
//        String data1 = Base64.getMimeEncoder().encodeToString(dataX) + "=";
//        data1 = data1.replaceAll("\r\n", "");
//        if(type == 0){
//            if(carNo.equals("无牌车")){
//                noOpen(request,response,data1);
//            }else {
//                if(timeStamp.contains("记录异常")){
//                    OutPark by5min = outParkService.findBy5min(carNo, parkId, LocalDateTime.now());
//                    if(by5min != null){
//                        //开闸
//                        open(request,response,data1);
//                        enterParkService.deleteByCarNo(carNo, parkId);
//                        redisTemplate.opsForValue().set("park_change_in_"+parkId,"true",1, TimeUnit.DAYS);
//                        int i = Integer.parseInt(redisnum);
//                        i--;
//                        if(i<0){
//                            String s= "2."+carNo+",场内停车数为0\n";
//                            writeTxt2(s);
//                            redisTemplate.opsForValue().set("car_park_" + parkId,"0",30, TimeUnit.DAYS);
//                            redisTemplate.opsForValue().set("park_up_" + parkId,"true",30, TimeUnit.DAYS);
//                        }else {
//                            String s= "2."+carNo+",场内停车数为"+i+"\n";
//                            writeTxt2(s);
//                            redisTemplate.opsForValue().set("car_park_" + parkId,Integer.toString(i),30, TimeUnit.DAYS);
//                            redisTemplate.opsForValue().set("park_up_" + parkId,"true",30, TimeUnit.DAYS);
//                        }
//                    }else {
//                        noOpen(request,response,data1);
//                    }
//                }else {
//                    //开闸
//                    open(request,response,data1);
//
//                    //缓存在redis里,心跳接口去抬杆
//                    String jsonValue = JSON.toJSONString(outPark);
//                    redisTemplate.opsForValue().set("outPark-"+outPark.getBarrierId(), jsonValue);
//
//                    enterParkService.deleteByCarNo(carNo, parkId);
//                    redisTemplate.opsForValue().set("park_change_in_"+parkId,"true",1, TimeUnit.DAYS);
//                    int i = Integer.parseInt(redisnum);
//                    i--;
//                    if(i<0){
//                        String s= "2."+carNo+",场内停车数为0\n";
//                        writeTxt2(s);
//                        redisTemplate.opsForValue().set("car_park_" + parkId,"0",30, TimeUnit.DAYS);
//                        redisTemplate.opsForValue().set("park_up_" + parkId,"true",30, TimeUnit.DAYS);
//                    }else {
//                        String s= "2."+carNo+",场内停车数为"+i+"\n";
//                        writeTxt2(s);
//                        redisTemplate.opsForValue().set("car_park_" + parkId,Integer.toString(i),30, TimeUnit.DAYS);
//                        redisTemplate.opsForValue().set("park_up_" + parkId,"true",30, TimeUnit.DAYS);
//                    }
//                }
//
//            }
//        }else {
//            noOpen(request,response,data1);
//        }
//
//    }
//
//    public void outLedShowYueZu(String carNo,String text,Integer parkId,HttpServletRequest request, HttpServletResponse response,int type) throws ServletException, IOException{
//        String redisnum = redisTemplate.opsForValue().get("car_park_" + parkId);
//        LedBean ledBean = new LedBean();
//        ledBean.setcolor1(0);
//        ledBean.setcolor2(0);
//        ledBean.setcolor3(0);
//        ledBean.setcolor4(0);
//        ledBean.setcontent1(carNo);
//        ledBean.setcontent2(text);
//        ledBean.setcontent3("减速慢行");
//        ledBean.setcontent4("欢迎下次光临");
//        ledBean.setdisMode1(0);
//        ledBean.setdisMode2(0);
//        ledBean.setdisMode3(0);
//        ledBean.setdisMode4(1);
//        ledBean.setvoiceContent(text+carNo+"欢迎下次光临");
//        ResultData resultData = CodeUtil.GetResultDataAllLine(ledBean);
//        byte[] dataX = new byte[resultData.getlenth()];
//        System.arraycopy(resultData.getdatas(),0,dataX,0,resultData.getlenth());
//        String data1 = Base64.getMimeEncoder().encodeToString(dataX) + "=";
//        data1 = data1.replaceAll("\r\n", "");
//        if(type == 0){
//            //开闸
//            open(request,response,data1);
//            enterParkService.deleteByCarNo(carNo,parkId);
//            redisTemplate.opsForValue().set("park_change_in_"+parkId,"true",1, TimeUnit.DAYS);
//            int i = Integer.parseInt(redisnum);
//            i--;
//            if(i<0){
//                String s= "2."+carNo+",场内停车数为0\n";
//                writeTxt2(s);
//                redisTemplate.opsForValue().set("car_park_" + parkId,"0",30, TimeUnit.DAYS);
//                redisTemplate.opsForValue().set("park_up_" + parkId,"true",30, TimeUnit.DAYS);
//            }else {
//                String s= "2."+carNo+",场内停车数为"+i+"\n";
//                writeTxt2(s);
//                redisTemplate.opsForValue().set("car_park_" + parkId,Integer.toString(i),30, TimeUnit.DAYS);
//                redisTemplate.opsForValue().set("park_up_" + parkId,"true",30, TimeUnit.DAYS);
//            }
//        }else {
//            noOpen(request,response,data1);
//        }
//    }
//
//    public void outLedShowDefault(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
//        LedBean ledBean = new LedBean();
//        ledBean.setcolor1(0);
//        ledBean.setcolor2(0);
//        ledBean.setcolor3(0);
//        ledBean.setcolor4(0);
//        ledBean.setcontent1("一车一杆");
//        ledBean.setcontent2("减速慢行");
//        ledBean.setcontent3("无需取卡");
//        ledBean.setcontent4("扫码缴费");
//        ledBean.setdisMode1(0);
//        ledBean.setdisMode2(0);
//        ledBean.setdisMode3(0);
//        ledBean.setdisMode4(0);
//        ledBean.setvoiceContent("");
//        ResultData resultData = CodeUtil.GetResultDataAllLine(ledBean);
//        byte[] dataX = new byte[resultData.getlenth()];
//        System.arraycopy(resultData.getdatas(),0,dataX,0,resultData.getlenth());
//        String data1 = Base64.getMimeEncoder().encodeToString(dataX) + "=";
//        data1 = data1.replaceAll("\r\n", "");
//        noOpen(request,response,data1);
//    }
//
//    public void inLedShowDefault(Integer parkId,HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
//        String num = redisTemplate.opsForValue().get("car_park_" +  parkId);
//        String con3 = "";
//        String con4 = "";
//        if(num == null){
//            num = "0";
//        }
//        Park byId = parkService.getById(parkId);
//        int i = byId.getNum() - Integer.parseInt(num);
//        if(i<=0){
//            i = 0;
//            con3 = "车位已满";
//            con4 = "请驶离";
//        }else {
//            con3 = "排队等候";
//            con4 = "余位:"+i;
//        }
//        LedBean ledBean = new LedBean();
//        ledBean.setcolor1(0);
//        ledBean.setcolor2(0);
//        ledBean.setcolor3(0);
//        ledBean.setcolor4(0);
//        ledBean.setcontent1("一车一杆");
//        ledBean.setcontent2("减速慢行");
//        ledBean.setcontent3(con3);
//        ledBean.setcontent4(con4);
//        ledBean.setdisMode1(0);
//        ledBean.setdisMode2(0);
//        ledBean.setdisMode3(0);
//        ledBean.setdisMode4(0);
//        ledBean.setvoiceContent("");
//        ResultData resultData = CodeUtil.GetResultDataAllLine(ledBean);
//        byte[] dataX = new byte[resultData.getlenth()];
//        System.arraycopy(resultData.getdatas(),0,dataX,0,resultData.getlenth());
//        String data1 = Base64.getMimeEncoder().encodeToString(dataX) + "=";
//        data1 = data1.replaceAll("\r\n", "");
//        noOpen(request,response,data1);
//    }
//
//
//}
package com.boying.controller.car;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.boying.common.R;
import com.boying.common.SystemConfigProperties;
import com.boying.entity.*;
import com.boying.service.*;
import com.boying.util.DateUtilOther;
import com.boying.util.FileUtil;
import com.boying.util.RedisJsonUtil;
import com.boying.util.StringUtil;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import ledshow.CodeUtil;
import ledshow.LedBean;
import ledshow.ResultData;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.Base64;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
 * Servlet implementation class PlateServlet
 */
@Controller
@RequestMapping("/ffzf/car")
@RequiredArgsConstructor
public class PlateServlet3 extends HttpServlet {
    private static final long serialVersionUID = 1L;
    private final SystemConfigProperties systemConfigProperties;
    private final StringRedisTemplate redisTemplate;
    private final ParkService parkService;
    private final OutParkService outParkService;
    private final EnterParkService enterParkService;
    private final BarrierService barrierService;
    private final TicketService ticketService;
    private final CostRuleService costRuleService;
    private final WhiteListService whiteListService;
    private final FileInfoService fileInfoService;
    private final TicketBlackService ticketBlackService;
    private final OutParkLogService outParkLogService;
   // private final RedisJsonUtil redisJsonUtil;
    private final String LEDURL = "http://192.168.31.212:9988/LedShow/IGetResultDataAllLine";
    /**
     * 回复开闸
     */
    protected void open(HttpServletRequest request, HttpServletResponse response,String data) throws ServletException, IOException {
        response.setContentType("text/json");
        PrintWriter out = response.getWriter();
        String aa = "{" +
                "\"Response_AlarmInfoPlate\": {" +
                "\"info\":\"ok\"," +
                "\"is_pay\":\"true\"," +
                "\"serialData\" :[" +
                "{" +
                "\"serialChannel\":0," +
                "\"data\" : \"" + data + "\"," +
                "\"dataLen\" :" + data.length() +
                "}" +
                "]" +
                "}" +
                "}";
        out.println(aa);
        out.flush();
        out.close();
    }
    //转码
    public static String deCode(String str) {
        try {
            byte[] b = str.getBytes("UTF-8");//����
            String sa = new String(b);//����:��ʲô�ַ����������ʲô�ַ�������
            //String sa = new String(str.getBytes());
            return sa;
        } catch (Exception e) {
            e.printStackTrace();
            return "";
        }
    }
    protected void noOpen(HttpServletRequest request, HttpServletResponse response,String data) throws IOException {
        response.setContentType("text/json");
        PrintWriter out = response.getWriter();
        String aa = "{" +
                "\"Response_AlarmInfoPlate\": {" +
                "\"serialData\" :[" +
                "{" +
                "\"serialChannel\":0," +
                "\"data\" : \"" + data + "\"," +
                "\"dataLen\" :" + data.length() +
                "}" +
                "]" +
                "}" +
                "}";
        out.println(aa);
        out.flush();
        out.close();
    }
    protected void easyOpen(HttpServletRequest request, HttpServletResponse response) throws IOException {
        response.setContentType("text/json");
        PrintWriter out = response.getWriter();
        out.println("{\"Response_AlarmInfoPlate\":{\"info\":\"ok\",\"content\":\"...\",\"is_pay\":\"true\"}}");
        out.flush();
        out.close();
    }
    protected void easyOpen2(HttpServletRequest request, HttpServletResponse response) throws IOException {
        response.setContentType("text/json");
        PrintWriter out = response.getWriter();
        out.println("{\"Response_AlarmInfoPlate\":{\"ivs_ioctrl\":{\"delay\":1000,\"io\":0,\"value\":2}}}");
        out.flush();
        out.close();
    }
    protected void easyNoOpen(HttpServletRequest request, HttpServletResponse response) throws IOException {
        response.setContentType("text/json");
        PrintWriter out = response.getWriter();
        out.println("{\"Response_AlarmInfoPlate\":{\"info\":\"error\",\"content\":\"...\",\"is_pay\":\"false\"}}");
        out.flush();
        out.close();
    }
    @PostMapping("/status")
    public void heart(String serialno,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
        Barrier barrier = barrierService.findByCode(serialno);
        Park park = parkService.getOneById(barrier.getParkId());
       // Park park = parkService.getById(barrier.getParkId());
       // String redis = redisTemplate.opsForValue().get("park_up_" + park.getId());
        String redisnum = redisTemplate.opsForValue().get("car_park_" + park.getId());
        if(StringUtils.isBlank(redisnum)){
            redisnum = "0";
        }
        if(barrier!=null){
            if(barrier.getType2()==1){
                //待开闸
                if(barrier.getType() == 1){
                    int i = Integer.parseInt(redisnum);
                    i++;
                    redisTemplate.opsForValue().set("car_park_" + park.getId(),Integer.toString(i),30, TimeUnit.DAYS);
                }else if(barrier.getType() == 0){
                    int i = Integer.parseInt(redisnum);
                    i--;
                    if(i<0){
                        String s= "2."+barrier.getCarNo()+"闸机手动启动,场内停车数为"+i+"\n";
                        writeTxt2(s);
                        redisTemplate.opsForValue().set("car_park_" + park.getId(),"0",30, TimeUnit.DAYS);
                        redisTemplate.opsForValue().set("park_up_" + park.getId(),"true",30, TimeUnit.DAYS);
                    }else {
                        String s= "2."+barrier.getCarNo()+"闸机手动启动,场内停车数为"+i+"\n";
                        writeTxt2(s);
                        redisTemplate.opsForValue().set("car_park_" + park.getId(),Integer.toString(i),30, TimeUnit.DAYS);
                        redisTemplate.opsForValue().set("park_up_" + park.getId(),"true",30, TimeUnit.DAYS);
                    }
                }
                barrier.setType2(0);
                barrier.setUpdateTime(LocalDateTime.now());
                barrier.setStatus(0);
                barrier.setUpdateTime(LocalDateTime.now());
                barrierService.saveOrUpdate(barrier);
                String jsonValue = JSON.toJSONString(barrier);
                redisTemplate.opsForValue().set("barrier-"+barrier.getCode(), jsonValue);
                easyOpen(request,response);
            }else {
                //不需开闸
                LocalDateTime now = LocalDateTime.now();
                LocalDateTime updateTime = barrier.getUpdateTime();
                Duration duration = Duration.between(updateTime,now);
                long minutes = duration.toMinutes();
                if(minutes>=2){
                    barrier.setStatus(0);
                    barrier.setUpdateTime(LocalDateTime.now());
                    barrierService.saveOrUpdate(barrier);
                }
                String jsonValue = JSON.toJSONString(barrier);
                redisTemplate.opsForValue().set("barrier-"+barrier.getCode(), jsonValue);
                if(barrier.getType() == 0){
                    OutPark outPark = outParkService.count4(barrier.getId());
                    if(outPark!=null){
                        if(barrier.getType() == 0){
                            int i = Integer.parseInt(redisnum);
                            i--;
                            if(i<0){
                                String s= "2."+outPark.getCarNo()+"缴费完成,场内停车数为"+i+"\n";
                                writeTxt2(s);
                                redisTemplate.opsForValue().set("car_park_" + park.getId(),"0",30, TimeUnit.DAYS);
                                redisTemplate.opsForValue().set("park_up_" + park.getId(),"true",30, TimeUnit.DAYS);
                            }else {
                                String s= "2."+outPark.getCarNo()+"缴费完成,场内停车数为"+i+"\n";
                                writeTxt2(s);
                                redisTemplate.opsForValue().set("car_park_" + park.getId(),Integer.toString(i),30, TimeUnit.DAYS);
                                redisTemplate.opsForValue().set("park_up_" + park.getId(),"true",30, TimeUnit.DAYS);
                            }
                        }
                        outPark.setStatus2(1);
                        outParkService.saveOrUpdate(outPark);
                        easyOpen(request,response);
                        OutParkLog byOutPark = outParkLogService.getByOutPark(outPark.getCarNo(), outPark.getId());
                        byOutPark.setOpenTime(LocalDateTime.now());
                        outParkLogService.saveOrUpdate(byOutPark);
                        enterParkService.deleteByCarNo(outPark.getCarNo(), barrier.getParkId());
                        redisTemplate.delete("outPark-"+outPark.getBarrierId());
                    }
                }
                if(barrier.getType() == 1){
                    boolean in = barrierService.getDateDifIn(park.getId());
                    if(in){
                        inLedShowDefault(park.getId(),request,response);
                    }
                }else if(barrier.getType() == 0){
                    boolean out = barrierService.getDateDifOut(barrier.getId());
                    if(out){
                        outLedShowDefault(request,response);
                    }
                }
            }
        }else {
            easyNoOpen(request,response);
        }
    }
    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    @PostMapping("/PlateServlet")
    protected void info(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String s= "";
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss");
        BufferedReader reader = new BufferedReader(new InputStreamReader(request.getInputStream(),"UTF-8"));
        String str = "";
        String lineStr = "";
        FileInfo fileInfo = null;
        while((str = reader.readLine()) != null){
            lineStr += str;
        }
       // System.out.println("获取到的道闸推送数据为:"+lineStr);
        JSONObject jsonObject1 = JSON.parseObject(lineStr);
        JSONObject alarmInfoPlate = jsonObject1.getJSONObject("AlarmInfoPlate");
        JSONObject result = alarmInfoPlate.getJSONObject("result");
        JSONObject plateResult = result.getJSONObject("PlateResult");
        String carNo = plateResult.get("license").toString();
        String image = plateResult.get("imageFile").toString();
        String code = alarmInfoPlate.get("serialno").toString();
        try {
            JsonParser parser=new JsonParser();
            do {
                JsonObject jsonObject=(JsonObject) parser.parse(lineStr);
                if( jsonObject == null || jsonObject.isJsonNull() ) {
                    break;
                }
                JsonObject jsonInfoPlate = jsonObject.get("AlarmInfoPlate").getAsJsonObject();
                if( jsonInfoPlate == null || jsonInfoPlate.isJsonNull() ) {
                    break;
                }
                JsonObject jsonResult = jsonInfoPlate.get("result").getAsJsonObject();
                if( jsonResult == null || jsonResult.isJsonNull() ) {
                    break;
                }
                JsonObject jsonPlateResult = jsonResult.get("PlateResult").getAsJsonObject();
                if( jsonPlateResult == null || jsonPlateResult.isJsonNull() ) {
                    break;
                }
                String license = jsonPlateResult.get("license").getAsString();//车牌号
                if( license == null || license == "") {
                    break;
                }
                String serialno = jsonInfoPlate.get("serialno").getAsString();//摄像机序列号
                if( serialno == null || serialno == "" ) {
                    break;
                }
                if(StringUtils.isNotBlank(image)){
                    fileInfo = FileUtil.generateBase64StringToFile(image, 1,1);
                    fileInfoService.save(fileInfo);
                }
                System.out.println("编号:"+serialno+"  设备识别到了:"+license);
                String format = sdf.format(new Date());
                s+= format+",车牌号为:"+license+",serialno为:"+code+"  ";
                Barrier barrier = barrierService.findByCode(code);
                System.out.println("查询到道闸为:"+barrier);
                if(barrier==null){
                    s+="查询道闸为空\n";
                    easyNoOpen(request,response);
                }else{
                    if(barrier.getType()==0){
                        outPark(license, barrier.getId(), barrier.getParkId(),request,response,fileInfo);
                        s+=license+"-保存出场记录\n";
                    }else{
                        String num = redisTemplate.opsForValue().get("car_park_" +  barrier.getParkId());
                        if(StringUtils.isBlank(num)){
                            num = "0";
                            redisTemplate.opsForValue().set("car_park_" + barrier.getParkId(),num,30, TimeUnit.DAYS);
                            redisTemplate.opsForValue().set("park_up_" + barrier.getParkId(),"true",30, TimeUnit.DAYS);
                        }
                        Park byId = parkService.getById(barrier.getParkId());
                        if(Integer.parseInt(num) >= byId.getNum() ){
                            //led显示
                            inLedFullShow(code, license,barrier.getParkId(),request,response);
                        }else {
                            //led显示
                            enterPark(license,barrier.getId(),barrier.getParkId(),fileInfo);
                            inLedShow(code, license,barrier.getParkId(),request,response);
                            s+=license+"-保存入场记录\n";
                        }
                    }
                }
                writeTxt(s);
            }while(false);
        }
        catch (Exception e) {
            System.out.println("无入场记录");
            s+=" ,查询场内记录异常";
            writeTxt(s);
            easyNoOpen(request,response);
        }
    }
    /**
     * 手机号入场
     * @param
     * @return
     */
    @PostMapping("/inParkByPhone" )
    @ResponseBody
    public Object inParkByPhone( EnterPark enterPark){
        Barrier barrier = barrierService.getById(enterPark.getBarrierId());
        if(barrier!=null){
            String num = redisTemplate.opsForValue().get("car_park_" +  barrier.getParkId());
            if(StringUtils.isBlank(num)){
                num = "0";
                redisTemplate.opsForValue().set("car_park_" + barrier.getParkId(),num,30, TimeUnit.DAYS);
                redisTemplate.opsForValue().set("park_up_" + barrier.getParkId(),"true",30, TimeUnit.DAYS);
            }
            Park byId = parkService.getById(barrier.getParkId());
            if(Integer.parseInt(num) >= byId.getNum() ){
                return R.failed(null,"禁止通行,车位已满");
            }else {
                QueryWrapper<EnterPark> wrapper2 = new QueryWrapper<>();
                wrapper2.lambda()
                        .eq(EnterPark::getBarrierId,barrier.getId())
                        .orderByDesc(EnterPark::getCreateTime)
                        .last(" limit 1");
                EnterPark one = enterParkService.getOne(wrapper2);
                if(one == null){
                    return R.failed("未查询到车辆存在");
                }else {
                    if(one.getCarNo().equals("_无_")){
                        enterPark.setCreateTime(LocalDateTime.now());
                        QueryWrapper<Ticket> wrapper = new QueryWrapper<>();
                        wrapper.lambda()
                                .eq(Ticket::getCarNo,enterPark.getCarNo())
                                .eq(Ticket::getPayStatus,1);
                        List<Ticket> tickets = ticketService.list(wrapper);
                        if(tickets.size()>0){
                            enterPark.setStatus(1);//发现有违章
                        }
                        enterPark.setIsPay(0);
                        enterPark.setPrice(0);
                        enterParkService.deleteByCarNo(enterPark.getCarNo(),enterPark.getParkId());
                        enterParkService.save(enterPark);
                        barrier.setType2(1);
                        barrierService.updateById(barrier);
                        return R.ok();
                    }else {
                        return R.failed("非法操作");
                    }
                }
            }
        }
        return R.failed(null,"数据异常");
    }
    /**
     * 手机号出场
     * @param
     * @return
     */
    @PostMapping("/outParkByPhone" )
    @ResponseBody
    public Object outParkByPhone(String code2,String carNo){
        Barrier byCode2 = barrierService.findByCode2(code2);
        QueryWrapper<EnterPark> wrapper =new QueryWrapper<>();
        wrapper.lambda()
                .eq(EnterPark::getParkId,byCode2.getParkId())
                .eq(EnterPark::getCarNo,carNo);
        EnterPark one = enterParkService.getOne(wrapper);
        if(one != null){
            double money = 0.0;
            String toDayHrMinSec = null;
            OutPark outPark = new OutPark();
            outPark.setCarNo(carNo);
            outPark.setParkId(one.getParkId());
            outPark.setBarrierId(byCode2.getId());
            outPark.setCreateTime(LocalDateTime.now());
            outPark.setCode(System.currentTimeMillis()+"");
            System.out.println("入场记录:"+one);
            outPark.setEnterTime(one.getCreateTime());
            outPark.setParkName(byCode2.getName());
            if(outPark.getTime() > 0){
                outPark.setTimeStr(DateUtilOther.millisToDayHrMinSec(new Double(outPark.getTime()).longValue()));
            }else {
                outPark.setTimeStr("不足一分钟");
            }
            try {
                long l = outPark.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli() - one.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli();
                outPark.setTime(l/(1000*60));
                toDayHrMinSec = DateUtilOther.millisToDayHrMinSec(l/(1000*60));
                money = costRuleService.getMoney(one.getParkId(), outPark.getEnterTime(), outPark.getCreateTime(), 1);
                //入场记录保存一下
                if(one.getIsPay()==1){
                    money = money - one.getPrice();
                }else {
                    one.setPrice(money);
                    one.setIsPay(0);
                    enterParkService.updateById(one);
                }
            } catch (ParseException e) {
                e.printStackTrace();
            }
            outPark.setPrice(money);
            outPark.setStatus3(findTicket(carNo));
            outParkService.saveOrUpdate(outPark);
            byCode2.setCarNo(carNo);
            //led展示
            if(toDayHrMinSec == null){
                return R.failed("异常记录");
            }
            if(outPark.getPrice()==0&&outPark.getStatus3()==0){
                System.out.println(outPark.getCarNo()+"该车不需要缴费");
                String s= "1."+byCode2.getCarNo()+"该车不需要缴费\n";
                writeTxt2(s);
                byCode2.setType2(1);
                barrierService.updateById(byCode2);
                return R.ok(outPark);
            }else {
                //需要缴费或者有违章
                System.out.println(outPark.getCarNo()+"该车需要缴费"+outPark.getPrice());
                String s= "1."+byCode2.getCarNo()+"该车需要缴费\n";
                writeTxt2(s);
                barrierService.updateById(byCode2);
                return R.ok(outPark);
            }
        }else {
            return R.failed("未查询到入场记录");
        }
    }
    private void writeTxt( String txt)
    {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
        try
        {
            FileWriter f = new FileWriter(systemConfigProperties.getLogPath()+sdf.format(new Date())+".txt",true);
            BufferedWriter bw=new BufferedWriter(f);
            bw.write(txt);
            bw.newLine();
            bw.close();
        }
        catch(Exception e)
        {
            System.out.println("打印错误");
        }
    }
    private void writeTxt2( String txt)
    {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
        try
        {
            FileWriter f = new FileWriter(systemConfigProperties.getLogPath()+sdf.format(new Date())+"LED.txt",true);
            BufferedWriter bw=new BufferedWriter(f);
            bw.write(txt);
            bw.newLine();
            bw.close();
        }
        catch(Exception e)
        {
            System.out.println("打印错误");
        }
    }
    public void enterPark(String carNo,Integer barrierId,Integer parkId,FileInfo fileInfo) {
        TicketBlack black = ticketBlackService.getByCarNo(carNo, 1);
        if(black != null){
            System.out.println("黑名单车辆"+carNo);
        }else {
            enterParkService.deleteByCarNo(carNo,parkId);
            EnterPark enterPark = new EnterPark();
            enterPark.setIsPay(0);
            enterPark.setPrice(0);
            enterPark.setCarNo(carNo);
            enterPark.setBarrierId(barrierId);
            enterPark.setParkId(parkId);
            QueryWrapper<Ticket> wrapper = new QueryWrapper<>();
            wrapper.lambda()
                    .eq(Ticket::getCarNo,enterPark.getCarNo())
                    .eq(Ticket::getPayStatus,1);
            List<Ticket> tickets = ticketService.list(wrapper);
            if(tickets.size()>0){
                enterPark.setStatus(1);//发现有违章
            }
            if(fileInfo != null){
                enterPark.setImgId(fileInfo.getId());
            }
            enterParkService.saveOrUpdate(enterPark);
            String jsonValue = JSON.toJSONString(enterPark);
            redisTemplate.opsForValue().set("enterPark_dif_"+ parkId, jsonValue);
        }
    }
    public double outPark(String carNo,Integer barrierId,Integer parkId,HttpServletRequest request, HttpServletResponse response,FileInfo fileInfo) throws ServletException, IOException {
        double money = 0.0;
        EnterPark enterPark = null;
        String toDayHrMinSec = null;
        OutPark outPark = new OutPark();
        outPark.setCarNo(carNo);
        outPark.setParkId(parkId);
        outPark.setBarrierId(barrierId);
        outPark.setCreateTime(LocalDateTime.now());
        outPark.setCode(System.currentTimeMillis()+"");
        List<EnterPark> byCarNo = enterParkService.findByCarNo(carNo,parkId);
        if(byCarNo.size() == 0){
            System.out.println(carNo+"未发现场内车辆");
        }else{
            enterPark = byCarNo.get(0);
            System.out.println("入场记录:"+enterPark);
            outPark.setEnterTime(enterPark.getCreateTime());
            try {
                long l = outPark.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli() - enterPark.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli();
                outPark.setTime(l/(1000*60));
                toDayHrMinSec = DateUtilOther.millisToDayHrMinSec(l/(1000*60));
                money = costRuleService.getMoney(parkId, outPark.getEnterTime(), outPark.getCreateTime(), 1);
                //入场记录保存一下
                if(enterPark.getIsPay() != null && enterPark.getIsPay()==1){
                    money = money - enterPark.getPrice();
                }else {
                    enterPark.setPrice(money);
                    enterPark.setIsPay(0);
                    enterParkService.updateById(enterPark);
                }
            } catch (ParseException e) {
                e.printStackTrace();
            }
        }
        //outPark.setPrice(Double.valueOf(String.format("%.1f", money)));
        outPark.setPrice(money);
        outPark.setStatus3(findTicket(carNo));
        if(fileInfo != null){
            outPark.setImgId(fileInfo.getId());
        }
        outParkService.saveOrUpdate(outPark);
        Barrier barrier =barrierService.getById(barrierId);
        barrier.setCarNo(carNo);
        //led展示
        if(toDayHrMinSec == null){
            toDayHrMinSec = "入场记录异常,请联系管理员";
        }
        //判断是否在白名单
        QueryWrapper<WhiteList> wrapper = new QueryWrapper<>();
        wrapper.lambda()
                .eq(WhiteList::getCarNo,carNo);
        List<WhiteList> all = whiteListService.list(wrapper);
        if(all.size() >0){
            for(WhiteList w : all){
                if(w.getType()==0){
                    outLedShowYueZu(barrier.getCarNo(),"月租车",parkId,request,response,0);
                    OutPark byCarNoAndBarrierId = outParkService.findByCarNoAndBarrierId(carNo, barrierId);
                    byCarNoAndBarrierId.setStatus(2);
                    byCarNoAndBarrierId.setStatus2(1);
                    outParkService.saveOrUpdate(byCarNoAndBarrierId);
                    barrierService.saveOrUpdate(barrier);
                    String jsonValue2 = JSON.toJSONString(barrier);
                    redisTemplate.opsForValue().set("barrier-"+barrier.getCode(), jsonValue2);
                    String jsonValue = JSON.toJSONString(byCarNoAndBarrierId);
                    redisTemplate.opsForValue().set("outPark_dif_"+ barrierId, jsonValue);
                    return 0.0;
                }else{
                    if(StringUtils.isNotBlank(w.getParkIds())){
                        if(w.getEndTime()!=null){
                            String parkIds = w.getParkIds();
                            String[] split = parkIds.split(",");
                            for (String s : split) {
                                int pid = Integer.parseInt(s);
                                if(pid == outPark.getParkId() && System.currentTimeMillis()<w.getEndTime().getTime()){
                                    outLedShowYueZu(barrier.getCarNo(),"月租车",parkId,request,response,0);
                                    OutPark byCarNoAndBarrierId = outParkService.findByCarNoAndBarrierId(carNo, barrierId);
                                    byCarNoAndBarrierId.setStatus(2);
                                    byCarNoAndBarrierId.setStatus2(1);
                                    outParkService.saveOrUpdate(byCarNoAndBarrierId);
                                    barrierService.saveOrUpdate(barrier);
                                    String jsonValue2 = JSON.toJSONString(barrier);
                                    redisTemplate.opsForValue().set("barrier-"+barrier.getCode(), jsonValue2);
                                    String jsonValue = JSON.toJSONString(byCarNoAndBarrierId);
                                    redisTemplate.opsForValue().set("outPark_dif_"+ barrierId, jsonValue);
                                    return 0.0;
                                }
                            }
                        }
                    }
                }
            }
        }
        barrierService.saveOrUpdate(barrier);
        String jsonValue2 = JSON.toJSONString(barrier);
        redisTemplate.opsForValue().set("barrier-"+barrier.getCode(), jsonValue2);
        if(outPark.getPrice()==0&&outPark.getStatus3()==0){
            System.out.println(outPark.getCarNo()+"该车不需要缴费");
            String s= "1."+barrier.getCarNo()+"该车不需要缴费\n";
            writeTxt2(s);
            String jsonValue = JSON.toJSONString(outPark);
            redisTemplate.opsForValue().set("outPark_dif_"+ barrierId, jsonValue);
            outLedShow(outPark,barrier.getCode(),barrier.getCarNo(),outPark.getPrice(),toDayHrMinSec,barrier.getParkId(),request,response,0);
        }else {
            //需要缴费或者有违章
            System.out.println(outPark.getCarNo()+"该车需要缴费"+outPark.getPrice());
            String s= "1."+barrier.getCarNo()+"该车需要缴费\n";
            writeTxt2(s);
            OutParkLog byOutPark = outParkLogService.getByOutPark(outPark.getCarNo(), outPark.getId());
            byOutPark.setOutTime(outPark.getCreateTime());
            byOutPark.setParkId(outPark.getParkId());
            outParkLogService.saveOrUpdate(byOutPark);
            String jsonValue = JSON.toJSONString(outPark);
            redisTemplate.opsForValue().set("outPark_dif_"+ barrierId, jsonValue);
            outLedShow(outPark,barrier.getCode(),barrier.getCarNo(),outPark.getPrice(),toDayHrMinSec,barrier.getParkId(),request,response,1);
        }
        return money;
    }
    public int findTicket(String carNo){
        QueryWrapper<Ticket> wrapper = new QueryWrapper<>();
        wrapper.lambda()
                .eq(Ticket::getCarNo,carNo)
                .eq(Ticket::getPayStatus,1);
        List<Ticket> tickets = ticketService.list(wrapper);
        if(tickets.size()>0){
            return 1;
        }else{
            return 0;
        }
    }
    public void inLedShow(String ledId,String carNo,Integer parkId,HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        TicketBlack black = ticketBlackService.getByCarNo(carNo, 1);
        if(black != null){
            LedBean ledBean = new LedBean();
            ledBean.setcolor1(0);
            ledBean.setcolor2(0);
            ledBean.setcolor3(0);
            ledBean.setcolor4(0);
            ledBean.setcontent1(carNo);
            ledBean.setcontent2("黑名单车辆");
            ledBean.setcontent3("禁止驶入");
            ledBean.setcontent4("联系管理员");
            ledBean.setdisMode1(0);
            ledBean.setdisMode2(0);
            ledBean.setdisMode3(0);
            ledBean.setdisMode4(0);
            ledBean.setvoiceContent("黑名单车辆"+carNo+",禁止驶入");
            ResultData resultData = CodeUtil.GetResultDataAllLine(ledBean);
            byte[] dataX = new byte[resultData.getlenth()];
            System.arraycopy(resultData.getdatas(),0,dataX,0,resultData.getlenth());
            String data1 = Base64.getMimeEncoder().encodeToString(dataX) + "=";
            data1 = data1.replaceAll("\r\n", "");
            noOpen(request,response,data1);
        }else {
            String num = redisTemplate.opsForValue().get("car_park_" +  parkId);
            if(num == null){
                num = "0";
            }
            Park byId = parkService.getById(parkId);
            int n = Integer.parseInt(num)+1;
            redisTemplate.opsForValue().set("car_park_" + parkId,Integer.toString(n),30, TimeUnit.DAYS);
            int i = byId.getNum() - Integer.parseInt(num);
            if(i<0){
                i = 0;
            }
            String carType = "";
            String carDay = "";
            Barrier barrier = barrierService.findByCode(ledId);
            WhiteList byCarNo = whiteListService.getByCarNo(carNo);
            if(byCarNo == null){
                carType = "临时车";
            }else {
                if (byCarNo.getType() == 0){
                    //白名单永久车辆
                    carType = "月租车";
                }else {
                    //白名单固定停车场车辆
                    if(StringUtils.isNotBlank(byCarNo.getParkIds()) && byCarNo.getParkIds().contains(barrier.getParkId()+"")){
                        carType = "月租车";
                        long l = (byCarNo.getEndTime().getTime() - byCarNo.getStartTime().getTime()) / (24 * 3600 * 1000);
                        carDay = "有效期还有"+l+"天";
                    }else {
                        carType = "临时车";
                    }
                }
            }
            if(StringUtils.isBlank(carDay) && !carNo.equals("_无_")){
                carDay = "欢迎光临";
            }else if(StringUtils.isBlank(carDay) && carNo.equals("_无_")){
                carDay = "拒绝驶入";
            }
            LedBean ledBean = new LedBean();
            ledBean.setcolor1(0);
            ledBean.setcolor2(0);
            ledBean.setcolor3(0);
            ledBean.setcolor4(0);
            ledBean.setcontent1(carNo);
            ledBean.setcontent2(carType);
            ledBean.setcontent3(carDay);
            ledBean.setcontent4("余位:"+i);
            ledBean.setdisMode1(0);
            ledBean.setdisMode2(0);
            ledBean.setdisMode3(0);
            ledBean.setdisMode4(0);
            ledBean.setvoiceContent(carType+","+carNo+","+carDay);
            ResultData resultData = CodeUtil.GetResultDataAllLine(ledBean);
            byte[] dataX = new byte[resultData.getlenth()];
            System.arraycopy(resultData.getdatas(),0,dataX,0,resultData.getlenth());
            String data1 = Base64.getMimeEncoder().encodeToString(dataX) + "=";
            data1 = data1.replaceAll("\r\n", "");
            if(!carNo.equals("_无_")){
                open(request,response,data1);//入场开闸
            }else {
                noOpen(request,response,data1);
            }
        }
    }
    public void inLedFullShow(String ledId, String carNo, Integer parkId,HttpServletRequest request, HttpServletResponse response) throws IOException {
        String carType = "";
        String carDay = "";
        Barrier barrier = barrierService.findByCode(ledId);
        WhiteList byCarNo = whiteListService.getByCarNo(carNo);
        if(byCarNo == null){
            carType = "临时车";
        }else {
            if (byCarNo.getType() == 0){
                //白名单永久车辆
                carType = "月租车";
            }else {
                //白名单固定停车场车辆
                if(StringUtils.isNotBlank(byCarNo.getParkIds()) && byCarNo.getParkIds().contains(barrier.getParkId()+"")){
                    carType = "月租车";
                }else {
                    carType = "临时车";
                }
            }
        }
        LedBean ledBean = new LedBean();
        ledBean.setcolor1(0);
        ledBean.setcolor2(0);
        ledBean.setcolor3(0);
        ledBean.setcolor4(0);
        ledBean.setcontent1(carNo);
        ledBean.setcontent2(carType);
        ledBean.setcontent3("车位已满");
        ledBean.setcontent4("请驶离");
        ledBean.setdisMode1(0);
        ledBean.setdisMode2(0);
        ledBean.setdisMode3(0);
        ledBean.setdisMode4(0);
        ledBean.setvoiceContent("车位已满,请驶离");
        ResultData resultData = CodeUtil.GetResultDataAllLine(ledBean);
        byte[] dataX = new byte[resultData.getlenth()];
        System.arraycopy(resultData.getdatas(),0,dataX,0,resultData.getlenth());
        String data1 = Base64.getMimeEncoder().encodeToString(dataX) + "=";
        data1 = data1.replaceAll("\r\n", "");
        noOpen(request,response,data1);//入场开闸
    }
    public void outLedShow(OutPark outPark,String ledId,String carNo,Double price,String timeStamp,Integer parkId,HttpServletRequest request, HttpServletResponse response,int type) throws ServletException, IOException {
        String redisnum = redisTemplate.opsForValue().get("car_park_" + parkId);
        Park park = parkService.getById(parkId);
        LedBean ledBean = new LedBean();
        ledBean.setcolor1(0);
        ledBean.setcolor2(0);
        ledBean.setcolor3(0);
        ledBean.setcolor4(0);
        ledBean.setcontent1(carNo);
        ledBean.setcontent2("停车"+timeStamp);
        ledBean.setcontent3("交费"+price+"元");
        ledBean.setcontent4("禁止闯杆");
        ledBean.setdisMode1(0);
        ledBean.setdisMode2(1);
        ledBean.setdisMode3(1);
        ledBean.setdisMode4(0);
        ledBean.setvoiceContent(carNo+"停车"+timeStamp+"交费"+price+"元");
        ResultData resultData = CodeUtil.GetResultDataAllLine(ledBean);
        byte[] dataX = new byte[resultData.getlenth()];
        System.arraycopy(resultData.getdatas(),0,dataX,0,resultData.getlenth());
        String data1 = Base64.getMimeEncoder().encodeToString(dataX) + "=";
        data1 = data1.replaceAll("\r\n", "");
        if(type == 0){
            if(carNo.equals("_无_")){
                noOpen(request,response,data1);
            }else {
                if(timeStamp.contains("记录异常")){
                    OutPark by5min = outParkService.findBy5min(carNo, parkId, LocalDateTime.now());
                    if(by5min != null){
                        //开闸
                        open(request,response,data1);
                        enterParkService.deleteByCarNo(carNo, parkId);
                        redisTemplate.opsForValue().set("park_change_in_"+parkId,"true",1, TimeUnit.DAYS);
                        int i = Integer.parseInt(redisnum);
                        i--;
                        if(i<0){
                            String s= "2."+carNo+",场内停车数为0\n";
                            writeTxt2(s);
                            redisTemplate.opsForValue().set("car_park_" + parkId,"0",30, TimeUnit.DAYS);
                            redisTemplate.opsForValue().set("park_up_" + parkId,"true",30, TimeUnit.DAYS);
                        }else {
                            String s= "2."+carNo+",场内停车数为"+i+"\n";
                            writeTxt2(s);
                            redisTemplate.opsForValue().set("car_park_" + parkId,Integer.toString(i),30, TimeUnit.DAYS);
                            redisTemplate.opsForValue().set("park_up_" + parkId,"true",30, TimeUnit.DAYS);
                        }
                    }else {
                        noOpen(request,response,data1);
                    }
                }else {
                    //开闸
                    open(request,response,data1);
                    //缓存在redis里,心跳接口去抬杆
                    String jsonValue = JSON.toJSONString(outPark);
                    redisTemplate.opsForValue().set("outPark-"+outPark.getBarrierId(), jsonValue);
                    enterParkService.deleteByCarNo(carNo, parkId);
                    redisTemplate.opsForValue().set("park_change_in_"+parkId,"true",1, TimeUnit.DAYS);
                    int i = Integer.parseInt(redisnum);
                    i--;
                    if(i<0){
                        String s= "2."+carNo+",场内停车数为0\n";
                        writeTxt2(s);
                        redisTemplate.opsForValue().set("car_park_" + parkId,"0",30, TimeUnit.DAYS);
                        redisTemplate.opsForValue().set("park_up_" + parkId,"true",30, TimeUnit.DAYS);
                    }else {
                        String s= "2."+carNo+",场内停车数为"+i+"\n";
                        writeTxt2(s);
                        redisTemplate.opsForValue().set("car_park_" + parkId,Integer.toString(i),30, TimeUnit.DAYS);
                        redisTemplate.opsForValue().set("park_up_" + parkId,"true",30, TimeUnit.DAYS);
                    }
                }
            }
        }else {
            noOpen(request,response,data1);
        }
    }
    public void outLedShowYueZu(String carNo,String text,Integer parkId,HttpServletRequest request, HttpServletResponse response,int type) throws ServletException, IOException{
        String redisnum = redisTemplate.opsForValue().get("car_park_" + parkId);
        LedBean ledBean = new LedBean();
        ledBean.setcolor1(0);
        ledBean.setcolor2(0);
        ledBean.setcolor3(0);
        ledBean.setcolor4(0);
        ledBean.setcontent1(carNo);
        ledBean.setcontent2(text);
        ledBean.setcontent3("减速慢行");
        ledBean.setcontent4("欢迎下次光临");
        ledBean.setdisMode1(0);
        ledBean.setdisMode2(0);
        ledBean.setdisMode3(0);
        ledBean.setdisMode4(1);
        ledBean.setvoiceContent(text+carNo+"欢迎下次光临");
        ResultData resultData = CodeUtil.GetResultDataAllLine(ledBean);
        byte[] dataX = new byte[resultData.getlenth()];
        System.arraycopy(resultData.getdatas(),0,dataX,0,resultData.getlenth());
        String data1 = Base64.getMimeEncoder().encodeToString(dataX) + "=";
        data1 = data1.replaceAll("\r\n", "");
        if(type == 0){
            //开闸
            open(request,response,data1);
            enterParkService.deleteByCarNo(carNo,parkId);
            redisTemplate.opsForValue().set("park_change_in_"+parkId,"true",1, TimeUnit.DAYS);
            int i = Integer.parseInt(redisnum);
            i--;
            if(i<0){
                String s= "2."+carNo+",场内停车数为0\n";
                writeTxt2(s);
                redisTemplate.opsForValue().set("car_park_" + parkId,"0",30, TimeUnit.DAYS);
                redisTemplate.opsForValue().set("park_up_" + parkId,"true",30, TimeUnit.DAYS);
            }else {
                String s= "2."+carNo+",场内停车数为"+i+"\n";
                writeTxt2(s);
                redisTemplate.opsForValue().set("car_park_" + parkId,Integer.toString(i),30, TimeUnit.DAYS);
                redisTemplate.opsForValue().set("park_up_" + parkId,"true",30, TimeUnit.DAYS);
            }
        }else {
            noOpen(request,response,data1);
        }
    }
    public void outLedShowDefault(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
        LedBean ledBean = new LedBean();
        ledBean.setcolor1(0);
        ledBean.setcolor2(0);
        ledBean.setcolor3(0);
        ledBean.setcolor4(0);
        ledBean.setcontent1("一车一杆");
        ledBean.setcontent2("减速慢行");
        ledBean.setcontent3("无需取卡");
        ledBean.setcontent4("扫码缴费");
        ledBean.setdisMode1(0);
        ledBean.setdisMode2(0);
        ledBean.setdisMode3(0);
        ledBean.setdisMode4(0);
        ledBean.setvoiceContent("");
        ResultData resultData = CodeUtil.GetResultDataAllLine(ledBean);
        byte[] dataX = new byte[resultData.getlenth()];
        System.arraycopy(resultData.getdatas(),0,dataX,0,resultData.getlenth());
        String data1 = Base64.getMimeEncoder().encodeToString(dataX) + "=";
        data1 = data1.replaceAll("\r\n", "");
        noOpen(request,response,data1);
    }
    public void inLedShowDefault(Integer parkId,HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
        String num = redisTemplate.opsForValue().get("car_park_" +  parkId);
        String con3 = "";
        String con4 = "";
        if(num == null){
            num = "0";
        }
        Park byId = parkService.getById(parkId);
        int i = byId.getNum() - Integer.parseInt(num);
        if(i<=0){
            i = 0;
            con3 = "车位已满";
            con4 = "请驶离";
        }else {
            con3 = "排队等候";
            con4 = "余位:"+i;
        }
        LedBean ledBean = new LedBean();
        ledBean.setcolor1(0);
        ledBean.setcolor2(0);
        ledBean.setcolor3(0);
        ledBean.setcolor4(0);
        ledBean.setcontent1("一车一杆");
        ledBean.setcontent2("减速慢行");
        ledBean.setcontent3(con3);
        ledBean.setcontent4(con4);
        ledBean.setdisMode1(0);
        ledBean.setdisMode2(0);
        ledBean.setdisMode3(0);
        ledBean.setdisMode4(0);
        ledBean.setvoiceContent("");
        ResultData resultData = CodeUtil.GetResultDataAllLine(ledBean);
        byte[] dataX = new byte[resultData.getlenth()];
        System.arraycopy(resultData.getdatas(),0,dataX,0,resultData.getlenth());
        String data1 = Base64.getMimeEncoder().encodeToString(dataX) + "=";
        data1 = data1.replaceAll("\r\n", "");
        noOpen(request,response,data1);
    }
}
src/main/java/com/boying/controller/car/PushCallback.java
@@ -1,44 +1,44 @@
package com.boying.controller.car;
/**
 * @author kdq
 * @version 1.0.0
 * @ClassName PushCallback.java
 * @Description TODO
 * @createTime 2024年03月20日 15:42:00
 */
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttMessage;
/**
 * 必须实现MqttCallback的接口并实现对应的相关接口方法CallBack 类将实现 MqttCallBack。
 * 每个客户机标识都需要一个回调实例。在此示例中,构造函数传递客户机标识以另存为实例数据。
 * 在回调中,将它用来标识已经启动了该回调的哪个实例。
 * 必须在回调类中实现三个方法:
 *  public void messageArrived(MqttTopic topic, MqttMessage message)接收已经预订的发布。
 *  public void connectionLost(Throwable cause)在断开连接时调用。
 *  public void deliveryComplete(MqttDeliveryToken token))
 *  接收到已经发布的 QoS 1 或 QoS 2 消息的传递令牌时调用。
 *  由 MqttClient.connect 激活此回调。
 */
public class PushCallback implements MqttCallback{
    @Override
    public void connectionLost(Throwable cause) {
        // 连接丢失后,一般在这里面进行重连
        System.out.println("连接断开……(可以做重连)");
    }
    @Override
    public void deliveryComplete(IMqttDeliveryToken token) {
        System.out.println("deliveryComplete---------" + token.isComplete());
    }
    @Override
    public void messageArrived(String topic, MqttMessage message) throws Exception {
        // subscribe后得到的消息会执行到这里面
        System.out.println("接收消息主题:" + topic + "  接收消息Qos:" + message.getQos() + "接收消息内容:" + new String(message.getPayload()));
    }
}
//package com.boying.controller.car;
//
///**
// * @author kdq
// * @version 1.0.0
// * @ClassName PushCallback.java
// * @Description TODO
// * @createTime 2024年03月20日 15:42:00
// */
//import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
//import org.eclipse.paho.client.mqttv3.MqttCallback;
//import org.eclipse.paho.client.mqttv3.MqttMessage;
//
///**
// * 必须实现MqttCallback的接口并实现对应的相关接口方法CallBack 类将实现 MqttCallBack。
// * 每个客户机标识都需要一个回调实例。在此示例中,构造函数传递客户机标识以另存为实例数据。
// * 在回调中,将它用来标识已经启动了该回调的哪个实例。
// * 必须在回调类中实现三个方法:
// *  public void messageArrived(MqttTopic topic, MqttMessage message)接收已经预订的发布。
// *  public void connectionLost(Throwable cause)在断开连接时调用。
// *  public void deliveryComplete(MqttDeliveryToken token))
// *  接收到已经发布的 QoS 1 或 QoS 2 消息的传递令牌时调用。
// *  由 MqttClient.connect 激活此回调。
// */
//public class PushCallback implements MqttCallback{
//
//    @Override
//    public void connectionLost(Throwable cause) {
//        // 连接丢失后,一般在这里面进行重连
//        System.out.println("连接断开……(可以做重连)");
//    }
//
//    @Override
//    public void deliveryComplete(IMqttDeliveryToken token) {
//        System.out.println("deliveryComplete---------" + token.isComplete());
//    }
//
//    @Override
//    public void messageArrived(String topic, MqttMessage message) throws Exception {
//        // subscribe后得到的消息会执行到这里面
//        System.out.println("接收消息主题:" + topic + "  接收消息Qos:" + message.getQos() + "接收消息内容:" + new String(message.getPayload()));
//
//    }
//}
src/main/java/com/boying/controller/car/ServerMQTT.java
@@ -1,93 +1,93 @@
package com.boying.controller.car;
import org.eclipse.paho.client.mqttv3.*;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
/**
 * @author kdq
 * @version 1.0.0
 * @ClassName ServerMQTT.java
 * @Description TODO
 * @createTime 2024年03月20日 15:43:00
 */
public class ServerMQTT {
    public static void main(String[] args) throws MqttException {
        ServerMQTT server = new ServerMQTT();
        server.message = new MqttMessage();
        server.message.setQos(2);
        server.message.setRetained(true);
        server.message.setPayload("ServerMQTT".getBytes());
        server.publish(server.topic , server.message);
        System.out.println(server.message.isRetained() + "------ratained状态");
    }
    //MQTT安装的服务器地址和端口号
    public static final String HOST = "tcp://39.96.92.240:9092";
    //定义一个主题
    public static final String TOPIC = "/device/message/up/ivs_result";
    //定义MQTT的ID,可以在MQTT服务配置中指定
    private static final String clientid = "client-1";
    private MqttClient client;
    private MqttTopic topic;
    private String userName = "mqtt";
    private String passWord = "mqtt";
    private MqttMessage message;
    /**
     * g构造函数
     */
    public ServerMQTT() throws MqttException {
        // MemoryPersistence设置clientid的保存形式,默认为以内存保存
        client = new MqttClient(HOST, clientid, new MemoryPersistence());
        connect();
    }
    /**
     * l连接服务器
     */
    private void connect() {
        MqttConnectOptions options = new MqttConnectOptions();
        options.setCleanSession(false);
        options.setUserName(userName);
        options.setPassword(passWord.toCharArray());
        // 设置超时时间
        options.setConnectionTimeout(10);
        // 设置会话心跳时间
        options.setKeepAliveInterval(20);
        try {
            client.setCallback(new MqttCallback() {
                @Override
                public void connectionLost(Throwable cause) {
                    // 连接丢失后,一般在这里面进行重连
                    System.out.println("连接断开……(可以做重连)");
                }
                @Override
                public void deliveryComplete(IMqttDeliveryToken token) {
                    System.out.println("deliveryComplete---------" + token.isComplete());
                }
                @Override
                public void messageArrived(String topic, MqttMessage message) throws Exception {
                    // subscribe后得到的消息会执行到这里面
                    System.out.println("接收消息主题:" + topic + "  接收消息Qos:" + message.getQos() + "接收消息内容:" + new String(message.getPayload()));
                }
            });
            client.connect(options);
            topic = client.getTopic(TOPIC);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
     * t推送消息
     */
    public void publish(MqttTopic topic , MqttMessage message) throws MqttPersistenceException, MqttException {
        MqttDeliveryToken token = topic.publish(message);
        token.waitForCompletion();
        System.out.println("message is published completely! " + token.isComplete());
    }
}
//package com.boying.controller.car;
//
//import org.eclipse.paho.client.mqttv3.*;
//import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
//
///**
// * @author kdq
// * @version 1.0.0
// * @ClassName ServerMQTT.java
// * @Description TODO
// * @createTime 2024年03月20日 15:43:00
// */
//public class ServerMQTT {
//
//    public static void main(String[] args) throws MqttException {
//        ServerMQTT server = new ServerMQTT();
//
//        server.message = new MqttMessage();
//        server.message.setQos(2);
//        server.message.setRetained(true);
//        server.message.setPayload("ServerMQTT".getBytes());
//        server.publish(server.topic , server.message);
//        System.out.println(server.message.isRetained() + "------ratained状态");
//    }
//
//    //MQTT安装的服务器地址和端口号
//    public static final String HOST = "tcp://39.96.92.240:9092";
//    //定义一个主题
//    public static final String TOPIC = "/device/message/up/ivs_result";
//    //定义MQTT的ID,可以在MQTT服务配置中指定
//    private static final String clientid = "client-1";
//
//    private MqttClient client;
//    private MqttTopic topic;
//    private String userName = "mqtt";
//    private String passWord = "mqtt";
//    private MqttMessage message;
//
//    /**
//     * g构造函数
//     */
//    public ServerMQTT() throws MqttException {
//        // MemoryPersistence设置clientid的保存形式,默认为以内存保存
//        client = new MqttClient(HOST, clientid, new MemoryPersistence());
//        connect();
//    }
//
//    /**
//     * l连接服务器
//     */
//    private void connect() {
//        MqttConnectOptions options = new MqttConnectOptions();
//        options.setCleanSession(false);
//        options.setUserName(userName);
//        options.setPassword(passWord.toCharArray());
//        // 设置超时时间
//        options.setConnectionTimeout(10);
//        // 设置会话心跳时间
//        options.setKeepAliveInterval(20);
//        try {
//            client.setCallback(new MqttCallback() {
//                @Override
//                public void connectionLost(Throwable cause) {
//                    // 连接丢失后,一般在这里面进行重连
//                    System.out.println("连接断开……(可以做重连)");
//                }
//                @Override
//                public void deliveryComplete(IMqttDeliveryToken token) {
//                    System.out.println("deliveryComplete---------" + token.isComplete());
//                }
//                @Override
//                public void messageArrived(String topic, MqttMessage message) throws Exception {
//                    // subscribe后得到的消息会执行到这里面
//                    System.out.println("接收消息主题:" + topic + "  接收消息Qos:" + message.getQos() + "接收消息内容:" + new String(message.getPayload()));
//                }
//            });
//            client.connect(options);
//
//            topic = client.getTopic(TOPIC);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//    }
//
//    /**
//     * t推送消息
//     */
//    public void publish(MqttTopic topic , MqttMessage message) throws MqttPersistenceException, MqttException {
//        MqttDeliveryToken token = topic.publish(message);
//        token.waitForCompletion();
//        System.out.println("message is published completely! " + token.isComplete());
//    }
//}
src/main/java/com/boying/controller/phone/NoticeController.java
@@ -7,8 +7,7 @@
import com.boying.entity.Park;
import com.boying.service.EnterParkService;
import com.boying.service.ParkService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -19,7 +18,6 @@
@RestController
@RequestMapping("ffzf/notice")
@RequiredArgsConstructor
@Tag(description = "ffzf/notice" , name = "违法通知接口" )
public class NoticeController {
    private final EnterParkService enterParkService;
@@ -27,7 +25,6 @@
    //停车场内有违法的车辆
    @PostMapping("/illegalCar")
    @Operation(summary = "根据id查询停车场内所有违法车辆" , description = "根据id查询停车场内所有违法车辆" )
    public Object illegalCar(Long parkId){
        QueryWrapper<EnterPark> wrapper = new QueryWrapper<>();
        wrapper.lambda()
@@ -39,7 +36,6 @@
    //停车场内有违法的车辆
    @PostMapping("/illegalCar2")
    @Operation(summary = "查询所有停车场内所有违法车辆" , description = "查询所有停车场内所有违法车辆" )
    public Object illegalCar2(){
        QueryWrapper<EnterPark> wrapper = new QueryWrapper<>();
        wrapper.lambda()
@@ -54,7 +50,6 @@
    }
    @PostMapping("/enterPark")
    @Operation(summary = "停车场内的车辆 根据状态查询" , description = "停车场内的车辆 根据状态查询" )
    public Object enterPark(Integer status, Page page){
        if(status==null){
            Page page1 = enterParkService.page(page);
src/main/java/com/boying/controller/phone/PayController.java
@@ -15,8 +15,7 @@
import com.boying.service.*;
import com.boying.util.HTTPEntityUtil;
import com.google.gson.Gson;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
@@ -47,7 +46,6 @@
@RestController
@RequestMapping("ffzf/ffPay")
@RequiredArgsConstructor
@Tag(description = "ffzf/ffPay" , name = "对接财政支付接口" )
public class PayController extends BaseController {
    private final OrderRecordService orderRecordService;
@@ -70,7 +68,6 @@
    //生成电子缴款码
    @PostMapping("zhiFa")
    @Operation(summary = "执法生成缴款码" , description = "执法生成缴款码" )
    public Object zhiFa(Long id){
        Ticket ticket = ticketService.getById(id);
        if(ticket.getPayStatus()==1){
@@ -172,7 +169,6 @@
    //支付接口通知
    @PostMapping("result")
    @Operation(summary = "缴费结果通知" , description = "缴费结果通知" )
    public String result(HttpServletRequest request, String payKey, String payerTypeCode, String payerNum, String payCode, Double amt, String status, String errorInfo, String sign, String signType) throws Exception{
        try {
           // updateOrderRecord(payCode,status);
@@ -184,7 +180,6 @@
    //生成电子缴款码
    @PostMapping("park2")
    @Operation(summary = "财政缴费更新生成缴款码" , description = "财政缴费更新生成缴款码" )
    public Object park2(Long id){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss");
        String logs = sdf.format(new Date())+"开始扫码缴费------》\n";
@@ -283,7 +278,6 @@
     * 缴款书
     */
    @PostMapping("park")
    @Operation(summary = "对接邮储生成缴款书" , description = "对接邮储生成缴款书" )
    public Object park(Long id){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss");
        String logs = sdf.format(new Date())+"开始扫码缴费------》\n";
@@ -396,7 +390,6 @@
     * 获取执法id
     */
    @PostMapping("getZhifaId")
    @Operation(summary = "更新大厅缴款码" , description = "更新大厅缴款码" )
    public Object getZhifaId(){
        QueryWrapper<NowPayOrder> wrapper = new QueryWrapper<>();
        wrapper.lambda()
@@ -415,7 +408,6 @@
     * 缴款书
     */
    @PostMapping("zhifa")
    @Operation(summary = "执法缴费(新)" , description = "执法缴费(新)" )
    public Object zhifa(Long id){
        System.out.println(id+"开始缴费");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss");
src/main/java/com/boying/controller/phone/TicketController.java
@@ -12,8 +12,7 @@
import com.boying.util.FileUtil;
import com.boying.util.NumberToCN;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
@@ -40,7 +39,6 @@
@RestController
@RequestMapping("ffzf/ticket")
@RequiredArgsConstructor
@Tag(description = "ffzf/ticket" , name = "手持开罚单接口" )
public class TicketController{
@@ -68,7 +66,6 @@
    //图片回显
    @RequestMapping(value = "/showImg", method = RequestMethod.GET)
    @Operation(summary = "图片回显" , description = "图片回显" )
    public void getAwardAsByteArray(HttpServletResponse response, HttpServletRequest request) throws IOException {
        String result = request.getParameter("result");
        InputStream in = null;
@@ -85,7 +82,6 @@
    }
    @PostMapping("findPage")
    @Operation(summary = "分页查询" , description = "分页查询" )
    public Object findPage(Page page, Ticket ticket){
        QueryWrapper<Ticket> wrapper =  new QueryWrapper<>();
        wrapper.lambda()
@@ -99,7 +95,6 @@
    }
    @PostMapping("/save")
    @Operation(summary = "保存罚单" , description = "保存罚单" )
    public Object save(Ticket ticket,HttpServletRequest request) throws IOException{
        String imgStr = "";
        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
@@ -170,7 +165,6 @@
    }
    @PostMapping("/save2")
    @Operation(summary = "保存罚单(废弃)" , description = "保存罚单(废弃)" )
    public Object save2(Ticket ticket) throws IOException{
        if(ticket.getUserId()!=null){
            User user = userService.getById(ticket.getUserId());
@@ -201,7 +195,6 @@
     */
    @ApiOperation(value = "通过id查询", notes = "通过id查询")
    @GetMapping("/{id}" )
    @Operation(summary = "通过id查询罚单" , description = "通过id查询罚单" )
    public R getById(@PathVariable("id" ) Integer id) {
        Ticket byId = ticketService.getById(id);
        byId.setContent(violationTypeService.getById(byId.getViolationTypeId()).getContent());
@@ -225,7 +218,6 @@
    @PostMapping("/delete")
    @Operation(summary = "删除罚单" , description = "删除罚单" )
    public Object delete(Long id){
        Ticket ticket =ticketService.getById(id);
        ticket.setStatus(3);
@@ -243,7 +235,6 @@
    }
    @PostMapping("/updateById")
    @Operation(summary = "更新罚单状态" , description = "更新罚单状态" )
    public Object updateById(Ticket ticket){
        if(ticket.getMoney() >0){
            BigDecimal numberOfMoney = new BigDecimal(ticket.getMoney()+"");
@@ -274,7 +265,6 @@
    //与执法对接
    @GetMapping("/getResult")
    @Operation(summary = "与执法平台对接,获取签字结果" , description = "与执法平台对接,获取签字结果" )
    public Object getResult(Ticket ticket){
        ticketService.updateById(ticket);
        return R.ok();
@@ -313,7 +303,6 @@
    }
    @PostMapping("/getZhiFa")
    @Operation(summary = "根据状态查询罚单" , description = "根据状态查询罚单" )
    public Object getZhiFa(Integer status,Page page){
        QueryWrapper<Ticket> wrapper = new QueryWrapper<>();
@@ -325,7 +314,6 @@
    }
    @PostMapping("/getCar")
    @Operation(summary = "获取黑名单车辆" , description = "获取黑名单车辆" )
    public Object getCar(String carNo,Page page,int type){
        QueryWrapper<TicketBlack> wrapper = new QueryWrapper<>();
        wrapper.lambda()
@@ -336,7 +324,6 @@
    }
    @PostMapping("/getCarList")
    @Operation(summary = "根据车牌分页获取罚单" , description = "根据车牌分页获取罚单" )
    public Object getCarList(String carNo,Page page){
        QueryWrapper<Ticket> wrapper = new QueryWrapper<>();
        wrapper.lambda()
@@ -347,7 +334,6 @@
    @PostMapping("/noFound")
    @Operation(summary = "更新罚单状态,增加备注" , description = "更新罚单状态,增加备注" )
    public Object noFound(Long ticketId,String remark){
        Ticket ticket = ticketService.getById(ticketId);
        ticket.setStatus(2);
@@ -357,7 +343,6 @@
    }
    @PostMapping("/getStatisticByYear")
    @Operation(summary = "统计年度罚单" , description = "统计年度罚单" )
    public Object getStatistic(int year){
        Map<String,Object> map = new HashMap<>();
        List<Object> list = new ArrayList<>();
@@ -394,7 +379,6 @@
    }
    @PostMapping("/getOrderList")
    @Operation(summary = "根据年和月统计罚单" , description = "根据年和月统计罚单" )
    public Object getOrderList(int year,int month){
        Date yearFirst = DateUtilOther.getFirstDayOfMonth(year,month);
@@ -408,7 +392,6 @@
    }
    @PostMapping("findById")
    @Operation(summary = "根据id查询" , description = "根据id查询" )
    public Object findById(Long id){
        Ticket ticket = ticketService.getById(id);
        if(ticket.getViolationTypeId()!=null){
@@ -426,7 +409,6 @@
     */
    @ApiOperation(value = "手动缴费", notes = "手动缴费")
    @PostMapping("/jiaofei" )
    @Operation(summary = "手动缴费更新二维码" , description = "手动缴费更新二维码" )
    public R jiaofei(Integer id) {
        Ticket byId = ticketService.getById(id);
        if(byId.getPayStatus() == 1){
@@ -450,7 +432,6 @@
     */
    @ApiOperation(value = "测试对接", notes = "测试对接")
    @GetMapping("/test" )
    @Operation(summary = "测试对接执法平台" , description = "测试对接执法平台" )
    public R test() {
        Ticket byId = ticketService.getById(13);
        byId = ticketService.getNumber(byId);
src/main/java/com/boying/controller/phone/UpdateAppController.java
@@ -3,8 +3,6 @@
import com.boying.common.R;
import com.boying.entity.UpdateApp;
import com.boying.service.UpdateAppService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -15,13 +13,11 @@
@RestController
@RequestMapping("ffzf/updateApp")
@RequiredArgsConstructor
@Tag(description = "ffzf/updateApp" , name = "app更新接口" )
public class UpdateAppController{
    private final UpdateAppService updateAppService;
    @PostMapping("/getUpdateApp")
    @Operation(summary = "获取最新app版本" , description = "获取最新app版本" )
    public Object getUpdateApp(){
        List<UpdateApp> all = updateAppService.list();
        if(all.size()==0){
src/main/java/com/boying/controller/phone/YCPayController.java
@@ -13,8 +13,7 @@
import com.boying.service.*;
import com.boying.util.DateUtilOther;
import com.google.gson.Gson;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.ResponseEntity;
@@ -48,7 +47,6 @@
@RestController
@RequestMapping("/ffzf/api")
@RequiredArgsConstructor
@Tag(description = "ffzf/api" , name = "邮储/邢台银行 对接支付接口" )
public class YCPayController {
    private final OutParkService outParkService;
    private final PayLogService payLogService;
@@ -71,7 +69,6 @@
     * @return
     */
    @GetMapping("/getByQueryId")
    @Operation(summary = "根据出场id获取出场数据" , description = "根据出场id获取出场数据" )
    public Object getByQueryId(Long queryId){
        if(queryId == null){
            return R.failed("参数为空");
@@ -87,7 +84,6 @@
     * 缴款书
     */
    @PostMapping("park")
    @Operation(summary = "邮储申请缴款书" , description = "邮储申请缴款书" )
    public Object park(Long id){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss");
        OutPark outPark =  outParkService.getById(id);
@@ -157,7 +153,6 @@
     * @return
     */
    @PostMapping("parkJudg")
    @Operation(summary = "判断支付端是否已经申请过支付" , description = "判断支付端是否已经申请过支付" )
    public Object parkJudg(Long id){
        if(id == null){
            return R.failed("未找到数据,请稍后重新点击");
@@ -188,7 +183,6 @@
     * 判断是否缴费
     */
    @PostMapping("parkXT")
    @Operation(summary = "邢台银行申请缴费" , description = "邢台银行申请缴费" )
    public Object parkXT(Long id){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss");
        OutPark outPark =  outParkService.getById(id);
@@ -263,7 +257,6 @@
     * 阿里缴费
     */
    @PostMapping("payByAli")
    @Operation(summary = "邢台银行支付宝缴费" , description = "邢台银行支付宝缴费" )
    public Object payByAli(Long id){
        OutPark outPark =  outParkService.getById(id);
        String xtyhpay = systemConfigProperties.getXTYHPAY();
@@ -339,7 +332,6 @@
     * 获取微信openid
     */
    @PostMapping("getOpenId")
    @Operation(summary = "邢台银行获取微信用户openid" , description = "邢台银行获取微信用户openid" )
    public Object park(Long id,String code){
        OutPark outPark =  outParkService.getById(id);
        String openIdByCode = wxService.getOpenIdByCode(code);
@@ -351,7 +343,6 @@
     * 微信缴费
     */
    @PostMapping("payByWX")
    @Operation(summary = "邢台银行微信支付" , description = "邢台银行微信支付" )
    public Object payByWX(Long id,String openId){
        System.out.println("开始支付");
        OutPark outPark =  outParkService.getById(id);
@@ -444,7 +435,6 @@
     * @return
     */
    @GetMapping("/result")
    @Operation(summary = "邮储获得支付回调" , description = "邮储获得支付回调" )
    public Object result(Long queryId,int success,int msg){
        OutPark byId = outParkService.getById(queryId);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss");
@@ -479,7 +469,6 @@
     * @return
     */
    @PostMapping("/getResult")
    @Operation(summary = "邢台银行支付回调接口" , description = "邢台银行支付回调接口" )
    public Object getResult(HttpServletRequest request){
        System.out.println("getResult收到访问");
        String respCode = request.getParameter("respCode");
@@ -534,7 +523,6 @@
     * @return
     */
    @PostMapping ("/checkbill")
    @Operation(summary = "邮储对账接口" , description = "邮储对账接口" )
    public Object checkbill(@RequestBody Map params){
        String checkDate = (String) params.get("checkDate");
        String tranDate = (String) params.get("tranDate");
@@ -556,7 +544,6 @@
     * @return
     */
    @PostMapping ("/checkbillXTYH")
    @Operation(summary = "邢台银行对账接口" , description = "邢台银行对账接口" )
    public Object checkbillXTYH(String date){
        String xtyhpay = systemConfigProperties.getXTYHPAY();
        Map<String,Object> map = new HashMap<>();
@@ -601,7 +588,6 @@
     * @return
     */
    @PostMapping ("/searchPayStatus")
    @Operation(summary = "交易状态查询" , description = "交易状态查询" )
    public Object searchPayStatus(String txnOrderId,String txnOrderTime){
        OutPark outPark = outParkService.findByOrderId(txnOrderId);
        if(outPark == null){