| | |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | 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.NumberToCN; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.commons.io.FileUtils; |
| | | import org.apache.commons.io.FilenameUtils; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.math.BigDecimal; |
| | | import java.text.DateFormat; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | |
| | | |
| | | private final TicketService ticketService; |
| | | |
| | | private final SystemConfigProperties systemConfigProperties; |
| | | @Value("${ffpark.uploadPath}") |
| | | private String uploadImgPath; |
| | | @Value("${ffpark.ip2}") |
| | | private String ip2; |
| | | |
| | | // @Autowired |
| | | // private final SystemConfigProperties systemConfigProperties; |
| | | |
| | | private final UserService userService; |
| | | |
| | |
| | | |
| | | private final StreetLogoService streetLogoService; |
| | | |
| | | private final NowPayOrderService nowPayOrderService; |
| | | |
| | | //图片回显 |
| | | @RequestMapping(value = "/showImg", method = RequestMethod.GET) |
| | | public void getAwardAsByteArray(HttpServletResponse response, HttpServletRequest request) throws IOException { |
| | | String result = request.getParameter("result"); |
| | | InputStream in = null; |
| | | in = FileUtils.openInputStream(new File(systemConfigProperties.getUploadImgPath()+result)); |
| | | in = FileUtils.openInputStream(new File(uploadImgPath+result)); |
| | | response.setContentType(MediaType.IMAGE_PNG_VALUE); |
| | | ServletOutputStream out = response.getOutputStream(); |
| | | try { |
| | |
| | | public Object findPage(Page page, Ticket ticket){ |
| | | QueryWrapper<Ticket> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda() |
| | | .eq(StringUtils.isNotBlank(ticket.getCarNo()),Ticket::getCarNo,ticket.getCarNo()) |
| | | .like(StringUtils.isNotBlank(ticket.getCarNo()),Ticket::getCarNo,ticket.getCarNo()) |
| | | .eq(ticket.getType() != null,Ticket::getType,ticket.getType()) |
| | | .eq(ticket.getViolationTypeId() != null,Ticket::getViolationTypeId,ticket.getViolationTypeId()) |
| | | .eq(ticket.getPayStatus() != null,Ticket::getPayStatus,ticket.getPayStatus()) |
| | | .ne(Ticket::getStatus,3) |
| | | .orderByDesc(Ticket::getCreateTime); |
| | | return R.ok(ticketService.page(page, wrapper)); |
| | | } |
| | |
| | | if(multipartFile != null){ |
| | | String fileExtension = FilenameUtils.getExtension(multipartFile.getOriginalFilename());//获取后缀 |
| | | String newFileName = System.currentTimeMillis() + "." + fileExtension;//图片名称 |
| | | String newFilePath = systemConfigProperties.getUploadImgPath() + newFileName;//上传路径 |
| | | String newFilePath = uploadImgPath + newFileName;//上传路径 |
| | | File destFile = new File(newFilePath); |
| | | FileUtils.writeByteArrayToFile(destFile, multipartFile.getBytes()); |
| | | if(i != imgs.size()-1){ |
| | |
| | | } |
| | | |
| | | ticket.setStatus(1);//已处理 |
| | | ticket.setPayStatus(0); |
| | | |
| | | ticketService.saveOrUpdate(ticket); |
| | | if(StringUtils.isBlank(ticket.getQrUrl())){ |
| | | ticket.setQrUrl(systemConfigProperties.getIp2()+"#/index?id="+ticket.getId()); |
| | | ticket.setQrUrl(ip2+"#/index?id="+ticket.getId()); |
| | | ticketService.saveOrUpdate(ticket); |
| | | } |
| | | |
| | | if(StringUtils.isNotBlank(ticket.getLng())&&StringUtils.isNotBlank(ticket.getLat())){ |
| | | saveLogo(ticket.getAddress(),ticket.getLng(),ticket.getLat()); |
| | | } |
| | | if(ticket.getType() == 2){ |
| | | try { |
| | | ticket.setPayStatus(1); |
| | | QueryWrapper<TicketBlack> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda() |
| | | .eq(TicketBlack::getCarNo,ticket.getCarNo()); |
| | | List<TicketBlack> list = ticketBlackService.list(wrapper); |
| | | if(list.size()>0){ |
| | | for (TicketBlack ticketBlack : list) { |
| | | ticketBlackService.removeById(ticketBlack.getId()); |
| | | } |
| | | } |
| | | ticket = ticketService.getNumber(ticket); |
| | | ticket.setPush(0); |
| | | ticketService.uploadInfo(ticket); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return R.ok(ticket); |
| | | } |
| | |
| | | updateBlackTicket(ticket); |
| | | |
| | | ticketService.saveOrUpdate(ticket); |
| | | ticket.setQrUrl(systemConfigProperties.getIp2()+"#/index?id="+ticket.getId()); |
| | | ticket.setQrUrl(ip2+"#/index?id="+ticket.getId()); |
| | | ticket.setType(1); |
| | | ticketService.saveOrUpdate(ticket); |
| | | return R.ok(ticket); |
| | |
| | | public R getById(@PathVariable("id" ) Integer id) { |
| | | Ticket byId = ticketService.getById(id); |
| | | byId.setContent(violationTypeService.getById(byId.getViolationTypeId()).getContent()); |
| | | String shouQianMing = byId.getShouQianMing(); |
| | | String zfQianMing1 = byId.getZfQianMing1(); |
| | | String zfQianMing2 = byId.getZfQianMing2(); |
| | | if(StringUtils.isNotBlank(shouQianMing)){ |
| | | String get = FileUtil.netSourceToBase64(shouQianMing, "GET"); |
| | | byId.setShouQianMing("data:image/png;base64,"+get); |
| | | } |
| | | if(StringUtils.isNotBlank(zfQianMing1)){ |
| | | String get = FileUtil.netSourceToBase64(zfQianMing1, "GET"); |
| | | byId.setZfQianMing1("data:image/png;base64,"+get); |
| | | } |
| | | if(StringUtils.isNotBlank(zfQianMing2)){ |
| | | String get = FileUtil.netSourceToBase64(zfQianMing2, "GET"); |
| | | byId.setZfQianMing2("data:image/png;base64,"+get); |
| | | } |
| | | return R.ok(byId); |
| | | } |
| | | |
| | |
| | | Ticket ticket =ticketService.getById(id); |
| | | ticket.setStatus(3); |
| | | ticketService.saveOrUpdate(ticket); |
| | | QueryWrapper<TicketBlack> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda() |
| | | .eq(TicketBlack::getCarNo,ticket.getCarNo()); |
| | | List<TicketBlack> list = ticketBlackService.list(wrapper); |
| | | if(list.size()>0){ |
| | | for (TicketBlack ticketBlack : list) { |
| | | ticketBlackService.removeById(ticketBlack.getId()); |
| | | } |
| | | } |
| | | return R.ok("操作成功"); |
| | | } |
| | | |
| | |
| | | String s = NumberToCN.number2CNMontrayUnit(numberOfMoney); |
| | | ticket.setMoneyStr(s.toString()); |
| | | } |
| | | return R.ok(ticketService.updateById(ticket)); |
| | | if(ticket.getMoney() == 0){ |
| | | if(StringUtils.isBlank(ticket.getNumber())){ |
| | | ticket = ticketService.getNumber(ticket); |
| | | ticket.setPush(0); |
| | | ticketService.uploadInfo(ticket); |
| | | } |
| | | } |
| | | if(StringUtils.isBlank(ticket.getZfName1())){ |
| | | ticket.setZfName1("王俊祥"); |
| | | ticket.setZfName2("张净雷"); |
| | | ticket.setZfNum1("03041699001"); |
| | | ticket.setZfNum2("03041618001"); |
| | | ticket.setZfQianMing1("http://127.0.0.1:8089/ffzf/fileinfo/showImg/wangjunxiang.png"); |
| | | ticket.setZfQianMing2("http://127.0.0.1:8089/ffzf/fileinfo/showImg/zhangjinglei.png"); |
| | | } |
| | | if(StringUtils.isBlank(ticket.getNumber())){ |
| | | ticket.setNumber("--"); |
| | | } |
| | | ticketService.updateById(ticket); |
| | | return R.ok(); |
| | | } |
| | | |
| | | //与执法对接 |
| | | @GetMapping("/getResult") |
| | | public Object getResult(Ticket ticket){ |
| | | ticketService.updateById(ticket); |
| | | return R.ok(); |
| | | } |
| | | |
| | | public void saveLogo(String name,String lng,String lat){ |
| | |
| | | tb.setCarType(ticket.getCarType()); |
| | | tb.setColor(ticket.getColor()); |
| | | tb.setViolationCount(1); |
| | | tb.setIsActive(0); |
| | | ticketBlackService.saveOrUpdate(tb); |
| | | }else { |
| | | TicketBlack ticketBlack = all.get(0); |
| | |
| | | @PostMapping("/jiaofei" ) |
| | | public R jiaofei(Integer id) { |
| | | Ticket byId = ticketService.getById(id); |
| | | byId.setContent(violationTypeService.getById(byId.getViolationTypeId()).getContent()); |
| | | return R.ok(byId); |
| | | if(byId.getPayStatus() == 1){ |
| | | return R.failed("此罚单已支付"); |
| | | }else if(byId.getMoney() == 0){ |
| | | return R.failed("此罚单无需缴费"); |
| | | }else { |
| | | NowPayOrder nowPayOrder = new NowPayOrder(); |
| | | nowPayOrder.setQueryId(byId.getId()); |
| | | nowPayOrder.setType(0); |
| | | nowPayOrder.setCarNo(byId.getCarNo()); |
| | | nowPayOrderService.saveOrder(nowPayOrder); |
| | | return R.ok("请扫码缴费"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 测试对接 |
| | | * @param |
| | | * @return R |
| | | */ |
| | | @ApiOperation(value = "测试对接", notes = "测试对接") |
| | | @GetMapping("/test" ) |
| | | public R test() { |
| | | Ticket byId = ticketService.getById(13); |
| | | byId = ticketService.getNumber(byId); |
| | | byId.setPush(0); |
| | | ticketService.uploadInfo(byId); |
| | | return R.ok(); |
| | | } |
| | | } |