ソースを参照

内部报验-改派

wangming 1 年間 前
コミット
e09064daec

+ 20 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/dao/ZhcxInsideInspectionDao.java

@@ -2,8 +2,11 @@ package com.rongwei.bscommon.sys.dao;
 
 import com.rongwei.bsentity.domain.ZhcxInsideInspectionDo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -25,4 +28,21 @@ public interface ZhcxInsideInspectionDao extends BaseMapper<ZhcxInsideInspection
             " where i.ID = d.INSIDEID and d.INSPECTIONCONCLUSION = '20' and i.ID = #{id}")
     void updateInspectionCount(Map<String, String> map);
 
+    @Select("SELECT\n" +
+            "      o.*,\n" +
+            "      parento.FULLNAME AS PFULLNAME,\n" +
+            "      parento.SHORTNAME AS PSHORTNAME,\n" +
+            "      parento.FULLPID AS PFULLPID\n" +
+            "    FROM\n" +
+            "      INCONTROL.SYS_ORGANIZATION o\n" +
+            "    JOIN INCONTROL.SYS_USER_ORG uo ON\n" +
+            "      uo.ORGID = o.ID\n" +
+            "      AND uo.DELETED = '0'\n" +
+            "    JOIN INCONTROL.SYS_ORGANIZATION parento ON\n" +
+            "      parento.ID = o.PID  AND parento.DELETED = '0'\n" +
+            "    JOIN SYS_USER u ON u.ID = uo.USERID AND u.DELETED = '0'\n" +
+            "    WHERE\n" +
+            "      u.ID = #{checkerId}" +
+            "      AND uo.DELETED = '0'")
+    List<Map<String, String>> getLaboratoryByCheckId(@Param("checkerId") String checkerId);
 }

+ 62 - 3
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxInsideInspectionServiceImpl.java

@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.rongwei.bscommon.sys.feign.SysNotifyFeginService;
@@ -19,7 +20,6 @@ import com.rongwei.bsentity.dto.InsideOperLogDto;
 import com.rongwei.bsentity.dto.NotifyDto;
 import com.rongwei.bsentity.dto.OperDto;
 import com.rongwei.bsentity.dto.inside.*;
-import com.rongwei.bsentity.vo.OperOutsideInspectionVo;
 import com.rongwei.commonservice.serial.service.SysSerialNumberService;
 import com.rongwei.rwadmincommon.system.domain.SysRoleDo;
 import com.rongwei.rwadmincommon.system.domain.SysUserDo;
@@ -29,9 +29,9 @@ import com.rongwei.rwadmincommon.system.vo.SysUserVo;
 import com.rongwei.rwcommon.base.exception.CustomException;
 import com.rongwei.rwcommon.utils.SecurityUtil;
 import com.rongwei.rwcommon.utils.StringUtils;
-import com.rongwei.rwcommon.vo.MailDo;
 import com.rongwei.rwcommon.vo.generalsql.MasterSlaveUpdateVo;
 import com.rongwei.rwcommonentity.commonservers.vo.SysSerialVo;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -48,6 +48,7 @@ import java.util.stream.Collectors;
  * @since 2024-05-21
  */
 @Service
+@Slf4j
 public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspectionDao, ZhcxInsideInspectionDo> implements ZhcxInsideInspectionService {
 
     @Autowired
@@ -187,6 +188,8 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
 
         List<String> msgList = new ArrayList<>();
         List<ZhcxInsideInspectionDispatchDo> dispatchList = new ArrayList<>();
+        List<ZhcxInsideInspectionDo> inspectionList = new ArrayList<>();
+
         for(String insideId : req.getInsideIdList()) {
             InsideOperDto inOper = getInsideOperDto(insideId);
             inOper.setOperTime(operDto.getOperTime());
@@ -209,8 +212,11 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
             dispatch.setSupervisionid(req.getSupervisionId());
             dispatch.setSupervision(userDo.getName());
             dispatch.setSupervisionphone(userDo.getMobile());
-
             dispatchList.add(dispatch);
+
+            //更改检验室
+            inspectionList.add(changeSupervision(inOper, req));
+
         }
 
         if(ObjectUtil.isNotEmpty(msgList)) {
@@ -220,6 +226,9 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
         //批量派单
         dispatchService.updateBatchById(dispatchList);
 
+        //批量更新
+        updateBatchById(inspectionList);
+
         //操作日志
         operLogService.saveOperLog(req, operDto, Collections.emptyMap());
     }
@@ -382,6 +391,56 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
         operLogService.saveOperLog(req, operDto, descMap);
     }
 
+    /**
+     * 获取更改检验员对象
+     *
+     * @param inOper
+     * @param req
+     * @return
+     */
+    private ZhcxInsideInspectionDo changeSupervision(InsideOperDto inOper, InsideInspectionDispatchRequest req) {
+        List<Map<String, String>> laboratoryList = dao.getLaboratoryByCheckId(req.getSupervisionId());
+        if(ObjectUtil.isEmpty(laboratoryList)) {
+            throw new CustomException("单据号:".concat(inOper.getInspection().getInspectioncode()).concat("分配检验员暂无检验室"));
+        }
+        ZhcxInsideInspectionDo inspection = new ZhcxInsideInspectionDo();
+        inspection.setId(inOper.getInspection().getId());
+
+        Map<String, String> row30 = null;
+        for(Map<String, String> row : laboratoryList) {
+            if("30".equals(row.get("ORGTYPE"))) {
+                row30 = row;
+                break;
+            }
+        }
+
+        //不存在班组,按检验室处理
+        if(ObjectUtil.isNull(row30)) {
+            //检验室
+            inspection.setLaboratoryid(laboratoryList.get(0).get("ID"));
+            inspection.setLaboratoryname(laboratoryList.get(0).get("SHORTNAME"));
+            inspection.setLaboratorypathid(laboratoryList.get(0).get("FULLPID"));
+            //班组
+            inspection.setTeamgroupid("");
+            inspection.setTeamgroupname("");
+            inspection.setTeamgrouppathid("");
+            return inspection;
+        } else {
+            //检验室
+            inspection.setLaboratoryid(row30.get("PID"));
+            inspection.setLaboratoryname(row30.get("PSHORTNAME"));
+            inspection.setLaboratorypathid(row30.get("PFULLPID"));
+            //班组
+            inspection.setTeamgroupid(row30.get("ID"));
+            inspection.setTeamgroupname(row30.get("SHORTNAME"));
+            inspection.setTeamgrouppathid(row30.get("FULLPID"));
+            return inspection;
+        }
+
+
+
+    }
+
     /**
      * 获取取消发送邮件内容
      *