k94314517
2024-10-16 17efddc6a667670dca682bf36b51a43e99615e6d
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/fhk/HkSyncOrgUserFromHKServiceImpl.java
@@ -22,7 +22,6 @@
import com.doumee.service.business.impl.hksync.HkSyncBaseServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
@@ -56,7 +55,7 @@
     */
    @Override
    @Transactional
    public   void syncOrgData(){
    public   void syncOrgData(LoginUserInfo user){
        if(Constants.DEALING_HK_ORG){
            return ;
        }
@@ -65,7 +64,6 @@
            if( Constants.formatIntegerNum(dataSyncConfig.getOrgUserDataOrigin()) != DataSyncConfig.origin.hk){
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "对不起,当前不支持组织同步操作~");
            }
            LoginUserInfo user =  (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
            TimeRangeListRequest param = new TimeRangeListRequest();
            //获取ERP组织信息(全量同步)
            boolean hasNext = true;
@@ -101,7 +99,7 @@
                throw  new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未同步到任何组织信息!");
            }
            companyMapper.delete(new UpdateWrapper<>());//清空原有数据
            companyMapper.insertBatchSomeColumn(allHkList);//插入新数据
            companyMapper.insert(allHkList);//插入新数据
        }catch (BusinessException e){
            throw  e;
        }catch (Exception e){
@@ -142,7 +140,7 @@
     * @return
     */
    @Override
    public   void syncUserData(){
    public   void syncUserData(LoginUserInfo user){
        if(Constants.DEALING_HK_USER){
            return   ;
        }
@@ -151,7 +149,6 @@
            if( Constants.formatIntegerNum(dataSyncConfig.getOrgUserDataOrigin()) != DataSyncConfig.origin.hk){
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "对不起,当前不支持组织同步操作~");
            }
            LoginUserInfo user =  (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
            List<Company> companies = companyMapper.selectList(new QueryWrapper<>());
            if(companies == null || companies.size() == 0){
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "对不起,请先同步企业组织信息~");
@@ -190,7 +187,7 @@
                throw  new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未同步到任何组织信息!");
            }
            memberMapper.delete(new UpdateWrapper<>());//清空原有数据
            memberMapper.insertBatchSomeColumn(allHkList);//插入新数据
            memberMapper.insert(allHkList);//插入新数据
        }catch (BusinessException e){
            throw  e;
        }catch (Exception e){