Search in sources :

Example 11 with MobileAppserviceName

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

the class MobileAppserviceNameService method selectListByAppserviceCharging.

/**
 * 取出所有属于该计费规则的服务名称
 *
 * @param certificationCharging
 * @return
 */
public List<MobileAppserviceName> selectListByAppserviceCharging(MobileAppserviceCharging appserviceChargings) {
    List<MobileAppserviceName> list = new ArrayList<MobileAppserviceName>();
    MobileAppserviceNameExample appserviceNameExample = new MobileAppserviceNameExample();
    MobileAppserviceNameExample.Criteria criteria = appserviceNameExample.or();
    criteria.andAppserviceChargingEqualTo(appserviceChargings.getId());
    list = sqlSession.selectList("com.itrus.portal.db.MobileAppserviceNameMapper.selectByExample", appserviceNameExample);
    return list;
}
Also used : MobileAppserviceName(com.itrus.portal.db.MobileAppserviceName) ArrayList(java.util.ArrayList) MobileAppserviceNameExample(com.itrus.portal.db.MobileAppserviceNameExample)

Example 12 with MobileAppserviceName

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

the class MobileAppserviceNameService method selectListByCertificationChargingId.

public List<MobileAppserviceName> selectListByCertificationChargingId(Long CertificationChargingId) {
    List<MobileAppserviceName> list = new ArrayList<MobileAppserviceName>();
    MobileAppserviceNameExample serviceNameExample = new MobileAppserviceNameExample();
    MobileAppserviceNameExample.Criteria criteria = serviceNameExample.or();
    criteria.andAppserviceChargingEqualTo(CertificationChargingId);
    // criteria.andCertificationChargingEqualTo();
    criteria.andIsValidityEqualTo(true);
    list = sqlSession.selectList("com.itrus.portal.db.MobileAppserviceNameMapper.selectByExample", serviceNameExample);
    return list;
}
Also used : MobileAppserviceName(com.itrus.portal.db.MobileAppserviceName) ArrayList(java.util.ArrayList) MobileAppserviceNameExample(com.itrus.portal.db.MobileAppserviceNameExample)

Example 13 with MobileAppserviceName

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

the class MobileAppserviceNameService method selectListByCertificationChargings.

/**
 * 取出所有属于该计费规则的服务名称
 *
 * @param certificationCharging
 * @return
 */
public List<MobileAppserviceName> selectListByCertificationChargings(List<MobileAppserviceCharging> certificationChargings) {
    List<Long> ccIdList = new ArrayList<Long>();
    for (int i = 0; i < certificationChargings.size(); i++) {
        ccIdList.add(certificationChargings.get(i).getId());
    }
    List<MobileAppserviceName> list = new ArrayList<MobileAppserviceName>();
    MobileAppserviceNameExample serviceNameExample = new MobileAppserviceNameExample();
    MobileAppserviceNameExample.Criteria criteria = serviceNameExample.or();
    // criteria.andCertificationChargingIn(ccIdList);
    criteria.andAppserviceChargingIn(ccIdList);
    list = sqlSession.selectList("com.itrus.portal.db.MobileAppserviceNameMapper.selectByExample", serviceNameExample);
    return list;
}
Also used : MobileAppserviceName(com.itrus.portal.db.MobileAppserviceName) ArrayList(java.util.ArrayList) MobileAppserviceNameExample(com.itrus.portal.db.MobileAppserviceNameExample)

Example 14 with MobileAppserviceName

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

the class MobileAppserviceNameService method checkNumber.

/**
 * 判断当前的计费规则是否适用(判断totalNumber是否处于最大值和最小值之间,处于返回true,不处于返回false).
 *
 * @param serviceName
 * @param chargingPrice
 * @return
 */
public boolean checkNumber(Long serviceNameId, MobileChargingPrice chargingPrice) {
    boolean flag = false;
    // 用数据库中的数据做对比
    MobileAppserviceName oldsServiceName = getServiceNameById(serviceNameId);
    flag = (chargingPrice.getMaximumNumber() > oldsServiceName.getTotalNumber()) && (chargingPrice.getMinimumNumber() <= oldsServiceName.getTotalNumber());
    return flag;
}
Also used : MobileAppserviceName(com.itrus.portal.db.MobileAppserviceName)

Example 15 with MobileAppserviceName

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

the class MobileAppserviceNameService method initAppServiceNameMap.

/**
 * 初始化当前时间内有效的serviceName
 * @return
 */
public ConcurrentHashMap<Long, MobileAppserviceName> initAppServiceNameMap() {
    ConcurrentHashMap<Long, MobileAppserviceName> serviceNameMap = new ConcurrentHashMap<>();
    ConcurrentHashMap<String, List<MobileChargingPrice>> chargeRuleMap = new ConcurrentHashMap<String, List<MobileChargingPrice>>();
    MobileAppserviceChargingExample cce = new MobileAppserviceChargingExample();
    MobileAppserviceChargingExample.Criteria criteria = cce.or();
    Date nowDate = new Date();
    criteria.andEndTimeGreaterThan(nowDate);
    cce.setOrderByClause("start_time asc");
    // 将入以下条件之后,只会加载当前时间处于计费起始终止时间内的计费规则,起始时间比当前时间还晚的就不加载
    // 加载一个小时以后也有效的计费规则,避免定时任务的空白期出现无可用计费的规则的情况
    Date laterDate = appserviceChargingService.getHourLaterDate(nowDate);
    criteria.andStartTimeLessThanOrEqualTo(laterDate);
    List<MobileAppserviceCharging> certificationChargings = new ArrayList<MobileAppserviceCharging>();
    certificationChargings = sqlSession.selectList("com.itrus.portal.db.MobileAppserviceChargingMapper.selectByExample", cce);
    if (null == certificationChargings) {
        return serviceNameMap;
    }
    for (int i = 0; i < certificationChargings.size(); i++) {
        List<MobileAppserviceName> serviceNames = selectListByCertificationChargingId(certificationChargings.get(i).getId());
        if (null != serviceNames && !serviceNames.isEmpty()) {
            for (MobileAppserviceName serviceName : serviceNames) {
                serviceNameMap.put(serviceName.getId(), serviceName);
            }
        }
    }
    return serviceNameMap;
}
Also used : MobileAppserviceCharging(com.itrus.portal.db.MobileAppserviceCharging) MobileChargingPrice(com.itrus.portal.db.MobileChargingPrice) ArrayList(java.util.ArrayList) MobileAppserviceChargingExample(com.itrus.portal.db.MobileAppserviceChargingExample) Date(java.util.Date) MobileAppserviceName(com.itrus.portal.db.MobileAppserviceName) AppserviceNameList(com.itrus.portal.mobile.entity.AppserviceNameList) ArrayList(java.util.ArrayList) List(java.util.List) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

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