@Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { if (bean instanceof PartnerService) { PartnerService pservice = (PartnerService) bean; if (pservice.getPatenerEnum() == null) { throw new RuntimeException( "partenerId没有设置,请在getPatenerId方法中填入返回值,className=" + pservice.getClass().getCanonicalName()); } if (partnerServiceMap.containsKey(pservice.getPatenerEnum().getPartenerId())) { throw new RuntimeException( "patenerId不能重复,patenerId=" + pservice.getPatenerEnum().getPartenerId() + ",className=" + pservice.getClass().getCanonicalName() + ",the same className=" + partnerServiceMap .get(pservice.getPatenerEnum().getPartenerId()) .getClass() .getCanonicalName()); } partnerServiceMap.put(pservice.getPatenerEnum().getPartenerId(), pservice); LogSystem.info( "成功装载 合作商信息" + pservice.getPatenerEnum().toString() + ",sreviceClass=" + pservice.getClass().getCanonicalName()); } return bean; }
/** * 加声望 * * @param userId * @param addAmount * @param drop */ public void addPrestige(String userId, int addAmount, int goodsUseType, CommonGoodsBeanBO drop) { User user = userService.getByUserId(userId); if (user == null) { String message = "更新用户声望失败,用户不存在.userId[" + userId + "], addAmount[" + addAmount + "]"; throw new ServiceException(SystemConstant.FAIL_CODE, message); } // 如果到了最高等级 则不再加经验 if (user.getPrestigeLevel() >= systemPrestigeLevelDaoCache.getMaxLevel()) { LogSystem.info("userId=" + userId + ",用户已经到达声望最高等级 不再加声望"); return; } // SystemPrestigeLevel systemPrestigeLevel = // this.systemPrestigeLevelDaoCache.getPrestigeLevel(addAmount+user.getPrestige()); // int leveAddCount = 0; // if(systemPrestigeLevel.getLevel()>user.getPrestigeLevel()){ // leveAddCount = systemPrestigeLevel.getLevel()-user.getPrestigeLevel(); // } // 修改经验和等级 // boolean success = this.userService.addPrestigeAndPrestigeLevel(userId, addAmount, // leveAddCount, goodsUseType, drop); // if(!success){ // throw new ServiceException(SystemConstant.FAIL_CODE, "加声望失败!"); // } }