Jelajahi Sumber

add:人脸识别不通过报错

caozixuan 1 tahun lalu
induk
melakukan
b0e592991d

+ 20 - 17
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDingServiceImpl.java

@@ -280,20 +280,38 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
         Long serviceId = sopCrmInfo.getServiceUnitId();
         Long flowId = sopCrmInfo.getFlowId();
         RoleTypeEnum roleType = sysRoleService.findRoleTypeByUserCrm(userId, crmNo);
-
         String signDate = DateFormatUtils.format(signTime, SystemConstant.DEFAULT_DATE_DAY_PATTERN);
         String currentDayStr = DateFormatUtils.format(System.currentTimeMillis(), SystemConstant.DEFAULT_DATE_DAY_PATTERN);
         if (!currentDayStr.equals(signDate)) {
             throw ExceptionResultEnum.ERROR.exception("打卡失败,时间异常");
         }
 
+        // 新增打卡历史记录
+        TBDingHistory history = new TBDingHistory();
+        history.setSopNo(sopNo);
+        history.setSignDate(signDate);
+        history.setDateType(dateType);
+        history.setSignTime(signTime);
+        history.setAxisX(axisX);
+        history.setAxisY(axisY);
+        history.setFaceOpen(faceOpen);
+        history.setFacePass(facePass);
+        history.setFacePhotoPath(facePhotoPath);
+        history.setMatchScore(score);
+        history.setCreateId(userId);
+        tbDingHistoryService.save(history);
+
+        if (faceOpen && !facePass){
+            log.error("人脸识别不通过,score :" + score);
+            throw ExceptionResultEnum.ERROR.exception("人脸识别不通过!");
+        }
+
         List<TBDing> tbDingList = this.list(new QueryWrapper<TBDing>().lambda()
                 .eq(TBDing::getSopNo, sopNo)
                 .eq(TBDing::getUserId, userId)
                 .eq(TBDing::getSignDate, signDate));
 
         List<String> otherSopNoList = tbSopInfoService.findFlowPassageByCrmNo(crmNo);
-
         if (CollectionUtils.isEmpty(tbDingList)) {
             // 没有这天的打卡记录 - 新增打卡记录
             TBDing tbDing = new TBDing();
@@ -363,21 +381,6 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
             }
             this.updateBatchById(recordList);
         }
-
-        // 新增打卡历史记录
-        TBDingHistory history = new TBDingHistory();
-        history.setSopNo(sopNo);
-        history.setSignDate(signDate);
-        history.setDateType(dateType);
-        history.setSignTime(signTime);
-        history.setAxisX(axisX);
-        history.setAxisY(axisY);
-        history.setFaceOpen(faceOpen);
-        history.setFacePass(facePass);
-        history.setFacePhotoPath(facePhotoPath);
-        history.setMatchScore(score);
-        history.setCreateId(userId);
-        tbDingHistoryService.save(history);
     }
 
     /**

+ 25 - 2
sop-business/src/main/java/com/qmth/sop/business/sync/FxxkApiUtils.java

@@ -1,5 +1,6 @@
 package com.qmth.sop.business.sync;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.qmth.sop.business.service.SysConfigService;
@@ -119,9 +120,30 @@ public class FxxkApiUtils {
 
             Map<String, Object> queryMap = new HashMap<>();
             queryMap.put("offset", 0.0);
-            queryMap.put("limit", 2.0);
+            queryMap.put("limit", 1000.0);
             queryMap.put("filters", new ArrayList<>());
 
+            // 查询
+            List<Map<String,Object>> filterMapList = new ArrayList<>();
+            Map<String,Object> filterMap = new HashMap<>();
+            filterMap.put("field_name","life_status");
+            List<String> fieldValues = new ArrayList<>();
+            fieldValues.add("normal");
+            filterMap.put("field_values",fieldValues);
+            filterMap.put("operator","EQ");
+
+            filterMapList.add(filterMap);
+            queryMap.put("filters",filterMapList);
+
+            // 排序
+            List<Map<String,Object>> orderMapList = new ArrayList<>();
+            // 最后更新时间降序
+            Map<String,Object> orderMap = new HashMap<>();
+            orderMap.put("fieldName","last_modified_time");
+            orderMap.put("isAsc",false);
+            orderMapList.add(orderMap);
+            queryMap.put("orders",orderMapList);
+
             dataMap.put("search_query_info", queryMap);
             map.put("data", dataMap);
 
@@ -136,6 +158,7 @@ public class FxxkApiUtils {
             }
             JSONObject data = jsonObject.getJSONObject("data");
             JSONArray dataList = data.getJSONArray("dataList");
+            System.out.println(JSON.toJSONString(dataList));
 
             List<FxxkCrm> fxxkCrmList = new ArrayList<>();
             for (int i = 0; i < dataList.size(); i++) {
@@ -144,7 +167,7 @@ public class FxxkApiUtils {
                 String crmNo = cell.getString("name");
                 Long beginTime = cell.getLong("createTime");
 
-                JSONObject ownerR = cell.getJSONObject("owner__r.nAME");
+                JSONObject ownerR = cell.getJSONObject("owner__r");
                 String managerName = ownerR.getString("name");
 
                 String customType = cell.getString("field_spOcm__c");