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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations