| | |
| | | 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; |
| | |
| | | import com.doumee.core.utils.DESUtil; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.core.utils.redis.RedisUtil; |
| | | import com.doumee.core.wx.wxPlat.WxPlatNotice; |
| | | import com.doumee.dao.business.*; |
| | | import com.doumee.dao.business.dao.CompanyMapper; |
| | |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | |
| | | |
| | | @Autowired |
| | | private VisitEventMapper visitEventMapper; |
| | | |
| | | |
| | | @Autowired |
| | | private VisitEventJoinMapper visitEventJoinMapper; |
| | |
| | | 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(),"对不起,停车库信息不存在,授权失败"); |
| | | } |