Commit e9123a3a authored by 张俊's avatar 张俊

房屋查询bug处理

parent b5abc4cf
...@@ -37,7 +37,7 @@ public class FwxxController { ...@@ -37,7 +37,7 @@ public class FwxxController {
@GetMapping("queryFwjh") @GetMapping("queryFwjh")
@ApiOperation(value = "列表", notes = "房屋列表", response = FwxxEntity.class) @ApiOperation(value = "列表", notes = "房屋列表", response = FwxxEntity.class)
public R queryFwjh(FwxxEntity fwxxEntity) { public R queryFwjh(FwxxEntity fwxxEntity) {
return R.ok().put("data", fwxxService.queryFwjh(fwxxEntity)); return R.ok().put("data", fwxxService.queryFwjh1(fwxxEntity));
} }
// 根据单元查询出房屋列表 // 根据单元查询出房屋列表
......
package io.renren.modules.app.dao; package io.renren.modules.app.dao;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import io.renren.modules.app.entity.FwxxEntity; import io.renren.modules.app.entity.FwxxEntity;
import io.renren.modules.app.entity.XlkEntity;
import io.renren.modules.app.entity.YwpzEntity; import io.renren.modules.app.entity.YwpzEntity;
import io.renren.modules.app.entity.YwpzmxEntity; import io.renren.modules.app.entity.YwpzmxEntity;
import io.renren.modules.app.entity.ZhxxEntity; import io.renren.modules.app.entity.ZhxxEntity;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -25,7 +24,7 @@ public interface FwxxDao extends BaseMapper<FwxxEntity> { ...@@ -25,7 +24,7 @@ public interface FwxxDao extends BaseMapper<FwxxEntity> {
/** /**
* 分页模糊查询 * 分页模糊查询
* *
* @param fwxxEntity * @param fwxxEntity
* @return * @return
*/ */
...@@ -64,6 +63,8 @@ public interface FwxxDao extends BaseMapper<FwxxEntity> { ...@@ -64,6 +63,8 @@ public interface FwxxDao extends BaseMapper<FwxxEntity> {
// 查询单元信息 // 查询单元信息
List<FwxxEntity> queryFwjhDy(FwxxEntity fwxxEntity); List<FwxxEntity> queryFwjhDy(FwxxEntity fwxxEntity);
List<FwxxEntity> queryByMhList(@Param("mhList") Collection<String> mhList);
// 查询房屋信息 // 查询房屋信息
List<FwxxEntity> queryFwjhFw(Map<String, Object> pd); List<FwxxEntity> queryFwjhFw(Map<String, Object> pd);
...@@ -83,6 +84,8 @@ public interface FwxxDao extends BaseMapper<FwxxEntity> { ...@@ -83,6 +84,8 @@ public interface FwxxDao extends BaseMapper<FwxxEntity> {
YwpzEntity selectshzt(String id); YwpzEntity selectshzt(String id);
List<YwpzEntity> selectshztByFwbmList(@Param("fwbmList") List<String> fwbmList);
void PLINSERTFwxx(FwxxEntity fwxxEntity); void PLINSERTFwxx(FwxxEntity fwxxEntity);
void updatezhxxhs(ZhxxEntity zhxxEntity); void updatezhxxhs(ZhxxEntity zhxxEntity);
...@@ -92,6 +95,6 @@ public interface FwxxDao extends BaseMapper<FwxxEntity> { ...@@ -92,6 +95,6 @@ public interface FwxxDao extends BaseMapper<FwxxEntity> {
FwxxEntity selectfwxx(String id); FwxxEntity selectfwxx(String id);
List<YwpzEntity> selectfwdjxx(String id); List<YwpzEntity> selectfwdjxx(String id);
YwpzmxEntity selectfwsfjq(String id); YwpzmxEntity selectfwsfjq(String id);
} }
...@@ -22,6 +22,7 @@ public interface FwxxService extends IService<FwxxEntity> { ...@@ -22,6 +22,7 @@ public interface FwxxService extends IService<FwxxEntity> {
// 查询房屋图 // 查询房屋图
List<Map<String, Object>> queryFwjh(FwxxEntity fwxxEntity); List<Map<String, Object>> queryFwjh(FwxxEntity fwxxEntity);
List<Map<String, Object>> queryFwjh1(FwxxEntity fwxxEntity);
// 根据单元查询出房屋列表 // 根据单元查询出房屋列表
PageInfo<FwxxEntity> queryByPage(FwxxEntity fwxxEntity); PageInfo<FwxxEntity> queryByPage(FwxxEntity fwxxEntity);
...@@ -49,7 +50,7 @@ public interface FwxxService extends IService<FwxxEntity> { ...@@ -49,7 +50,7 @@ public interface FwxxService extends IService<FwxxEntity> {
/** /**
* 查询是否有项目 * 查询是否有项目
* *
* @param dwbm * @param dwbm
* @return * @return
*/ */
...@@ -57,12 +58,12 @@ public interface FwxxService extends IService<FwxxEntity> { ...@@ -57,12 +58,12 @@ public interface FwxxService extends IService<FwxxEntity> {
// 删除单位 // 删除单位
int deleteFromSfdw(@Param("dwbm") String dwbm); int deleteFromSfdw(@Param("dwbm") String dwbm);
void PLINSERTFwxx(FwxxEntity fwxxEntity); void PLINSERTFwxx(FwxxEntity fwxxEntity);
void updatezhxxhs(ZhxxEntity zhxxEntity); void updatezhxxhs(ZhxxEntity zhxxEntity);
ZhxxEntity selectzhxxhs(String id); ZhxxEntity selectzhxxhs(String id);
List<YwpzEntity> selectdjxxbyfw(String id); List<YwpzEntity> selectdjxxbyfw(String id);
} }
package io.renren.modules.app.service.impl; package io.renren.modules.app.service.impl;
import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import io.renren.modules.app.dao.FwxxDao; import io.renren.modules.app.dao.FwxxDao;
import io.renren.modules.app.entity.FwxxEntity; import io.renren.modules.app.entity.FwxxEntity;
import io.renren.modules.app.entity.XlkEntity;
import io.renren.modules.app.entity.YwpzEntity; import io.renren.modules.app.entity.YwpzEntity;
import io.renren.modules.app.entity.YwpzmxEntity; import io.renren.modules.app.entity.YwpzmxEntity;
import io.renren.modules.app.entity.ZhxxEntity; import io.renren.modules.app.entity.ZhxxEntity;
import io.renren.modules.app.service.FwxxService; import io.renren.modules.app.service.FwxxService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays; import java.util.*;
import java.util.HashMap; import java.util.stream.Collectors;
import java.util.List;
import java.util.Map;
@Service("fwxxService") @Service("fwxxService")
public class FwxxServiceImpl extends ServiceImpl<FwxxDao, FwxxEntity> implements FwxxService { public class FwxxServiceImpl extends ServiceImpl<FwxxDao, FwxxEntity> implements FwxxService {
...@@ -154,17 +149,17 @@ public class FwxxServiceImpl extends ServiceImpl<FwxxDao, FwxxEntity> implements ...@@ -154,17 +149,17 @@ public class FwxxServiceImpl extends ServiceImpl<FwxxDao, FwxxEntity> implements
for(FwxxEntity f: fwlist){ for(FwxxEntity f: fwlist){
if("1".equals(f.getSfyj())){ if("1".equals(f.getSfyj())){
List<YwpzEntity> ys=baseMapper.selectfwdjbh(f.getFwbm()); List<YwpzEntity> ys=baseMapper.selectfwdjbh(f.getFwbm());
YwpzEntity y1=baseMapper.selectshzt(ys.get(0).getDjbh()); YwpzEntity y1=baseMapper.selectshzt(ys.get(0).getDjbh());
if(isObjectNotEmpty(y1)==false||isObjectNotEmpty(ys.get(0))==false){ if(isObjectNotEmpty(y1)==false||isObjectNotEmpty(ys.get(0))==false){
}else{
if("1".equals(y1.getShzt())){
f.setSfyfh("1");
}else{ }else{
if("1".equals(y1.getShzt())){ f.setSfyfh("0");
f.setSfyfh("1");
}else{
f.setSfyfh("0");
}
} }
}
} }
} }
// 单元房屋 // 单元房屋
...@@ -176,7 +171,78 @@ public class FwxxServiceImpl extends ServiceImpl<FwxxDao, FwxxEntity> implements ...@@ -176,7 +171,78 @@ public class FwxxServiceImpl extends ServiceImpl<FwxxDao, FwxxEntity> implements
} }
return returnlist; return returnlist;
} }
public List<Map<String, Object>> queryFwjh1(FwxxEntity fwxxEntity) {
// 返回list集合
List<Map<String, Object>> returnlist = new ArrayList<Map<String, Object>>();
// 根据栋号获取单元,查询本栋楼的所有单元
List<FwxxEntity> dhlist = baseMapper.queryFwjhDy(fwxxEntity);
// 单元编码
Set<String> fwdybmList = dhlist.stream().map(FwxxEntity::getFwdybm).collect(Collectors.toSet());
// 查询单元的所有楼层信息。mh:门号,单元编码
List<FwxxEntity> fwxxEntityList = baseMapper.queryByMhList(fwdybmList);
// 按门号分组
Map<String, List<FwxxEntity>> fwxxMap = fwxxEntityList.stream().collect(Collectors.groupingBy(FwxxEntity::getMh));
// 获取每个单元的楼层,每个单元的楼层可能会不一样
// 按楼层分组
/*Map<Integer, List<FwxxEntity>> lcMap = fwxxEntityList.stream().collect(Collectors.groupingBy(FwxxEntity::getLc));
Set<Integer> lcSet = lcMap.keySet();*/
// 筛选出已缴的数据
List<FwxxEntity> yjFwxxList = fwxxEntityList.stream().filter(f -> "1".equals(f.getSfyj())).collect(Collectors.toList());
Map<String, YwpzEntity> ywpzEntityMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(yjFwxxList))
{
List<YwpzEntity> ywpzEntityList = baseMapper.selectshztByFwbmList(yjFwxxList.stream().map(FwxxEntity::getFwbm).collect(Collectors.toList()));
ywpzEntityMap = ywpzEntityList.stream().collect(Collectors.toMap(YwpzEntity::getFwbm, y -> y, (y1, y2) -> y1));
}
for (FwxxEntity fwxx : dhlist)
{
// 返回Map集合
Map<String, Object> map = new HashMap<>();
// 获取单元名称
map.put("dymc", fwxx.getDymc());
// 接受楼层
List<Object> list = new ArrayList<Object>();
// 获取本单元的房屋
List<FwxxEntity> currentMhList = fwxxMap.get(fwxx.getFwdybm());
if (CollectionUtils.isNotEmpty(currentMhList)){
// 获取每个单元的楼层,每个单元的楼层可能会不一样
Set<Integer> lcSet = currentMhList.stream().map(FwxxEntity::getLc).collect(Collectors.toSet());
// 每个楼层的信息
for (Integer lc : lcSet)
{
Map<String, Object> fwmap = new HashMap<>();
fwmap.put("lc", lc);
// 本楼层的房屋数据
List<FwxxEntity> fwlist = currentMhList.stream().filter(c -> c.getLc().equals(lc)).collect(Collectors.toList());
for (FwxxEntity f : fwlist)
{
YwpzEntity ywpzEntity = ywpzEntityMap.get(f.getFwbm());
if (ywpzEntity != null)
{
if ("1".equals(ywpzEntity.getShzt()))
{
f.setSfyfh("1");
}
else
{
f.setSfyfh("0");
}
}
}
// 单元房屋
fwmap.put("fwxx", fwlist);
list.add(fwmap);
}
}
map.put("lcxx", list);
returnlist.add(map);
}
return returnlist;
}
public static Boolean isObjectNotEmpty(Object obj) { public static Boolean isObjectNotEmpty(Object obj) {
String str = ObjectUtils.toString(obj, ""); String str = ObjectUtils.toString(obj, "");
return StringUtils.isNotBlank(str); return StringUtils.isNotBlank(str);
...@@ -187,7 +253,7 @@ public class FwxxServiceImpl extends ServiceImpl<FwxxDao, FwxxEntity> implements ...@@ -187,7 +253,7 @@ public class FwxxServiceImpl extends ServiceImpl<FwxxDao, FwxxEntity> implements
public FwxxEntity queryDhsj(FwxxEntity fwxxEntity) { public FwxxEntity queryDhsj(FwxxEntity fwxxEntity) {
return baseMapper.queryDhsj(fwxxEntity); return baseMapper.queryDhsj(fwxxEntity);
} }
/** /**
* 查询是否存在项目 * 查询是否存在项目
*/ */
...@@ -208,19 +274,19 @@ public class FwxxServiceImpl extends ServiceImpl<FwxxDao, FwxxEntity> implements ...@@ -208,19 +274,19 @@ public class FwxxServiceImpl extends ServiceImpl<FwxxDao, FwxxEntity> implements
@Override @Override
public void PLINSERTFwxx(FwxxEntity fwxxEntity) { public void PLINSERTFwxx(FwxxEntity fwxxEntity) {
baseMapper.PLINSERTFwxx(fwxxEntity); baseMapper.PLINSERTFwxx(fwxxEntity);
} }
@Override @Override
public void updatezhxxhs(ZhxxEntity zhxxEntity) { public void updatezhxxhs(ZhxxEntity zhxxEntity) {
baseMapper.updatezhxxhs(zhxxEntity); baseMapper.updatezhxxhs(zhxxEntity);
} }
@Override @Override
public ZhxxEntity selectzhxxhs(String id) { public ZhxxEntity selectzhxxhs(String id) {
return baseMapper.selectzhxxhs(id); return baseMapper.selectzhxxhs(id);
} }
...@@ -229,7 +295,7 @@ public class FwxxServiceImpl extends ServiceImpl<FwxxDao, FwxxEntity> implements ...@@ -229,7 +295,7 @@ public class FwxxServiceImpl extends ServiceImpl<FwxxDao, FwxxEntity> implements
FwxxEntity f=baseMapper.selectfwxx(id); FwxxEntity f=baseMapper.selectfwxx(id);
List<YwpzEntity> ys=new ArrayList<YwpzEntity>(); List<YwpzEntity> ys=new ArrayList<YwpzEntity>();
if("1".equals(f.getSfyj())){ if("1".equals(f.getSfyj())){
ys=baseMapper.selectfwdjxx(id); ys=baseMapper.selectfwdjxx(id);
} }
return ys; return ys;
} }
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment