| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.domain.*; |
| | | import com.ruoyi.domain.ZfEquipment; |
| | | import com.ruoyi.domain.dto.zfEventdto; |
| | | import com.ruoyi.mapper.ZfEquipmentMapper; |
| | | import com.ruoyi.service.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class ZfEquipmentServiceImpl extends ServiceImpl<ZfEquipmentMapper, ZfEquipment> implements ZfEquipmentService { |
| | | public class ZfEquipmentServiceImpl extends ServiceImpl<ZfEquipmentMapper, ZfEquipment> implements ZfEquipmentService ,ModuleSearchable{ |
| | | @Resource |
| | | ZInfoUserService zInfoUserService; |
| | | |
| | |
| | | lqw.like(StringUtils.isNotEmpty(zfEquipment.getLocation()), ZfEquipment::getLocation, zfEquipment.getLocation()); |
| | | lqw.like(StringUtils.isNotEmpty(zfEquipment.getRemark()), ZfEquipment::getRemark, zfEquipment.getRemark()); |
| | | lqw.eq(zfEquipment.getHappenTime() != null, ZfEquipment::getHappenTime, zfEquipment.getHappenTime()); |
| | | lqw.in(ZfEquipment::getFamilyId,familyIdList); |
| | | lqw.in(familyIdList != null,ZfEquipment::getFamilyId,familyIdList); |
| | | lqw.between(zfEquipment.getHappenStartTime() != null && zfEquipment.getHappenEndTime() != null, ZfEquipment::getHappenTime, zfEquipment.getHappenStartTime(), zfEquipment.getHappenEndTime()); |
| | | |
| | | if (StringUtils.isNotEmpty(zfEquipment.getIsHide())) { |
| | | |
| | | lqw.and(wrapper -> wrapper |
| | | .ne(ZfEquipment::getIsHide, "是") |
| | | .or() |
| | | .isNull(ZfEquipment::getIsHide) |
| | | ); |
| | | } |
| | | if (zfEquipment.getHasAttachment() != null && zfEquipment.getHasAttachment().equals("是")) { |
| | | lqw.apply("url IS NOT NULL AND url != ''"); |
| | | } |
| | | // lqw.in(StringUtils.isNotEmpty(zfEquipment.getCompanionList()),zfEquipment::getCompanion,zfEquipment.getCompanionList()); |
| | | // if (zfEquipment.getYear() != 0) { |
| | | // System.out.println("pppppppppppppppppppppppppppppppppppppppppppppppppppp"+zfEquipment.getYear()); |
| | | // lqw.apply("YEAR(happen_time) = {0}", zfEquipment.getYear()); |
| | | // } |
| | | |
| | | if (CollectionUtils.isNotEmpty(zfEquipment.getCompanionList())) { |
| | | List<String> companionList = zfEquipment.getCompanionList(); |
| | | |
| | | // 清理和去重 |
| | | companionList = companionList.stream() |
| | | .map(String::trim) |
| | | .filter(s -> !s.isEmpty()) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | |
| | | if (!companionList.isEmpty()) { |
| | | // 确保所有参与人都在companion字段中 |
| | | for (String companion : companionList) { |
| | | lqw.apply("FIND_IN_SET({0}, REPLACE(REPLACE(companion, ' ', ''), ',', ',')) > 0", |
| | | companion); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | lqw.eq(zfEquipment.getHappenTime() != null, ZfEquipment::getHappenTime, zfEquipment.getHappenTime()); |
| | | |
| | | |
| | | return lqw; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | // //------------------------------------------------------------------------------------------ |
| | | // private LambdaQueryWrapper<ZfEquipment> buildCondition(ZfEquipment zfEquipment, String familyIds, String secondFamilyAuthority) { |
| | | // //模糊查询的条件 |
| | |
| | | esModel.setFid(familyId); |
| | | //这里存储查询详情的路径 |
| | | esService.insertTable(esModel); |
| | | |
| | | |
| | | return AjaxResult.success(); |
| | | } else { |
| | | return AjaxResult.error(); |
| | |
| | | }else { |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public String getModuleCode() { |
| | | return "设备"; |
| | | } |
| | | |
| | | @Override |
| | | // @Cacheable(value = "economy_search", key = "T(String).format('2045_%s_%s_%s_%s',#companion != null ? #companion : 'null',#happenStartTime != null ? #happenStartTime.getTime() : 0,#happenEndTime != null ? #happenEndTime.getTime() : 0,#hasAttachment != null ? #hasAttachment : 'null')") |
| | | public List<?> search(String companion, Date happenStartTime,Date happenEndTime,String hasAttachment) { |
| | | ZfEquipment zfEquipment = new ZfEquipment(); |
| | | zfEquipment.setCompanion(companion); |
| | | zfEquipment.setHappenStartTime(happenStartTime); |
| | | zfEquipment.setHappenEndTime(happenEndTime); |
| | | |
| | | String[] split = companion.split(","); |
| | | List<String> list = Arrays.asList(split); |
| | | |
| | | zfEquipment.setCompanionList(list); |
| | | zfEquipment.setHasAttachment(hasAttachment); |
| | | zfEquipment.setIsHide("否"); |
| | | |
| | | System.out.println("[[[[[[[["+zfEquipment); |
| | | |
| | | return dataList(zfEquipment); |
| | | } |
| | | |
| | | public List<zfEventdto> dataList(ZfEquipment zfEquipment) { |
| | | |
| | | LambdaQueryWrapper<ZfEquipment> lqw = buildCondition(zfEquipment, null); |
| | | |
| | | List<ZfEquipment> beanRecords = list(lqw); |
| | | |
| | | |
| | | |
| | | return encapData(beanRecords); |
| | | } |
| | | |
| | | public List<zfEventdto> encapData(List<ZfEquipment> lis) |
| | | { |
| | | List<zfEventdto> daoRes = new ArrayList<>() ; |
| | | for(ZfEquipment obj : lis) |
| | | { |
| | | zfEventdto atd = new zfEventdto(); |
| | | atd.setId(Math.toIntExact(obj.getId())); |
| | | atd.setModule("设备"); |
| | | atd.setName(obj.getCompanion()); |
| | | atd.setCreateTime(obj.getCreateTime()); |
| | | daoRes.add(atd); |
| | | } |
| | | return daoRes; |
| | | } |
| | | } |