|  |  | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | 
 |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
 |  |  | import com.baomidou.mybatisplus.extension.api.R; | 
 |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
 |  |  | import com.doumee.biz.system.SystemDictDataBiz; | 
 |  |  | import com.doumee.config.DataSyncConfig; | 
 |  |  | import com.doumee.config.Jwt.JwtPayLoad; | 
 |  |  | import com.doumee.config.Jwt.JwtTokenUtil; | 
 |  |  | import com.doumee.core.constants.ResponseStatus; | 
 |  |  | import com.doumee.core.erp.ErpConstants; | 
 |  |  | import com.doumee.core.erp.ErpTool; | 
 |  |  | 
 |  |  |             List<Company>  allList = companyMapper.selectList(new QueryWrapper<Company>().lambda().eq(Company::getType,Constants.ONE)); | 
 |  |  |             dealCompanyChangeList(list,addList,updateList,delIds,allList); | 
 |  |  |             if(addList.size()>0){ | 
 |  |  |                 companyMapper.insertBatchSomeColumn(addList); | 
 |  |  |                 companyMapper.insert(addList); | 
 |  |  |             } | 
 |  |  |             if(updateList.size()>0){ | 
 |  |  |                 for(Company c : updateList){ | 
 |  |  | 
 |  |  |                     .eq(Member::getType, Constants.memberType.internal)); | 
 |  |  |             dealUserChangeList(list,addList,updateList,delList,allList,param); | 
 |  |  |             if(addList.size()>0){ | 
 |  |  |                 memberMapper.insertBatchSomeColumn(addList); | 
 |  |  |                 memberMapper.insert(addList); | 
 |  |  |                /* for (Member member:addList) { | 
 |  |  |                     dealRoleEmpower(member ); | 
 |  |  |                 }*/ | 
 |  |  | 
 |  |  |         return  false; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public AccessTokenResponse createERPToken(String accessKey, String accessSecret){ | 
 |  |  |         AccessTokenResponse result = new AccessTokenResponse(); | 
 |  |  |         try{ | 
 |  |  |             String erpAccessKey = systemDictDataBiz.queryByCode(Constants.ERP_CONFIG,Constants.ERP_ACCESS_KEY).getCode(); | 
 |  |  |             String erpAccessSecret = systemDictDataBiz.queryByCode(Constants.ERP_CONFIG,Constants.ERP_ACCESS_SECRET).getCode(); | 
 |  |  |             if(!(accessKey.equals(erpAccessKey)&&erpAccessSecret.equals(accessSecret))){ | 
 |  |  |                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"秘钥匹配失败"); | 
 |  |  |             } | 
 |  |  |             JwtPayLoad payLoad = new JwtPayLoad(erpAccessKey+"-"+erpAccessSecret); | 
 |  |  |             String token = JwtTokenUtil.generateToken(payLoad); | 
 |  |  |             RedisUtil.addObject(redisTemplate,Constants.RedisKeys.ERP_TOKEN,token,Constants.RedisKeys.EXPIRE_TIME); | 
 |  |  |             result.setToken(token); | 
 |  |  |             result.setExpireTime(Constants.RedisKeys.EXPIRE_TIME); | 
 |  |  |             return result; | 
 |  |  |         }catch (BusinessException e){ | 
 |  |  |             throw e; | 
 |  |  |         }finally { | 
 |  |  |             Map<String,String> param = new HashMap<>(); | 
 |  |  |             param.put("accessKey",accessKey); | 
 |  |  |             param.put("accessSecret",accessSecret); | 
 |  |  |             saveInterfaceLog(param,"/visitBiz/accesstoken",JSONObject.toJSONString(result),Constants.ZERO); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |     } | 
 |  |  | //    @Override | 
 |  |  | //    public AccessTokenResponse createERPToken(String accessKey, String accessSecret){ | 
 |  |  | //        AccessTokenResponse result = new AccessTokenResponse(); | 
 |  |  | //        try{ | 
 |  |  | //            String erpAccessKey = systemDictDataBiz.queryByCode(Constants.ERP_CONFIG,Constants.ERP_ACCESS_KEY).getCode(); | 
 |  |  | //            String erpAccessSecret = systemDictDataBiz.queryByCode(Constants.ERP_CONFIG,Constants.ERP_ACCESS_SECRET).getCode(); | 
 |  |  | //            if(!(accessKey.equals(erpAccessKey)&&erpAccessSecret.equals(accessSecret))){ | 
 |  |  | //                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"秘钥匹配失败"); | 
 |  |  | // | 
 |  |  | //            String token = JwtTokenUtil.generateToken(payLoad); | 
 |  |  | //            RedisUtil.addObject(redisTemplate,Constants.RedisKeys.ERP_TOKEN,token,Constants.RedisKeys.EXPIRE_TIME); | 
 |  |  | //            result.setToken(token); | 
 |  |  | //            result.setExpireTime(Constants.RedisKeys.EXPIRE_TIME); | 
 |  |  | //            return result; | 
 |  |  | //        }catch (BusinessException e){ | 
 |  |  | //            throw e; | 
 |  |  | //        }finally { | 
 |  |  | //            Map<String,String> param = new HashMap<>(); | 
 |  |  | //            param.put("accessKey",accessKey); | 
 |  |  | //            param.put("accessSecret",accessSecret); | 
 |  |  | //            saveInterfaceLog(param,"/visitBiz/accesstoken",JSONObject.toJSONString(result),Constants.ZERO); | 
 |  |  | //        } | 
 |  |  | // | 
 |  |  | //    } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 门禁组全量接口 | 
 |  |  | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             if(memberCardList.size()>0){ | 
 |  |  |                 memberCardMapper.insertBatchSomeColumn(memberCardList); | 
 |  |  |                 memberCardMapper.insert(memberCardList); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  | 
 |  |  |                         parkBook.setRemark("待同步安防平台"); | 
 |  |  |                         parkBookList.add(parkBook); | 
 |  |  |                     } | 
 |  |  |                     parkBookMapper.insertBatchSomeColumn(parkBookList); | 
 |  |  |                     parkBookMapper.insert(parkBookList); | 
 |  |  |                 }else{ | 
 |  |  |                     throw  new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,停车库信息不存在,授权失败"); | 
 |  |  |                 } |