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