Search in sources :

Example 16 with MobileAppserviceCharging

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

the class MobileAppserviceChargingService method getAllAppId.

/**
 * 获取计费下所有的应用id
 * @return
 */
public Set<Long> getAllAppId() {
    Set<Long> set = new TreeSet<Long>();
    List<Long> list = new ArrayList<Long>();
    List<MobileAppserviceCharging> acList = selectByExample(null);
    if (null != acList && acList.size() > 0) {
        for (MobileAppserviceCharging appserviceCharging : acList) {
            set.add(appserviceCharging.getApp());
        }
    }
    return set;
}
Also used : MobileAppserviceCharging(com.itrus.portal.db.MobileAppserviceCharging) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList)

Example 17 with MobileAppserviceCharging

use of com.itrus.portal.db.MobileAppserviceCharging 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

MobileAppserviceCharging (com.itrus.portal.db.MobileAppserviceCharging)17 ArrayList (java.util.ArrayList)13 MobileAppserviceName (com.itrus.portal.db.MobileAppserviceName)10 Date (java.util.Date)8 MobileChargingPrice (com.itrus.portal.db.MobileChargingPrice)7 MobileAppserviceChargingExample (com.itrus.portal.db.MobileAppserviceChargingExample)6 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)6 HashMap (java.util.HashMap)5 List (java.util.List)5 AppserviceNameList (com.itrus.portal.mobile.entity.AppserviceNameList)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 ApplicationInfo (com.itrus.portal.db.ApplicationInfo)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 CertificationChargingHandler (com.itrus.portal.service.CertificationChargingHandler)2 AppService (com.itrus.portal.db.AppService)1 Charging (com.itrus.portal.db.Charging)1 MobileAppserviceNameExample (com.itrus.portal.db.MobileAppserviceNameExample)1 MobileCharging (com.itrus.portal.db.MobileCharging)1