浏览代码

采样、洗澡前拍照流程

wwh 1 年之前
父节点
当前提交
f85a765184

+ 10 - 1
huimv-receive/src/main/java/com/huimv/receive/controller/BillCleanBeforeController.java

@@ -6,8 +6,11 @@ import com.huimv.receive.common.utils.ResultCode;
 import com.huimv.receive.service.IBillCleanBeforeService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+import java.text.ParseException;
 import java.util.Map;
 
 /**
@@ -35,5 +38,11 @@ public class BillCleanBeforeController {
     public Result getDetail(HttpServletRequest httpServletRequest, @RequestBody Map<String, String> paramsMap){
         return new Result(ResultCode.SUCCESS,billCleanBeforeService.getById(paramsMap.get("id")));
     }
-
+    @PostMapping("/edit")
+    public Result goodsCarClean(HttpServletRequest httpServletRequest, @RequestParam("id") String id,
+                                @RequestParam("date") String data,
+                                @RequestParam(value = "img", required = false) MultipartFile img,
+                                @RequestParam("farmId") String farmId) throws IOException, ParseException {
+        return billCleanBeforeService.edit(httpServletRequest, farmId, id, data, img);
+    }
 }

+ 10 - 0
huimv-receive/src/main/java/com/huimv/receive/controller/BillSamplingController.java

@@ -6,8 +6,11 @@ import com.huimv.receive.common.utils.ResultCode;
 import com.huimv.receive.service.IBillSamplingService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+import java.text.ParseException;
 import java.util.Map;
 
 /**
@@ -36,4 +39,11 @@ public class BillSamplingController {
         return new Result(ResultCode.SUCCESS,billSamplingService.getById(paramsMap.get("id")));
     }
 
+    @PostMapping("/edit")
+    public Result goodsCarClean(HttpServletRequest httpServletRequest, @RequestParam("id") String id,
+                                @RequestParam("date") String data,
+                                @RequestParam(value = "video", required = false) MultipartFile video,
+                                @RequestParam("farmId") String farmId) throws IOException, ParseException {
+        return billSamplingService.edit(httpServletRequest, farmId, id, data, video);
+    }
 }

+ 6 - 0
huimv-receive/src/main/java/com/huimv/receive/service/IBillSamplingService.java

@@ -3,8 +3,11 @@ package com.huimv.receive.service;
 import com.huimv.receive.common.utils.Result;
 import com.huimv.receive.entity.BillSampling;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+import java.text.ParseException;
 import java.util.Map;
 
 /**
@@ -18,4 +21,7 @@ import java.util.Map;
 public interface IBillSamplingService extends IService<BillSampling> {
 
     Result listPersonalSample(HttpServletRequest httpServletRequest, Map<String, String> paramsMap);
+
+    Result edit(HttpServletRequest httpServletRequest, String farmId, String id, String date,
+                MultipartFile img) throws ParseException, IOException;
 }

+ 30 - 21
huimv-receive/src/main/java/com/huimv/receive/service/impl/BillCleanBeforeServiceImpl.java

@@ -10,9 +10,7 @@ import com.huimv.receive.common.utils.Result;
 import com.huimv.receive.common.utils.ResultCode;
 import com.huimv.receive.common.utils.UploadImage;
 import com.huimv.receive.entity.*;
-import com.huimv.receive.mapper.BaseLocationMapper;
-import com.huimv.receive.mapper.BaseProcessMapper;
-import com.huimv.receive.mapper.BillCleanBeforeMapper;
+import com.huimv.receive.mapper.*;
 import com.huimv.receive.service.IBillCleanBeforeService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -24,6 +22,7 @@ import javax.servlet.http.HttpServletRequest;
 import java.io.IOException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
+import java.time.LocalDateTime;
 import java.util.Date;
 import java.util.Map;
 
@@ -46,6 +45,17 @@ public class BillCleanBeforeServiceImpl extends ServiceImpl<BillCleanBeforeMappe
     private BaseProcessMapper processMapper;
     @Autowired
     private BaseLocationMapper locationMapper;
+    @Autowired
+    private BillPcrMapper pcrMapper;
+    @Autowired
+    private BillCleanMapper cleanMapper;
+    @Autowired
+    private BillIsolateMapper isolateMapper;
+    @Autowired
+    private BillSamplingMapper samplingMapper;
+    @Autowired
+    private BillDryMapper dryMapper;
+
 
     @Override
     public Result listPersonalCleanBefore(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
@@ -67,7 +77,6 @@ public class BillCleanBeforeServiceImpl extends ServiceImpl<BillCleanBeforeMappe
 
     @Override
     public Result edit(HttpServletRequest httpServletRequest, String farmId, String id, String date, MultipartFile img) throws ParseException, IOException {
-        //1为合格2为异常
         String s = "";
         if (uploadImage.getImageCom(img).equals("上传失败")) {
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -81,16 +90,16 @@ public class BillCleanBeforeServiceImpl extends ServiceImpl<BillCleanBeforeMappe
             date = sdf.format(new Date());
         }
         BillCleanBefore cleanBefore = billCleanBeforeMapper.selectById(id);
-      /*  billPcr.setImgUrl(s);
-        billPcr.setImgStatus(1);
+        cleanBefore.setImgUrl(s);
+        cleanBefore.setImgStatus(1);
 
 
         QueryWrapper<BaseProcess> processQueryWrapper = new QueryWrapper<>();
-        processQueryWrapper.eq("farm_id", farmId).eq("id", billPcr.getProcessId());
+        processQueryWrapper.eq("farm_id", farmId).eq("id", cleanBefore.getProcessId());
         BaseProcess baseProcess = processMapper.selectOne(processQueryWrapper);//进程
 
         QueryWrapper<BaseLocation> locationQueryWrapper = new QueryWrapper<>();
-        locationQueryWrapper.eq("id", billPcr.getTestLocationId());
+        locationQueryWrapper.eq("id", cleanBefore.getTestLocationId());
         BaseLocation baseLocation = locationMapper.selectOne(locationQueryWrapper);//当前pcr检测所在的位置
 
         String allLocationId = baseProcess.getAllLocationId();//所有的位置id
@@ -101,19 +110,19 @@ public class BillCleanBeforeServiceImpl extends ServiceImpl<BillCleanBeforeMappe
         Integer nextId = Integer.parseInt(split[0]);
 
 
-        billPcr.setBillStatus(1);
-        billPcr.setPassUserName(TokenSign.getUserNameByJwtToken(httpServletRequest));
-        billPcr.setPassUserId(TokenSign.getMemberIdByJwtToken(httpServletRequest));
-        billPcr.setTestLocation(baseLocation.getLocationName());
-        billPcr.setTestLocationId(baseLocation.getId());
-        billPcr.setCheckDate(sdf.parse(date));
-        billPcr.setPassDate(sdf.parse(sdf.format(new Date())));
+        cleanBefore.setBillStatus(1);
+        cleanBefore.setPassUserName(TokenSign.getUserNameByJwtToken(httpServletRequest));
+        cleanBefore.setPassUserId(TokenSign.getMemberIdByJwtToken(httpServletRequest));
+        cleanBefore.setTestLocation(baseLocation.getLocationName());
+        cleanBefore.setTestLocationId(baseLocation.getId());
+        cleanBefore.setCheckDate(LocalDateTime.parse(date));
+        cleanBefore.setPassDate(LocalDateTime.now());
 
 
-        Object newObject = BillPcrServiceImpl.getNewObject(nextId, billPcr.getDestName(), billPcr.getDestId(), billPcr.getAdmissionUserName(),
-                billPcr.getAdmissionUserId(), billPcr.getVistitDate(), billPcr.getSubDate(),
-                billPcr.getProcessId(), billPcr.getFarmId(), billPcr.getTestLocation(), billPcr.getTestLocationId(),
-                billPcr.getVistitType(), billPcr.getPhone());
+        Object newObject = BillPcrServiceImpl.getNewObject(nextId, cleanBefore.getDestName(), cleanBefore.getDestId(), cleanBefore.getAdmissionUserName(),
+                cleanBefore.getAdmissionUserId(), cleanBefore.getVistitDate(), cleanBefore.getSubDate(),
+                cleanBefore.getProcessId(), Integer.parseInt(cleanBefore.getFarmId()), cleanBefore.getTestLocation(), cleanBefore.getTestLocationId(),
+                cleanBefore.getVistitType(), cleanBefore.getPhone());
         if (nextId == 0) {
             int index = allLocationId.indexOf(baseLocation.getId());
             StringBuilder status = new StringBuilder(baseProcess.getAllLocationId());
@@ -143,7 +152,7 @@ public class BillCleanBeforeServiceImpl extends ServiceImpl<BillCleanBeforeMappe
         } else if (nextId == 6) {
             //新增洗澡前拍照
             BillCleanBefore before = new BillCleanBefore();
-            beforeMapper.insert(before);
+            billCleanBeforeMapper.insert(before);
         }
         baseProcess.setUpdateDate(baseProcess.getUpdateDate() + "," + sdf.format(new Date()));
         baseProcess.setCurrentLocation(baseProcess.getCurrentLocation() + "," + baseLocation.getLocationName());
@@ -154,7 +163,7 @@ public class BillCleanBeforeServiceImpl extends ServiceImpl<BillCleanBeforeMappe
         baseProcess.setCurrentStatus(substring + "1," + 0);
         baseProcess.setCurrentFlowId(baseProcess.getCurrentLocationId() + "," + nextId);
         processMapper.updateById(baseProcess);
-        pcrMapper.updateById(billPcr);*/
+        billCleanBeforeMapper.updateById(cleanBefore);
         return new Result(10000, "修改成功!", true);
     }
 }

+ 119 - 2
huimv-receive/src/main/java/com/huimv/receive/service/impl/BillSamplingServiceImpl.java

@@ -3,18 +3,27 @@ package com.huimv.receive.service.impl;
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.huimv.receive.common.token.TokenSign;
 import com.huimv.receive.common.utils.Result;
 import com.huimv.receive.common.utils.ResultCode;
-import com.huimv.receive.entity.BillSampling;
-import com.huimv.receive.mapper.BillSamplingMapper;
+import com.huimv.receive.common.utils.UploadImage;
+import com.huimv.receive.entity.*;
+import com.huimv.receive.mapper.*;
 import com.huimv.receive.service.IBillSamplingService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.LocalDateTime;
+import java.util.Date;
 import java.util.Map;
 
 /**
@@ -30,6 +39,22 @@ public class BillSamplingServiceImpl extends ServiceImpl<BillSamplingMapper, Bil
 
     @Autowired
     private BillSamplingMapper billSamplingMapper;
+    @Autowired
+    private UploadImage uploadImage;
+    @Autowired
+    private BaseProcessMapper processMapper;
+    @Autowired
+    private BaseLocationMapper locationMapper;
+    @Autowired
+    private BillPcrMapper pcrMapper;
+    @Autowired
+    private BillCleanMapper cleanMapper;
+    @Autowired
+    private BillIsolateMapper isolateMapper;
+    @Autowired
+    private BillDryMapper dryMapper;
+    @Autowired
+    private BillCleanBeforeMapper billCleanBeforeMapper;
 
     @Override
     public Result listPersonalSample(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
@@ -48,4 +73,96 @@ public class BillSamplingServiceImpl extends ServiceImpl<BillSamplingMapper, Bil
         Integer count = billSamplingMapper.selectCount(queryWrapper);
         return new Result(ResultCode.SUCCESS,billSamplingPage,count);
     }
+
+    @Override
+    public Result edit(HttpServletRequest httpServletRequest, String farmId, String id, String date, MultipartFile img) throws ParseException, IOException {
+        String s = "";
+        if (uploadImage.getVideoCom(img).equals("上传失败")) {
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            return new Result(10001, "视频上传失败", false);
+        }
+        s = uploadImage.getVideoCom(img);
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+
+        if (StringUtils.isBlank(date)) {
+            date = sdf.format(new Date());
+        }
+        BillSampling sampling = billSamplingMapper.selectById(id);
+        sampling.setImgUrl(s);
+        sampling.setImgStatus(1);
+
+
+        QueryWrapper<BaseProcess> processQueryWrapper = new QueryWrapper<>();
+        processQueryWrapper.eq("farm_id", farmId).eq("id", sampling.getProcessId());
+        BaseProcess baseProcess = processMapper.selectOne(processQueryWrapper);//进程
+
+        QueryWrapper<BaseLocation> locationQueryWrapper = new QueryWrapper<>();
+        locationQueryWrapper.eq("id", sampling.getTestLocationId());
+        BaseLocation baseLocation = locationMapper.selectOne(locationQueryWrapper);//当前pcr检测所在的位置
+
+        String allLocationId = baseProcess.getAllLocationId();//所有的位置id
+        String allFlowId = baseProcess.getAllFlowId();//所有的流程id
+        String currentFlowId = baseProcess.getCurrentFlowId();//当前已经完成的流程id
+        String substring1 = allFlowId.substring(currentFlowId.length() + 1, allFlowId.length());
+        String[] split = substring1.split(",");
+        Integer nextId = Integer.parseInt(split[0]);
+
+
+        sampling.setBillStatus(1);
+        sampling.setPassUserName(TokenSign.getUserNameByJwtToken(httpServletRequest));
+        sampling.setPassUserId(TokenSign.getMemberIdByJwtToken(httpServletRequest));
+        sampling.setTestLocation(baseLocation.getLocationName());
+        sampling.setTestLocationId(baseLocation.getId());
+        sampling.setCheckDate(LocalDateTime.parse(date));
+        sampling.setPassDate(LocalDateTime.now());
+
+
+        Object newObject = BillPcrServiceImpl.getNewObject(nextId, sampling.getDestName(), sampling.getDestId(), sampling.getAdmissionUserName(),
+                sampling.getAdmissionUserId(), sampling.getVistitDate(), sampling.getSubDate(),
+                sampling.getProcessId(), Integer.parseInt(sampling.getFarmId()), sampling.getTestLocation(), sampling.getTestLocationId(),
+                sampling.getVistitType(), sampling.getPhone());
+        if (nextId == 0) {
+            int index = allLocationId.indexOf(baseLocation.getId());
+            StringBuilder status = new StringBuilder(baseProcess.getAllLocationId());
+            status.setCharAt(index, '1');
+            status.setCharAt(index + 2, '1');
+            baseProcess.setAllLocationStatus(status.toString());
+        } else if (nextId == 1) {
+            //新增采样
+            BillSampling billSampling = (BillSampling) newObject;
+            billSamplingMapper.insert(billSampling);
+        } else if (nextId == 2) {
+            //新增pcr
+            BillPcr billClean = (BillPcr) newObject;
+            pcrMapper.insert(billClean);
+        } else if (nextId == 3) {
+            //新增洗澡
+            BillClean billClean = (BillClean) newObject;
+            cleanMapper.insert(billClean);
+        } else if (nextId == 4) {
+            //新增隔离
+            BillIsolate pcr = (BillIsolate) newObject;
+            isolateMapper.insert(pcr);
+        } else if (nextId == 5) {
+            BillDry billClean = (BillDry) newObject;
+            dryMapper.insert(billClean);
+            //新增烘干
+        } else if (nextId == 6) {
+            //新增洗澡前拍照
+            BillCleanBefore before = new BillCleanBefore();
+            billCleanBeforeMapper.insert(before);
+        }
+        baseProcess.setUpdateDate(baseProcess.getUpdateDate() + "," + sdf.format(new Date()));
+        baseProcess.setCurrentLocation(baseProcess.getCurrentLocation() + "," + baseLocation.getLocationName());
+        baseProcess.setCurrentLocationId(baseProcess.getCurrentLocationId() + "," + baseLocation.getId());
+        String status = baseProcess.getCurrentStatus();
+        String substring = status.substring(0, status.length() - 1);
+
+        baseProcess.setCurrentStatus(substring + "1," + 0);
+        baseProcess.setCurrentFlowId(baseProcess.getCurrentLocationId() + "," + nextId);
+        processMapper.updateById(baseProcess);
+        billSamplingMapper.updateById(sampling);
+        return new Result(10000, "修改成功!", true);
+    }
 }