From fb050c0dafa5363a73540dd9e52b78487e25ba0a Mon Sep 17 00:00:00 2001
From: kongdeqiang <123456>
Date: 星期二, 09 四月 2024 17:32:46 +0800
Subject: [PATCH] fix:新增手动抬杆记录
---
src/main/java/com/boying/controller/phone/TicketController.java | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 106 insertions(+), 8 deletions(-)
diff --git a/src/main/java/com/boying/controller/phone/TicketController.java b/src/main/java/com/boying/controller/phone/TicketController.java
index c8528b3..9c4c681 100644
--- a/src/main/java/com/boying/controller/phone/TicketController.java
+++ b/src/main/java/com/boying/controller/phone/TicketController.java
@@ -5,17 +5,19 @@
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;
@@ -28,6 +30,9 @@
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
@@ -38,7 +43,13 @@
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;
@@ -57,7 +68,7 @@
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 {
@@ -73,10 +84,11 @@
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));
}
@@ -91,7 +103,7 @@
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){
@@ -118,15 +130,35 @@
}
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);
}
@@ -149,7 +181,7 @@
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);
@@ -165,6 +197,21 @@
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);
}
@@ -174,6 +221,15 @@
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("鎿嶄綔鎴愬姛");
}
@@ -184,7 +240,33 @@
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){
@@ -209,6 +291,7 @@
tb.setCarType(ticket.getCarType());
tb.setColor(ticket.getColor());
tb.setViolationCount(1);
+ tb.setIsActive(0);
ticketBlackService.saveOrUpdate(tb);
}else {
TicketBlack ticketBlack = all.get(0);
@@ -340,4 +423,19 @@
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();
+ }
}
--
Gitblit v1.9.1