Search in sources :

Example 6 with ApplicationInfo

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

the class ApplicationInfoController method update.

// 修改处理
@RequestMapping(method = RequestMethod.PUT, produces = "text/html")
public String update(@Valid ApplicationInfo applicationInfo, Long isupdate, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
    if (bindingResult.hasErrors()) {
        uiModel.addAttribute("applicationInfo", applicationInfo);
        return "applicationinfo/update";
    }
    ApplicationInfo applicationInfo0 = applicationInfoService.selectById(applicationInfo.getId());
    applicationInfo.setAppId(applicationInfo0.getAppId());
    applicationInfo.setSecretKey(applicationInfo0.getSecretKey());
    applicationInfo.setAppServiceItems(applicationInfo0.getAppServiceItems());
    applicationInfo.setCreator(applicationInfo0.getCreator());
    applicationInfo.setCreateTime(applicationInfo0.getCreateTime());
    applicationInfo.setModifier(getAdmin().getId());
    applicationInfo.setModifyTime(new Date());
    applicationInfo.setAppId2(applicationInfo0.getAppId2());
    applicationInfo.setSecretKey2(applicationInfo0.getSecretKey2());
    // applicationInfo.setCallback(applicationInfo0.getCallback());
    EvidenceCert cert = new EvidenceCert();
    if (isupdate == null) {
        if (!"applicationinfo.certBase64".equals(applicationInfo.getCertBase64())) {
            String result = null;
            try {
                sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder();
                byte[] bt = decoder.decodeBuffer(applicationInfo.getCertBase64());
                result = new String(bt, "utf-8");
                UserCert userCert = CertUtil.getCertFromBase64(result);
                cert.setCreateTime(new Date());
                result = result.replaceAll("-----BEGIN CERTIFICATE-----", "").replaceAll("-----END CERTIFICATE-----", "").replaceAll("\r", "").replaceAll("\n", "");
                cert.setCertBase64(result);
                cert.setStartTime(userCert.getCertStartTime());
                cert.setEndTime(userCert.getCertEndTime());
                cert.setCertSerialnumber(userCert.getCertSn());
                cert.setIssuerdn(userCert.getIssuerDn());
                cert.setSubjectdn(userCert.getCertDn());
                /*if(userCert.getCertBuf()!=null){
						cert.setEvidenceBuf(userCert.getCertBuf().toString());
					}*/
                sqlSession.insert("com.itrus.portal.db.EvidenceCertMapper.insert", cert);
                String certDn = userCert.getCertDn();
                // applicationInfo.setCertBase64(cert.getId().toString());
                applicationInfo.setCertBase64(cert.getId().toString());
                applicationInfo.setCertDn(certDn);
                applicationInfo.setCertCn(EvidenceSaveServiceApi.getCertCn(certDn));
            // applicationInfo.setCertBase64(result);
            /*UserCert userCert = CertUtil.getCertFromBase64(result);
					String certDn = userCert.getCertDn();
					applicationInfo.setCertDn(certDn);
					applicationInfo.setCertCn(EvidenceSaveServiceApi.getCertCn(certDn));*/
            } catch (CertificateException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (SigningServerException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (UnsupportedEncodingException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        } else {
            applicationInfo.setCertBase64(null);
        }
        applicationInfoService.updateByApplicationInfo(applicationInfo);
    } else {
        applicationInfo.setCertBase64(applicationInfo0.getCertBase64());
        applicationInfo.setCertDn(applicationInfo0.getCertDn());
        applicationInfo.setCertCn(applicationInfo0.getCertCn());
        applicationInfoService.updateByApplicationInfo(applicationInfo);
    }
    /*else if(isupdate==1){
			try {
				applicationInfo.setCertBase64(applicationInfo0.getCertBase64());
				UserCert userCert = CertUtil.getCertFromBase64(applicationInfo0.getCertBase64());
				String certDn = userCert.getCertDn();
				applicationInfo.setCertDn(certDn);
				applicationInfo.setCertCn(EvidenceSaveServiceApi.getCertCn(certDn));
			} catch (CertificateException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (SigningServerException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}*/
    String oper = "修改应用";
    String info = "应用名称: " + applicationInfo.getName();
    LogUtil.adminlog(sqlSession, oper, info);
    return "redirect:applicationinfo/" + applicationInfo.getId();
}
Also used : ApplicationInfo(com.itrus.portal.db.ApplicationInfo) UnsupportedEncodingException(java.io.UnsupportedEncodingException) CertificateException(java.security.cert.CertificateException) IOException(java.io.IOException) Date(java.util.Date) EvidenceCert(com.itrus.portal.db.EvidenceCert) SigningServerException(com.itrus.cryptorole.SigningServerException) UserCert(com.itrus.portal.db.UserCert) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 7 with ApplicationInfo

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

the class ApplicationInfoController method show.

// 显示详情
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) {
    ApplicationInfo applicationInfo = applicationInfoService.selectById(id);
    uiModel.addAttribute("applicationInfo", applicationInfo);
    return "applicationinfo/show";
}
Also used : ApplicationInfo(com.itrus.portal.db.ApplicationInfo) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 8 with ApplicationInfo

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

the class BelievableFaceController method show.

/**
 * 返回查看详情页面
 * @param id
 * @param uiModel
 * @return
 */
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) {
    BelievableFace believableFace = believableFaceService.selectById(id);
    uiModel.addAttribute("believableFace", believableFace);
    ApplicationInfo applicationInfo = applicationInfoService.selectById(believableFace.getApplicationInfo());
    uiModel.addAttribute("applicationInfo", applicationInfo);
    // 查询照片表,多条数据
    FaceMatchingExample face = new FaceMatchingExample();
    FaceMatchingExample.Criteria faceMat = face.createCriteria();
    faceMat.andBelievableFaceEqualTo(believableFace.getId());
    List<FaceMatching> faceMatching = sqlSession.selectList("com.itrus.portal.db.FaceMatchingMapper.selectByExample", face);
    uiModel.addAttribute("faceMatching", faceMatching);
    return "believableFace/show";
}
Also used : FaceMatching(com.itrus.portal.db.FaceMatching) ApplicationInfo(com.itrus.portal.db.ApplicationInfo) FaceMatchingExample(com.itrus.portal.db.FaceMatchingExample) BelievableFace(com.itrus.portal.db.BelievableFace) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 9 with ApplicationInfo

use of com.itrus.portal.db.ApplicationInfo 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 10 with ApplicationInfo

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

the class StoreCharingServiceTest method checkStoreChargingtest.

@Test
public void checkStoreChargingtest() {
    try {
        cacheCustomer.initChargeRule();
        String appid = "8356e077dc6f45";
        String appserviceId = "cz0001";
        ApplicationInfo applicationInfo = CertificationChargingService.getApplicationInfoByAppId(appid);
        AppService appService = CertificationChargingService.getAppServiceByAppServiceId(appserviceId);
        // boolean flag = CertificationChargingService.checkTransInfo(appid, appserviceId,applicationInfo,appService);
        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap = storeChargingService.checkStoreCharging(true, applicationInfo, appService, 0, 1);
        System.out.println(retMap);
    // if (flag) {
    // retMap = CertificationChargingService.charging(appid, appserviceId, "测试交易表名1", 1L,applicationInfo,appService,1L,"11");
    // Integer retCode  = (Integer) retMap.get("retCode");
    // synchronized (SUCCESS_COUNT) {// 给SUCCESS_COUNT加上同步锁,避免计数不准确
    // if (retCode == 1) {
    // SUCCESS_COUNT = SUCCESS_COUNT + 1;
    // } else {
    // System.out.println("失败:" + retMap.get("retMsg"));
    // }
    // }
    // }
    } catch (Exception e) {
        System.out.println("出现异常:" + e.getMessage());
    }
}
Also used : AppService(com.itrus.portal.db.AppService) HashMap(java.util.HashMap) ApplicationInfo(com.itrus.portal.db.ApplicationInfo) AbstractTest(com.itrus.portal.abstracttest.test.AbstractTest) Test(org.junit.Test)

Aggregations

ApplicationInfo (com.itrus.portal.db.ApplicationInfo)59 HashMap (java.util.HashMap)36 ApplicationInfoExample (com.itrus.portal.db.ApplicationInfoExample)25 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)25 JSONObject (com.alibaba.fastjson.JSONObject)19 AppService (com.itrus.portal.db.AppService)19 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)16 Date (java.util.Date)13 EvidenceBasicInformation (com.itrus.portal.db.EvidenceBasicInformation)11 ArrayList (java.util.ArrayList)11 IOException (java.io.IOException)8 PostMapping (org.springframework.web.bind.annotation.PostMapping)8 Map (java.util.Map)7 Bill (com.itrus.portal.db.Bill)6 RealNameAuthentication (com.itrus.portal.db.RealNameAuthentication)6 Enterprise (com.itrus.portal.db.Enterprise)4 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)4 JSONException (org.json.JSONException)4 TransactionStatus (org.springframework.transaction.TransactionStatus)4 DefaultTransactionDefinition (org.springframework.transaction.support.DefaultTransactionDefinition)4