From 73acd2a65a5dbab4573ef2a93a258c0da177bcd3 Mon Sep 17 00:00:00 2001
From: 张天森 <1292933220@qq.com>
Date: 星期四, 17 十一月 2022 11:58:38 +0800
Subject: [PATCH] 普达物业公司权限处理
---
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngCarServiceImpl.java | 47 ++++++++++++++++++++++++++++++++++-------------
1 files changed, 34 insertions(+), 13 deletions(-)
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngCarServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngCarServiceImpl.java
index 3cc4723..8cf20eb 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngCarServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngCarServiceImpl.java
@@ -4,6 +4,7 @@
import javax.annotation.Resource;
+import com.panzhihua.common.utlis.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@@ -110,7 +111,7 @@
List<ComMngCarDO> existList = comMngCarDAO.selectList(
new QueryWrapper<ComMngCarDO>().lambda().eq(ComMngCarDO::getPlateNum, comMngCarSaveDTO.getPlateNum()));
if (!existList.isEmpty()) {
- return R.ok("车辆已存在");
+ return R.fail("车辆已存在");
}
}
ComMngVillageDO comMngVillageDO = comMngVillageDAO.selectById(comMngCarSaveDTO.getAreaId());
@@ -125,7 +126,20 @@
}
ComMngCarDO comMngCarDO = new ComMngCarDO();
BeanUtils.copyProperties(comMngCarSaveDTO, comMngCarDO);
- comMngCarDO.setAreaName(comMngVillageDO.getGroupAt());
+ //如果小区没有名字,则将街路巷和地区号拼接起来
+ if(comMngVillageDO.getName() != null && StringUtils.isNotEmpty(comMngVillageDO.getName())){
+ comMngCarDO.setAreaName(comMngVillageDO.getName());
+ }else{
+ StringBuilder sb = new StringBuilder();
+ sb.append(comMngVillageDO.getAlley());
+ if(!comMngVillageDO.getHouseNum().contains("号")){
+ sb.append(comMngVillageDO.getHouseNum() + "号");
+ }
+ comMngCarDO.setAreaName(sb.toString());
+ }
+// if(comMngVillageDO.getGroupAt() == null){
+// comMngCarDO.setAreaName(comMngVillageDO.getGroupAt());
+// }
comMngCarDO.setCommunityId(comMngVillageDO.getCommunityId());
try {
comMngCarDO.setCardNo(AESUtil.encrypt128(comMngCarSaveDTO.getCardNo(), aesKey));
@@ -166,26 +180,28 @@
@Override
public R listSaveMngCarExcelVO(List<ComMngCarExcelVO> list, Long communityId) {
// 获取社区下所有的小区
- List<ComMngStructAreaDO> comMngStructAreaDOs = comMngStructAreaDAO.selectList(
- new QueryWrapper<ComMngStructAreaDO>().lambda().eq(ComMngStructAreaDO::getCommunityId, communityId));
- Map<String, ComMngStructAreaDO> areaMap = new HashMap<>(comMngStructAreaDOs.size());
- comMngStructAreaDOs.forEach(comMngStructAreaDO -> {
- areaMap.put(comMngStructAreaDO.getAreaName(), comMngStructAreaDO);
+ List<ComMngVillageDO> comMngVillageDOS = comMngVillageDAO.selectList(
+ new QueryWrapper<ComMngVillageDO>().lambda().eq(ComMngVillageDO::getCommunityId, communityId));
+ Map<String, ComMngVillageDO> areaMap = new HashMap<>(comMngVillageDOS.size());
+ comMngVillageDOS.forEach(comMngVillageDO -> {
+ areaMap.put(comMngVillageDO.getName(),comMngVillageDO);
});
List<ComMngCarDO> comMngCarDOS = new ArrayList<>();
list.forEach(vo -> {
int count = comMngCarDAO.selectCount(new QueryWrapper<ComMngCarDO>().lambda()
.eq(ComMngCarDO::getPlateNum, vo.getPlateNum()).and(wrapper -> wrapper.eq(ComMngCarDO::getSource, 2)));
- if (count == 0 && areaMap.containsKey(vo.getAreaName())) {
- ComMngCarDO comMngCarDO = new ComMngCarDO();
- BeanUtils.copyProperties(vo, comMngCarDO);
+ ComMngCarDO comMngCarDO = new ComMngCarDO();
+ BeanUtils.copyProperties(vo, comMngCarDO);
+ if (count == 0 ) {
+ if(StringUtils.isNotEmpty(vo.getAreaName())&&areaMap.containsKey(vo.getAreaName())){
+ comMngCarDO.setAreaId(areaMap.get(vo.getAreaName()).getVillageId());
+ }
try {
comMngCarDO.setCardNo(AESUtil.encrypt128(vo.getCardNo(), aesKey));
} catch (Exception e) {
}
comMngCarDO.setCommunityId(communityId);
- comMngCarDO.setAreaId(areaMap.get(vo.getAreaName()).getId());
R<SysUserVO> sysUserVOR = userService.getSysUserVOByPhone(vo.getMobile());
if (R.isOk(sysUserVOR)) {
SysUserVO sysUserVO =
@@ -196,8 +212,13 @@
comMngCarDOS.add(comMngCarDO);
}
});
- this.saveBatch(comMngCarDOS);
- return R.ok("共计导入车辆数量:" + comMngCarDOS.size());
+ if(comMngCarDOS.isEmpty()){
+ return R.fail("导入数据有误");
+ }
+ else {
+ this.saveBatch(comMngCarDOS);
+ return R.ok("共计导入车辆数量:" + comMngCarDOS.size());
+ }
}
@Override
--
Gitblit v1.7.1