From 2c4cfb7ed1ece6c3b80f7d551a267e9367ddb12b Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期五, 05 一月 2024 10:31:31 +0800
Subject: [PATCH] 整理

---
 server/dmvisit_service/src/main/java/com/doumee/service/business/impl/erp/ErpSyncServiceImpl.java |   50 ++++++++++++++++++++++++++++++++++----------------
 1 files changed, 34 insertions(+), 16 deletions(-)

diff --git a/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/erp/ErpSyncServiceImpl.java b/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/erp/ErpSyncServiceImpl.java
index 8d5026f..5675fc4 100644
--- a/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/erp/ErpSyncServiceImpl.java
+++ b/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/erp/ErpSyncServiceImpl.java
@@ -122,6 +122,9 @@
     @Override
     @Transactional
     public String syncCompany(OrgListRequest param){
+        if(!StringUtils.equals(Constants.ONE+"", systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.ORG_USER_ORIGIN).getCode())){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "瀵逛笉璧凤紝褰撳墠涓嶆敮鎸佺粍缁囧悓姝ユ搷浣渵");
+        }
         //鑾峰彇ERP缁勭粐淇℃伅锛堝叏閲忓悓姝ワ級
         List<ErpOrgListResponse>  list = ErpTool.getErpOrgList(ErpConstants.orgListUrl,param);
         if(list !=null && list.size()>0){
@@ -219,13 +222,16 @@
      */
     private Company getAddCompanyModel(ErpOrgListResponse respone, Date date) {
         Company    company = new Company();
+        company.setStatus(respone.getStatus());
         company.setIsdeleted(Constants.ZERO);
         company.setName(respone.getName());
         company.setErpId(respone.getId());
         company.setCreateDate(date);
         company.setType(Constants.ONE);
         company.setCode(respone.getCode());
-        company.setErpParentId(respone.getParentOrgId());
+        if(StringUtils.isNotBlank(respone.getParentOrgId())&&!respone.getParentOrgId().equals("orgRoot")){
+            company.setErpParentId(respone.getParentOrgId());
+        }
         company.setErpDate(date);
         company.setHkStatus(Constants.ZERO);
         return  company;
@@ -262,6 +268,9 @@
     @Override
     @Transactional
     public  String syncUsers(UserListRequest param){
+        if(!StringUtils.equals(Constants.ONE+"", systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.ORG_USER_ORIGIN).getCode())){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "瀵逛笉璧凤紝褰撳墠涓嶆敮鎸佷汉鍛樺悓姝ユ搷浣渵");
+        }
         List<ErpUserListResponse>  list = ErpTool.getErpUserList(ErpConstants.userListUrl,param);
         if(list !=null && list.size()>0) {
             List<Member> addList = new ArrayList<>();
@@ -298,7 +307,6 @@
         }else{
             throw  new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "鍚屾ERP鏁版嵁涓虹┖锛�");
         }
-
     }
 
     public void dealRoleEmpower(Member member,Date startTime , Date endTime){
@@ -715,9 +723,9 @@
             if(Objects.isNull(param)
                     ||Objects.isNull(param.getId())
                     ||StringUtils.isBlank(param.getName())
-                    ||StringUtils.isBlank(param.getLinkName())
-                    ||StringUtils.isBlank(param.getLinkPhone())
-                    ||Objects.isNull(param.getEditDate())
+//                    ||StringUtils.isBlank(param.getLinkName())
+//                    ||StringUtils.isBlank(param.getLinkPhone())
+//                    ||Objects.isNull(param.getEditDate())
             ){
                 throw new BusinessException(ResponseStatus.BAD_REQUEST);
             }
@@ -729,6 +737,7 @@
                     throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌涓婄骇缁勭粐鏁版嵁");
                 }
             }
+            String rootOrgId = systemDictDataBiz.queryByCode(Constants.HK_PARAM,Constants.HK_ROOTORG_CODE).getCode();
             if(Objects.isNull(company)){
                 company = new Company();
                 company.setId(null);
@@ -736,9 +745,14 @@
                 company.setHkStatus(Constants.ZERO);
                 company.setErpStatus(Constants.ONE);
                 company.setErpDate(new Date());
+                company.setName(param.getName());
+               /* if(StringUtils.isNotBlank(param.getParentId())){
+                    company.setHkId(rootOrgId);
+                }*/
                 company.setErpId(param.getId());
                 company.setErpParentId(param.getParentId());
                 company.setParentId(Objects.isNull(parentCompany)?null:parentCompany.getId());
+                company.setErpParentId(param.getParentId());
                 company.setFsStatus(Constants.ZERO);
                 company.setType(Constants.ONE);
                 company.setLinkName(param.getLinkName());
@@ -749,8 +763,12 @@
 //                BeanUtils.copyProperties(param,company);
                 company.setEditDate(new Date());
                 company.setErpId(param.getId());
+            /*    if(StringUtils.isNotBlank(param.getParentId())){
+                    company.setHkId(rootOrgId);
+                }*/
                 company.setHkStatus(Constants.ZERO);
                 company.setErpDate(new Date());
+                company.setName(param.getName());
                 company.setErpParentId(param.getParentId());
                 company.setParentId(Objects.isNull(parentCompany)?null:parentCompany.getId());
                 company.setLinkName(param.getLinkName());
@@ -771,16 +789,16 @@
     public void userUpdate(UserUpdateRequest param){
         try{
             if(Objects.isNull(param)
-                    ||Objects.isNull(param.getId())
-                    ||StringUtils.isBlank(param.getName())
-                    ||StringUtils.isBlank(param.getIdNo())
-                    ||Objects.isNull(param.getIdType())
-                    ||Objects.isNull(param.getSex())
-                    ||Objects.isNull(param.getOrgId())
-                    ||StringUtils.isNotBlank(param.getFaceImg())
-                    ||StringUtils.isNotBlank(param.getCode())
-                    ||StringUtils.isNotBlank(param.getPhone())
-                    ||Objects.isNull(param.getEditDate())){
+                    ||Objects.isNull(param.getId())//缂栫爜
+                    ||StringUtils.isBlank(param.getName())//鍚嶇О
+                    ||StringUtils.isBlank(param.getIdNo())//璇佷欢鍙�
+                    ||Objects.isNull(param.getIdType())//璇佷欢绫诲瀷
+                    ||Objects.isNull(param.getSex())//鎬у埆
+                    ||Objects.isNull(param.getOrgId())//鎵�灞炵粍缁囩紪鐮�
+                    ||StringUtils.isBlank(param.getFaceImg())//浜鸿劯鐓х墖
+                    ||StringUtils.isBlank(param.getCode())//宸ュ彿
+                    ||StringUtils.isBlank(param.getPhone())//鎵嬫満鍙�
+             ){
                 throw new BusinessException(ResponseStatus.BAD_REQUEST);
             }
             Member member = memberMapper.selectOne(new QueryWrapper<Member>().lambda().eq(Member::getErpId,param.getId()).last("limit 1"));
@@ -972,7 +990,7 @@
                 .set(ParkBook::getHkStatus,Constants.ZERO)
         );
         //鏌ヨ杞﹀簱淇℃伅
-        List<Parks> parksList = parksMapper.selectList(new QueryWrapper<Parks>().lambda().in(Parks::getId,param.getPartIdList()));
+        List<Parks> parksList = parksMapper.selectList(new QueryWrapper<Parks>().lambda().in(Parks::getId,param.getParkIdList()));
         if(CollectionUtils.isNotEmpty(parksList)){
             List<ParkBook> parkBookList = new ArrayList<>();
             for (Parks parks:parksList) {

--
Gitblit v1.9.3