| | |
| | | package com.yuanchu.limslaboratory.service.impl; |
| | | |
| | | import com.yuanchu.limslaboratory.mapper.PlanMapper; |
| | | import com.yuanchu.limslaboratory.pojo.vo.PlanVo; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.yuanchu.limslaboratory.mapper.*; |
| | | import com.yuanchu.limslaboratory.pojo.InspectionProduct; |
| | | import com.yuanchu.limslaboratory.pojo.Instrument; |
| | | import com.yuanchu.limslaboratory.pojo.User; |
| | | import com.yuanchu.limslaboratory.service.InstrumentService; |
| | | import com.yuanchu.limslaboratory.service.PlanService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Resource |
| | | private PlanMapper planMapper; |
| | | |
| | | /** |
| | | * 查询检验计划 |
| | | * |
| | | * @return |
| | | */ |
| | | @Resource |
| | | InspectionProductMapper inspectionProductMapper; |
| | | |
| | | @Resource |
| | | UserMapper userMapper; |
| | | |
| | | @Resource |
| | | InstrumentMapper instrumentMapper; |
| | | |
| | | //查询检验计划 |
| | | @Override |
| | | public List<PlanVo> selectAllPlan(String device, Date beginTime, Date endTime, String user) { |
| | | //获取数据库数据 |
| | | List<PlanVo> planVos = planMapper.selectAllPlan(device, beginTime, endTime, user); |
| | | //添加计划工期和检验进度 |
| | | planVos.forEach(planVo -> { |
| | | //添加检验进度 |
| | | //判断是否是已完成 |
| | | if (planVo.getState() != null) { |
| | | planVo.setProgress(100); |
| | | } |
| | | //判断是否是未分配 |
| | | if (planVo.getCheckproject() == null) { |
| | | planVo.setProgress(0); |
| | | } |
| | | //判断是否是进行中 |
| | | if (planVo.getState() == null && planVo.getCheckproject() != null) { |
| | | planVo.setProgress(50); |
| | | } |
| | | //添加计划工期 |
| | | if (planVo.getFinishtime() != null && planVo.getStarttime() != null) { |
| | | long startTimeInMillis = planVo.getStarttime().getTime(); |
| | | long endTimeInMillis = planVo.getFinishtime().getTime(); |
| | | long durationInMillis = endTimeInMillis - startTimeInMillis; |
| | | long duration = durationInMillis / (1000 * 60 * 60); |
| | | planVo.setDuration(Integer.valueOf((int) duration)); |
| | | } |
| | | }); |
| | | return planVos; |
| | | public List<Map<String,Object>> selectAllPlan(String code , String beginTime, String endTime,Integer status) { |
| | | return planMapper.selectAllPlan(code,beginTime,endTime,status); |
| | | } |
| | | |
| | | //分配-->选择检验人 |
| | | @Override |
| | | public List<Map<String, Object>> choosecheck() { |
| | | return userMapper.selectUser(); |
| | | } |
| | | |
| | | //分配-->选择设备 |
| | | @Override |
| | | public List<Map<String, Object>> chooseinstum() { |
| | | return null; |
| | | } |
| | | |
| | | //分配人员与设备 |
| | | @Override |
| | | public String distribution(Integer id, Integer userId, Integer instrumentId) { |
| | | InspectionProduct inspectionProduct = new InspectionProduct(); |
| | | inspectionProduct.setId(id); |
| | | inspectionProduct.setUserId(userId); |
| | | inspectionProduct.setInstrumentId(instrumentId); |
| | | inspectionProductMapper.updateById(inspectionProduct); |
| | | return "分配完成!"; |
| | | } |
| | | } |