| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import liquibase.repackaged.org.apache.commons.lang3.StringUtils; |
| | | import org.apache.logging.log4j.util.Strings; |
| | | import org.springblade.common.cache.SysCache; |
| | | import org.springblade.common.node.TreeIntegerNode; |
| | | import org.springblade.common.node.TreeStringNode; |
| | | import org.springblade.common.utils.NodeTreeUtil; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | |
| | | private IUserService userService; |
| | | |
| | | @Autowired |
| | | private IDeptService deptService; |
| | | |
| | | @Autowired |
| | | private IPlaceService placeService; |
| | | |
| | | @Override |
| | | public IPage<HouseholdVO> selectHouseholdPage(IPage<HouseholdVO> page, HouseholdVO household) { |
| | | StopWatch stopWatch = new StopWatch(); |
| | | stopWatch.start(); |
| | | Dept dept = deptService.getById(AuthUtil.getDeptId()); |
| | | if (null!=dept){ |
| | | household.setRegionCode(dept.getRegionCode()); |
| | | } |
| | | List<HouseholdVO> householdVOS = baseMapper.selectHouseholdPage(page, household); |
| | | List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId()); |
| | | Integer isAdministrator = AuthUtil.isAdministrator()==true?1:2; |
| | | List<HouseholdVO> householdVOS = baseMapper.selectHouseholdPage(page, household,regionChildCodesList,isAdministrator); |
| | | stopWatch.stop(); |
| | | System.out.println("selectHouseholdPage:" + stopWatch.getTotalTimeMillis()); |
| | | return page.setRecords(householdVOS); |
| | |
| | | |
| | | @Override |
| | | public IPage<HouseholdVO> getKeynotePersonnelPage(IPage<HouseholdVO> page, HouseholdVO household) { |
| | | StopWatch stopWatch = new StopWatch(); |
| | | stopWatch.start(); |
| | | // Dept dept = deptService.getById(AuthUtil.getDeptId()); |
| | | // if (null!=dept){ |
| | | // household.setRegionCode(dept.getRegionCode()); |
| | | // } |
| | | // StopWatch stopWatch = new StopWatch(); |
| | | // stopWatch.start(); |
| | | // Dept dept = deptService.getById(AuthUtil.getDeptId()); |
| | | // if (null!=dept){ |
| | | // household.setRegionCode(dept.getRegionCode()); |
| | | // } |
| | | List<HouseholdVO> householdVOS = baseMapper.getKeynotePersonnelPage(page, household); |
| | | stopWatch.stop(); |
| | | System.out.println("selectHouseholdPage:" + stopWatch.getTotalTimeMillis()); |
| | | // stopWatch.stop(); |
| | | // System.out.println("selectHouseholdPage:" + stopWatch.getTotalTimeMillis()); |
| | | return page.setRecords(householdVOS); |
| | | } |
| | | |
| | |
| | | public List<HouseholdVO> getHouseholdListByParam(List<Integer> list) { |
| | | return baseMapper.getHouseholdListByParam(list); |
| | | } |
| | | |
| | | @Override |
| | | public List<TreeIntegerNode> getlabelStatistics(HouseholdVO household) { |
| | | Map<Integer, TreeIntegerNode> labelTreeList = baseMapper.getlabelStatistics(household); |
| | | List<TreeIntegerNode> nodeTree = NodeTreeUtil.getNodeTree(labelTreeList); |
| | | nodeTree.forEach(node -> recursion(node)); |
| | | return nodeTree; |
| | | } |
| | | |
| | | private void recursion(TreeIntegerNode node) { |
| | | if (node.getChildren() != null && node.getChildren().size() > 0) { |
| | | node.getChildren().forEach(node2 -> recursion(node2)); |
| | | } else { |
| | | node.setChildren(null); |
| | | } |
| | | } |
| | | } |