| | |
| | | import com.boying.entity.*; |
| | | import com.boying.service.*; |
| | | import com.boying.util.DateUtilOther; |
| | | 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.http.MediaType; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.MultipartHttpServletRequest; |
| | | |
| | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | @RequestMapping("ticket") |
| | | @RequestMapping("ffzf/ticket") |
| | | @RequiredArgsConstructor |
| | | public class TicketController{ |
| | | |
| | |
| | | private final OrderRecordService orderRecordService; |
| | | |
| | | private final StreetLogoService streetLogoService; |
| | | |
| | | private final NowPayOrderService nowPayOrderService; |
| | | |
| | | //图片回显 |
| | | @RequestMapping(value = "/showImg", method = RequestMethod.GET) |
| | |
| | | } |
| | | |
| | | @PostMapping("findPage") |
| | | public Object findPage(Page page, Integer type){ |
| | | if(type==null){ |
| | | QueryWrapper<Ticket> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda() |
| | | .eq(Ticket::getType,1) |
| | | .orderByDesc(Ticket::getId); |
| | | return R.ok(ticketService.page(page, wrapper)); |
| | | }else{ |
| | | QueryWrapper<Ticket> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda() |
| | | .eq(Ticket::getType,type) |
| | | .orderByDesc(Ticket::getId); |
| | | return R.ok(ticketService.page(page, wrapper)); |
| | | } |
| | | |
| | | public Object findPage(Page page, Ticket ticket){ |
| | | QueryWrapper<Ticket> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda() |
| | | .eq(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()) |
| | | .orderByDesc(Ticket::getCreateTime); |
| | | return R.ok(ticketService.page(page, wrapper)); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/save") |
| | | public Object save(Ticket ticket,HttpServletRequest request) throws IOException{ |
| | |
| | | return R.ok(ticket); |
| | | } |
| | | |
| | | /** |
| | | * 通过id查询票据表 |
| | | * @param id id |
| | | * @return R |
| | | */ |
| | | @ApiOperation(value = "通过id查询", notes = "通过id查询") |
| | | @GetMapping("/{id}" ) |
| | | public R getById(@PathVariable("id" ) Integer id) { |
| | | Ticket byId = ticketService.getById(id); |
| | | byId.setContent(violationTypeService.getById(byId.getViolationTypeId()).getContent()); |
| | | return R.ok(byId); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/delete") |
| | | public Object delete(Long id){ |
| | | Ticket ticket =ticketService.getById(id); |
| | | ticket.setStatus(3); |
| | | ticketService.saveOrUpdate(ticket); |
| | | return R.ok("操作成功"); |
| | | } |
| | | |
| | | @PostMapping("/updateById") |
| | | public Object updateById(Ticket ticket){ |
| | | if(ticket.getMoney() >0){ |
| | | BigDecimal numberOfMoney = new BigDecimal(ticket.getMoney()+""); |
| | | String s = NumberToCN.number2CNMontrayUnit(numberOfMoney); |
| | | ticket.setMoneyStr(s.toString()); |
| | | } |
| | | return R.ok(ticketService.updateById(ticket)); |
| | | } |
| | | |
| | | public void saveLogo(String name,String lng,String lat){ |
| | |
| | | } |
| | | return R.ok(ticket); |
| | | } |
| | | |
| | | /** |
| | | * 手动缴费 |
| | | * @param id id |
| | | * @return R |
| | | */ |
| | | @ApiOperation(value = "手动缴费", notes = "手动缴费") |
| | | @PostMapping("/jiaofei" ) |
| | | public R jiaofei(Integer id) { |
| | | Ticket byId = ticketService.getById(id); |
| | | 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("请扫码缴费"); |
| | | } |
| | | } |
| | | } |