Search in sources :

Example 21 with CertificationCharging

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

the class CertificationChargingServiceImpl method selectListByAppId.

/**
 * 根据输入的信息,查找对实名认证计费的List
 *
 * @param appId
 * @param isValidity
 * @param userGe
 * @return
 */
public List<CertificationCharging> selectListByAppId(Long appId, Long userGe) {
    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);
    }
    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 22 with CertificationCharging

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

the class CertificationChargingServiceImpl 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)

Example 23 with CertificationCharging

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

the class CertificationChargingServiceImpl method getAllAppId.

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

Example 24 with CertificationCharging

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

the class CertificationChargingServiceImpl method saveOrUpdateCertificationCharging.

/**
 * 新增或修改实名认证计费:CertificationCharging
 *
 * @param certificationCharging
 * @return
 * @throws Exception
 */
public Map<String, Object> saveOrUpdateCertificationCharging(CertificationCharging certificationCharging) throws Exception {
    Map<String, Object> retMap = new HashMap<String, Object>();
    retMap.put("flag", false);
    // 参数检查,参数不能为null,且结束时间大于起始时间
    boolean check = (null != certificationCharging && null != certificationCharging.getApp() && null != certificationCharging.getAccountingStrategy() && null != certificationCharging.getUserGe() && (1 == certificationCharging.getEndTime().compareTo(certificationCharging.getStartTime())));
    if (!check) {
        retMap.put("retMsg", "实名认证计费表参数不合法,请检查修改后重新提交");
        return retMap;
    }
    CertificationCharging oldCertificationCharging = new CertificationCharging();
    // 新增
    if (null == certificationCharging.getId()) {
        certificationCharging.setCreateTime(new Date());
        certificationCharging.setModifyTime(new Date());
        certificationCharging = save(certificationCharging);
    } else {
        // 修改
        oldCertificationCharging = getCertificationChargingById(certificationCharging.getId());
        // 将前台没有返回的属性值设置后再做对比
        certificationCharging = setOldValueInto(certificationCharging, oldCertificationCharging);
        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
        list = CompareTwoObjectUtils.compareTwoClass(oldCertificationCharging, certificationCharging);
        if (list.size() > 0) {
            LogUtil.adminlog(sqlSession, "修改实名认证计费规则", "实名认证计费主表中,id为:" + certificationCharging.getId() + ",进行了修改,修改内容为:" + list.toString());
        }
        Date date = new Date();
        certificationCharging.setModifyTime(date);
        oldCertificationCharging.setModifyTime(date);
        certificationCharging = update(certificationCharging);
    }
    retMap.put("certificationCharging", certificationCharging);
    retMap.put("oldCertificationCharging", oldCertificationCharging);
    retMap.put("flag", true);
    return retMap;
}
Also used : CertificationCharging(com.itrus.portal.db.CertificationCharging) HashMap(java.util.HashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ArrayList(java.util.ArrayList) HashMap(java.util.HashMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Date(java.util.Date)

Example 25 with CertificationCharging

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

the class CertificationChargingServiceImpl 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)

Aggregations

CertificationCharging (com.itrus.portal.db.CertificationCharging)43 ArrayList (java.util.ArrayList)34 ServiceName (com.itrus.portal.db.ServiceName)25 Date (java.util.Date)23 ChargingPrice (com.itrus.portal.db.ChargingPrice)21 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)19 CertificationChargingExample (com.itrus.portal.db.CertificationChargingExample)16 List (java.util.List)15 HashMap (java.util.HashMap)13 ServiceNameList (com.itrus.portal.entity.ServiceNameList)9 CertificationChargingList (com.itrus.portal.entity.CertificationChargingList)6 CertificationChargingWrap (com.itrus.portal.entity.CertificationChargingWrap)6 ChargingPriceList (com.itrus.portal.entity.ChargingPriceList)6 IOException (java.io.IOException)4 Map (java.util.Map)4 Test (org.junit.Test)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 AppService (com.itrus.portal.db.AppService)3 ApplicationInfo (com.itrus.portal.db.ApplicationInfo)3 Charging (com.itrus.portal.db.Charging)3