| | |
| | | import org.springblade.common.utils.PositionUtil; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.modules.yw.entity.FirmInfo; |
| | | import org.springblade.modules.yw.entity.RescueTeamEntity; |
| | | import org.springblade.modules.yw.excel.FirmInfoExcel; |
| | | import org.springblade.modules.yw.mapper.FirmInfoMapper; |
| | | import org.springblade.modules.yw.service.IFirmInfoService; |
| | | import org.springblade.modules.yw.service.IRescueTeamService; |
| | | import org.springblade.modules.yw.vo.FirmInfoVO; |
| | | import org.springblade.modules.yw.vo.SearchVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Service |
| | | public class FirmInfoServiceImpl extends ServiceImpl<FirmInfoMapper, FirmInfo> implements IFirmInfoService { |
| | | |
| | | @Lazy |
| | | @Resource |
| | | private IRescueTeamService rescueTeamService; |
| | | |
| | | /** |
| | | * 自定义分页查询 |
| | |
| | | List<FirmInfoVO> firmInfoVOS = baseMapper.selectFirmInfoPage(page, firmInfo); |
| | | for (FirmInfoVO firmInfoVO : firmInfoVOS) { |
| | | if (!Strings.isBlank(firmInfoVO.getCategory())){ |
| | | firmInfoVO.setCategoryName( |
| | | DictBizCache.getValues("industry_category",firmInfoVO.getCategory()) |
| | | ); |
| | | firmInfoVO.setCategoryName(firmInfoVO.getCategory()); |
| | | } |
| | | } |
| | | return page.setRecords(firmInfoVOS); |
| | |
| | | // 数据转换 |
| | | FirmInfo firmInfo = Objects.requireNonNull(BeanUtil.copy(firmInfoExcel, FirmInfo.class)); |
| | | // 经纬度转换 |
| | | positionConvert(firmInfo); |
| | | // positionConvert(firmInfo); |
| | | // 判断信息是否已录入 |
| | | FirmInfo oldFirmInfo = isSave(firmInfo); |
| | | // 已存在并且不更新 |
| | |
| | | // 返回 |
| | | return getOne(wrapper); |
| | | } |
| | | |
| | | /** |
| | | * 自定义详情查询 |
| | | * @param firmInfo |
| | | * @return |
| | | */ |
| | | @Override |
| | | public FirmInfoVO getDetail(FirmInfoVO firmInfo) { |
| | | FirmInfoVO detail = baseMapper.getDetail(firmInfo); |
| | | // 设置类型解析 |
| | | if (!Strings.isBlank(detail.getCategory())){ |
| | | detail.setCategoryName( |
| | | DictBizCache.getValues("industry_category",detail.getCategory()) |
| | | ); |
| | | } |
| | | // 查询救援队伍信息 |
| | | QueryWrapper<RescueTeamEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("firm_id",detail.getId()).eq("is_deleted",0); |
| | | List<RescueTeamEntity> list = rescueTeamService.list(wrapper); |
| | | if (list.size()>0){ |
| | | firmInfo.setRescuePerName(list.get(0).getPerInCha()); |
| | | firmInfo.setRescuePerPhone(list.get(0).getPerInChaPho()); |
| | | } |
| | | // 返回 |
| | | return detail; |
| | | } |
| | | |
| | | /** |
| | | * 模糊查询企业名称、应急空间名称、风险源名称 |
| | | * @param firmInfo |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<SearchVO> fuzzyQuery(FirmInfoVO firmInfo) { |
| | | return baseMapper.fuzzyQuery(firmInfo); |
| | | } |
| | | } |