|  |  |  | 
|---|
|  |  |  | import com.doumee.core.model.PageData; | 
|---|
|  |  |  | import com.doumee.core.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.core.utils.DateUtil; | 
|---|
|  |  |  | import com.doumee.core.utils.Utils; | 
|---|
|  |  |  | import com.doumee.dao.business.*; | 
|---|
|  |  |  | import com.doumee.dao.business.dto.YwWorkorderDataDTO; | 
|---|
|  |  |  | import com.doumee.dao.business.model.*; | 
|---|
|  |  |  | import com.doumee.dao.business.vo.YwWorkorderDataVO; | 
|---|
|  |  |  | import com.doumee.dao.system.MultifileMapper; | 
|---|
|  |  |  | import com.doumee.dao.system.SystemUserMapper; | 
|---|
|  |  |  | import com.doumee.dao.system.model.Multifile; | 
|---|
|  |  |  | 
|---|
|  |  |  | import org.springframework.util.CollectionUtils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  | import java.util.stream.Collectors; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 运维工单信息表Service实现 | 
|---|
|  |  |  | 
|---|
|  |  |  | queryWrapper.orderByAsc(sortData.getProperty()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(StringUtils.isNotBlank(pageWrap.getModel().getBuildingName())){ | 
|---|
|  |  |  | queryWrapper.and(rw ->{ | 
|---|
|  |  |  | rw.like(YwBuilding::getName,pageWrap.getModel().getBuildingName()).or() | 
|---|
|  |  |  | .like(YwRoom::getName,pageWrap.getModel().getBuildingName()); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | queryWrapper.ge(Objects.nonNull(pageWrap.getModel().getQueryStartTime()), YwWorkorder::getCreateDate, pageWrap.getModel().getQueryStartTime()) | 
|---|
|  |  |  | .le(Objects.nonNull(pageWrap.getModel().getQueryEndTime()), YwWorkorder::getCreateDate, pageWrap.getModel().getQueryEndTime()); | 
|---|
|  |  |  | queryWrapper.orderByDesc(YwContract::getCreateDate ); | 
|---|
|  |  |  | return PageData.from(ywWorkorderMapper.selectPage(page, queryWrapper)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | PageData<YwWorkorder> result =   PageData.from(ywWorkorderMapper.selectPage(page, queryWrapper)); | 
|---|
|  |  |  | if(result!=null && result.getRecords()!=null){ | 
|---|
|  |  |  | for(YwWorkorder m : result.getRecords()){ | 
|---|
|  |  |  | if(Constants.equalsInteger(m.getAreaType(),Constants.ZERO)){ | 
|---|
|  |  |  | //0室内维修 | 
|---|
|  |  |  | m.setAreaNameInfo(StringUtils.defaultString(m.getBuildingName(),"")+"/"+StringUtils.defaultString(m.getRoomNum(),"")); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | m.setAreaNameInfo(StringUtils.defaultString(m.getBuildingName(),"")+"/"+StringUtils.defaultString(m.getFloorName(),"")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return result; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  | QueryWrapper<YwWorkorder> wrapper = new QueryWrapper<>(ywWorkorder); | 
|---|
|  |  |  | return ywWorkorderMapper.selectCount(wrapper); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public YwWorkorderDataVO getDataVO(YwWorkorderDataDTO dto){ | 
|---|
|  |  |  | YwWorkorderDataVO ywWorkorderDataVO = new YwWorkorderDataVO(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<YwWorkorder> list = ywWorkorderMapper.selectList(new QueryWrapper<YwWorkorder>().lambda() | 
|---|
|  |  |  | .eq(YwWorkorder::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .eq(Constants.equalsInteger(dto.getQueryType(),Constants.ONE),YwWorkorder::getProjectId,dto.getQueryId()) | 
|---|
|  |  |  | .eq(Constants.equalsInteger(dto.getQueryType(),Constants.TWO),YwWorkorder::getFloorId,dto.getQueryId()) | 
|---|
|  |  |  | .eq(Constants.equalsInteger(dto.getQueryType(),Constants.THREE),YwWorkorder::getRoomId,dto.getQueryId())); | 
|---|
|  |  |  | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(list)){ | 
|---|
|  |  |  | ywWorkorderDataVO.setAmount(list.size()); | 
|---|
|  |  |  | ywWorkorderDataVO.setMonthAmount(list.stream().filter(i-> DateUtil.formatDate(i.getSubmitDate(),"yyyy-MM").equals(DateUtil.formatDate(new Date(),"yyyy-MM"))).collect(Collectors.toList()).size()); | 
|---|
|  |  |  | ywWorkorderDataVO.setWaitDealAmount(list.stream().filter(i-> Constants.equalsInteger(i.getDealStatus(),Constants.ONE)).collect(Collectors.toList()).size()); | 
|---|
|  |  |  | ywWorkorderDataVO.setWaitAssignAmount(list.stream().filter(i-> Constants.equalsInteger(i.getDealStatus(),Constants.ZERO)).collect(Collectors.toList()).size()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return ywWorkorderDataVO; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|