From 4d01da944fd5489e0110cdc4b0090fdac9eae897 Mon Sep 17 00:00:00 2001 From: gaoben Date: Thu, 27 May 2021 09:55:58 +0800 Subject: [PATCH] =?UTF-8?q?v2.0.11=201.=E4=BF=AE=E5=A4=8D=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E5=81=9C=E8=BD=A6=E8=AE=B0=E5=BD=95=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E8=AE=B0=E5=BD=95=E7=9A=84bug=202.=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E4=BF=AE=E6=94=B9=E4=BA=BA=E5=91=98=E6=98=AF=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E7=A9=BA=E5=AD=97=E7=AC=A6=E9=97=A8=E7=A6=81=E5=8D=A1?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/car/controller/CarOpenApi.java | 54 ++++++++++++++----- .../ten/controller/TenPersonController.java | 8 ++- .../service/TenPackRecordEnterService.java | 2 + .../ten/service/TenPackRecordExitService.java | 3 ++ .../impl/TenPackRecordEnterServiceImpl.java | 8 +++ .../impl/TenPackRecordExitServiceImpl.java | 7 +++ 6 files changed, 66 insertions(+), 16 deletions(-) diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/car/controller/CarOpenApi.java b/shapelight-admin/src/main/java/net/shapelight/modules/car/controller/CarOpenApi.java index 46c1983..fd820e2 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/car/controller/CarOpenApi.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/car/controller/CarOpenApi.java @@ -334,6 +334,44 @@ public class CarOpenApi { imgUrl = imgUrl.replace("amp;", ""); } + + //去重 + if (serviceName.equals("enter")) { + long enterTimeLong = bizContent.getLongValue("enterTime"); + Date enterTime = new Date(enterTimeLong * 1000L); + //查重 + List checkRecordEnter = tenPackRecordEnterService.list(new QueryWrapper() + .eq("plate_number",plateNum) + .eq("enter_time",enterTime)); + List checkRecordExit = tenPackRecordExitService.list(new QueryWrapper() + .eq("plate_number",plateNum) + .eq("exit_time",enterTime)); + if(checkRecordEnter.size()>0 || checkRecordExit.size() > 0){ + res.put("code", "200"); + res.put("msg", "成功"); + return res; + } + } else if (serviceName.equals("exit")) { + long exitTimeLong = bizContent.getLongValue("exitTime"); + Date exitTime = new Date(exitTimeLong * 1000L); + //查重 + List checkRecordEnter = tenPackRecordEnterService.list(new QueryWrapper() + .eq("plate_number",plateNum) + .eq("enter_time",exitTime)); + List checkRecordExit = tenPackRecordExitService.list(new QueryWrapper() + .eq("plate_number",plateNum) + .eq("exit_time",exitTime)); + if(checkRecordEnter.size() >0 || checkRecordExit.size()>0){ + res.put("code", "200"); + res.put("msg", "成功"); + return res; + } + } + + + + + String fileName = "car/" + parkCode + "/" + UUIDUtil.uuid() + ".jpg"; if (!StringUtils.isEmpty(imgUrl)) { URL url = null; @@ -425,13 +463,7 @@ public class CarOpenApi { enter.setChannalCode(channalCode); if (fileName.length() > 0) enter.setImage(fileName); - //查重 - List checkRecord = tenPackRecordEnterService.list(new QueryWrapper() - .eq("plate_number",enter.getPlateNumber()) - .eq("enter_time",enter.getEnterTime())); - if(checkRecord.size()==0){ - this.tenPackRecordEnterService.save(enter); - } + this.tenPackRecordEnterService.saveTr(enter); } else if (serviceName.equals("exit")) { long exitTimeLong = bizContent.getLongValue("exitTime"); Date exitTime = new Date(exitTimeLong * 1000L); @@ -453,13 +485,7 @@ public class CarOpenApi { exit.setChannalCode(channalCode); if (fileName.length() > 0) exit.setImage(fileName); - //查重 - List checkRecord = tenPackRecordExitService.list(new QueryWrapper() - .eq("plate_number",exit.getPlateNumber()) - .eq("exit_time",exit.getExitTime())); - if(checkRecord.size()==0){ - this.tenPackRecordExitService.save(exit); - } + this.tenPackRecordExitService.saveTr(exit); } res.put("code", "200"); res.put("msg", "成功"); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPersonController.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPersonController.java index fb50370..d30bcca 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPersonController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPersonController.java @@ -330,7 +330,7 @@ public class TenPersonController extends AbstractController { } } //验证卡号 - if(tenPerson.getDoorCardEntity()!=null && !tenPerson.getDoorCardEntity().getDoorCard().isEmpty()){ + if(tenPerson.getDoorCardEntity()!=null && tenPerson.getDoorCardEntity().getDoorCard().isEmpty()){ //1. 检查当前钥匙是否已经使用 TenDoorCardEntity card = tenDoorCardService.getOne(new QueryWrapper() .eq("door_card",tenPerson.getDoorCardEntity().getDoorCard()) @@ -409,7 +409,9 @@ public class TenPersonController extends AbstractController { //验证卡号 - if(tenPerson.getDoorCardEntity()!=null){ + if(tenPerson.getDoorCardEntity()!=null && tenPerson.getDoorCardEntity().getDoorCard()!=null + && !tenPerson.getDoorCardEntity().getDoorCard().isEmpty()){ + TenDoorCardEntity oldDoorCard = tenDoorCardService.getOne(new QueryWrapper() .eq("person_id",tenPerson.getPersonId())); if (oldDoorCard!=null) { @@ -431,6 +433,8 @@ public class TenPersonController extends AbstractController { return R.error("卡号已录入"); } } + }else{ + tenPerson.setDoorCardEntity(null); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordEnterService.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordEnterService.java index 5ceb898..d24fe61 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordEnterService.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordEnterService.java @@ -15,4 +15,6 @@ public interface TenPackRecordEnterService extends IService getNotSync(Long cellId); List getNotSyncImage(Long cellId); + + void saveTr(TenPackRecordEnterEntity entity); } \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordExitService.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordExitService.java index 3cf7912..cb351f0 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordExitService.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordExitService.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.Map; import net.shapelight.common.utils.PageUtils; +import net.shapelight.modules.ten.entity.TenPackRecordEnterEntity; import net.shapelight.modules.ten.entity.TenPackRecordExitEntity; import net.shapelight.modules.ten.entity.TenRecordEntity; @@ -16,4 +17,6 @@ public interface TenPackRecordExitService extends IService getNotSync(Long cellId); List getNotSyncImage(Long cellId); + + void saveTr(TenPackRecordExitEntity entity); } \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackRecordEnterServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackRecordEnterServiceImpl.java index 73886d9..69c71a4 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackRecordEnterServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackRecordEnterServiceImpl.java @@ -21,7 +21,9 @@ import net.shapelight.modules.ten.entity.TenRecordEntity; import net.shapelight.modules.ten.service.TenCellService; import net.shapelight.modules.ten.service.TenPackRecordEnterService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.annotation.Transient; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; @Service("tenPackRecordEnterService") public class TenPackRecordEnterServiceImpl extends ServiceImpl implements TenPackRecordEnterService { @@ -93,4 +95,10 @@ public class TenPackRecordEnterServiceImpl extends ServiceImpl implements TenPackRecordExitService { @@ -85,4 +86,10 @@ public class TenPackRecordExitServiceImpl extends ServiceImpl