Search in sources :

Example 1 with ChargingPriceList

use of com.itrus.portal.entity.ChargingPriceList in project portal by ixinportal.

the class TakeChargingController method show.

// 根据应用id,查询应用下的所有计费规则信息
@RequestMapping(value = "/show/{id}")
public String show(@PathVariable("id") Long id, Model uiModel, HttpServletRequest request) {
    ApplicationInfo applicationInfo = sqlSession.selectOne("com.itrus.portal.db.ApplicationInfoMapper.selectByPrimaryKey", id);
    uiModel.addAttribute("applicationInfo", applicationInfo);
    // 系统配置的实名认证服务集合
    List<AppService> appServices = new ArrayList<AppService>();
    AppServiceExample appServiceExample = new AppServiceExample();
    AppServiceExample.Criteria criteria = appServiceExample.or();
    criteria.andTypeEqualTo(ComNames.SERVICE_TYPE_TAKE);
    appServices = sqlSession.selectList("com.itrus.portal.db.AppServiceMapper.selectByExample", appServiceExample);
    uiModel.addAttribute("appServices", appServices);
    List<CertificationCharging> certificationChargings = new ArrayList<CertificationCharging>();
    certificationChargings = takeChargingService.selectList(id, ComNames.CHARGING_TYPE_TAKE_3);
    CertificationChargingWrap certificationChargingWrap = new CertificationChargingWrap();
    List<CertificationChargingList> certificationChargingLists = new ArrayList<CertificationChargingList>();
    for (int i = 0; i < certificationChargings.size(); i++) {
        CertificationChargingList certificationChargingList = new CertificationChargingList();
        List<ServiceName> serviceNames = new ArrayList<ServiceName>();
        serviceNames = takeServiceNameService.selectListByCertificationCharging(certificationChargings.get(i));
        List<ServiceNameList> serviceNameLists = new ArrayList<ServiceNameList>();
        for (int j = 0; j < serviceNames.size(); j++) {
            List<ChargingPrice> chargingPrices = takeChargingPriceService.selectListByOneServiceName(serviceNames.get(j));
            ServiceNameList serviceNameList = new ServiceNameList();
            ChargingPriceList chargingPriceList = new ChargingPriceList();
            // 1
            chargingPriceList.setChargingPriceLists(chargingPrices);
            // 2
            serviceNameList.setServiceName(serviceNames.get(j));
            serviceNameList.setChargingPriceList(chargingPriceList);
            serviceNameLists.add(serviceNameList);
        }
        certificationChargingList.setCertificationCharging(certificationChargings.get(i));
        certificationChargingList.setServiceNameLists(serviceNameLists);
        certificationChargingLists.add(certificationChargingList);
    }
    certificationChargingWrap.setCertificationChargingLists(certificationChargingLists);
    uiModel.addAttribute("ccw", certificationChargingWrap);
    Map<Long, AppService> appServiceMap = sqlSession.selectMap("com.itrus.portal.db.AppServiceMapper.selectByExample", null, "id");
    uiModel.addAttribute("appServiceMap", appServiceMap);
    // 返回页面上的表单数据
    returnParam(request, uiModel);
    return "takecharging/show";
}
Also used : ServiceNameList(com.itrus.portal.entity.ServiceNameList) ChargingPriceList(com.itrus.portal.entity.ChargingPriceList) CertificationChargingList(com.itrus.portal.entity.CertificationChargingList) CertificationChargingWrap(com.itrus.portal.entity.CertificationChargingWrap)

Example 2 with ChargingPriceList

use of com.itrus.portal.entity.ChargingPriceList in project portal by ixinportal.

the class TakeChargingController method createOrUpdate.

// 新建和修改处理
@RequestMapping(value = "/createOrUpdate", method = RequestMethod.POST, produces = "text/html")
@ResponseBody
public synchronized Map<String, Object> createOrUpdate(@RequestParam("certificationChargingStr") String certificationChargingStr) {
    Map<String, Object> retMap = new HashMap<String, Object>();
    retMap.put("flag", false);
    DefaultTransactionDefinition dtd = new DefaultTransactionDefinition();
    // 事物的传播行为,使用同一个事物
    dtd.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    TransactionStatus status = transactionManager.getTransaction(dtd);
    try {
        CertificationChargingWrap ccw = jsonTool.readValue(certificationChargingStr, CertificationChargingWrap.class);
        List<CertificationChargingList> certificationChargingLists = ccw.getCertificationChargingLists();
        // 1.新增或修改CertificationCharging
        for (int i = 0; i < certificationChargingLists.size(); i++) {
            // 取出单个的服务名称主表对象和服务名封装list
            CertificationCharging cc = certificationChargingLists.get(i).getCertificationCharging();
            if (null == cc.getChargingType()) {
                cc.setChargingType(ComNames.CHARGING_TYPE_TAKE_3);
            }
            List<ServiceNameList> serviceNameLists = certificationChargingLists.get(i).getServiceNameLists();
            Map<String, Object> mapCC = new HashMap<String, Object>();
            mapCC = takeChargingService.saveOrUpdateCertificationCharging(cc);
            boolean retCodeCC = false;
            retCodeCC = (boolean) mapCC.get("flag");
            // 新增或修改CertificationCharging成功
            if (retCodeCC) {
                cc = (CertificationCharging) mapCC.get("certificationCharging");
                CertificationCharging oldCC = (CertificationCharging) mapCC.get("oldCertificationCharging");
                // 将CertificationCharging的id值赋值给serviceNameList中新增的服务
                serviceNameLists = takeServiceNameService.insertIdIntoServiceName(cc, serviceNameLists);
                // 2.新增或修改ServiceName
                for (int j = 0; j < serviceNameLists.size(); j++) {
                    ServiceName serviceName = serviceNameLists.get(j).getServiceName();
                    ChargingPriceList chargingPriceList = serviceNameLists.get(j).getChargingPriceList();
                    boolean retCodeSN = false;
                    Map<String, Object> mapServiceName = new HashMap<String, Object>();
                    mapServiceName = takeServiceNameService.saveOrUpdateServiceName(serviceName, cc, oldCC);
                    retCodeSN = (boolean) mapServiceName.get("flag");
                    // 新增或修改ServiceName成功
                    if (retCodeSN) {
                        serviceName = (ServiceName) mapServiceName.get("serviceName");
                        ServiceName oldServiceName = (ServiceName) mapServiceName.get("oldServiceName");
                        List<ServiceName> oldServiceNames = (List<ServiceName>) mapServiceName.get("serviceNames");
                        // 将serviceNameId,CertificationCharging的id值赋值给chargingPriceList中计费以及价格区间
                        chargingPriceList = takeChargingPriceService.insertIdIntoChargingPrice(serviceName, chargingPriceList);
                        List<ChargingPrice> chargingPrices = chargingPriceList.getChargingPriceLists();
                        // 3.charprice新增或修改
                        for (int k = 0; k < chargingPrices.size(); k++) {
                            Map<String, Object> mapChargingPrice = new HashMap<String, Object>();
                            mapChargingPrice = takeChargingPriceService.saveOrUpdateChargingPrice(cc, serviceName, chargingPrices.get(k), oldCC, oldServiceName, oldServiceNames);
                            boolean retCodeChargingPrice = false;
                            retCodeChargingPrice = (boolean) mapChargingPrice.get("flag");
                            // 新增或修改ChargingPrice失败
                            if (!retCodeChargingPrice) {
                                transactionManager.rollback(status);
                                retMap = mapChargingPrice;
                                return retMap;
                            }
                        }
                    } else {
                        // TODO 新增或修改ServiceName错误,返回异常信息
                        transactionManager.rollback(status);
                        retMap = mapServiceName;
                        return retMap;
                    }
                }
            } else {
                // TODO 新增或修改CertificationCharging错误,返回异常信息
                transactionManager.rollback(status);
                retMap = mapCC;
                return retMap;
            }
        }
        LogUtil.adminlog(sqlSession, "新增计费规则", "新增了计费规则");
        transactionManager.commit(status);
        retMap.put("flag", true);
        // 修改应用对应的服务:将应用和服务关联起来
        Set<Long> set = takeChargingService.getAllAppId();
        if (null != set && set.size() > 0) {
            for (Long long1 : set) {
                Set<Long> AppserviceIDs = takeChargingService.getAppserviceIDsByAppId(long1);
                applicationInfoService.addServiceByAppInfo(long1, AppserviceIDs);
            }
        }
        // 通知其他机器,加载缓存
        CertificationChargingHandler cch = new CertificationChargingHandler();
        QueueThread.buildCertificationTask(cch);
        cacheCustomer.initChargeRule();
        return retMap;
    } catch (JsonParseException e) {
        transactionManager.rollback(status);
        retMap.put("retMsg", e.getMessage());
        return retMap;
    } catch (JsonMappingException e) {
        transactionManager.rollback(status);
        retMap.put("retMsg", e.getMessage());
        return retMap;
    } catch (IOException e) {
        transactionManager.rollback(status);
        retMap.put("retMsg", e.getMessage());
        return retMap;
    } catch (Exception e) {
        transactionManager.rollback(status);
        retMap.put("retMsg", e.getMessage());
        return retMap;
    }
}
Also used : DefaultTransactionDefinition(org.springframework.transaction.support.DefaultTransactionDefinition) ChargingPriceList(com.itrus.portal.entity.ChargingPriceList) TransactionStatus(org.springframework.transaction.TransactionStatus) CertificationChargingList(com.itrus.portal.entity.CertificationChargingList) JsonParseException(org.codehaus.jackson.JsonParseException) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) CertificationChargingList(com.itrus.portal.entity.CertificationChargingList) ServiceNameList(com.itrus.portal.entity.ServiceNameList) ChargingPriceList(com.itrus.portal.entity.ChargingPriceList) ServiceNameList(com.itrus.portal.entity.ServiceNameList) IOException(java.io.IOException) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) IOException(java.io.IOException) JsonParseException(org.codehaus.jackson.JsonParseException) CertificationChargingWrap(com.itrus.portal.entity.CertificationChargingWrap)

Example 3 with ChargingPriceList

use of com.itrus.portal.entity.ChargingPriceList in project portal by ixinportal.

the class CertificationChargingController method createOrUpdate.

// 新建和修改处理
@RequestMapping(value = "/createOrUpdate", method = RequestMethod.POST, produces = "text/html")
@ResponseBody
public synchronized Map<String, Object> createOrUpdate(@RequestParam("certificationChargingStr") String certificationChargingStr) {
    Map<String, Object> retMap = new HashMap<String, Object>();
    retMap.put("flag", false);
    DefaultTransactionDefinition dtd = new DefaultTransactionDefinition();
    // 事物的传播行为,使用同一个事物
    dtd.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    TransactionStatus status = transactionManager.getTransaction(dtd);
    try {
        CertificationChargingWrap ccw = jsonTool.readValue(certificationChargingStr, CertificationChargingWrap.class);
        List<CertificationChargingList> certificationChargingLists = ccw.getCertificationChargingLists();
        // 1.新增或修改CertificationCharging
        for (int i = 0; i < certificationChargingLists.size(); i++) {
            // 取出单个的服务名称主表对象和服务名封装list
            CertificationCharging cc = certificationChargingLists.get(i).getCertificationCharging();
            if (null == cc.getChargingType()) {
                cc.setChargingType(ComNames.CHARGING_TYPE_SMRZ_1);
            }
            List<ServiceNameList> serviceNameLists = certificationChargingLists.get(i).getServiceNameLists();
            Map<String, Object> mapCC = new HashMap<String, Object>();
            mapCC = certificationChargingService.saveOrUpdateCertificationCharging(cc);
            boolean retCodeCC = false;
            retCodeCC = (boolean) mapCC.get("flag");
            // 新增或修改CertificationCharging成功
            if (retCodeCC) {
                cc = (CertificationCharging) mapCC.get("certificationCharging");
                CertificationCharging oldCC = (CertificationCharging) mapCC.get("oldCertificationCharging");
                // 将CertificationCharging的id值赋值给serviceNameList中新增的服务
                serviceNameLists = serviceNameService.insertIdIntoServiceName(cc, serviceNameLists);
                // 2.新增或修改ServiceName
                for (int j = 0; j < serviceNameLists.size(); j++) {
                    ServiceName serviceName = serviceNameLists.get(j).getServiceName();
                    ChargingPriceList chargingPriceList = serviceNameLists.get(j).getChargingPriceList();
                    boolean retCodeSN = false;
                    Map<String, Object> mapServiceName = new HashMap<String, Object>();
                    mapServiceName = serviceNameService.saveOrUpdateServiceName(serviceName, cc, oldCC);
                    retCodeSN = (boolean) mapServiceName.get("flag");
                    // 新增或修改ServiceName成功
                    if (retCodeSN) {
                        serviceName = (ServiceName) mapServiceName.get("serviceName");
                        ServiceName oldServiceName = (ServiceName) mapServiceName.get("oldServiceName");
                        List<ServiceName> oldServiceNames = (List<ServiceName>) mapServiceName.get("serviceNames");
                        // 将serviceNameId,CertificationCharging的id值赋值给chargingPriceList中计费以及价格区间
                        chargingPriceList = chargingPriceService.insertIdIntoChargingPrice(serviceName, chargingPriceList);
                        List<ChargingPrice> chargingPrices = chargingPriceList.getChargingPriceLists();
                        // 3.charprice新增或修改
                        for (int k = 0; k < chargingPrices.size(); k++) {
                            Map<String, Object> mapChargingPrice = new HashMap<String, Object>();
                            mapChargingPrice = chargingPriceService.saveOrUpdateChargingPrice(cc, serviceName, chargingPrices.get(k), oldCC, oldServiceName, oldServiceNames);
                            boolean retCodeChargingPrice = false;
                            retCodeChargingPrice = (boolean) mapChargingPrice.get("flag");
                            // 新增或修改ChargingPrice失败
                            if (!retCodeChargingPrice) {
                                transactionManager.rollback(status);
                                retMap = mapChargingPrice;
                                return retMap;
                            }
                        }
                    } else {
                        // TODO 新增或修改ServiceName错误,返回异常信息
                        transactionManager.rollback(status);
                        retMap = mapServiceName;
                        return retMap;
                    }
                }
            } else {
                // TODO 新增或修改CertificationCharging错误,返回异常信息
                transactionManager.rollback(status);
                retMap = mapCC;
                return retMap;
            }
        }
        LogUtil.adminlog(sqlSession, "新增计费规则", "新增了计费规则");
        transactionManager.commit(status);
        retMap.put("flag", true);
        // 修改应用对应的服务:将应用和服务关联起来
        Set<Long> set = certificationChargingService.getAllAppId();
        if (null != set && set.size() > 0) {
            for (Long long1 : set) {
                Set<Long> AppserviceIDs = certificationChargingService.getAppserviceIDsByAppId(long1);
                applicationInfoService.addServiceByAppInfo(long1, AppserviceIDs);
            }
        }
        // 通知其他机器,加载缓存
        CertificationChargingHandler cch = new CertificationChargingHandler();
        QueueThread.buildCertificationTask(cch);
        cacheCustomer.initChargeRule();
        return retMap;
    } catch (JsonParseException e) {
        transactionManager.rollback(status);
        retMap.put("retMsg", e.getMessage());
        return retMap;
    } catch (JsonMappingException e) {
        transactionManager.rollback(status);
        retMap.put("retMsg", e.getMessage());
        return retMap;
    } catch (IOException e) {
        transactionManager.rollback(status);
        retMap.put("retMsg", e.getMessage());
        return retMap;
    } catch (Exception e) {
        transactionManager.rollback(status);
        retMap.put("retMsg", e.getMessage());
        return retMap;
    }
}
Also used : DefaultTransactionDefinition(org.springframework.transaction.support.DefaultTransactionDefinition) HashMap(java.util.HashMap) ChargingPriceList(com.itrus.portal.entity.ChargingPriceList) TransactionStatus(org.springframework.transaction.TransactionStatus) CertificationChargingList(com.itrus.portal.entity.CertificationChargingList) JsonParseException(org.codehaus.jackson.JsonParseException) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) CertificationChargingList(com.itrus.portal.entity.CertificationChargingList) ArrayList(java.util.ArrayList) ServiceNameList(com.itrus.portal.entity.ServiceNameList) ChargingPriceList(com.itrus.portal.entity.ChargingPriceList) List(java.util.List) ServiceNameList(com.itrus.portal.entity.ServiceNameList) CertificationCharging(com.itrus.portal.db.CertificationCharging) IOException(java.io.IOException) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) IOException(java.io.IOException) JsonParseException(org.codehaus.jackson.JsonParseException) CertificationChargingWrap(com.itrus.portal.entity.CertificationChargingWrap) ServiceName(com.itrus.portal.db.ServiceName) ChargingPrice(com.itrus.portal.db.ChargingPrice) CertificationChargingHandler(com.itrus.portal.service.CertificationChargingHandler) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 4 with ChargingPriceList

use of com.itrus.portal.entity.ChargingPriceList in project portal by ixinportal.

the class CertificationChargingController method show.

// 根据应用id,查询应用下的所有计费规则信息
@RequestMapping(value = "/show/{id}")
public String show(@PathVariable("id") Long id, Model uiModel, HttpServletRequest request) {
    ApplicationInfo applicationInfo = sqlSession.selectOne("com.itrus.portal.db.ApplicationInfoMapper.selectByPrimaryKey", id);
    uiModel.addAttribute("applicationInfo", applicationInfo);
    // 系统配置的实名认证服务集合
    List<AppService> appServices = new ArrayList<AppService>();
    AppServiceExample appServiceExample = new AppServiceExample();
    AppServiceExample.Criteria criteria = appServiceExample.or();
    criteria.andTypeEqualTo(ComNames.SERVICE_TYPE_CERTIFICATION);
    appServices = sqlSession.selectList("com.itrus.portal.db.AppServiceMapper.selectByExample", appServiceExample);
    uiModel.addAttribute("appServices", appServices);
    List<CertificationCharging> certificationChargings = new ArrayList<CertificationCharging>();
    certificationChargings = certificationChargingService.selectList(id, ComNames.CHARGING_TYPE_SMRZ_1);
    CertificationChargingWrap certificationChargingWrap = new CertificationChargingWrap();
    List<CertificationChargingList> certificationChargingLists = new ArrayList<CertificationChargingList>();
    for (int i = 0; i < certificationChargings.size(); i++) {
        CertificationChargingList certificationChargingList = new CertificationChargingList();
        List<ServiceName> serviceNames = new ArrayList<ServiceName>();
        serviceNames = serviceNameService.selectListByCertificationCharging(certificationChargings.get(i));
        List<ServiceNameList> serviceNameLists = new ArrayList<ServiceNameList>();
        for (int j = 0; j < serviceNames.size(); j++) {
            List<ChargingPrice> chargingPrices = chargingPriceService.selectListByOneServiceName(serviceNames.get(j));
            ServiceNameList serviceNameList = new ServiceNameList();
            ChargingPriceList chargingPriceList = new ChargingPriceList();
            // 1
            chargingPriceList.setChargingPriceLists(chargingPrices);
            // 2
            serviceNameList.setServiceName(serviceNames.get(j));
            serviceNameList.setChargingPriceList(chargingPriceList);
            serviceNameLists.add(serviceNameList);
        }
        certificationChargingList.setCertificationCharging(certificationChargings.get(i));
        certificationChargingList.setServiceNameLists(serviceNameLists);
        certificationChargingLists.add(certificationChargingList);
    }
    certificationChargingWrap.setCertificationChargingLists(certificationChargingLists);
    uiModel.addAttribute("ccw", certificationChargingWrap);
    Map<Long, AppService> appServiceMap = sqlSession.selectMap("com.itrus.portal.db.AppServiceMapper.selectByExample", null, "id");
    uiModel.addAttribute("appServiceMap", appServiceMap);
    // 返回页面上的表单数据
    returnParam(request, uiModel);
    return "certificationcharging/show";
}
Also used : ServiceNameList(com.itrus.portal.entity.ServiceNameList) AppService(com.itrus.portal.db.AppService) CertificationCharging(com.itrus.portal.db.CertificationCharging) ApplicationInfo(com.itrus.portal.db.ApplicationInfo) ArrayList(java.util.ArrayList) ChargingPriceList(com.itrus.portal.entity.ChargingPriceList) CertificationChargingList(com.itrus.portal.entity.CertificationChargingList) AppServiceExample(com.itrus.portal.db.AppServiceExample) CertificationChargingWrap(com.itrus.portal.entity.CertificationChargingWrap) ServiceName(com.itrus.portal.db.ServiceName) ChargingPrice(com.itrus.portal.db.ChargingPrice) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 5 with ChargingPriceList

use of com.itrus.portal.entity.ChargingPriceList in project portal by ixinportal.

the class StoreChargingController method createOrUpdate.

// 新建和修改处理
@RequestMapping(value = "/createOrUpdate", method = RequestMethod.POST, produces = "text/html")
@ResponseBody
public synchronized Map<String, Object> createOrUpdate(@RequestParam("certificationChargingStr") String certificationChargingStr) {
    Map<String, Object> retMap = new HashMap<String, Object>();
    retMap.put("flag", false);
    DefaultTransactionDefinition dtd = new DefaultTransactionDefinition();
    // 事物的传播行为,使用同一个事物
    dtd.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    TransactionStatus status = transactionManager.getTransaction(dtd);
    try {
        CertificationChargingWrap ccw = jsonTool.readValue(certificationChargingStr, CertificationChargingWrap.class);
        List<CertificationChargingList> certificationChargingLists = ccw.getCertificationChargingLists();
        // 1.新增或修改CertificationCharging
        for (int i = 0; i < certificationChargingLists.size(); i++) {
            // 取出单个的服务名称主表对象和服务名封装list
            CertificationCharging cc = certificationChargingLists.get(i).getCertificationCharging();
            if (null == cc.getChargingType()) {
                cc.setChargingType(ComNames.CHARGING_TYPE_STORE_2);
            }
            List<ServiceNameList> serviceNameLists = certificationChargingLists.get(i).getServiceNameLists();
            Map<String, Object> mapCC = new HashMap<String, Object>();
            mapCC = storeChargingService.saveOrUpdateCertificationCharging(cc);
            boolean retCodeCC = false;
            retCodeCC = (boolean) mapCC.get("flag");
            // 新增或修改CertificationCharging成功
            if (retCodeCC) {
                cc = (CertificationCharging) mapCC.get("certificationCharging");
                CertificationCharging oldCC = (CertificationCharging) mapCC.get("oldCertificationCharging");
                // 将CertificationCharging的id值赋值给serviceNameList中新增的服务
                serviceNameLists = storeServiceNameService.insertIdIntoServiceName(cc, serviceNameLists);
                // 2.新增或修改ServiceName
                for (int j = 0; j < serviceNameLists.size(); j++) {
                    ServiceName serviceName = serviceNameLists.get(j).getServiceName();
                    ChargingPriceList chargingPriceList = serviceNameLists.get(j).getChargingPriceList();
                    boolean retCodeSN = false;
                    Map<String, Object> mapServiceName = new HashMap<String, Object>();
                    mapServiceName = storeServiceNameService.saveOrUpdateServiceName(serviceName, cc, oldCC);
                    retCodeSN = (boolean) mapServiceName.get("flag");
                    // 新增或修改ServiceName成功
                    if (retCodeSN) {
                        serviceName = (ServiceName) mapServiceName.get("serviceName");
                        ServiceName oldServiceName = (ServiceName) mapServiceName.get("oldServiceName");
                        List<ServiceName> oldServiceNames = (List<ServiceName>) mapServiceName.get("serviceNames");
                        // 将serviceNameId,CertificationCharging的id值赋值给chargingPriceList中计费以及价格区间
                        chargingPriceList = storeChargingPriceService.insertIdIntoChargingPrice(serviceName, chargingPriceList);
                        List<ChargingPrice> chargingPrices = chargingPriceList.getChargingPriceLists();
                        // 3.charprice新增或修改
                        for (int k = 0; k < chargingPrices.size(); k++) {
                            Map<String, Object> mapChargingPrice = new HashMap<String, Object>();
                            mapChargingPrice = storeChargingPriceService.saveOrUpdateChargingPrice(cc, serviceName, chargingPrices.get(k), oldCC, oldServiceName, oldServiceNames);
                            boolean retCodeChargingPrice = false;
                            retCodeChargingPrice = (boolean) mapChargingPrice.get("flag");
                            // 新增或修改ChargingPrice失败
                            if (!retCodeChargingPrice) {
                                transactionManager.rollback(status);
                                retMap = mapChargingPrice;
                                return retMap;
                            }
                        }
                    } else {
                        // TODO 新增或修改ServiceName错误,返回异常信息
                        transactionManager.rollback(status);
                        retMap = mapServiceName;
                        return retMap;
                    }
                }
            } else {
                // TODO 新增或修改CertificationCharging错误,返回异常信息
                transactionManager.rollback(status);
                retMap = mapCC;
                return retMap;
            }
        }
        LogUtil.adminlog(sqlSession, "新增计费规则", "新增了计费规则");
        transactionManager.commit(status);
        retMap.put("flag", true);
        // 修改应用对应的服务:将应用和服务关联起来
        Set<Long> set = storeChargingService.getAllAppId();
        if (null != set && set.size() > 0) {
            for (Long long1 : set) {
                Set<Long> AppserviceIDs = storeChargingService.getAppserviceIDsByAppId(long1);
                applicationInfoService.addServiceByAppInfo(long1, AppserviceIDs);
            }
        }
        // 通知其他机器,加载缓存
        CertificationChargingHandler cch = new CertificationChargingHandler();
        QueueThread.buildCertificationTask(cch);
        cacheCustomer.initChargeRule();
        return retMap;
    } catch (JsonParseException e) {
        transactionManager.rollback(status);
        retMap.put("retMsg", e.getMessage());
        return retMap;
    } catch (JsonMappingException e) {
        transactionManager.rollback(status);
        retMap.put("retMsg", e.getMessage());
        return retMap;
    } catch (IOException e) {
        transactionManager.rollback(status);
        retMap.put("retMsg", e.getMessage());
        return retMap;
    } catch (Exception e) {
        transactionManager.rollback(status);
        retMap.put("retMsg", e.getMessage());
        return retMap;
    }
}
Also used : DefaultTransactionDefinition(org.springframework.transaction.support.DefaultTransactionDefinition) ChargingPriceList(com.itrus.portal.entity.ChargingPriceList) TransactionStatus(org.springframework.transaction.TransactionStatus) CertificationChargingList(com.itrus.portal.entity.CertificationChargingList) JsonParseException(org.codehaus.jackson.JsonParseException) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) CertificationChargingList(com.itrus.portal.entity.CertificationChargingList) ServiceNameList(com.itrus.portal.entity.ServiceNameList) ChargingPriceList(com.itrus.portal.entity.ChargingPriceList) ServiceNameList(com.itrus.portal.entity.ServiceNameList) IOException(java.io.IOException) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) IOException(java.io.IOException) JsonParseException(org.codehaus.jackson.JsonParseException) CertificationChargingWrap(com.itrus.portal.entity.CertificationChargingWrap)

Aggregations

CertificationChargingList (com.itrus.portal.entity.CertificationChargingList)12 CertificationChargingWrap (com.itrus.portal.entity.CertificationChargingWrap)12 ChargingPriceList (com.itrus.portal.entity.ChargingPriceList)12 ServiceNameList (com.itrus.portal.entity.ServiceNameList)12 CertificationCharging (com.itrus.portal.db.CertificationCharging)6 ChargingPrice (com.itrus.portal.db.ChargingPrice)6 ServiceName (com.itrus.portal.db.ServiceName)6 IOException (java.io.IOException)6 ArrayList (java.util.ArrayList)6 JsonParseException (org.codehaus.jackson.JsonParseException)3 JsonMappingException (org.codehaus.jackson.map.JsonMappingException)3 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)3 Test (org.junit.Test)3 TransactionStatus (org.springframework.transaction.TransactionStatus)3 DefaultTransactionDefinition (org.springframework.transaction.support.DefaultTransactionDefinition)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 AppService (com.itrus.portal.db.AppService)2 AppServiceExample (com.itrus.portal.db.AppServiceExample)2 ApplicationInfo (com.itrus.portal.db.ApplicationInfo)2 Date (java.util.Date)2