| | |
| | | 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.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; |
| | | 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; |
| | |
| | | @RestController |
| | | @RequestMapping("ffzf/ticket") |
| | | @RequiredArgsConstructor |
| | | @Tag(description = "ffzf/ticket" , name = "手持开罚单接口" ) |
| | | public class TicketController{ |
| | | |
| | | |
| | | 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; |
| | | |
| | |
| | | |
| | | //图片回显 |
| | | @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; |
| | | 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 { |
| | |
| | | } |
| | | |
| | | @PostMapping("findPage") |
| | | @Operation(summary = "分页查询" , description = "分页查询" ) |
| | | public Object findPage(Page page, Ticket ticket){ |
| | | QueryWrapper<Ticket> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda() |
| | |
| | | } |
| | | |
| | | @PostMapping("/save") |
| | | @Operation(summary = "保存罚单" , description = "保存罚单" ) |
| | | public Object save(Ticket ticket,HttpServletRequest request) throws IOException{ |
| | | String imgStr = ""; |
| | | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
| | |
| | | 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){ |
| | |
| | | |
| | | 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); |
| | | } |
| | | |
| | | @PostMapping("/save2") |
| | | @Operation(summary = "保存罚单(废弃)" , description = "保存罚单(废弃)" ) |
| | | public Object save2(Ticket ticket) throws IOException{ |
| | | if(ticket.getUserId()!=null){ |
| | | User user = userService.getById(ticket.getUserId()); |
| | |
| | | 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); |
| | |
| | | */ |
| | | @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()); |
| | |
| | | |
| | | |
| | | @PostMapping("/delete") |
| | | @Operation(summary = "删除罚单" , description = "删除罚单" ) |
| | | public Object delete(Long id){ |
| | | 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("操作成功"); |
| | | } |
| | | |
| | | @PostMapping("/updateById") |
| | | @Operation(summary = "更新罚单状态" , description = "更新罚单状态" ) |
| | | public Object updateById(Ticket ticket){ |
| | | if(ticket.getMoney() >0){ |
| | | BigDecimal numberOfMoney = new BigDecimal(ticket.getMoney()+""); |
| | | String s = NumberToCN.number2CNMontrayUnit(numberOfMoney); |
| | | ticket.setMoneyStr(s.toString()); |
| | | } |
| | | 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.setZfQianMing2("http://127.0.0.1:8089/ffzf/fileinfo/showImg/zhangjinglei.png"); |
| | | } |
| | | if(StringUtils.isBlank(ticket.getNumber())){ |
| | | ticket = ticketService.getNumber(ticket); |
| | | ticket.setPush(0); |
| | | ticketService.uploadInfo(ticket); |
| | | }else { |
| | | ticketService.updateById(ticket); |
| | | ticket.setNumber("--"); |
| | | } |
| | | ticketService.updateById(ticket); |
| | | return R.ok(); |
| | | } |
| | | |
| | | //与执法对接 |
| | | @GetMapping("/getResult") |
| | | @Operation(summary = "与执法平台对接,获取签字结果" , description = "与执法平台对接,获取签字结果" ) |
| | | public Object getResult(Ticket ticket){ |
| | | ticketService.updateById(ticket); |
| | | return R.ok(); |
| | |
| | | } |
| | | |
| | | @PostMapping("/getZhiFa") |
| | | @Operation(summary = "根据状态查询罚单" , description = "根据状态查询罚单" ) |
| | | public Object getZhiFa(Integer status,Page page){ |
| | | |
| | | QueryWrapper<Ticket> wrapper = new QueryWrapper<>(); |
| | |
| | | } |
| | | |
| | | @PostMapping("/getCar") |
| | | @Operation(summary = "获取黑名单车辆" , description = "获取黑名单车辆" ) |
| | | public Object getCar(String carNo,Page page,int type){ |
| | | QueryWrapper<TicketBlack> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda() |
| | |
| | | } |
| | | |
| | | @PostMapping("/getCarList") |
| | | @Operation(summary = "根据车牌分页获取罚单" , description = "根据车牌分页获取罚单" ) |
| | | public Object getCarList(String carNo,Page page){ |
| | | QueryWrapper<Ticket> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda() |
| | |
| | | |
| | | |
| | | @PostMapping("/noFound") |
| | | @Operation(summary = "更新罚单状态,增加备注" , description = "更新罚单状态,增加备注" ) |
| | | public Object noFound(Long ticketId,String remark){ |
| | | Ticket ticket = ticketService.getById(ticketId); |
| | | ticket.setStatus(2); |
| | |
| | | } |
| | | |
| | | @PostMapping("/getStatisticByYear") |
| | | @Operation(summary = "统计年度罚单" , description = "统计年度罚单" ) |
| | | public Object getStatistic(int year){ |
| | | Map<String,Object> map = new HashMap<>(); |
| | | List<Object> list = new ArrayList<>(); |
| | |
| | | } |
| | | |
| | | @PostMapping("/getOrderList") |
| | | @Operation(summary = "根据年和月统计罚单" , description = "根据年和月统计罚单" ) |
| | | public Object getOrderList(int year,int month){ |
| | | |
| | | Date yearFirst = DateUtilOther.getFirstDayOfMonth(year,month); |
| | |
| | | } |
| | | |
| | | @PostMapping("findById") |
| | | @Operation(summary = "根据id查询" , description = "根据id查询" ) |
| | | public Object findById(Long id){ |
| | | Ticket ticket = ticketService.getById(id); |
| | | if(ticket.getViolationTypeId()!=null){ |
| | |
| | | */ |
| | | @ApiOperation(value = "手动缴费", notes = "手动缴费") |
| | | @PostMapping("/jiaofei" ) |
| | | @Operation(summary = "手动缴费更新二维码" , description = "手动缴费更新二维码" ) |
| | | public R jiaofei(Integer id) { |
| | | Ticket byId = ticketService.getById(id); |
| | | if(byId.getPayStatus() == 1){ |
| | |
| | | */ |
| | | @ApiOperation(value = "测试对接", notes = "测试对接") |
| | | @GetMapping("/test" ) |
| | | @Operation(summary = "测试对接执法平台" , description = "测试对接执法平台" ) |
| | | public R test() { |
| | | Ticket byId = ticketService.getById(13); |
| | | byId = ticketService.getNumber(byId); |