Search in sources :

Example 6 with CertificationChargingList

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

the class ChargingPriceControllerTest method testUpdate.

@Test
public void testUpdate() {
    String str = "";
    ChargingPrice cp = new ChargingPrice();
    ChargingPrice cp2 = new ChargingPrice();
    cp.setMaximumNumber(Integer.valueOf(100));
    cp.setMinimumNumber(Integer.valueOf(0));
    cp.setCreateTime(new Date());
    cp.setUnitPrice(Double.valueOf(0.6));
    cp.setId(Long.valueOf(1));
    cp2.setCreateTime(new Date());
    cp2.setUnitPrice(Double.valueOf(0.5));
    cp2.setMaximumNumber(Integer.valueOf(1000));
    cp2.setMinimumNumber(Integer.valueOf(100));
    ChargingPriceList chargingPriceList = new ChargingPriceList();
    ChargingPriceList chargingPriceList2 = new ChargingPriceList();
    List<ChargingPrice> chargingPrices = new ArrayList<>();
    chargingPriceList.setChargingPriceLists(chargingPrices);
    chargingPriceList.getChargingPriceLists().add(cp);
    chargingPriceList2.setChargingPriceLists(chargingPrices);
    chargingPriceList2.getChargingPriceLists().add(cp2);
    ServiceNameList serviceNameList = new ServiceNameList();
    ServiceNameList serviceNameList2 = new ServiceNameList();
    ServiceName serviceName = new ServiceName();
    ServiceName serviceName2 = new ServiceName();
    serviceName.setCreateTime(new Date());
    serviceName.setCertificationCharging(null);
    serviceName.setCertificationServiceId(Long.valueOf(1));
    serviceName.setServieType(Long.valueOf(1));
    serviceName.setTotalNumber(Integer.valueOf(0));
    serviceName2.setCreateTime(new Date());
    serviceName2.setCertificationCharging(null);
    serviceName2.setCertificationServiceId(Long.valueOf(1));
    serviceName2.setServieType(Long.valueOf(1));
    serviceName2.setTotalNumber(Integer.valueOf(0));
    List<ServiceName> serviceNames = new ArrayList<>();
    serviceNames.add(serviceName);
    serviceNames.add(serviceName2);
    serviceNameList.setChargingPriceList(chargingPriceList);
    serviceNameList.setServiceName(serviceName);
    serviceNameList2.setChargingPriceList(chargingPriceList2);
    serviceNameList2.setServiceName(serviceName2);
    List<ServiceNameList> list = new ArrayList<ServiceNameList>();
    list.add(serviceNameList);
    list.add(serviceNameList2);
    /**
     * 		// 参数检查,参数不能为null,且结束时间大于起始时间
     *		boolean check = (null != certificationCharging
     *				&& null != certificationCharging.getApp()
     *				&& null != certificationCharging.getAccountingStrategy()
     *				&& null != certificationCharging.getUserGe() && (1 == certificationCharging
     *				.getEndTime().compareTo(certificationCharging.getStartTime())));
     */
    CertificationCharging certificationCharging = new CertificationCharging();
    certificationCharging.setApp(Long.valueOf(1));
    certificationCharging.setAccountingStrategy(Double.valueOf(1));
    certificationCharging.setUserGe(Long.valueOf(2));
    certificationCharging.setStartTime(new Date(2016, 5, 3));
    certificationCharging.setEndTime(new Date(2017, 3, 2));
    // certificationCharging.setIsValidity(true);
    certificationCharging.setCreateTime(new Date());
    CertificationChargingList certificationChargingList = new CertificationChargingList();
    CertificationChargingList certificationChargingList2 = new CertificationChargingList();
    certificationChargingList.setCertificationCharging(certificationCharging);
    certificationChargingList.setServiceNameLists(list);
    certificationChargingList2.setCertificationCharging(certificationCharging);
    certificationChargingList2.setServiceNameLists(list);
    List<CertificationChargingList> cList = new ArrayList<CertificationChargingList>();
    cList.add(certificationChargingList);
    cList.add(certificationChargingList2);
    CertificationChargingWrap certificationChargingWrap = new CertificationChargingWrap();
    certificationChargingWrap.setCertificationChargingLists(cList);
    ObjectMapper json = new ObjectMapper();
    try {
        str = json.writeValueAsString(certificationChargingWrap);
    // CertificationChargingWrap certificationChargingWrap2 = json.readValue(str, CertificationChargingWrap.class);
    // List<CertificationChargingList> chargingPriceLists = certificationChargingWrap2.getCertificationChargingLists();
    // CertificationChargingList certificationChargingList3 = chargingPriceLists.get(0);
    // System.out.println(certificationChargingWrap2.toString());
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    try {
        // CertificationChargingController certificationChargingController = new CertificationChargingController();
        Map<String, Object> retmap = certificationChargingController.createOrUpdate(str);
        System.out.println(retmap.toString());
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : ServiceNameList(com.itrus.portal.entity.ServiceNameList) CertificationCharging(com.itrus.portal.db.CertificationCharging) ChargingPriceList(com.itrus.portal.entity.ChargingPriceList) ArrayList(java.util.ArrayList) CertificationChargingList(com.itrus.portal.entity.CertificationChargingList) IOException(java.io.IOException) Date(java.util.Date) IOException(java.io.IOException) CertificationChargingWrap(com.itrus.portal.entity.CertificationChargingWrap) ServiceName(com.itrus.portal.db.ServiceName) ChargingPrice(com.itrus.portal.db.ChargingPrice) ObjectMapper(org.codehaus.jackson.map.ObjectMapper) Test(org.junit.Test)

Example 7 with CertificationChargingList

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

the class StoreChargingController method update.

// 返回修改页面
@RequestMapping(value = "/update/{id}")
public String update(@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 ase = new AppServiceExample();
    AppServiceExample.Criteria criteria = ase.or();
    // 筛选实名认证类型的服务
    criteria.andTypeEqualTo(ComNames.SERVICE_TYPE_STORE);
    appServices = sqlSession.selectList("com.itrus.portal.db.AppServiceMapper.selectByExample", ase);
    uiModel.addAttribute("appServices", appServices);
    List<CertificationCharging> certificationChargings = new ArrayList<CertificationCharging>();
    certificationChargings = storeChargingService.selectList(id, ComNames.CHARGING_TYPE_STORE_2);
    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 = storeServiceNameService.selectListByCertificationCharging(certificationChargings.get(i));
        List<ServiceNameList> serviceNameLists = new ArrayList<ServiceNameList>();
        for (int j = 0; j < serviceNames.size(); j++) {
            List<ChargingPrice> chargingPrices = storeChargingPriceService.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 "storecharging/update";
}
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 8 with CertificationChargingList

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

the class StoreChargingController 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_STORE);
    appServices = sqlSession.selectList("com.itrus.portal.db.AppServiceMapper.selectByExample", appServiceExample);
    uiModel.addAttribute("appServices", appServices);
    List<CertificationCharging> certificationChargings = new ArrayList<CertificationCharging>();
    certificationChargings = storeChargingService.selectList(id, ComNames.CHARGING_TYPE_STORE_2);
    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 = storeServiceNameService.selectListByCertificationCharging(certificationChargings.get(i));
        List<ServiceNameList> serviceNameLists = new ArrayList<ServiceNameList>();
        for (int j = 0; j < serviceNames.size(); j++) {
            List<ChargingPrice> chargingPrices = storeChargingPriceService.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 "storecharging/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 9 with CertificationChargingList

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

the class TakeChargingController method update.

// 返回修改页面
@RequestMapping(value = "/update/{id}")
public String update(@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 ase = new AppServiceExample();
    AppServiceExample.Criteria criteria = ase.or();
    // 筛选出证服务类型的服务
    criteria.andTypeEqualTo(ComNames.SERVICE_TYPE_TAKE);
    appServices = sqlSession.selectList("com.itrus.portal.db.AppServiceMapper.selectByExample", ase);
    uiModel.addAttribute("appServices", appServices);
    Map<String, Object> map = new HashMap<>();
    map.put("serviceType", 1);
    // 系统配置的实名认证服务集合-企业
    List<AppService> appServices_e = new ArrayList<AppService>();
    appServices_e = sqlSession.selectList("com.itrus.portal.db.CertificationChargingMapper.selectAppServiceByServiceType", map);
    // 系统配置的实名认证服务集合-个人
    map.put("serviceType", 2);
    List<AppService> appServices_p = new ArrayList<AppService>();
    appServices_p = sqlSession.selectList("com.itrus.portal.db.CertificationChargingMapper.selectAppServiceByServiceType", map);
    uiModel.addAttribute("appServices_e", appServices_e);
    uiModel.addAttribute("appServices_p", appServices_p);
    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/update";
}
Also used : ChargingPriceList(com.itrus.portal.entity.ChargingPriceList) CertificationChargingList(com.itrus.portal.entity.CertificationChargingList) ServiceNameList(com.itrus.portal.entity.ServiceNameList) CertificationChargingWrap(com.itrus.portal.entity.CertificationChargingWrap)

Example 10 with CertificationChargingList

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

the class CertificationChargingController method update.

// 返回修改页面
@RequestMapping(value = "/update/{id}")
public String update(@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 ase = new AppServiceExample();
    AppServiceExample.Criteria criteria = ase.or();
    // 筛选实名认证类型的服务
    criteria.andTypeEqualTo(ComNames.SERVICE_TYPE_CERTIFICATION);
    appServices = sqlSession.selectList("com.itrus.portal.db.AppServiceMapper.selectByExample", ase);
    uiModel.addAttribute("appServices", appServices);
    Map<String, Object> map = new HashMap<>();
    map.put("serviceType", 1);
    // 系统配置的实名认证服务集合-企业
    List<AppService> appServices_e = new ArrayList<AppService>();
    appServices_e = sqlSession.selectList("com.itrus.portal.db.CertificationChargingMapper.selectAppServiceByServiceType", map);
    // 系统配置的实名认证服务集合-个人
    map.put("serviceType", 2);
    List<AppService> appServices_p = new ArrayList<AppService>();
    appServices_p = sqlSession.selectList("com.itrus.portal.db.CertificationChargingMapper.selectAppServiceByServiceType", map);
    uiModel.addAttribute("appServices_e", appServices_e);
    uiModel.addAttribute("appServices_p", appServices_p);
    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/update";
}
Also used : HashMap(java.util.HashMap) 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) ServiceNameList(com.itrus.portal.entity.ServiceNameList) AppService(com.itrus.portal.db.AppService) CertificationCharging(com.itrus.portal.db.CertificationCharging) 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)

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