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 | 71 ++++++++++++++++++++++++++--------- 1 files changed, 52 insertions(+), 19 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 45da709..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,21 +1,25 @@ 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> @@ -34,9 +38,18 @@ @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; } @@ -53,19 +66,39 @@ return judge > 0; } - //鏍规嵁鏍峰搧id鏌ヨ妫�楠岃鍒掗噷闈㈢殑妫�楠岄」鐩� + //淇敼(鍒嗛厤)妫�楠岃鍒掗噷鍒嗛厤璁″垝鐨勪俊鎭� @Override - public List<InspectionProductList> selectProductById(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); - //淇敼妫�楠岃鍒掗噷鍒嗛厤璁″垝鐨勪俊鎭� - @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); + //鏍规嵁璁惧鍚嶈幏鍙栬澶噄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); } //鏌ヨ鎴愬搧妫�楠� -- Gitblit v1.9.3