|
|
|
|
@ -2,13 +2,10 @@ package org.springblade.hzinfo_inspect.duty.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.springblade.core.mp.support.Condition; |
|
|
|
|
import org.springblade.core.mp.support.Query; |
|
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
|
@ -21,7 +18,6 @@ import org.springblade.hzinfo_inspect.duty.enums.DutyMainStatus;
|
|
|
|
|
import org.springblade.hzinfo_inspect.duty.mapper.ImsDutyEmergencyMapper; |
|
|
|
|
import org.springblade.hzinfo_inspect.duty.mapper.ImsDutyMainMapper; |
|
|
|
|
import org.springblade.hzinfo_inspect.duty.service.IImsDutyEmergencyService; |
|
|
|
|
import org.springblade.hzinfo_inspect.duty.vo.ImsDutyEmergencyVo; |
|
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
|
import org.springblade.system.user.feign.IUserClient; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
@ -70,64 +66,26 @@ public class ImsDutyEmergencyServiceImpl extends ServiceImpl<ImsDutyEmergencyMap
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R queryEntity(ImsDutyEmergencyVo imsDutyEmergencyVo, Query query) { |
|
|
|
|
// QueryWrapper<ImsDutyEmergencyEntity> queryWrapper = getQueryWrapper(imsDutyEmergencyVo);
|
|
|
|
|
IPage<ImsDutyEmergencyEntity> imsDutyEmergencyEntityIPage = baseMapper.selectPage(Condition.getPage(query), new LambdaQueryWrapper<>()); |
|
|
|
|
List<ImsDutyEmergencyEntity> records = imsDutyEmergencyEntityIPage.getRecords(); |
|
|
|
|
List<ImsDutyEmergencyEntity> collect; |
|
|
|
|
if (CollectionUtils.isNotEmpty(records)) { |
|
|
|
|
collect = records.stream().map(sig -> { |
|
|
|
|
R<User> user = userClient.userInfoById(sig.getRegistrant()); |
|
|
|
|
public R queryEmergency(ImsDutyEmergencyEntity entity, Query query) { |
|
|
|
|
IPage<ImsDutyEmergencyEntity> pageList = this.page(Condition.getPage(query), Condition.getQueryWrapper(entity)); |
|
|
|
|
if (pageList.getTotal() == 0) { |
|
|
|
|
return R.data(pageList); |
|
|
|
|
} |
|
|
|
|
List<ImsDutyEmergencyEntity> resultList = pageList.getRecords().stream().map(obj -> { |
|
|
|
|
R<User> user = userClient.userInfoById(obj.getRegistrant()); |
|
|
|
|
if (user.isSuccess() && ObjectUtils.isNotEmpty(user.getData())) { |
|
|
|
|
sig.setRegistrantName(user.getData().getName()); |
|
|
|
|
obj.setRegistrantName(user.getData().getName()); |
|
|
|
|
} |
|
|
|
|
R<User> userR = userClient.userInfoById(sig.getChargePerson()); |
|
|
|
|
R<User> userR = userClient.userInfoById(obj.getChargePerson()); |
|
|
|
|
if (userR.isSuccess() && ObjectUtils.isNotEmpty(userR.getData())) { |
|
|
|
|
sig.setChargePersonName(userR.getData().getName()); |
|
|
|
|
obj.setChargePersonName(userR.getData().getName()); |
|
|
|
|
} |
|
|
|
|
ImsDutyClassEntity classEntity = imsDutyClassService.getById(sig.getDutyClass()); |
|
|
|
|
sig.setDutyClassName(classEntity.getClassName()); |
|
|
|
|
return sig; |
|
|
|
|
ImsDutyClassEntity classEntity = imsDutyClassService.getById(obj.getDutyClass()); |
|
|
|
|
obj.setDutyClassName(classEntity == null ? "未知" : classEntity.getClassName()); |
|
|
|
|
return obj; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
imsDutyEmergencyEntityIPage.setRecords(collect); |
|
|
|
|
} |
|
|
|
|
return R.data(imsDutyEmergencyEntityIPage); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private QueryWrapper<ImsDutyEmergencyEntity> getQueryWrapper(ImsDutyEmergencyVo imsDutyEmergencyVo) { |
|
|
|
|
QueryWrapper<ImsDutyEmergencyEntity> queryWrapper = new QueryWrapper(); |
|
|
|
|
if (ObjectUtils.isNotEmpty(imsDutyEmergencyVo.getId())) { |
|
|
|
|
queryWrapper.lambda().in(ImsDutyEmergencyEntity::getId, imsDutyEmergencyVo.getId()); |
|
|
|
|
} |
|
|
|
|
if (ObjectUtils.isNotEmpty(imsDutyEmergencyVo.getDutyStartTime())) { |
|
|
|
|
queryWrapper.lambda().ge(ImsDutyEmergencyEntity::getDutyTime, imsDutyEmergencyVo.getDutyStartTime()); |
|
|
|
|
} |
|
|
|
|
if (ObjectUtils.isNotEmpty(imsDutyEmergencyVo.getDutyEndTime())) { |
|
|
|
|
queryWrapper.lambda().le(ImsDutyEmergencyEntity::getDutyTime, imsDutyEmergencyVo.getDutyEndTime()); |
|
|
|
|
} |
|
|
|
|
if (CollectionUtils.isNotEmpty(imsDutyEmergencyVo.getDutyClass())) { |
|
|
|
|
queryWrapper.lambda().in(ImsDutyEmergencyEntity::getDutyClass, imsDutyEmergencyVo.getDutyClass()); |
|
|
|
|
} |
|
|
|
|
if (CollectionUtils.isNotEmpty(imsDutyEmergencyVo.getChargePerson())) { |
|
|
|
|
queryWrapper.lambda().in(ImsDutyEmergencyEntity::getChargePerson, imsDutyEmergencyVo.getChargePerson()); |
|
|
|
|
pageList.setRecords(resultList); |
|
|
|
|
return R.data(pageList); |
|
|
|
|
} |
|
|
|
|
if (CollectionUtils.isNotEmpty(imsDutyEmergencyVo.getRegistrant())) { |
|
|
|
|
queryWrapper.lambda().in(ImsDutyEmergencyEntity::getRegistrant, imsDutyEmergencyVo.getRegistrant()); |
|
|
|
|
} |
|
|
|
|
if (CollectionUtils.isNotEmpty(imsDutyEmergencyVo.getRegistrant())) { |
|
|
|
|
queryWrapper.lambda().in(ImsDutyEmergencyEntity::getRegistrant, imsDutyEmergencyVo.getRegistrant()); |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isNotEmpty(imsDutyEmergencyVo.getEventTitle())) { |
|
|
|
|
queryWrapper.lambda().like(ImsDutyEmergencyEntity::getEventTitle, imsDutyEmergencyVo.getEventTitle()); |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isNotEmpty(imsDutyEmergencyVo.getEventInfo())) { |
|
|
|
|
queryWrapper.lambda().like(ImsDutyEmergencyEntity::getEventInfo, imsDutyEmergencyVo.getEventInfo()); |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isNotEmpty(imsDutyEmergencyVo.getEventType())) { |
|
|
|
|
queryWrapper.lambda().like(ImsDutyEmergencyEntity::getEventType, imsDutyEmergencyVo.getEventType()); |
|
|
|
|
} |
|
|
|
|
return queryWrapper; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|