Explorar o código

信息牌算法流程改造 2023-04-09

donggaosheng %!s(int64=2) %!d(string=hai) anos
pai
achega
56840bc39e
Modificáronse 16 ficheiros con 359 adicións e 17 borrados
  1. 16 0
      zd-api/zd-laboratory-api/src/main/java/com/zd/laboratory/api/entity/LabSysUserInfo.java
  2. 1 1
      zd-api/zd-laboratory-api/src/main/java/com/zd/laboratory/api/feign/RemoteDutyService.java
  3. 1 1
      zd-api/zd-laboratory-api/src/main/java/com/zd/laboratory/api/feign/fallback/RemoteDutyFailback.java
  4. 22 2
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/face/controller/FaceApi.java
  5. 16 0
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/forward/controller/SignInCheckController.java
  6. 90 1
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/forward/serivce/CheckService.java
  7. 5 2
      zd-modules/zd-base/src/main/java/com/zd/base/app/controller/LabBoardApi.java
  8. 34 1
      zd-modules/zd-base/src/main/java/com/zd/base/app/domain/board/LabXxpSubjectVo.java
  9. 19 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabXxpCardInfoController.java
  10. 38 1
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabXxpUserAuthController.java
  11. 38 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/onemachine/controller/OneMachineController.java
  12. 0 1
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabSubjectManagerService.java
  13. 70 4
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabSubjectServiceImpl.java
  14. 4 1
      zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabSubjectMapper.xml
  15. 1 1
      zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/XxpDutyMapper.xml
  16. 4 1
      zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/XxpUserAuthMapper.xml

+ 16 - 0
zd-api/zd-laboratory-api/src/main/java/com/zd/laboratory/api/entity/LabSysUserInfo.java

@@ -46,6 +46,14 @@ public class LabSysUserInfo {
     @ApiModelProperty(value = "是否白名单")
     private Integer isWhite;
 
+
+    /**
+     * 是否值班人员
+     */
+    @ApiModelProperty(value = "是否值班人员")
+    private Integer isDutyUser;
+
+
     /**
      * 页面类型
      */
@@ -103,4 +111,12 @@ public class LabSysUserInfo {
     public void setUserId(Long userId) {
         this.userId = userId;
     }
+
+    public Integer getIsDutyUser() {
+        return isDutyUser;
+    }
+
+    public void setIsDutyUser(Integer isDutyUser) {
+        this.isDutyUser = isDutyUser;
+    }
 }

+ 1 - 1
zd-api/zd-laboratory-api/src/main/java/com/zd/laboratory/api/feign/RemoteDutyService.java

@@ -169,7 +169,7 @@ public interface RemoteDutyService {
      * @return
      */
     @RequestMapping("/XxpUserAuth/getFingerByUserId")
-    ResultData getFingerByUserId(@RequestParam("userId") Long userId);
+    ResultData getFingerByUserId(@RequestParam("labId") Long labId,@RequestParam("userId") Long userId);
 
     /**
      * 根据用户id查询指纹信息

+ 1 - 1
zd-api/zd-laboratory-api/src/main/java/com/zd/laboratory/api/feign/fallback/RemoteDutyFailback.java

@@ -103,7 +103,7 @@ public class RemoteDutyFailback implements FallbackFactory<RemoteDutyService> {
             }
 
             @Override
-            public ResultData getFingerByUserId(Long userId) {
+            public ResultData getFingerByUserId(Long labId,Long userId) {
                 return ResultData.fail("根据用户获取指纹列表失败:" + cause.getMessage());
              }
 

+ 22 - 2
zd-modules/zd-algorithm/src/main/java/com/zd/alg/face/controller/FaceApi.java

@@ -7,11 +7,14 @@ import com.github.xiaoymin.knife4j.annotations.ApiSupport;
 import com.zd.alg.face.service.FaceService;
 import com.zd.alg.face.utils.FileUtil;
 import com.zd.algorithm.api.face.feign.FaceCompare;
+import com.zd.common.core.utils.DateUtils;
+import com.zd.common.core.utils.StringUtils;
 import com.zd.common.swagger.config.Knife4jConfiguration;
 import com.zd.laboratory.api.entity.LabStudentsInfo;
 import com.zd.laboratory.api.entity.LabSysUserInfo;
 import com.zd.laboratory.api.feign.RemoteDutyService;
 import com.zd.laboratory.api.feign.RemoteStudentsService;
+import com.zd.model.constant.HttpStatus;
 import com.zd.model.domain.R;
 import com.zd.model.domain.ResultData;
 import io.swagger.annotations.Api;
@@ -24,6 +27,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 import java.io.*;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Author: zhoupan
@@ -99,6 +103,7 @@ public class FaceApi {
     @PostMapping("/multiCompare")
     public ResultData multiFaceDetection(@RequestBody FaceCompare faceCompare) {
         logger.info("====人脸比较====");
+        Integer isDutyUser=0;
         ResultData<List<LabSysUserInfo>> infoList = remoteStudentsService.getFaceBySecuritySubjectId(faceCompare.getLabId());
         if (infoList.getCode() == 200 && infoList.getData() != null) {
             logger.info("====人脸data组装====");
@@ -119,6 +124,23 @@ public class FaceApi {
                         info.setPageType(2);
                     }
                     info.setFaceFeature(null);
+                    String dateTime = DateUtils.getDate();
+                    ResultData dutyUserData = remoteDutyService.selectDutyUser(faceCompare.getLabId(),dateTime);
+                    //判断是否当天值班
+                    if(null==dutyUserData && dutyUserData.getCode()!= HttpStatus.SUCCESS){
+                        return ResultData.fail("获取值班人员识别!");
+                    }
+                    List<Map<String,Object>> dutyList= (List<Map<String, Object>>) dutyUserData.getData();
+                    for(Map<String,Object> dutyMap:dutyList){
+                        String userObj=String.valueOf(dutyMap.get("userId"));
+                        if(StringUtils.isNotEmpty(userObj) && StringUtils.isNotNull(userObj)){
+                            if(Long.parseLong(userObj)==info.getUserId()){
+                                isDutyUser=1;
+                                break;
+                            }
+                        }
+                    }
+                    info.setIsDutyUser(isDutyUser);
                     logger.info("====compore====" +"对比成功用户ID:"+info.getUserId());
                     return ResultData.success(info);
                 }
@@ -145,6 +167,4 @@ public class FaceApi {
             e.printStackTrace();
         }
     }
-
-
 }

+ 16 - 0
zd-modules/zd-algorithm/src/main/java/com/zd/alg/forward/controller/SignInCheckController.java

@@ -11,6 +11,7 @@ import com.zd.alg.forward.serivce.VideoCheckResultValidImpl;
 import com.zd.common.core.exception.ServiceException;
 import com.zd.common.core.redis.RedisService;
 import com.zd.common.core.utils.Assert;
+import com.zd.common.core.utils.UUID;
 import com.zd.common.swagger.config.Knife4jConfiguration;
 import com.zd.model.constant.BaseConstants;
 import com.zd.model.constant.HttpStatus;
@@ -97,6 +98,21 @@ public class SignInCheckController {
     }
 
 
+
+    /**
+     * 进入项验证:合并
+     *
+     * @param file 带验证图片
+     */
+    @ApiOperation(value = "进入项验证:合并,codes格式:1,2,3")
+    @PostMapping("/checkInXxpAll")
+    public R checkInXxpAll(@ApiParam("图片文件") @RequestParam("file") MultipartFile file,
+                        @ApiParam("实验室ID") @RequestParam("subId") Long subId) {
+
+        String id= UUID.fastUUID().toString();
+        return checkService.checkAndCommitXxp(id, file, subId);
+    }
+
     /**
      * 进入项验证:mock方法
      *

+ 90 - 1
zd-modules/zd-algorithm/src/main/java/com/zd/alg/forward/serivce/CheckService.java

@@ -146,7 +146,7 @@ public class CheckService {
                         if (StringUtils.isNotEmpty(labSkipped) && labSkipped.equals("1")) {
                             //如果没有通过则次数加一
                             //键为前缀+签到id +下划线+验证类型
-                            String key = BaseConstants.SINGIN_CHECK_JUMP_KEY + id + "_" + code;
+                            String key = BaseConstants.SINGIN_CHECK_JUMP_KEY  +id+ "_" + code;
                             Long increment = redisTemplate.opsForValue().increment(key);
                             redisService.expire(key, BaseConstants.SINGIN_OUT_TIME);
                             if (increment != null && increment >= Integer.parseInt(labCheckCount)) {
@@ -174,6 +174,95 @@ public class CheckService {
         return R.fail();
     }
 
+
+    /**
+     * 合并检查 三合一套餐
+     */
+    public R checkAndCommitXxp(String id, MultipartFile file, Long subId) {
+        try {
+            int alarmNum = 0;
+            //根据实验室id查询检查项
+            R<Map<Object, Object>> subject = laboratoryService.getCheckInfo(subId);
+            if (subject.getCode() != HttpStatus.SUCCESS) {
+                return subject;
+            }
+            Map<Object, Object> map = subject.getData();
+            Object labCheckInObj = map.get("inspectCheckIn");
+            if (StringUtils.isNull(labCheckInObj)) {
+                return R.fail(700, "未配置检查项");
+            }
+            //上传原始图片
+            String orgImgUrl = "";
+            R<SysFile> r = remoteFileService.upload(file);
+            if (r.getCode() == HttpStatus.SUCCESS) {
+                orgImgUrl = r.getData().getUrl();
+            }
+            String labSkipped = "0";
+            String labCheckCount = "2";
+            Object labSkippedObj = map.get("inspectSkipped");
+            if (StringUtils.isNotNull(labSkippedObj)) {
+                labSkipped = String.valueOf(labSkippedObj);
+            }
+            Object labCheckCountObj = map.get("inspectCheckCount");
+            if (StringUtils.isNotNull(labCheckCountObj)) {
+                labCheckCount = String.valueOf(labCheckCountObj);
+            }
+            String labCheckIn = String.valueOf(labCheckInObj);
+            String[] checkItem = labCheckIn.split(",");
+            File toFile = multipartFileToFile(file);
+            for (String code : checkItem) {
+                //========= 获取算法INFO ===========
+                AlgorithmYml.CheckValid checkValid = algorithmYml.getCheckValid(Integer.valueOf(code));
+                MultiValueMap<String, Object> params = getStringObjectMultiValueMap(checkValid, String.valueOf(id));
+                HttpEntity<MultiValueMap<String, Object>> files = getHttpEntityMap(toFile, params);
+                //添加一条算法请求记录
+                R alg = insertRequestRecordLog(orgImgUrl, subId, checkValid);
+                logger.info("【调用算法服务】 添加算法调用日志,添加结果:"+JSONObject.toJSONString(alg));
+
+                //请求算法服务
+                ImgPostResponse<AnalysisReturnData> send = HttpUtils.sendV5(restTemplateLocal, files, algorithmYml);
+                AlgorithmResponseResult responseResult = getResponseResult(send);
+                //添加成功,更新算法日志记录
+                if (alg.getCode() == 200) {
+                    updateRequestRecordLog(alg.getData() != null?Long.valueOf(alg.getData()+""):null, responseResult);
+                    logger.info("【调用算法服务】 更新算法调用日志记录");
+                }
+                //判断算法
+                if (responseResult.getCode() == 1000) {
+                    //通过
+                    if (responseResult.getIsPass()) {
+                        alarmNum++;
+                    } else {
+                        //不跳过
+                        if (StringUtils.isNotEmpty(labSkipped) && labSkipped.equals("1")) {
+                            //如果没有通过则次数加一
+                            //键为前缀+签到id +下划线+验证类型
+                            String key = BaseConstants.SINGIN_CHECK_JUMP_KEY + id + "_" + code;
+                            Long increment = redisTemplate.opsForValue().increment(key);
+                            redisService.expire(key, BaseConstants.SINGIN_OUT_TIME);
+                            if (increment != null && increment >= Integer.parseInt(labCheckCount)) {
+                                //黎晨这里让把跳过时状态码改为700,所以700的含义为检查失败并且跳过
+                                return R.fail(700, "符合跳过条件执行跳过");
+                            }
+                        }
+                        return R.fail(300, "算法识别未通过", code);
+                    }
+                } else {
+                    assert send != null;
+                    //logger.error("【调用算法服务】 算法服务调用失败,响应信息:"+ JSONObject.toJSONString(send));
+                    return R.fail("算法服务错误,请重试!");
+                }
+            }
+            if (alarmNum == checkItem.length) {
+                return R.ok();
+            }
+        } catch (Exception e) {
+            logger.error("【调用算法服务】 算法服务调用发生异常", e);
+        }
+        return R.fail();
+    }
+
+
     /**
      * 获取响应结果
      * @param send

+ 5 - 2
zd-modules/zd-base/src/main/java/com/zd/base/app/controller/LabBoardApi.java

@@ -112,6 +112,9 @@ public class LabBoardApi {
             }
             vo.setSafeUserVoList(safeUserList);
         }
+        vo.setInCheck((List<Map<String, String>>)map.get("checkIn"));
+        vo.setOutCheck((List<String>)map.get("checkOut"));
+        vo.setInspectInCheck((List<Map<String, String>>)map.get("inspectCheckIn"));
         ResultData<LabXxpSubjectVo> xxpResultData= remoteDutyService.classifyDetailSubjectById(labId);
         if(null==xxpResultData || xxpResultData.getCode()!=200){
             return ResultData.fail("获取实验室信息类目失败!");
@@ -450,8 +453,8 @@ public class LabBoardApi {
      */
     @ApiOperation(value = "根据用户查询指纹列表")
     @GetMapping(value = "/getFingerByUserId")
-    public ResultData getFingerByUserId(@RequestParam Long userId){
-        ResultData resultData=remoteDutyService.getFingerByUserId(userId);
+    public ResultData getFingerByUserId(@RequestParam("labId") Long labId,@RequestParam("userId") Long userId){
+        ResultData resultData=remoteDutyService.getFingerByUserId(labId,userId);
         return resultData;
     }
 

+ 34 - 1
zd-modules/zd-base/src/main/java/com/zd/base/app/domain/board/LabXxpSubjectVo.java

@@ -1,10 +1,10 @@
 package com.zd.base.app.domain.board;
 
-import com.zd.model.annotation.Excel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Author: donggaosheng
@@ -34,6 +34,15 @@ public class LabXxpSubjectVo {
     @ApiModelProperty(value = "二维码地址")
     private String deptName;
 
+    @ApiModelProperty("进入检查项")
+    private List<Map<String,String>> inCheck;
+
+    @ApiModelProperty("巡查进入检查项")
+    private List<Map<String,String>> inspectInCheck;
+
+    @ApiModelProperty("离开检查项")
+    private List<String> outCheck;
+
     public String getDeptName() {
         return deptName;
     }
@@ -144,4 +153,28 @@ public class LabXxpSubjectVo {
     public void setXxpSubjectVoList(List<LabXxpSubjectVo> xxpSubjectVoList) {
         this.xxpSubjectVoList = xxpSubjectVoList;
     }
+
+    public List<Map<String, String>> getInCheck() {
+        return inCheck;
+    }
+
+    public void setInCheck(List<Map<String, String>> inCheck) {
+        this.inCheck = inCheck;
+    }
+
+    public List<Map<String, String>> getInspectInCheck() {
+        return inspectInCheck;
+    }
+
+    public void setInspectInCheck(List<Map<String, String>> inspectInCheck) {
+        this.inspectInCheck = inspectInCheck;
+    }
+
+    public List<String> getOutCheck() {
+        return outCheck;
+    }
+
+    public void setOutCheck(List<String> outCheck) {
+        this.outCheck = outCheck;
+    }
 }

+ 19 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabXxpCardInfoController.java

@@ -4,12 +4,15 @@ import com.zd.common.core.annotation.Log;
 import com.zd.common.core.annotation.PreAuthorize;
 import com.zd.common.core.log.BusinessType;
 import com.zd.common.core.security.TokenService;
+import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.ExcelUtil;
+import com.zd.common.core.utils.StringUtils;
 import com.zd.common.core.web.controller.BaseController;
 import com.zd.laboratory.domain.XxpCardInfo;
 import com.zd.laboratory.service.ILabSecurityApplyService;
 import com.zd.laboratory.service.ILabSubjectService;
 import com.zd.laboratory.service.IXxpCardInfoService;
+import com.zd.laboratory.service.IXxpDutyService;
 import com.zd.model.domain.ResultData;
 import com.zd.model.domain.per.PerFun;
 import com.zd.model.domain.per.PerPrefix;
@@ -40,6 +43,8 @@ public class LabXxpCardInfoController extends BaseController {
     private ILabSecurityApplyService iLabSecurityApplyService;
     @Autowired
     private ILabSubjectService iLabSubjectService;
+    @Autowired
+    private IXxpDutyService iXxpDutyService;
 
     @Autowired
     private TokenService tokenService;
@@ -199,6 +204,7 @@ public class LabXxpCardInfoController extends BaseController {
      */
     @RequestMapping("/pwdValidate")
     public ResultData pwdValidate(String num, String pwd,Long labId, Long userId) {
+        Integer isDutyUser=0;
         Map<String,Object> map=iLabSecurityApplyService.selectCountLabSecurityUserId(labId,userId);
         if(null==map){
             return ResultData.fail("未获得实验室准入资格;");
@@ -219,6 +225,19 @@ public class LabXxpCardInfoController extends BaseController {
             map.put("pageType",1);
         }
         map.remove("isWhite");
+        String dateTime = DateUtils.getDate();
+        List<Map<String,Object>> list = iXxpDutyService.selectDutyUser(labId,dateTime);
+        //判断是否当天值班
+        for(Map<String,Object> dutyMap:list){
+            String userObj=String.valueOf(dutyMap.get("userId"));
+            if(StringUtils.isNotEmpty(userObj) && StringUtils.isNotNull(userObj)){
+                if(Long.parseLong(userObj)==userId){
+                    isDutyUser=1;
+                    break;
+                }
+            }
+        }
+        map.put("isDutyUser",isDutyUser);
         return ResultData.success(map);
     }
 

+ 38 - 1
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabXxpUserAuthController.java

@@ -6,8 +6,10 @@ import com.zd.common.core.annotation.PreAuthorize;
 import com.zd.common.core.log.BusinessType;
 import com.zd.common.core.redis.RedisService;
 import com.zd.common.core.security.TokenService;
+import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.DictUtils;
 import com.zd.common.core.utils.ExcelUtil;
+import com.zd.common.core.utils.StringUtils;
 import com.zd.common.core.web.controller.BaseController;
 import com.zd.laboratory.api.vo.XxpUserAuthVo;
 import com.zd.laboratory.domain.LabSubject;
@@ -15,6 +17,7 @@ import com.zd.laboratory.domain.XxpCardInfo;
 import com.zd.laboratory.domain.XxpUserAuth;
 import com.zd.laboratory.service.ILabSubjectService;
 import com.zd.laboratory.service.IXxpCardInfoService;
+import com.zd.laboratory.service.IXxpDutyService;
 import com.zd.laboratory.service.IXxpUserAuthService;
 import com.zd.model.domain.ResultData;
 import com.zd.model.domain.per.PerFun;
@@ -48,6 +51,12 @@ public class LabXxpUserAuthController extends BaseController
     @Autowired
     private IXxpCardInfoService iXxpCardInfoService;
 
+    @Autowired
+    private ILabSubjectService iLabSubjectService;
+
+    @Autowired
+    private IXxpDutyService iXxpDutyService;
+
     /**
      * 查询列表
      */
@@ -198,9 +207,37 @@ public class LabXxpUserAuthController extends BaseController
      * @return
      */
     @GetMapping("/getFingerByUserId")
-    public ResultData getFingerByUserId(@RequestParam Long userId)
+    public ResultData getFingerByUserId(@RequestParam Long labId,@RequestParam Long userId)
     {
         List<Map<String,Object>> mapList= xxpUserAuthService.getFingerByUserId(userId);
+        for(Map<String,Object> map:mapList){
+            Integer isDutyUser=0;
+            String userType=String.valueOf(map.get("userType"));
+            String isWhite=String.valueOf(map.get("isWhite"));
+            //如果是学生 或者白名单的老师 进二类页面
+            if(userType.equals("22") || (userType.equals("11") && isWhite.equals("0"))){
+                map.put("pageType",2);
+            }
+            int number=iLabSubjectService.isAdminOrSafeUser(labId,userId);
+            //一类首页对应身份为白名单老师、实验室负责人、安全责任人
+            if(number>0 || (userType.equals("11") && isWhite.equals("1"))){
+                map.put("pageType",1);
+            }
+            String dateTime = DateUtils.getDate();
+            List<Map<String,Object>> list = iXxpDutyService.selectDutyUser(labId,dateTime);
+            //判断是否当天值班
+            for(Map<String,Object> dutyMap:list){
+                String userObj=String.valueOf(dutyMap.get("userId"));
+                if(StringUtils.isNotEmpty(userObj) && StringUtils.isNotNull(userObj)){
+                    if(Long.parseLong(userObj)==userId){
+                        isDutyUser=1;
+                        break;
+                    }
+                }
+            }
+            map.put("isDutyUser",isDutyUser);
+            map.remove("isWhite");
+        }
         return ResultData.success(mapList);
     }
 

+ 38 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/onemachine/controller/OneMachineController.java

@@ -249,6 +249,44 @@ public class OneMachineController extends BaseController {
         return ResultData.success(oneMachineService.createSignInPerInfoVO(subId, userResult.getData(), SignEnum.SIGN_IN));
     }
 
+
+
+    @GetMapping("/{subId}/SignInXxpCheck/{userId}")
+    public ResultData<SignInPerInfoVO> checkXxpUser(@PathVariable("userId") Long userId, @PathVariable("subId") Long subId, HttpServletRequest request) {
+        //获取指定用户信息
+        // 查询用户信息
+        R<SysUser> userResult = userService.getUserInfoByUserId(userId,SecurityConstants.INNER);
+
+        //验证用户账户状态
+        SysUser sysUser = userResult.getData();
+        if(sysUser.getStatus()==null || !sysUser.getStatus().equals("0")){
+            throw new ServiceException("用户:" + sysUser.getNickName() + " 账户停用,请联系管理员");
+        }
+
+        /*String url="";
+        String baseUrl=request.getServerName() ;
+        if(baseUrl.contains("192.168")){
+            url=fileConfigUtils.getLocalUrl()+sysUser.getAvatar();
+        }else {
+            url=fileConfigUtils.getRemoteUrl()+sysUser.getAvatar();
+        }*/
+//        //通过配置动态加载域名
+//        String url = fileConfigUtils.getFileDomainApp() + sysUser.getAvatar();
+//        String imgUrl = UrlFormatUtils.getHttpsORHttpUrl(url);
+//        sysUser.setAvatar(imgUrl);
+
+        //判断当天是否已签到,没有签出
+//        int num=labSubjectAccessRecordService.getRecordNoOut(userResult.getData().getUserId());
+//        if(num==0){
+//            return ResultData.fail(600,"你已经签到了,无法进行重复签到!");
+//        }
+        //签证前置信息
+        return ResultData.success(oneMachineService.createSignInPerInfoVO(subId, userResult.getData(), SignEnum.SIGN_IN));
+    }
+
+
+
+
     @ApiOperation("签出验证")
     @GetMapping("/{subId}/SignOutCheck/{username}")
     public ResultData<SignInPerInfoVO> checkOutUser(@PathVariable("username") String username, @PathVariable("subId") Long subId) {

+ 0 - 1
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabSubjectManagerService.java

@@ -420,7 +420,6 @@ public class LabSubjectManagerService {
                     .filter(a -> a.length > 0)
                     .ifPresent(a -> {
                         List<Map<String, String>> list = new ArrayList<>();
-
                         subSimpleVO.setInCheck(list);
                         Arrays.stream(a).map(c -> {
                             Optional<SysDictData> first = check_in.stream().filter(d -> c.equals(d.getDictValue())).findFirst();

+ 70 - 4
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabSubjectServiceImpl.java

@@ -1,9 +1,11 @@
 package com.zd.laboratory.service.impl;
 
+import cn.hutool.core.util.StrUtil;
 import com.zd.common.core.annotation.DataScope;
 import com.zd.common.core.exception.ServiceException;
 import com.zd.common.core.utils.Assert;
 import com.zd.common.core.utils.DateUtils;
+import com.zd.common.core.utils.DictUtils;
 import com.zd.common.core.utils.SecurityUtils;
 import com.zd.laboratory.api.vo.LabSubClassVO;
 import com.zd.laboratory.domain.*;
@@ -24,15 +26,16 @@ import com.zd.model.domain.per.PerPrefix;
 import com.zd.model.entity.SysUser;
 import com.zd.model.entity.TotalByID;
 import com.zd.model.enums.HazardTypeEnum;
+import com.zd.system.api.entity.SysDictData;
 import com.zd.system.api.feign.RemoteUserService;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 实验室Service业务层处理
@@ -546,7 +549,70 @@ public class LabSubjectServiceImpl implements ILabSubjectService {
 
     @Override
     public Map<String,Object> selectLabSubjectInfoId(Long id) {
-        return labSubjectMapper.selectXxpLabSubjectById(id);
+        Map<String,Object> labMap=labSubjectMapper.selectXxpLabSubjectById(id);
+        //进入检查
+        //设置
+        String checkIn=String.valueOf(labMap.get("check_in"));
+        String inspectCheckIn=String.valueOf(labMap.get("inspect_check_in"));
+        if (StrUtil.isNotBlank(checkIn)) {
+            List<SysDictData> check_in = DictUtils.getDictCache("sub_check_in");
+            Optional.ofNullable(checkIn.split(","))
+                    .filter(a -> a.length > 0)
+                    .ifPresent(a -> {
+                        List<Map<String, String>> list = new ArrayList<>();
+                        labMap.put("checkIn",list);
+                        Arrays.stream(a).map(c -> {
+                            Optional<SysDictData> first = check_in.stream().filter(d -> c.equals(d.getDictValue())).findFirst();
+                            return first;
+                        }).filter(c -> c.isPresent())
+                                .forEach(c -> {
+                                    c.ifPresent(d -> {
+                                        Map<String, String> map = new HashMap<>(2);
+                                        map.put("code", d.getDictValue());
+                                        map.put("name", d.getDictLabel());
+                                        list.add(map);
+
+                                    });
+                                });
+                    });
+
+        }
+        if (StrUtil.isNotBlank(inspectCheckIn)) {
+            List<SysDictData> check_in = DictUtils.getDictCache("sub_check_in");
+            Optional.ofNullable(inspectCheckIn.split(","))
+                    .filter(a -> a.length > 0)
+                    .ifPresent(a -> {
+                        List<Map<String, String>> list = new ArrayList<>();
+                        labMap.put("inspectCheckIn",list);
+                        Arrays.stream(a).map(c -> {
+                            Optional<SysDictData> first = check_in.stream().filter(d -> c.equals(d.getDictValue())).findFirst();
+                            return first;
+                        }).filter(c -> c.isPresent())
+                                .forEach(c -> {
+                                    c.ifPresent(d -> {
+                                        Map<String, String> map = new HashMap<>(2);
+                                        map.put("code", d.getDictValue());
+                                        map.put("name", d.getDictLabel());
+                                        list.add(map);
+
+                                    });
+                                });
+                    });
+
+        }
+        List<SysDictData> dictDatas = DictUtils.getDictCache("lab_onepc_outcheck");
+        List<String> newDictDatas = new ArrayList<>();
+        String checkOut=String.valueOf(labMap.get("check_out"));
+        if(StringUtils.isNotBlank(checkOut)){
+            newDictDatas = Optional.ofNullable(checkOut).map(b -> b.split(",")).map(b -> Arrays.asList(b))
+                    .orElse(new ArrayList <>()).stream().map(b -> Optional.ofNullable(dictDatas).filter(a -> a.size() > 0)
+                            .orElseGet(Collections::emptyList).stream()
+                            .filter(a -> b.equals(a.getDictValue())).findFirst().orElse(new SysDictData()))
+                    .map(SysDictData::getDictLabel).collect(Collectors.toList());
+        }
+        newDictDatas.removeIf(x->StringUtils.isEmpty(x));
+        labMap.put("checkOut",newDictDatas);
+        return labMap;
     }
 
     @Override

+ 4 - 1
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabSubjectMapper.xml

@@ -1022,6 +1022,9 @@
         select s.check_in,
                s.skipped,
                s.check_count,
+               s.inspect_check_in,
+               s.inspect_skipped,
+               s.inspect_check_count,
                (SELECT sl.room FROM lab_subject_layout sl WHERE sl.id = s.`layout_id`) room,
                (SELECT dt.dept_name FROM sys_dept dt WHERE dt.dept_id = s.`dept_id`)   dept_name
         from lab_subject s
@@ -1225,7 +1228,7 @@
                su.phonenumber                                                 as          adminPhone,
                sd.dept_name                                                   as          deptName,
                (select GROUP_CONCAT(concat(nick_name,'@',phonenumber)) from sys_user where find_in_set(user_id,
-        t.safe_user_id)) safeUserNameAdminPhone
+        t.safe_user_id)) safeUserNameAdminPhone,t.check_out, t.check_in,inspect_check_in
         from lab_subject t
                  left join sys_user su on su.user_id = t.admin_id AND su.`del_flag` = 0
                  left join sys_dept sd on sd.dept_id = t.dept_id

+ 1 - 1
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/XxpDutyMapper.xml

@@ -76,7 +76,7 @@
     </select>
 
     <select id="selectDutyUser" resultType="java.util.Map">
-        select user_name userName,user_phone userPhone,user_img avatar from  xxp_duty xxp
+        select user_id userId,user_name userName,user_phone userPhone,user_img avatar from  xxp_duty xxp
         <where>
             xxp.subject_id=#{labId}
             <if test="dateTime!=null">

+ 4 - 1
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/XxpUserAuthMapper.xml

@@ -86,7 +86,10 @@
     </select>
 
     <select id="getFingerByUserId" resultType="java.util.Map">
-        SELECT id AS id, finger as finger,finger_key as fingerKey FROM  `xxp_user_auth` WHERE user_id=#{userId}
+        <!--SELECT id AS id, finger as finger,finger_key as fingerKey FROM  `xxp_user_auth` WHERE user_id=#{userId}-->
+                SELECT id AS id, finger AS finger,finger_key AS fingerKey,user_id userId,user_name userName,user_type userType,
+                 IF((SELECT COUNT(*) FROM  `lab_whitelist` lw INNER JOIN `lab_white_join_sublist` lwjs ON lw.user_id=lwjs.white_user_id WHERE lwjs.subject_id=xua.subject_id AND lwjs.white_user_id=xua.user_id)>0,1,0)  AS isWhite
+                FROM  `xxp_user_auth` xua WHERE user_id=#{userId}
     </select>
 
     <insert id="insertXxpUserAuth" parameterType="com.zd.laboratory.domain.XxpUserAuth">