| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import org.dromara.common.core.constant.DictConstants; |
| | | import org.dromara.common.core.utils.DateUtils; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.eims.domain.EimsEqu; |
| | | import org.dromara.eims.domain.EimsInspectRecord; |
| | | import org.dromara.eims.domain.vo.EimsInspectRecordVo; |
| | | import org.dromara.eims.mapper.EimsEquMapper; |
| | | import org.dromara.eims.mapper.EimsInspectRecordMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.dromara.eims.domain.bo.EimsInspectStBo; |
| | |
| | | public class EimsInspectStServiceImpl implements IEimsInspectStService { |
| | | |
| | | private final EimsInspectStMapper baseMapper; |
| | | private final EimsEquMapper equMapper; |
| | | private final EimsInspectRecordMapper recordMapper; |
| | | |
| | | /** |
| | |
| | | @Override |
| | | public EimsInspectStVo queryById(Long id){ |
| | | EimsInspectStVo stVo = baseMapper.selectVoById(id); |
| | | if(stVo!=null&&stVo.getEquId()!=null){ |
| | | EimsEqu eimsEqu = equMapper.selectById(stVo.getEquId()); |
| | | stVo.setEquName(eimsEqu.getEquName()); |
| | | stVo.setAssetNo(eimsEqu.getAssetNo()); |
| | | } |
| | | // fillStDataSingle(stVo); |
| | | return stVo; |
| | | } |
| | | |
| | | @Override |
| | | public EimsInspectStVo queryByStId(String stId) { |
| | | QueryWrapper<EimsInspectSt> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("st_id", stId); |
| | | EimsInspectStVo stVo = baseMapper.selectVoOne(queryWrapper); |
| | | if(stVo!=null&&stVo.getEquId()!=null){ |
| | | EimsEqu eimsEqu = equMapper.selectById(stVo.getEquId()); |
| | | stVo.setEquName(eimsEqu.getEquName()); |
| | | stVo.setAssetNo(eimsEqu.getAssetNo()); |
| | | } |
| | | // fillStDataSingle(stVo); |
| | | return stVo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * |
| | | * @param stVo |
| | | * @param type Day-日视图 Month-月视图 |
| | | * @param stVo type Day-日视图 Month-月视图 |
| | | * @param |
| | | */ |
| | | private void fillStDataSingle(EimsInspectStVo stVo,String type) { |
| | | private void fillStDataSingle(EimsInspectStVo stVo) { |
| | | |
| | | LambdaQueryWrapper<EimsInspectRecord> recordLqw = Wrappers.lambdaQuery(); |
| | | recordLqw.eq(EimsInspectRecord::getEquId, stVo.getEquId()); |
| | |
| | | LocalDate endOfMonth = planTime.with(TemporalAdjusters.lastDayOfMonth()); |
| | | |
| | | // 日视图查询范围 |
| | | if(type.equals("Day")){ |
| | | if(stVo.getType().equals("Day")){ |
| | | recordLqw.between(EimsInspectRecord::getPlanTime, planTime, planTime); |
| | | }else { |
| | | // 月视图查询范围 |
| | |
| | | qw.like(StringUtils.isNotBlank(bo.getTitle()), "st.title", bo.getTitle()); |
| | | qw.like(StringUtils.isNotBlank(bo.getEquName()), "equ.equ_name", bo.getEquName()); |
| | | qw.like(StringUtils.isNotBlank(bo.getAssetNo()), "equ.asset_no", bo.getAssetNo()); |
| | | if(bo.getPlanTime()!=null&&bo.getViewMode() != null && bo.getViewMode().equals("Day")){ |
| | | qw.eq("DATE_FORMAT(st.plan_time, '%Y-%m-%d')", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,bo.getPlanTime())); |
| | | }else if(bo.getPlanTime()!=null&&bo.getViewMode() != null && bo.getViewMode().equals("Month")){ |
| | | qw.eq("DATE_FORMAT(st.plan_time, '%Y-%m')", DateUtils.parseDateToStr(DateUtils.YYYY_MM,bo.getPlanTime())); |
| | | } |
| | | qw.eq( "st.type", bo.getType()); |
| | | qw.between(params.get("beginPlanTime") != null && params.get("endPlanTime") != null, |
| | | "st.plan_time", params.get("beginPlanTime"), params.get("endPlanTime")); |
| | | qw.eq(bo.getInspUser() != null, "st.maint_user", bo.getInspUser()); |
| | | qw.eq(bo.getVerifyUser() != null, "st.verify_user", bo.getVerifyUser()); |
| | | qw.eq(bo.getStatus() != null, "st.status", bo.getStatus()); |
| | | qw.eq(bo.getUpdateBy() != null, "st.update_by", bo.getUpdateBy()); |
| | | qw.orderByDesc( "st.create_time"); |
| | | return qw; |
| | | } |