From bdfb1bfaf5dc5d7318c632fcc6fdf3ffacbd075f Mon Sep 17 00:00:00 2001
From: lin <sbla5888@163.com>
Date: Mon, 15 Apr 2024 17:21:29 +0800
Subject: [PATCH] 社区管理员查询轮播图+报事报修查询优化
---
src/main/java/org/springblade/modules/place/service/impl/PlaceServiceImpl.java | 136 +++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 131 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/springblade/modules/place/service/impl/PlaceServiceImpl.java b/src/main/java/org/springblade/modules/place/service/impl/PlaceServiceImpl.java
index 8942f88..c48a46c 100644
--- a/src/main/java/org/springblade/modules/place/service/impl/PlaceServiceImpl.java
+++ b/src/main/java/org/springblade/modules/place/service/impl/PlaceServiceImpl.java
@@ -20,6 +20,7 @@
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import liquibase.pro.packaged.P;
import liquibase.pro.packaged.W;
import liquibase.repackaged.org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.util.Strings;
@@ -962,8 +963,10 @@
if (null == one) {
Long userId = updateUser(placeExcel);
// 插入场所
- PlaceEntity placeEntity = new PlaceEntity();
- placeEntity.setHouseCode(placeExcel.getHouseCode());
+ PlaceVO placeEntity = new PlaceVO();
+ String[] split = placeExcel.getHouseCode().split(",");
+ placeEntity.setHouseCode(split[0]);
+ placeEntity.setHouseCodeBinds(placeExcel.getHouseCode());
placeEntity.setPrincipalUserId(userId);
placeEntity.setPrincipal(placeExcel.getName());
placeEntity.setPrincipalPhone(placeExcel.getPhoneNumber());
@@ -971,8 +974,103 @@
placeEntity.setCreateUser(AuthUtil.getUserId());
placeEntity.setUpdateTime(new Date());
placeEntity.setUpdateUser(AuthUtil.getUserId());
- //一个一个插入,防止同一个表中有相同的数据
+ // 默认为未完善
+ placeEntity.setStatus(1);
+ // 是否现场采集 1:是 2:否
+ placeEntity.setIsScene(1);
+ // 来源 1:地址总表 2:国控采集 3:商超
+ if (!Strings.isBlank(placeExcel.getHouseCode())) {
+ placeEntity.setSource(1);
+ }else {
+ placeEntity.setSource(2);
+ // 并生成36位的houseCode
+ placeEntity.setHouseCode(IdUtils.getIdBy36());
+ }
+ // 九小场所类型处理
+ if (!Strings.isBlank(placeExcel.getNineType())) {
+ placeEntity.setIsNine(1);
+ placeEntity.setNineType(Integer.parseInt(placeExcel.getNineType()));
+ }
+ // 网格绑定处理
+ importGridHandle(placeExcel,placeEntity);
+ // 新增
save(placeEntity);
+ // 保存详情
+ savePlaceExtAndTaskInfo(placeEntity);
+ // 场所标签信息处理
+ if (!Strings.isBlank(placeExcel.getLabelCode())) {
+ PlaceVO placeVO = new PlaceVO();
+ placeVO.setId(placeEntity.getId());
+ placeVO.setLabel(placeExcel.getLabelCode());
+ // 处理
+ placeLabelBind(placeVO);
+ }
+ // 房屋编号绑定处理
+ houseCodeBindHandle(placeEntity);
+ }else {
+ // 更新
+ Long userId = updateUser(placeExcel);
+ // 插入场所
+ PlaceVO placeEntity = new PlaceVO();
+ placeEntity.setId(one.getId());
+ placeEntity.setHouseCode(placeExcel.getHouseCode());
+ placeEntity.setHouseCodeBinds(placeExcel.getHouseCode());
+ placeEntity.setPrincipalUserId(userId);
+ placeEntity.setPrincipal(placeExcel.getName());
+ placeEntity.setPrincipalPhone(placeExcel.getPhoneNumber());
+ placeEntity.setCreateTime(new Date());
+ placeEntity.setCreateUser(AuthUtil.getUserId());
+ placeEntity.setUpdateTime(new Date());
+ placeEntity.setUpdateUser(AuthUtil.getUserId());
+ // 默认为未完善
+ placeEntity.setStatus(1);
+ // 是否现场采集 1:是 2:否
+ placeEntity.setIsScene(1);
+ // 来源 1:地址总表 2:国控采集 3:商超
+ placeEntity.setSource(1);
+ // 九小场所类型处理
+ if (!Strings.isBlank(placeExcel.getNineType())) {
+ placeEntity.setIsNine(1);
+ placeEntity.setNineType(Integer.parseInt(placeExcel.getNineType()));
+ }
+ // 网格绑定处理
+ importGridHandle(placeExcel,placeEntity);
+ // 更新
+ updateById(placeEntity);
+ // 场所标签信息处理
+ if (!Strings.isBlank(placeExcel.getLabelCode())) {
+ PlaceVO placeVO = new PlaceVO();
+ placeVO.setId(placeEntity.getId());
+ placeVO.setLabel(placeExcel.getLabelCode());
+ // 处理
+ placeLabelBind(placeVO);
+ }
+ }
+ }
+ }
+
+ /**
+ * 导入是网格数据绑定处理
+ * @param placeExcel
+ * @param placeEntity
+ */
+ private void importGridHandle(PlaceExcel placeExcel, PlaceVO placeEntity) {
+ if (!Strings.isBlank(placeExcel.getCommunityName()) &&
+ !Strings.isBlank(placeExcel.getGridName())){
+ // 查询对应的网格信息
+ GridEntity gridEntity = gridService.getGridInfoByParam(placeExcel.getCommunityName(),placeExcel.getGridName());
+ if (null!=gridEntity){
+ // 设置场所范围
+ placeEntity.setGridId(gridEntity.getId());
+ placeEntity.setGridCode(gridEntity.getGridCode());
+ // 更新网格范围绑定
+ GridRangeEntity gridRangeEntity = new GridRangeEntity();
+ gridRangeEntity.setGridId(gridEntity.getId());
+ gridRangeEntity.setGridCode(gridEntity.getGridCode());
+ gridRangeEntity.setHouseCode(placeEntity.getHouseCode());
+ UpdateWrapper<GridRangeEntity> updateWrapper = new UpdateWrapper<>();
+ updateWrapper.eq("house_code",placeEntity.getHouseCode());
+ gridRangeService.update(gridRangeEntity,updateWrapper);
}
}
}
@@ -987,8 +1085,8 @@
if (!Strings.isBlank(placeExcel.getPhoneNumber()) &&
!Strings.isBlank(placeExcel.getName())) {
PlaceVO placeVO = new PlaceVO();
- placeVO.setPhone(placeExcel.getPhoneNumber());
- placeVO.setUsername(placeExcel.getName());
+ placeVO.setPrincipal(placeExcel.getPhoneNumber());
+ placeVO.setPrincipalPhone(placeExcel.getName());
// 更新场所负责人
User user = bindUserHandle(placeVO);
// 返回
@@ -1574,4 +1672,32 @@
// 返回
return page.setRecords(placeVOS);
}
+
+ /**
+ * 查询所有场所数据
+ * @return
+ */
+ @Override
+ public List<PlaceVO> getAllList(int i,int size) {
+ return baseMapper.getAllList(i,size);
+ }
+
+ /**
+ * 查询所有场所数据总数
+ * @return
+ */
+ @Override
+ public int getAllListTotal() {
+ return baseMapper.getAllListTotal();
+ }
+
+ /**
+ * 查询对应的社区编号
+ * @param id
+ * @return
+ */
+ @Override
+ public String getCommunityCode(Long id) {
+ return baseMapper.getCommunityCode(id);
+ }
}
--
Gitblit v1.9.3