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();
}
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";
}
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";
}
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";
}
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());
}
}
Aggregations