1.修复上传停车记录查询重复记录的bug
2.修复修改人员是加入空字符门禁卡的bug
This commit is contained in:
gaoben 2021-05-27 09:55:58 +08:00
parent 309dff172b
commit 4d01da944f
6 changed files with 66 additions and 16 deletions

View File

@ -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<TenPackRecordEnterEntity> checkRecordEnter = tenPackRecordEnterService.list(new QueryWrapper<TenPackRecordEnterEntity>()
.eq("plate_number",plateNum)
.eq("enter_time",enterTime));
List<TenPackRecordExitEntity> checkRecordExit = tenPackRecordExitService.list(new QueryWrapper<TenPackRecordExitEntity>()
.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<TenPackRecordEnterEntity> checkRecordEnter = tenPackRecordEnterService.list(new QueryWrapper<TenPackRecordEnterEntity>()
.eq("plate_number",plateNum)
.eq("enter_time",exitTime));
List<TenPackRecordExitEntity> checkRecordExit = tenPackRecordExitService.list(new QueryWrapper<TenPackRecordExitEntity>()
.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<TenPackRecordEnterEntity> checkRecord = tenPackRecordEnterService.list(new QueryWrapper<TenPackRecordEnterEntity>()
.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<TenPackRecordExitEntity> checkRecord = tenPackRecordExitService.list(new QueryWrapper<TenPackRecordExitEntity>()
.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", "成功");

View File

@ -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<TenDoorCardEntity>()
.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<TenDoorCardEntity>()
.eq("person_id",tenPerson.getPersonId()));
if (oldDoorCard!=null) {
@ -431,6 +433,8 @@ public class TenPersonController extends AbstractController {
return R.error("卡号已录入");
}
}
}else{
tenPerson.setDoorCardEntity(null);
}

View File

@ -15,4 +15,6 @@ public interface TenPackRecordEnterService extends IService<TenPackRecordEnterEn
List<TenPackRecordEnterEntity> getNotSync(Long cellId);
List<TenPackRecordEnterEntity> getNotSyncImage(Long cellId);
void saveTr(TenPackRecordEnterEntity entity);
}

View File

@ -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<TenPackRecordExitEnti
List<TenPackRecordExitEntity> getNotSync(Long cellId);
List<TenPackRecordExitEntity> getNotSyncImage(Long cellId);
void saveTr(TenPackRecordExitEntity entity);
}

View File

@ -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<TenPackRecordEnterDao, TenPackRecordEnterEntity> implements TenPackRecordEnterService {
@ -93,4 +95,10 @@ public class TenPackRecordEnterServiceImpl extends ServiceImpl<TenPackRecordEnte
.eq("xa_sync", 1)
.last(" and TO_DAYS(enter_time) = TO_DAYS(NOW())"));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void saveTr(TenPackRecordEnterEntity entity) {
save(entity);
}
}

View File

@ -19,6 +19,7 @@ import net.shapelight.modules.ten.service.TenCellService;
import net.shapelight.modules.ten.service.TenPackRecordExitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service("tenPackRecordExitService")
public class TenPackRecordExitServiceImpl extends ServiceImpl<TenPackRecordExitDao, TenPackRecordExitEntity> implements TenPackRecordExitService {
@ -85,4 +86,10 @@ public class TenPackRecordExitServiceImpl extends ServiceImpl<TenPackRecordExitD
.ne("channal_code_xa","")
.last(" and TO_DAYS(exit_time) = TO_DAYS(NOW())"));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void saveTr(TenPackRecordExitEntity entity) {
save(entity);
}
}