From ee5f64ff15c79240681fc46b0201a293ccaf54ad Mon Sep 17 00:00:00 2001 From: zss <zss@example.com> Date: 星期三, 26 七月 2023 18:02:56 +0800 Subject: [PATCH] 检验模块 --- inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/PlanServiceImpl.java | 81 +++++++++++++++++++++++++++++++++------- 1 files changed, 66 insertions(+), 15 deletions(-) diff --git a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/PlanServiceImpl.java b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/PlanServiceImpl.java index e3e23a9..285a465 100644 --- a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/PlanServiceImpl.java +++ b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/PlanServiceImpl.java @@ -1,22 +1,29 @@ package com.yuanchu.limslaboratory.service.impl; -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.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.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; + /** * <p> - * 鏈嶅姟瀹炵幇绫� + * 鏈嶅姟瀹炵幇绫� * </p> * * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 @@ -29,15 +36,24 @@ PlanMapper planMapper; @Resource + InspectionProductListMapper inspectionProductListMapper; + + @Resource InspectionMaterialListMapper inspectionMaterialListMapper; @Resource - InspectionProductListMapper inspectionProductListMapper; + UserMapper userMapper; - //鏌ヨ鎵�鏈夋楠岃鍒� + @Resource + InstrumentMapper instrumentMapper; + + //鏌ヨ鎵�鏈夋楠岃鍒掑垎閰� @Override - public List<PlanDto> selectAllPlan(int pageSize, int countSize, Integer state) { - return planMapper.selectAllPlan((pageSize - 1) * countSize,pageSize * countSize, state); + public List<PlanVo> selectAllPlan(int pageSize, int countSize, Integer state) { + if (state == null) { + state = 2; + } + return planMapper.selectAllPlan((pageSize - 1) * countSize, pageSize * countSize, state); } //浣滃簾妫�楠岃鍒� @@ -47,12 +63,47 @@ //鐘舵�佹敼涓轰綔搴�0 plan.setState(0); int judge = planMapper.updateById(plan); - return judge>0; + return judge > 0; } - //鏌ヨ妫�楠岃鍒掗噷闈㈢殑鍒嗛厤淇℃伅 + //淇敼(鍒嗛厤)妫�楠岃鍒掗噷鍒嗛厤璁″垝鐨勪俊鎭� @Override - public List<InspectionProductList> selectById(Integer id) { - return inspectionProductListMapper.selectByMaterId(id); + public void upPlan(InspectionProductListDto inspectionProductListDto) { + /*鏇存柊璁″垝琛ㄤ腑鐨勭姸鎬�(3:宸插垎閰�),鏇存柊鏃堕棿*/ + //鏌ヨ鎶ユ鍗昳d + 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()); + //鏍规嵁鎶ユ鍗昳d杩涜鏇存柊璁″垝琛� + LambdaUpdateWrapper<Plan> updateWrapper1 = new LambdaUpdateWrapper<>(); + updateWrapper1.eq(Plan::getInspectionId, plan.getInspectionId()); + planMapper.update(plan, updateWrapper1); + + /*鏇存柊妫�楠岄」鐩〃涓殑椤圭洰妫�楠屽紑濮嬫棩鏈�,椤圭洰妫�楠岀粨鏉熸棩鏈�,椤圭洰璇曢獙鍛�,璇曢獙瑕佹眰,鏇存柊鏃堕棿,璁惧id*/ + InspectionProductList inspectionProductList = new InspectionProductList(); + //澶嶅埗涔嬪悗,inspectionProductList閲岄潰鏈夐」鐩楠屽紑濮嬨�佺粨鏉熸棩鏈�,椤圭洰鍚嶇О,璇曢獙鏂规硶,璇曢獙瑕佹眰,鍗曚綅, + BeanUtils.copyProperties(inspectionProductListDto, inspectionProductList); + //鏍规嵁璁惧鍚嶈幏鍙栬澶噄d + LambdaQueryWrapper<Instrument> wrapper1 = new LambdaQueryWrapper<>(); + wrapper1.eq(Instrument::getEquipmentName, inspectionProductListDto.getInstrumentName()); + Instrument instrument = instrumentMapper.selectOne(wrapper1); + //鏍规嵁鐢ㄦ埛鍚嶈幏鍙栫敤鎴穒d + 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); + } + + //鏌ヨ鎴愬搧妫�楠� + @Override + public List<PlanDto> selectInspection(int pageSize, int countSize, Integer state) { + return planMapper.selectInspection((pageSize - 1) * countSize, pageSize * countSize, state); } } -- Gitblit v1.9.3