Search in sources :

Example 16 with MobileAppserviceName

use of com.itrus.portal.db.MobileAppserviceName in project portal by ixinportal.

the class MobileAppserviceChargingService method checkTransInfo.

/**
 * 根据输入的appid,查看是否有有效的计费规则,能计费则返回true,不能则返回false,请注意,要保证输入的参数都不能为null,且应用存在
 *
 * @param appId
 *            ,应用appid
 * @param applicationInfo
 *            ,应用appid对应的applicationInfo对象
 * @return
 */
public boolean checkTransInfo(String appId, /*String appServiceId,*/
ApplicationInfo applicationInfo) /*, AppService appService*/
{
    // String key = applicationInfo.getId() + ",";/* + appService.getId();*/
    ConcurrentHashMap<Long, List<MobileChargingPrice>> chargeRuleMap = CacheCustomer.getMOBILE_CHARGERULE_MAP();
    List<MobileChargingPrice> chargingPrices = chargeRuleMap.get(applicationInfo.getId());
    ConcurrentHashMap<Long, MobileAppserviceName> serviceNameMap = CacheCustomer.getAPPSERVICENAMEMAP();
    if (null != chargingPrices && !chargingPrices.isEmpty()) {
        for (MobileChargingPrice chargingPrice : chargingPrices) {
            // 校验计费规则对应的时间,是否处于当前时间内,如果不是,则进行下一个计费规则
            // getCertificationCharging()
            MobileAppserviceCharging certificationCharging = CacheCustomer.getMOBILE_CERTIFICATIONCHARGING_MAP().get(chargingPrice.getAppserviceCharging());
            boolean dateFlag = compareDate(new Date(), certificationCharging.getStartTime(), certificationCharging.getEndTime());
            if (dateFlag) {
                continue;
            }
            MobileAppserviceName serviceName = serviceNameMap.get(chargingPrice.getAppserviceName());
            if (null != serviceName && serviceName.getTotalNumber() < chargingPrice.getMaximumNumber()) {
                return true;
            }
        }
    }
    return false;
}
Also used : MobileAppserviceCharging(com.itrus.portal.db.MobileAppserviceCharging) MobileAppserviceName(com.itrus.portal.db.MobileAppserviceName) MobileChargingPrice(com.itrus.portal.db.MobileChargingPrice) ArrayList(java.util.ArrayList) List(java.util.List) Date(java.util.Date)

Aggregations

MobileAppserviceName (com.itrus.portal.db.MobileAppserviceName)16 ArrayList (java.util.ArrayList)11 MobileAppserviceCharging (com.itrus.portal.db.MobileAppserviceCharging)10 MobileChargingPrice (com.itrus.portal.db.MobileChargingPrice)6 Date (java.util.Date)6 MobileAppserviceNameExample (com.itrus.portal.db.MobileAppserviceNameExample)5 AppserviceNameList (com.itrus.portal.mobile.entity.AppserviceNameList)4 HashMap (java.util.HashMap)4 List (java.util.List)4 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)4 MobileAppserviceChargingExample (com.itrus.portal.db.MobileAppserviceChargingExample)3 AppserviceChargingList (com.itrus.portal.mobile.entity.AppserviceChargingList)3 AppserviceChargingWrap (com.itrus.portal.mobile.entity.AppserviceChargingWrap)3 ChargingPriceList (com.itrus.portal.mobile.entity.ChargingPriceList)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 ApplicationInfo (com.itrus.portal.db.ApplicationInfo)2 AppService (com.itrus.portal.db.AppService)1 MobileCharging (com.itrus.portal.db.MobileCharging)1 SysConfig (com.itrus.portal.db.SysConfig)1 CertificationChargingList (com.itrus.portal.entity.CertificationChargingList)1