Search in sources :

Example 1 with ChargingFlow

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

the class StoreChargingServiceImpl method storeCharging.

/**
 * 存证计费,记录流水号
 * 根据输入的appid和appserviceId,查找对应的计费规则,并进行一次计费,请注意,要保证输入的参数都不能为null,且应用和服务存在
 * @param transinfoName,关联服务配置表名称
 * @param transinfoId,关联服务配置id
 * @param applicationInfo,应用appid对应的applicationInfo对象
 * @param appService,服务编码对应的appService对象
 * @param transinfoPrimaryId,服务调用记录生成的主键id
 * @param transinfoTableName,服务调用记录的表名称
 * @param baseSize,基础大小,单位M,不允许为NULL
 * @param totalSize,本次的总大小,单位M,不允许为NULL
 * @param isNew,该证据编号是否是第一次提交,true表示是第一次提交,false表示是第2-n次提交,不允许为null
 * @return
 */
public Map<String, Object> storeCharging(String transinfoName, Long transinfoId, ApplicationInfo applicationInfo, AppService appService, Long transinfoPrimaryId, String transinfoTableName, Integer baseSize, Integer totalSize, boolean isNew, String sn) {
    Map<String, Object> retMap = new HashMap<String, Object>();
    retMap.put("retCode", 0);
    try {
        ChargingFlow chargingFlow = chargingFlowService.insertOneStoreChargingFlow(transinfoName, transinfoId, applicationInfo.getId(), appService.getId(), transinfoPrimaryId, transinfoTableName, baseSize, totalSize, isNew, sn);
        retMap.put("retCode", 1);
        retMap.put("chargingFlow", chargingFlow);
        return retMap;
    } catch (Exception e) {
        try {
            // 如果上一次记录流水失败,则再次记录
            retMap.put("retMsg", e.getMessage());
            ChargingFlow chargingFlow = chargingFlowService.insertOneStoreChargingFlow(transinfoName, transinfoId, applicationInfo.getId(), appService.getId(), transinfoPrimaryId, transinfoTableName, baseSize, totalSize, isNew, sn);
            LogUtil.syslog(sqlSession, "账单流水出现异常", "出现异常后再次记账的单号:" + chargingFlow.getId() + ",异常信息" + e.getMessage());
            retMap.put("retCode", 1);
            retMap.put("chargingFlow", chargingFlow);
        } catch (Exception e2) {
            // TODO: handle exception
            retMap.put("retCode", 0);
            LogUtil.syslog(sqlSession, "账单流水出现异常", "再次计费后仍然异常, 异常信息" + e.getMessage());
            return retMap;
        }
    }
    return retMap;
}
Also used : ChargingFlow(com.itrus.portal.db.ChargingFlow) HashMap(java.util.HashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Example 2 with ChargingFlow

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

the class ChargingFlowServiceImpl method insertOneChargingFlowByTake.

/**
 * 插入一个类型是出证的流水记录
 * @param transinfoName
 * @param transinfoId
 * @param applicationInfo
 * @param appService
 * @param transinfoPrimaryId
 * @param transinfoTableName
 * @return
 */
public ChargingFlow insertOneChargingFlowByTake(String transinfoName, Long transinfoId, Long applicationInfo, Long appService, Long transinfoPrimaryId, String transinfoTableName, Integer totalSize, String serviceRequestPlatform, String hisApplicant) {
    ChargingFlow chargingFlow = new ChargingFlow();
    chargingFlow.setApplicationInfo(applicationInfo);
    chargingFlow.setAppService(appService);
    chargingFlow.setChargingType(ComNames.SERVICE_TYPE_TAKE);
    chargingFlow.setCreateTime(new Date());
    chargingFlow.setIsCharging(false);
    chargingFlow.setTransinfoId(transinfoId);
    chargingFlow.setTransinfoName(transinfoName);
    chargingFlow.setTransinfoPrimaryId(transinfoPrimaryId);
    chargingFlow.setTransinfoTableName(transinfoTableName);
    chargingFlow.setTotalSize(totalSize);
    chargingFlow.setExtraMessage1(serviceRequestPlatform);
    chargingFlow.setExtraMessage2(hisApplicant);
    chargingFlow = insertone(chargingFlow);
    return chargingFlow;
}
Also used : ChargingFlow(com.itrus.portal.db.ChargingFlow) Date(java.util.Date)

Example 3 with ChargingFlow

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

the class ChargingFlowServiceImpl method insertOneChargingFlow.

/**
 * 插入一个类型是实名认证的流水记录
 * @param transinfoName
 * @param transinfoId
 * @param applicationInfo
 * @param appService
 * @param transinfoPrimaryId
 * @param transinfoTableName
 * @return
 */
public ChargingFlow insertOneChargingFlow(String transinfoName, Long transinfoId, Long applicationInfo, Long appService, Long transinfoPrimaryId, String transinfoTableName) {
    ChargingFlow chargingFlow = new ChargingFlow();
    chargingFlow.setApplicationInfo(applicationInfo);
    chargingFlow.setAppService(appService);
    chargingFlow.setChargingType(ComNames.SERVICE_TYPE_CERTIFICATION);
    chargingFlow.setCreateTime(new Date());
    chargingFlow.setIsCharging(false);
    chargingFlow.setTransinfoId(transinfoId);
    chargingFlow.setTransinfoName(transinfoName);
    chargingFlow.setTransinfoPrimaryId(transinfoPrimaryId);
    chargingFlow.setTransinfoTableName(transinfoTableName);
    chargingFlow = insertone(chargingFlow);
    return chargingFlow;
}
Also used : ChargingFlow(com.itrus.portal.db.ChargingFlow) Date(java.util.Date)

Example 4 with ChargingFlow

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

the class CertificationChargingServiceImpl method charging.

/**
 * 根据输入的appid和appserviceId,查找对应的计费规则,并进行一次计费,请注意,要保证输入的参数都不能为null,且应用和服务存在
 * @param appId,应用appid
 * @param appServiceId,服务编码
 * @param transinfoName,关联服务配置表名称
 * @param transinfoId,关联服务配置id
 * @param applicationInfo,应用appid对应的applicationInfo对象
 * @param appService,服务编码对应的appService对象
 * @param transinfoPrimaryId,服务调用记录生成的主键id
 * @param transinfoTableName,服务调用记录的表名称
 * @return
 */
public Map<String, Object> charging(String appId, String appServiceId, String transinfoName, Long transinfoId, ApplicationInfo applicationInfo, AppService appService, Long transinfoPrimaryId, String transinfoTableName) {
    Map<String, Object> retMap = new HashMap<String, Object>();
    retMap.put("retCode", 0);
    try {
        ChargingFlow chargingFlow = chargingFlowService.insertOneChargingFlow(transinfoName, transinfoId, applicationInfo.getId(), appService.getId(), transinfoPrimaryId, transinfoTableName);
        retMap.put("retCode", 1);
        retMap.put("chargingFlow", chargingFlow);
        return retMap;
    } catch (Exception e) {
        // 如果上一次记录流水失败,则再次记录
        retMap.put("retMsg", e.getMessage());
        ChargingFlow chargingFlow = chargingFlowService.insertOneChargingFlow(transinfoName, transinfoId, applicationInfo.getId(), appService.getId(), transinfoPrimaryId, transinfoTableName);
        LogUtil.syslog(sqlSession, "账单流水出现异常", "出现异常后再次记账的单号:" + chargingFlow.getId() + ",异常信息" + e.getMessage());
        retMap.put("retCode", 1);
        retMap.put("chargingFlow", chargingFlow);
    }
    return retMap;
}
Also used : ChargingFlow(com.itrus.portal.db.ChargingFlow) HashMap(java.util.HashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Example 5 with ChargingFlow

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

the class ChargingFlowServiceImpl method insertOneStoreChargingFlow.

/**
 * 插入一个类型是存证的流水记录
 * @param transinfoName
 * @param transinfoId
 * @param applicationInfo
 * @param appService
 * @param evidenceSn
 * @param transinfoTableName
 * @param baseSize
 * @param size
 * @param isNew
 * @return
 */
public ChargingFlow insertOneStoreChargingFlow(String transinfoName, Long transinfoId, Long applicationInfo, Long appService, Long transinfoPrimaryId, String transinfoTableName, Integer baseSize, Integer size, boolean isNew, String sn) {
    ChargingFlow chargingFlow = new ChargingFlow();
    chargingFlow.setApplicationInfo(applicationInfo);
    chargingFlow.setAppService(appService);
    chargingFlow.setChargingType(ComNames.SERVICE_TYPE_STORE);
    chargingFlow.setCreateTime(new Date());
    chargingFlow.setIsCharging(false);
    chargingFlow.setTransinfoId(transinfoId);
    chargingFlow.setTransinfoName(transinfoName);
    chargingFlow.setTransinfoPrimaryId(transinfoPrimaryId);
    chargingFlow.setTransinfoTableName(transinfoTableName);
    chargingFlow.setBaseSize(baseSize);
    chargingFlow.setTotalSize(size);
    chargingFlow.setIsNew(isNew);
    chargingFlow.setCertificateNumber(sn);
    chargingFlow = insertone(chargingFlow);
    return chargingFlow;
}
Also used : ChargingFlow(com.itrus.portal.db.ChargingFlow) Date(java.util.Date)

Aggregations

ChargingFlow (com.itrus.portal.db.ChargingFlow)8 HashMap (java.util.HashMap)5 Date (java.util.Date)4 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 ActivityMsgTemp (com.itrus.portal.db.ActivityMsgTemp)1 AppService (com.itrus.portal.db.AppService)1 ApplicationInfo (com.itrus.portal.db.ApplicationInfo)1 Charging (com.itrus.portal.db.Charging)1 ChargingFlowExample (com.itrus.portal.db.ChargingFlowExample)1 ConditionRecord (com.itrus.portal.db.ConditionRecord)1 SignatureRecord (com.itrus.portal.db.SignatureRecord)1 CertificationChargingHandler (com.itrus.portal.service.CertificationChargingHandler)1 UnknownHostException (java.net.UnknownHostException)1 TransactionStatus (org.springframework.transaction.TransactionStatus)1 DefaultTransactionDefinition (org.springframework.transaction.support.DefaultTransactionDefinition)1