From 2dbc49184bd74845c8da694c20d6fd03d7ac87e0 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期四, 21 九月 2023 16:16:21 +0800
Subject: [PATCH] 修改 9.21
---
inspect-server/src/main/java/com/yuanchu/mom/service/impl/OpinionServiceImpl.java | 94 +++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 83 insertions(+), 11 deletions(-)
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/OpinionServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/OpinionServiceImpl.java
index bb2ad6b..69fd347 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/OpinionServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/OpinionServiceImpl.java
@@ -1,16 +1,13 @@
package com.yuanchu.mom.service.impl;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.yuanchu.mom.pojo.InspectUnaccepted;
-import com.yuanchu.mom.pojo.Opinion;
-import com.yuanchu.mom.mapper.OpinionMapper;
+import com.yuanchu.mom.mapper.*;
+import com.yuanchu.mom.pojo.*;
import com.yuanchu.mom.pojo.dto.UpdateInspectUnacceptedDto;
import com.yuanchu.mom.service.OpinionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.yuanchu.mom.utils.MyUtil;
+import com.yuanchu.mom.utils.JackSonUtil;
+import com.yuanchu.mom.vo.Result;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -18,6 +15,8 @@
import java.util.Date;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
/**
* <p>
@@ -32,6 +31,25 @@
@Resource
private OpinionMapper opinionMapper;
+
+ @Resource
+ InspectUnacceptedMapper inspectUnacceptedMapper;
+
+ @Resource
+ RawInspectMapper rawInspectMapper;
+
+ @Resource
+ ProcessInspectMapper processInspectMapper;
+
+ @Resource
+ FinishedInspectMapper finishedInspectMapper;
+
+ @Resource
+ InspectionItemMapper inspectionItemMapper;
+
+ @Resource
+ RawInsProductMapper rawInsProductMapper;
+
@Override
public List<UpdateInspectUnacceptedDto> clickEditingTriggerQuery(Integer rawUnacceptedId) {
@@ -50,13 +68,67 @@
return mapList;
}
+ //缂栬緫鎰忚
@Override
- public Integer updateOpinion(String id, List<Opinion> opinion) {
+ public Integer updateOpinion(String id, List<?> opinion) {
+ List<Opinion> list = new ArrayList<>();
+ AtomicInteger a= new AtomicInteger();
+ AtomicInteger unId= new AtomicInteger();
opinion.forEach(i -> {
- i.setUserId(Integer.valueOf(id));
- i.setFillDate(new Date());
+ try {
+ Opinion unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(i), Opinion.class);
+ unmarshal.setUserId(Integer.valueOf(id));
+ unmarshal.setFillDate(new Date());
+ list.add(unmarshal);
+ //璁板綍澶勭悊鐨勬柟寮忎负杩斾慨鐨勬鏁�
+ if (unmarshal.getWay()==1){
+ a.getAndIncrement();
+ }
+ //璁板綍杩欎釜澶勭悊鎰忚鍏宠仈鐨勪笉鍚堟牸璁㈠崟id
+ unId.set(opinionMapper.selectById(unmarshal.getId()).getRawUnacceptedId());
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
});
- return opinionMapper.updateOpinion(opinion);
+ //缂栬緫鎰忚涔嬪悗濮滃鐞嗙姸鎬佷慨鏀逛负1宸插鐞�
+ InspectUnaccepted inspectUnaccepted = inspectUnacceptedMapper.selectById(unId.get());
+ inspectUnaccepted.setDealState(1);
+ inspectUnacceptedMapper.updateById(inspectUnaccepted);
+ //濡傛灉鍏ㄩ儴閮芥槸杩斾慨鍒欒繑鍥炴楠�,灏嗘楠岀姸鎬佹竻绌�
+ if (a.get()==opinion.size()){
+ switch (inspectUnaccepted.getType()){
+ case 1:
+ //鎴愬搧妫�楠屽崟
+ finishedInspectMapper.updById(inspectUnaccepted.getRawInspectId());
+ //鎴愬搧妫�楠岄」鐩�
+ List<InspectionItem> inspectionItemList = inspectionItemMapper.selectList(Wrappers.<InspectionItem>query()
+ .eq("type", 2)
+ .eq("inspect_id", inspectUnaccepted.getRawInspectId()));
+ inspectionItemMapper.updateBatch(inspectionItemList);
+ break;
+ case 2:
+ //杩囩▼妫�楠屽崟
+ processInspectMapper.updById(inspectUnaccepted.getRawInspectId());
+ //杩囩▼妫�楠岄」鐩�
+ List<InspectionItem> inspectionItems = inspectionItemMapper.selectList(Wrappers.<InspectionItem>query()
+ .eq("type", 1)
+ .eq("inspect_id", inspectUnaccepted.getRawInspectId()));
+ inspectionItemMapper.updateBatch(inspectionItems);
+ break;
+ case 0:
+ //鍘熸潗鏂欐楠屽崟
+ rawInspectMapper.updById(inspectUnaccepted.getRawInspectId());
+ //鍘熸潗鏂欐楠岄」鐩�
+ List<RawInsProduct> rawInsProductList = rawInsProductMapper.selectList(Wrappers.<RawInsProduct>query()
+ .eq("raw_inspect_id", inspectUnaccepted.getRawInspectId()));
+ rawInsProductMapper.updateBatch(rawInsProductList);
+ break;
+ default:
+ break;
+ }
+ }
+ //鏇存柊鎰忚
+ return opinionMapper.updateOpinion(list);
}
@Override
--
Gitblit v1.9.3