use of com.itrus.portal.db.MobileCharging in project portal by ixinportal.
the class MobileChargingServiceImpl method insertOneIntoCharging.
/**
* 向移动端计费表中插入一条计费记录
*
* @param applicationInfoId
* @param appServiceId
* @param chargingPrice,计费以及价格区间
* @return
*/
public Map<String, Object> insertOneIntoCharging(Long applicationInfoId, /*Long appServiceId,*/
MobileChargingPrice chargingPrice, /*Long transinfoPrimaryId,*/
String transinfoTableName, Long chargingFlow) {
Map<String, Object> retMap = new HashMap<String, Object>();
retMap.put("flag", false);
MobileAppserviceName serviceName = appServiceNameService.getMobileAppServiceNameById(chargingPrice.getAppserviceName());
MobileAppserviceCharging cc = appserviceChargingService.getCertificationChargingById(chargingPrice.getAppserviceCharging());
Date date = new Date();
MobileCharging charging = new MobileCharging();
charging.setApplicationInfo(applicationInfoId);
// charging.setAppService(appServiceId);
charging.setCertificationCharging(chargingPrice.getAppserviceCharging());
charging.setCreateTime(date);
charging.setChargingPrice(chargingPrice.getId());
charging.setIsValidity(true);
charging.setModifyTime(date);
charging.setServiceName(chargingPrice.getAppserviceName());
charging.setServieType(Long.parseLong(String.valueOf(serviceName.getServiceType())));
charging.setUnitPrice(chargingPrice.getUnitPrice());
charging.setUserGe(cc.getUserGe());
charging = getYearMonthQuarter(date, charging);
// charging.setTransinfoName(transinfoName);
// charging.setTransinfoId(transinfoId);
charging.setChargingType(ComNames.SERVICE_TYPE_FOUR);
// charging.setTransinfoPrimaryId(transinfoPrimaryId);
charging.setTransinfoTableName(transinfoTableName);
charging.setChargingId(UniqueIDUtils.genCertificationTransInfoUID(sqlSession));
charging.setChargingFlow(chargingFlow);
// 认证组合名称:组合字段的值是:应用id+','+服务id+','+服务类别+','+年份+','+计费策略
String combinationName = applicationInfoId + /*+ "," + appServiceId*/
"," + serviceName.getServiceType() + "," + charging.getYear1() + "," + cc.getUserGe();
charging.setCombinationName(combinationName);
try {
charging = insertOne(charging);
serviceName.setTotalNumber(serviceName.getTotalNumber() + 1);
appServiceNameService.updateTotalNum(serviceName);
} catch (Exception e) {
// TODO: handle exception
retMap.put("retMsg", e.getMessage());
retMap.put("flag", false);
return retMap;
}
retMap.put("flag", true);
retMap.put("charging", charging);
return retMap;
}
Aggregations