package com.newfiber.api.mobile.service; import cn.hutool.core.collection.CollectionUtil; import com.baomidou.mybatisplus.plugins.Page; import com.google.common.base.Strings; import com.google.common.collect.Lists; import com.newfiber.api.core.base.BaseService; import com.newfiber.api.mobile.dao.RiverBusinessPicsDao; import com.newfiber.api.mobile.model.domain.RiverBusinessPics; import com.newfiber.api.pc.dao.RiverManage.RiverInfoBasisDao; import com.newfiber.api.pc.model.River.RiverInfoBasis; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; import java.util.Map; import java.util.Optional; /** * 河道基础信息表 Service * @author xcc * @date 2018-12-04 16:21:59 */ @Service("riverInfoBasisService") public class RiverInfoBasisService extends BaseService<RiverInfoBasisDao, RiverInfoBasis> { @Autowired private RiverInfoBasisDao riverInfoBasisDao; @Autowired private RiverBusinessPicsDao riverBusinessPicsDao; /** 根据条件获取河道基础信息表列表(分页) */ public List<RiverInfoBasis> queryList(Map<String, Object> map,Page<RiverInfoBasis> page){ return riverInfoBasisDao.queryList(map,page); } /** 根据条件获取河道基础信息表列表(无分页) */ public List<RiverInfoBasis> queryList(Map<String, Object> map){ return riverInfoBasisDao.queryList(map); } /** * @Description: 根据行政区划编号查询河流列表 * @return: java.util.List<com.newfiber.api.pc.model.River.RiverInfoBasis> * @Author: Wmj * @Date: 2018/12/10 15:09 */ public List<RiverInfoBasis> queryRiverListDivisionNo(String userNo){ if("Admin".equalsIgnoreCase(userNo)){ userNo = null; } List<RiverInfoBasis> riverInfoBasisList = Optional.ofNullable(riverInfoBasisDao.queryRiverListByDivisionNo(userNo)) .orElse(Lists.newArrayList()); if(CollectionUtil.isEmpty(riverInfoBasisList)){ return riverInfoBasisList; } for(RiverInfoBasis riverInfoBasis : riverInfoBasisList){ if(!Strings.isNullOrEmpty(riverInfoBasis.getRiverPicsNo())){ //放入巡查问题图片 String riverPicsNo = riverInfoBasis.getRiverPicsNo(); List<RiverBusinessPics> picsList = riverBusinessPicsDao.queryListByPicsNo(riverPicsNo); riverInfoBasis.setRiverPics(picsList); } } return riverInfoBasisList; } /** * @Description: 根据河流编号查询河流具体信息 * @param riverNo 河道信息 * @return: com.newfiber.api.pc.model.River.RiverInfoBasis * @Author: Wmj * @Date: 2018/12/10 17:09 */ public RiverInfoBasis queryRiverInfoByRivertNo(String riverNo,String userNo){ return riverInfoBasisDao.queryRiverInfoByRivertNo(riverNo,userNo); } /** * @Description: 根据父级河流编号查询子级河流具体信息 * @param parentRiverNo * @return: java.util.List<com.newfiber.api.pc.model.River.RiverInfoBasis> * @Author: Wmj * @Date: 2018/12/10 17:10 */ public List<RiverInfoBasis> queryRiverListByParentRiverNo(String parentRiverNo){ List<RiverInfoBasis> riverInfoBasisList = Optional.ofNullable(riverInfoBasisDao.queryRiverListByParentRivertNo(parentRiverNo)) .orElse(Lists.newArrayList()); return riverInfoBasisList; } public List<RiverInfoBasis> queryRiverListByDivisionNo(String divisionNo){ return riverInfoBasisDao.queryRiverListByDivision(divisionNo); } }