| | |
| | | package com.yuanchu.limslaboratory.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.yuanchu.limslaboratory.mapper.InspectionMaterialListMapper; |
| | | import com.yuanchu.limslaboratory.mapper.InspectionProductListMapper; |
| | | import com.yuanchu.limslaboratory.pojo.InspectionMaterialList; |
| | | import com.yuanchu.limslaboratory.pojo.InspectionProductList; |
| | | import com.yuanchu.limslaboratory.pojo.Plan; |
| | | import com.yuanchu.limslaboratory.mapper.PlanMapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.yuanchu.limslaboratory.mapper.*; |
| | | import com.yuanchu.limslaboratory.pojo.*; |
| | | import com.yuanchu.limslaboratory.pojo.dto.InspectionProductListDto; |
| | | import com.yuanchu.limslaboratory.pojo.dto.PlanDto; |
| | | import com.yuanchu.limslaboratory.pojo.vo.PlanVo; |
| | | import com.yuanchu.limslaboratory.service.PlanService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Resource |
| | | InspectionProductListMapper inspectionProductListMapper; |
| | | |
| | | @Resource |
| | | InspectionMaterialListMapper inspectionMaterialListMapper; |
| | | |
| | | @Resource |
| | | UserMapper userMapper; |
| | | |
| | | @Resource |
| | | InstrumentMapper instrumentMapper; |
| | | |
| | | //查询所有检验计划分配 |
| | | @Override |
| | | public Map selectAllPlan(int pageSize, int countSize, Integer state) { |
| | | public List<PlanVo> selectAllPlan(int pageSize, int countSize, Integer state) { |
| | | if (state == null) { |
| | | state = 2; |
| | | } |
| | |
| | | return judge > 0; |
| | | } |
| | | |
| | | //根据样品id查询检验计划里面的检验项目 |
| | | //修改(分配)检验计划里分配计划的信息 |
| | | @Override |
| | | public List<InspectionProductList> selectProductById(Integer id) { |
| | | return inspectionProductListMapper.selectByMaterId(id); |
| | | } |
| | | public void upPlan(InspectionProductListDto inspectionProductListDto) { |
| | | /*更新计划表中的状态(3:已分配),更新时间*/ |
| | | //查询报检单id |
| | | InspectionMaterialList inspectionMaterialList = inspectionMaterialListMapper.selectById(inspectionProductListDto.getInspectionMaterialListId()); |
| | | LambdaQueryWrapper<Plan> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(Plan::getInspectionId, inspectionMaterialList.getInspectionId()); |
| | | Plan plan = planMapper.selectOne(queryWrapper); |
| | | plan.setState(3).setUpdateTime(new Date()); |
| | | //根据报检单id进行更新计划表 |
| | | LambdaUpdateWrapper<Plan> updateWrapper1 = new LambdaUpdateWrapper<>(); |
| | | updateWrapper1.eq(Plan::getInspectionId, plan.getInspectionId()); |
| | | planMapper.update(plan, updateWrapper1); |
| | | |
| | | //修改检验计划里分配计划的信息 |
| | | @Override |
| | | public void upPlan(InspectionProductList inspectionProductList) { |
| | | LambdaUpdateWrapper<InspectionProductList> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(InspectionProductList::getInspectionMaterialListId, inspectionProductList.getInspectionMaterialListId()) |
| | | .eq(InspectionProductList::getMethod, inspectionProductList.getMethod()); |
| | | inspectionProductListMapper.update(inspectionProductList, updateWrapper); |
| | | /*更新检验项目表中的项目检验开始日期,项目检验结束日期,项目试验员,试验要求,更新时间,设备id*/ |
| | | InspectionProductList inspectionProductList = new InspectionProductList(); |
| | | //复制之后,inspectionProductList里面有项目检验开始、结束日期,项目名称,试验方法,试验要求,单位, |
| | | BeanUtils.copyProperties(inspectionProductListDto, inspectionProductList); |
| | | //根据设备名获取设备id |
| | | LambdaQueryWrapper<Instrument> wrapper1 = new LambdaQueryWrapper<>(); |
| | | wrapper1.eq(Instrument::getEquipmentName, inspectionProductListDto.getInstrumentName()); |
| | | Instrument instrument = instrumentMapper.selectOne(wrapper1); |
| | | //根据用户名获取用户id |
| | | LambdaQueryWrapper<User> wrapper2 = new LambdaQueryWrapper<>(); |
| | | wrapper2.eq(User::getName, inspectionProductListDto.getUserName()); |
| | | User user = userMapper.selectOne(wrapper2); |
| | | inspectionProductList.setUpdateTime(new Date()).setUserId(user.getId()).setInstrumentId(instrument.getId()); |
| | | //根据报检样品id和项目名称进行更新检验项目表 |
| | | LambdaUpdateWrapper<InspectionProductList> updateWrapper2 = new LambdaUpdateWrapper<>(); |
| | | updateWrapper2.eq(InspectionProductList::getInspectionMaterialListId, inspectionProductList.getInspectionMaterialListId()) |
| | | .eq(InspectionProductList::getName, inspectionProductList.getName()); |
| | | inspectionProductListMapper.update(inspectionProductList, updateWrapper2); |
| | | } |
| | | |
| | | //查询成品检验 |