Search in sources :

Example 11 with CertificationChargingExample

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

the class TakeChargingServiceImpl method selectList.

public List<CertificationCharging> selectList(Long appId, Long chargingType) {
    List<CertificationCharging> list = new ArrayList<CertificationCharging>();
    CertificationChargingExample cce = new CertificationChargingExample();
    CertificationChargingExample.Criteria criteria = cce.or();
    if (null != appId) {
        criteria.andAppEqualTo(appId);
    }
    if (null != chargingType) {
        criteria.andChargingTypeEqualTo(chargingType);
    }
    list = sqlSession.selectList("com.itrus.portal.db.CertificationChargingMapper.selectByExample", cce);
    return list;
}
Also used : CertificationChargingExample(com.itrus.portal.db.CertificationChargingExample) CertificationCharging(com.itrus.portal.db.CertificationCharging) ArrayList(java.util.ArrayList)

Example 12 with CertificationChargingExample

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

the class StoreChargingServiceImpl method selectListByAppId.

/**
 * 根据输入的信息,查找对实名认证计费的List
 *
 * @param appId
 * @param isValidity
 * @param userGe
 * @return
 */
public List<CertificationCharging> selectListByAppId(Long appId, Long userGe, Long chargingType) {
    List<CertificationCharging> list = new ArrayList<CertificationCharging>();
    CertificationChargingExample cce = new CertificationChargingExample();
    CertificationChargingExample.Criteria criteria = cce.or();
    if (null != appId) {
        criteria.andAppEqualTo(appId);
    }
    // criteria.andIsValidityEqualTo(isValidity);
    if (null != userGe) {
        criteria.andUserGeEqualTo(userGe);
    }
    if (null != chargingType) {
        criteria.andChargingTypeEqualTo(chargingType);
    }
    list = sqlSession.selectList("com.itrus.portal.db.CertificationChargingMapper.selectByExample", cce);
    return list;
}
Also used : CertificationChargingExample(com.itrus.portal.db.CertificationChargingExample) CertificationCharging(com.itrus.portal.db.CertificationCharging) ArrayList(java.util.ArrayList)

Example 13 with CertificationChargingExample

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

the class StoreChargingServiceImpl method initStoreCharging.

/**
 * 初始化存证计费规则 取出当前有效的计费规则.并存入系统缓存中
 */
public ConcurrentHashMap<String, List<ChargingPrice>> initStoreCharging() {
    ConcurrentHashMap<String, List<ChargingPrice>> chargeRuleMap = new ConcurrentHashMap<String, List<ChargingPrice>>();
    CertificationChargingExample cce = new CertificationChargingExample();
    CertificationChargingExample.Criteria criteria = cce.or();
    Date nowDate = new Date();
    criteria.andEndTimeGreaterThan(nowDate);
    cce.setOrderByClause("start_time asc");
    // 将入以下条件之后,只会加载当前时间处于计费起始终止时间内的计费规则,起始时间比当前时间还晚的就不加载
    // 加载一个小时以后也有效的计费规则,避免定时任务的空白期出现无可用计费的规则的情况
    Date laterDate = getHourLaterDate(nowDate);
    criteria.andStartTimeLessThanOrEqualTo(laterDate);
    criteria.andChargingTypeEqualTo(ComNames.CHARGING_TYPE_STORE_2);
    List<CertificationCharging> certificationChargings = new ArrayList<CertificationCharging>();
    certificationChargings = sqlSession.selectList("com.itrus.portal.db.CertificationChargingMapper.selectByExample", cce);
    if (null == certificationChargings) {
        return chargeRuleMap;
    }
    for (int i = 0; i < certificationChargings.size(); i++) {
        List<ServiceName> serviceNames = serviceNameService.selectListByCertificationChargingId(certificationChargings.get(i).getId());
        if (null != serviceNames && serviceNames.size() > 0) {
            for (int j = 0; j < serviceNames.size(); j++) {
                List<ChargingPrice> chargingPrices = new ArrayList<ChargingPrice>();
                chargingPrices = chargingPriceService.selectListByServiceName(serviceNames.get(j));
                String key = certificationChargings.get(i).getApp() + "," + serviceNames.get(j).getCertificationServiceId() + "," + certificationChargings.get(i).getAccountingStrategy();
                chargeRuleMap.put(key, chargingPrices);
            }
        }
    }
    return chargeRuleMap;
}
Also used : CertificationChargingExample(com.itrus.portal.db.CertificationChargingExample) CertificationCharging(com.itrus.portal.db.CertificationCharging) ArrayList(java.util.ArrayList) Date(java.util.Date) ServiceName(com.itrus.portal.db.ServiceName) ArrayList(java.util.ArrayList) List(java.util.List) ChargingPrice(com.itrus.portal.db.ChargingPrice) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Example 14 with CertificationChargingExample

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

the class StoreChargingServiceImpl method initAllStoreCharging.

/**
 * 初始化所有的存证计费
 */
public ConcurrentHashMap<String, List<ChargingPrice>> initAllStoreCharging() {
    ConcurrentHashMap<String, List<ChargingPrice>> chargeRuleMap = new ConcurrentHashMap<String, List<ChargingPrice>>();
    CertificationChargingExample cce = new CertificationChargingExample();
    CertificationChargingExample.Criteria criteria = cce.or();
    Date nowDate = new Date();
    cce.setOrderByClause("start_time asc");
    criteria.andChargingTypeEqualTo(ComNames.CHARGING_TYPE_STORE_2);
    List<CertificationCharging> certificationChargings = new ArrayList<CertificationCharging>();
    certificationChargings = sqlSession.selectList("com.itrus.portal.db.CertificationChargingMapper.selectByExample", cce);
    if (null == certificationChargings) {
        return chargeRuleMap;
    }
    for (int i = 0; i < certificationChargings.size(); i++) {
        List<ServiceName> serviceNames = serviceNameService.selectListByCertificationChargingId(certificationChargings.get(i).getId());
        if (null != serviceNames && serviceNames.size() > 0) {
            for (int j = 0; j < serviceNames.size(); j++) {
                List<ChargingPrice> chargingPrices = new ArrayList<ChargingPrice>();
                chargingPrices = chargingPriceService.selectListByServiceName(serviceNames.get(j));
                String key = certificationChargings.get(i).getApp() + "," + serviceNames.get(j).getCertificationServiceId() + "," + certificationChargings.get(i).getAccountingStrategy();
                chargeRuleMap.put(key, chargingPrices);
            }
        }
    }
    return chargeRuleMap;
}
Also used : CertificationChargingExample(com.itrus.portal.db.CertificationChargingExample) CertificationCharging(com.itrus.portal.db.CertificationCharging) ArrayList(java.util.ArrayList) Date(java.util.Date) ServiceName(com.itrus.portal.db.ServiceName) ArrayList(java.util.ArrayList) List(java.util.List) ChargingPrice(com.itrus.portal.db.ChargingPrice) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Example 15 with CertificationChargingExample

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

the class StoreChargingServiceImpl method initCertificationChargingMap.

/**
 * 初始化CertificationChargingMap
 */
public ConcurrentHashMap<Long, CertificationCharging> initCertificationChargingMap() {
    ConcurrentHashMap<Long, CertificationCharging> certificationChargingMap = new ConcurrentHashMap<Long, CertificationCharging>();
    CertificationChargingExample cce = new CertificationChargingExample();
    CertificationChargingExample.Criteria criteria = cce.or();
    Date nowDate = new Date();
    criteria.andEndTimeGreaterThan(nowDate);
    cce.setOrderByClause("start_time asc");
    // 将入以下条件之后,只会加载当前时间处于计费起始终止时间内的计费规则,起始时间比当前时间还晚的就不加载
    // 加载一个小时以后也有效的计费规则,避免定时任务的空白期出现无可用计费的规则的情况
    Date laterDate = getHourLaterDate(nowDate);
    criteria.andStartTimeLessThanOrEqualTo(laterDate);
    List<CertificationCharging> certificationChargings = new ArrayList<CertificationCharging>();
    certificationChargings = sqlSession.selectList("com.itrus.portal.db.CertificationChargingMapper.selectByExample", cce);
    if (null != certificationChargings && !certificationChargings.isEmpty()) {
        for (CertificationCharging certificationCharging : certificationChargings) {
            certificationChargingMap.put(certificationCharging.getId(), certificationCharging);
        }
    }
    return certificationChargingMap;
}
Also used : CertificationChargingExample(com.itrus.portal.db.CertificationChargingExample) CertificationCharging(com.itrus.portal.db.CertificationCharging) ArrayList(java.util.ArrayList) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Date(java.util.Date)

Aggregations

CertificationCharging (com.itrus.portal.db.CertificationCharging)16 CertificationChargingExample (com.itrus.portal.db.CertificationChargingExample)16 ArrayList (java.util.ArrayList)15 Date (java.util.Date)10 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)9 ServiceName (com.itrus.portal.db.ServiceName)8 ChargingPrice (com.itrus.portal.db.ChargingPrice)7 List (java.util.List)7 ServiceNameList (com.itrus.portal.entity.ServiceNameList)3 SysConfig (com.itrus.portal.db.SysConfig)1 InetAddress (java.net.InetAddress)1 UnknownHostException (java.net.UnknownHostException)1 Scheduled (org.springframework.scheduling.annotation.Scheduled)1