From c1e7bbbec984e4cd1b9f31490e3d85ae7c923ab0 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期一, 04 三月 2024 13:58:43 +0800
Subject: [PATCH] ERP接口

---
 server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java |   27 ++++++++++++---------------
 1 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java b/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java
index 43d9931..e387803 100644
--- a/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java
+++ b/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java
@@ -111,7 +111,6 @@
     @Transactional(rollbackFor = {BusinessException.class,Exception.class})
     public void createFKForErp(ErpVisitDTO erpVisitDTO){
         try {
-
             if (Objects.isNull(erpVisitDTO)
                     || StringUtils.isBlank(erpVisitDTO.getName())
                     || StringUtils.isBlank(erpVisitDTO.getPhone())
@@ -120,6 +119,7 @@
                     || Objects.isNull(erpVisitDTO.getStarttime())
                     || Objects.isNull(erpVisitDTO.getEndtime())
                     || StringUtils.isBlank(erpVisitDTO.getFaceImg())
+                    || StringUtils.isBlank(erpVisitDTO.getDoors())
                     || Objects.isNull(erpVisitDTO.getReceptMemberId())
                     || Objects.isNull(erpVisitDTO.getErpId())
             ) {
@@ -159,7 +159,7 @@
                 }
                 visits.setWithUserList(visitsList);
             }
-            this.createFk(visits);
+            this.createFk(visits,true);
         }catch (BusinessException e){
             throw e;
         }finally {
@@ -190,12 +190,12 @@
      */
     @Override
     @Transactional(rollbackFor = {BusinessException.class,Exception.class})
-    public Integer createFk(Visits visits) {
+    public Integer createFk(Visits visits,Boolean isERP) {
         isValidBaseParam(visits);
         //妫�鏌ユ槸鍚﹀繀椤荤瓟棰橈紝骞朵笖绗﹀悎绛旈瑕佹眰
         ProblemLog problemLog = isValidProblemLog(visits);
         //鑾峰彇鐢宠鐨勬捣搴疯闂棬绂佺粍淇℃伅
-        getHkDeviceRoles(visits);
+        getHkDeviceRoles(visits,isERP);
         //妫�楠屾嫓璁夸汉鏄惁鍚堟硶
         Member visitMember = isValideVisitedUser(visits.getReceptMemberId());
         if(Constants.equalsInteger(Constants.ZERO, visits.getIdcardType())&&visits.getIdcardNo().length()!=18
@@ -577,9 +577,9 @@
                 || visits.getReceptMemberId() == null){
             throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵逛笉璧凤紝淇℃伅濉啓涓嶆纭紒");
         }
-//        if(visits.getStarttime().getTime() < System.currentTimeMillis()){
-//            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵逛笉璧凤紝棰勭害寮�濮嬫椂闂村繀椤诲ぇ浜庡綋鍓嶆椂闂达紒");//
-//        }
+        if(visits.getEndtime().getTime() < System.currentTimeMillis()){
+            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵逛笉璧凤紝棰勭害缁撴潫鏃堕棿蹇呴』澶т簬褰撳墠鏃堕棿锛�");//
+        }
         if(visits.getEndtime().getTime() <= visits.getStarttime().getTime()){
             throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵逛笉璧凤紝棰勭害缁撴潫鏃堕棿蹇呴』澶т簬寮�濮嬫椂闂达紒");//
         }
@@ -944,16 +944,13 @@
      * @param visits
      * @return
      */
-    private String[] getHkDeviceRoles(Visits visits) {
+    private String[] getHkDeviceRoles(Visits visits,Boolean isERP) {
         String mustSelectDoors = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SELECT_DOORS_VISIT_REQUIRED).getCode();
+        if(isERP){
+            mustSelectDoors = Constants.ONE+"";
+        }
         List<DeviceRole> roles = null;
         if(StringUtils.equals(mustSelectDoors,Constants.ZERO+"")){
-            //濡傛灉璁剧疆涓嶉�夋嫨闂ㄧ锛屽垯鎻愪緵榛樿闂ㄧ缁勪俊鎭�
-            if(StringUtils.isBlank(visits.getDoors())){
-                throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵逛笉璧凤紝璇烽�夋嫨璁块棶闂ㄧ锛�");
-            }
-            //鏍¢獙闂ㄧ缁勪俊鎭槸鍚︽纭�
-            String[] dIds = visits.getDoors().split(",");
             roles = deviceRoleMapper.selectList(new QueryWrapper<DeviceRole>().lambda()
                     .eq(DeviceRole::getIsDefault,Constants.ZERO)
                     .eq(DeviceRole::getIsdeleted,Constants.ZERO)
@@ -963,7 +960,7 @@
             }
         }else{
             //濡傛灉蹇呴』閫夋嫨闂ㄧ锛屼絾鏈�夋嫨
-            if(StringUtils.isNotBlank(visits.getDoors())){
+            if(StringUtils.isBlank(visits.getDoors())){
                 throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵逛笉璧凤紝璇烽�夋嫨鏈夋晥璁块棶闂ㄧ锛�");
             }
             String[] dIds = visits.getDoors().split(",");

--
Gitblit v1.9.3