jiangping
2023-12-20 4b139bcb2b3c6bf1082aca29913caf5166ec8167
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPrivilegeServiceImpl.java
@@ -5,12 +5,16 @@
import com.doumee.core.exception.BusinessException;
import com.doumee.core.haikang.model.HKConstants;
import com.doumee.core.haikang.model.param.BaseResponse;
import com.doumee.core.haikang.model.param.request.AcsDeviceListRequest;
import com.doumee.core.haikang.model.param.request.PrivilegeGroupRequest;
import com.doumee.core.haikang.model.param.respose.AcsDeviceInfoResponse;
import com.doumee.core.haikang.model.param.respose.AcsDeviceListResponse;
import com.doumee.core.haikang.model.param.respose.PrivilegeGroupInfoResponse;
import com.doumee.core.haikang.model.param.respose.PrivilegeGroupListResponse;
import com.doumee.core.haikang.service.HKService;
import com.doumee.core.utils.Constants;
import com.doumee.dao.business.DeviceRoleMapper;
import com.doumee.dao.business.model.Device;
import com.doumee.dao.business.model.DeviceRole;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -38,6 +42,11 @@
    @Override
//    @Async
    public String syncPrivilege(PrivilegeGroupRequest param){
        if(Constants.DEALING_HK_SYNCDEVICE){
            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "同步任务正在执行哦,请稍后查看结果!") ;
        }
        Constants.DEALING_HK_SYNCDEVICE =true;
        try {
        List<DeviceRole> deleteList = new ArrayList<>();
        List<DeviceRole> addList = new ArrayList<>();
        List<DeviceRole> editList = new ArrayList<>();
@@ -91,6 +100,13 @@
            }
        }
        return "同步数据:新增【"+addList.size()+"】条,更新【"+editList.size()+"】条,删除【"+deleteList.size()+"】条";
        }catch (Exception e){
            e.printStackTrace();
            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "同步失败!");
        }finally {
            Constants.DEALING_HK_SYNCDEVICE =false;
        }
    }
    private void getDataChangeList(List<DeviceRole> allList, List<PrivilegeGroupInfoResponse> allHkList, List<DeviceRole> addList, List<DeviceRole> editList,List<DeviceRole> deleteList, Date date) {