use of com.itrus.portal.db.RealNameAuthentication in project portal by ixinportal.
the class EvidenceSaveServiceApi method searchStored.
/**
* 查询存证
* @param signature
* 签名值
* @param appId
* 应用标识
* @param evidenceSn
* 证据编号
* @param request
* @return
*/
@RequestMapping(value = "/searchStored")
@ResponseBody
public Map<String, Object> searchStored(@RequestHeader("Content-Signature") String signature, @RequestParam(value = "appId", required = false) String appId, @RequestParam(value = "evidenceSn", required = false) String evidenceSn, HttpServletRequest request) {
// TODO : 查询存证接口
Map<String, Object> result = new HashMap<String, Object>();
// 验证参数是否完整
if (StringUtils.isEmpty(signature) || StringUtils.isEmpty(appId) || StringUtils.isEmpty(evidenceSn)) {
result.put("status", 0);
result.put("message", "提交的参数信息不完整");
return result;
}
// 得到应用信息 改成service
Map<String, ApplicationInfo> appInfoMap = CacheCustomer.getAPP_INFO_MAP();
ApplicationInfo applicationInfo = appInfoMap.get(appId);
if (applicationInfo == null) {
ApplicationInfoExample applicationInfoExample = new ApplicationInfoExample();
ApplicationInfoExample.Criteria appInfoExampleCriteria = applicationInfoExample.createCriteria();
appInfoExampleCriteria.andAppIdEqualTo(appId);
applicationInfo = sqlSession.selectOne("com.itrus.portal.db.ApplicationInfoMapper.selectByExample", applicationInfoExample);
}
if (applicationInfo == null) {
result.put("status", -11);
result.put("message", "应用标识不存在");
return result;
}
if (applicationInfo.getIsAppStatus() == 0) {
result.put("status", -12);
result.put("message", "应用状态已关闭");
return result;
}
// 核验ip限制
if (!applicationInfo.getAccessIp().contains(request.getRemoteAddr()) && "1".equals(applicationInfo.getIsIpStatus())) {
result.put("status", -1);
result.put("message", "没有此服务权限");
log.debug("EvidenceSaveSeriveceTest_AccsessIp : " + request.getRemoteAddr());
return result;
}
// 验证hmac有效性
try {
String macVal = Base64.encode(HMACSHA1.getHmacSHA1(appId + evidenceSn, applicationInfo.getSecretKey()), false);
if (!signature.equals("HMAC-SHA1 " + macVal)) {
result.put("status", -2);
result.put("message", "服务密钥错误");
return result;
}
} catch (Exception e) {
result.put("status", -3);
result.put("message", "Hmac验证错误");
e.printStackTrace();
return result;
}
// 获得证据基础信息
EvidenceBasicInformationExample basicInformationExample = new EvidenceBasicInformationExample();
EvidenceBasicInformationExample.Criteria beCriteria = basicInformationExample.createCriteria();
beCriteria.andEvidenceSnEqualTo(evidenceSn);
List<EvidenceBasicInformation> basicInformationList = sqlSession.selectList("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByExample", basicInformationExample);
if (basicInformationList == null || basicInformationList.isEmpty()) {
result.put("status", 0);
result.put("message", "未找到对应证据编号信息,请稍后重试。");
return result;
}
EvidenceBasicInformation basicInformation = basicInformationList.get(0);
// 判断该存储信息状态是否成功
if (basicInformation.getEvidenceStatus() == 1) {
// 判断业务类型为 身份认证 及 2,3 时 不需要返回回执报告 1:电子合同, 2:合同摘要数据, 3:图片摘要数据
if (basicInformation.getType().equals("2") || basicInformation.getType().equals("3") || basicInformation.getType().equals("4") || (basicInformation.getType().equals("1") && basicInformation.getEvidenceType() == 1)) {
result.put("status", 1);
result.put("message", "存证成功");
return result;
}
if (basicInformation.getReceiptStatus() == 1) {
// 获取原子服务地址 1.实名认证 2.密码服务 3.时间戳
RealNameAuthentication realNameAuthentication = CacheCustomer.getAUTH_CONFIG_MAP().get(2);
if (realNameAuthentication == null) {
try {
realNameAuthentication = realNameAuthenticationSerivce.getRealNameAuthenticationByTwo();
} catch (Exception e) {
e.printStackTrace();
result.put("status", -6);
result.put("message", "原子服务配置异常,请联系管理员");
return result;
}
}
if (realNameAuthentication == null) {
result.put("status", -6);
result.put("message", "缺少密码服务配置,请联系管理员");
return result;
}
// 获取回执报告附件表信息
EvidenceEnclosureExample enclosureExample = new EvidenceEnclosureExample();
EvidenceEnclosureExample.Criteria ec = enclosureExample.createCriteria();
ec.andEvidenceSnEqualTo(basicInformation.getEvidenceSn());
ec.andPdfTypeEqualTo("3");
List<EvidenceEnclosure> enclosures = sqlSession.selectList("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", enclosureExample);
if (basicInformationList == null || basicInformationList.isEmpty()) {
result.put("status", 0);
result.put("message", "未找到对应回执报告信息");
return result;
}
EvidenceEnclosure enclosure = enclosures.get(0);
// 调解密下载接口从原子服务拿到回执报告base64
String base64 = decryptedAndDownload(sqlSession, enclosure.getBuid(), realNameAuthentication.getRealNameddress());
if (StringUtils.isNotEmpty(base64)) {
result.put("base64", base64);
} else {
result.put("status", 0);
result.put("message", "获取存证回执报告失败,请联系管理员");
return result;
}
} else {
// 调用生成回执报告方法
Map<String, Object> mapRet = null;
try {
mapRet = reportTemplate.returnreceipt(evidenceSn, applicationInfo, null);
} catch (Exception e) {
result.put("status", 0);
result.put("message", "生成存证回执报告失败,请重试或者联系管理员");
return result;
}
if (mapRet.get("status") != null && (int) mapRet.get("status") == 0) {
// 修改证据基本信息回执状态为已出
result.put("reportBase64", mapRet.get("pdfBase64"));
basicInformation.setReceiptStatus(1);
sqlSession.update("com.itrus.portal.db.EvidenceBasicInformationMapper.updateByPrimaryKey", basicInformation);
} else {
result.put("status", 0);
result.put("message", "生成存证回执报告失败,请重试或者联系管理员");
return result;
}
}
result.put("status", 1);
if (StringUtils.isEmpty(basicInformation.getLackMainContent()))
result.put("message", "存证回执报告生成成功");
else
result.put("message", "存证回执报告生成成功," + basicInformation.getLackMainContent());
} else {
if (StringUtils.isEmpty(basicInformation.getLackMainContent()))
result.put("message", basicInformation.getFailureReason());
else
result.put("message", basicInformation.getFailureReason() + "," + basicInformation.getLackMainContent());
result.put("status", 0);
}
return result;
}
use of com.itrus.portal.db.RealNameAuthentication in project portal by ixinportal.
the class EvidenceSaveServiceApi method save.
// @Autowired
// private ProducerService producerService;
// 回执报告缓存Map key:证据编号 value:回执base64
// public static ConcurrentHashMap<String, String> cacheReportBySnMap = new ConcurrentHashMap<>();
/**
* 存证接口
* @param signature
* 签名值
* @param appId
* 应用id
* @param serviceCode
* 服务编号
* @param evidenceSn
* 证据编号
* @param signedBase64
* 签名值base64
* @param evidencePackage
* 证据包
* @param request
* @return
*/
@RequestMapping("/save")
@ResponseBody
public Map<String, Object> save(@RequestHeader("Content-Signature") String signature, @RequestParam(value = "appId", required = false) String appId, @RequestParam(value = "serviceCode", required = false) String serviceCode, @RequestParam(value = "evidenceSn", required = false) String evidenceSn, @RequestParam(value = "hashAlg", required = false) String hashAlg, @RequestParam(value = "signedBase64", required = false) String signedBase64, @RequestParam(value = "evidencePackage", required = false) String evidencePackage, HttpServletRequest request) {
// 返回值
Map<String, Object> result = new HashMap<String, Object>();
result.put("status", 1);
// 申请时间
Date date = new Date();
// 验证参数是否完整
if (StringUtils.isEmpty(signature) || StringUtils.isEmpty(appId) || StringUtils.isEmpty(serviceCode) || StringUtils.isEmpty(evidencePackage) || StringUtils.isEmpty(hashAlg) || StringUtils.isEmpty(signedBase64)) {
result.put("status", 0);
result.put("message", "提交的参数信息不完整");
return result;
}
// 获取对应应用信息
ApplicationInfo applicationInfo = applicationInfoService.getApplicationInfo(appId);
if (applicationInfo == null) {
result.put("status", -11);
result.put("message", "应用标识不存在");
return result;
}
if (applicationInfo.getIsAppStatus() == 0) {
result.put("status", -12);
result.put("message", "应用状态已关闭");
return result;
}
// 核验ip限制
if (!applicationInfo.getAccessIp().contains(request.getRemoteAddr()) && "1".equals(applicationInfo.getIsIpStatus())) {
result.put("status", -1);
result.put("message", "没有此服务权限");
log.debug("EvidenceSaveSeriveceTest_AccsessIp : " + request.getRemoteAddr());
return result;
}
// 验证hmac有效性
try {
String macVal = Base64.encode(HMACSHA1.getHmacSHA1(appId + serviceCode + evidenceSn + hashAlg + signedBase64 + evidencePackage, applicationInfo.getSecretKey()), false);
if (!signature.equals("HMAC-SHA1 " + macVal)) {
result.put("status", -2);
result.put("message", "服务密钥错误");
return result;
}
} catch (Exception e) {
result.put("status", -3);
result.put("message", "Hmac验证错误");
e.printStackTrace();
return result;
}
// 获取对应应用信息
EvidenceSaveService evidenceSaveService = null;
AppService appService = appServiceExt.getAppService(serviceCode);
if (appService != null && "EvidenceSaveService".equals(appService.getServiceConfigName())) {
evidenceSaveService = saveServiceImpl.selectById(appService.getServiceConfigId());
} else {
result.put("status", -21);
result.put("message", "应用服务不存在");
return result;
}
if (evidenceSaveService == null) {
result.put("status", -21);
result.put("message", "应用服务不存在");
return result;
}
if (appService.getIsAppServiceStatus() == 0) {
result.put("status", -22);
result.put("message", "服务已关闭");
return result;
}
// 获取存证回执模版
if (evidenceSaveService.getAppServiceName() != null) {
AppService appServiceOut = CacheCustomer.APP_SERVICE_MAP_BY_ID().get(evidenceSaveService.getAppServiceName());
if (appServiceOut == null) {
appServiceOut = appServiceExt.selectById(evidenceSaveService.getAppServiceName());
if (appServiceOut == null) {
result.put("status", -22);
result.put("message", "回执模版不存在");
return result;
}
}
}
if (StringUtils.isNotEmpty(evidenceSn)) {
EvidenceBasicInformation basicInformation = basicInformationService.getInformationBySn(evidenceSn, 1);
if (basicInformation != null) {
result.put("status", 0);
result.put("message", "该证据不可补交");
return result;
}
}
RealNameAuthentication realNameAuthentication = null;
RealNameAuthentication realNameAuthenticationTime = null;
RealNameAuthentication realNameAuthenticationOss = null;
try {
// 获取原子服务地址 1.实名认证 2.密码服务 3.时间戳 4.OSS
realNameAuthentication = CacheCustomer.getAUTH_CONFIG_MAP().get(2);
if (realNameAuthentication == null) {
realNameAuthentication = realNameAuthenticationSerivce.getRealNameAuthenticationByTwo();
}
if (realNameAuthentication == null) {
result.put("status", -6);
result.put("message", "缺少密码服务配置,请联系管理员");
return result;
}
// 获取原子服务地址 1.实名认证 2.密码服务 3.时间戳 4.OSS
realNameAuthenticationTime = CacheCustomer.getAUTH_CONFIG_MAP().get(3);
if (realNameAuthenticationTime == null) {
realNameAuthenticationTime = realNameAuthenticationSerivce.getRealNameAuthenticationByThree();
}
if (realNameAuthenticationTime == null) {
result.put("status", -6);
result.put("message", "缺少时间戳服务配置,请联系管理员");
return result;
}
// 获取原子服务地址 1.实名认证 2.密码服务 3.时间戳 4.OSS
realNameAuthenticationOss = CacheCustomer.getAUTH_CONFIG_MAP().get(4);
if (realNameAuthenticationOss == null) {
realNameAuthenticationOss = realNameAuthenticationSerivce.getRealNameAuthenticationByOss();
}
if (realNameAuthenticationOss == null) {
result.put("status", -6);
result.put("message", "缺少OSS配置,请联系管理员");
return result;
}
// 本次证据包大小
int fileSize = evidencePackage.getBytes("utf-8").length;
// 存证计费校验接口
Map<String, Object> mapCharging = storeChargingService.checkStoreCharging(StringUtils.isBlank(evidenceSn), applicationInfo, appService, evidenceSaveService.getBaseSpace(), getSize(fileSize));
// log.debug("存证计费校验 mapCharging__ : " + mapCharging);
if ((int) mapCharging.get("retCode") == 0) {
result.put("status", -4);
if (mapCharging.get("retMsg") != null)
result.put("message", mapCharging.get("retMsg"));
else
result.put("message", "服务计费失败");
return result;
}
// 证据包申请
String hashvalue = HMACSHA1.getDigest(hashAlg, evidencePackage);
// 1.验签之后返回
List<String> certs = verifySign(result, applicationInfo, evidenceSaveService, hashvalue, signedBase64, realNameAuthentication);
Date dateVp = (Date) result.get("dateVp");
Date dateVc = (Date) result.get("dateVc");
result.remove("dateVp");
result.remove("dateVc");
if (null != certs) {
String genSn = null;
if (StringUtils.isEmpty(evidenceSn)) {
genSn = UniqueIDUtils.genAppServiceUID(applicationInfo, appService.getAppServiceName(), sqlSession, 3);
}
result = saveTask.saveBody(result, applicationInfo, appService, evidenceSaveService, date, evidenceSn, genSn, signedBase64, evidencePackage, hashAlg, hashvalue, dateVp, dateVc, certs, realNameAuthentication, realNameAuthenticationTime, realNameAuthenticationOss, mapCharging);
if ((int) result.get("status") == 1) {
result.put("message", "申请存证成功,请稍后通过查询存证接口查看存证结果!");
if (StringUtils.isNotEmpty(evidenceSn))
result.put("evidenceSn", evidenceSn);
else
result.put("evidenceSn", genSn);
}
} else {
result.put("status", -8);
result.put("message", "验证证书失败");
}
return result;
} catch (Exception e) {
e.printStackTrace();
if (e instanceof IllegalStateException) {
result.put("status", -100);
result.put("message", "当前系统忙,请稍后再尝试!");
return result;
}
StackTraceElement stackTraceElement = e.getStackTrace()[e.getStackTrace().length - 2];
String info = stackTraceElement.getClassName() + stackTraceElement.getLineNumber() + e.toString();
LogUtil.evidencelog(sqlSession, null, "存证接口", "申请存证失败,失败原因:" + info);
result = new HashMap<String, Object>();
result.put("status", -5);
result.put("message", "系统服务错误,请联系管理员");
return result;
} finally {
if (realNameAuthentication != null) {
realNameAuthentication = null;
}
if (realNameAuthenticationOss != null) {
realNameAuthenticationOss = null;
}
if (realNameAuthenticationTime != null) {
realNameAuthenticationTime = null;
}
}
}
use of com.itrus.portal.db.RealNameAuthentication in project portal by ixinportal.
the class EvidenceSaveServiceApi method searchGenerated.
/**
* 查询出证
* @param signature
* 签名值
* @param appId
* 应用标识
* @param orderNumber
* 服务流水号
* @param request
* @return
*/
@RequestMapping(value = "/searchGenerated")
@ResponseBody
public Map<String, Object> searchGenerated(@RequestHeader("Content-Signature") String signature, @RequestParam(value = "appId", required = true) String appId, @RequestParam(value = "orderNumber", required = true) String orderNumber, HttpServletRequest request) {
// TODO : 查询出证接口
Map<String, Object> result = new HashMap<String, Object>();
// 验证参数是否完整
if (StringUtils.isEmpty(signature) || StringUtils.isEmpty(appId) || StringUtils.isEmpty(orderNumber)) {
result.put("status", 0);
result.put("message", "提交的参数信息不完整");
return result;
}
// 得到应用信息 改成service
Map<String, ApplicationInfo> appInfoMap = CacheCustomer.getAPP_INFO_MAP();
ApplicationInfo applicationInfo = appInfoMap.get(appId);
if (applicationInfo == null) {
ApplicationInfoExample applicationInfoExample = new ApplicationInfoExample();
ApplicationInfoExample.Criteria appInfoExampleCriteria = applicationInfoExample.createCriteria();
appInfoExampleCriteria.andAppIdEqualTo(appId);
applicationInfo = sqlSession.selectOne("com.itrus.portal.db.ApplicationInfoMapper.selectByExample", applicationInfoExample);
}
if (applicationInfo == null) {
result.put("status", -11);
result.put("message", "应用标识不存在");
return result;
}
if (applicationInfo.getIsAppStatus() == 0) {
result.put("status", -12);
result.put("message", "应用状态已关闭");
return result;
}
// 核验ip限制
if (!applicationInfo.getAccessIp().contains(request.getRemoteAddr()) && "1".equals(applicationInfo.getIsIpStatus())) {
result.put("status", -1);
result.put("message", "没有此服务权限");
log.debug("EvidenceSaveSeriveceTest_AccsessIp : " + request.getRemoteAddr());
return result;
}
// 验证hmac有效性
try {
String macVal = Base64.encode(HMACSHA1.getHmacSHA1(appId + orderNumber, applicationInfo.getSecretKey()), false);
if (!signature.equals("HMAC-SHA1 " + macVal)) {
result.put("status", -2);
result.put("message", "服务密钥错误");
return result;
}
} catch (Exception e) {
result.put("status", -3);
result.put("message", "Hmac验证错误");
e.printStackTrace();
return result;
}
EvidenceHisCertificateExample hisCertificateExample = new EvidenceHisCertificateExample();
EvidenceHisCertificateExample.Criteria hec = hisCertificateExample.createCriteria();
hec.andSerialnumberEqualTo(orderNumber);
List<EvidenceHisCertificate> hisCertificates = sqlSession.selectList("com.itrus.portal.db.EvidenceHisCertificateMapper.selectByExample", hisCertificateExample);
if (hisCertificates.size() == 0 || hisCertificates.isEmpty()) {
result.put("status", 0);
result.put("message", "流水号信息有误");
return result;
}
EvidenceHisCertificate hisCertificate = hisCertificates.get(0);
if (StringUtils.isNotEmpty(hisCertificate.getHisCauseFailure())) {
result.put("status", 0);
result.put("message", hisCertificate.getHisCauseFailure());
return result;
}
EvidenceHisRelationshipExample hisRelationshipExample = new EvidenceHisRelationshipExample();
EvidenceHisRelationshipExample.Criteria rec = hisRelationshipExample.createCriteria();
rec.andHisCertificateEqualTo(hisCertificate.getId());
List<EvidenceHisRelationship> hisRelationships = sqlSession.selectList("com.itrus.portal.db.EvidenceHisRelationshipMapper.selectByExample", hisCertificates);
for (EvidenceHisRelationship hisRelationship : hisRelationships) {
EvidenceBasicInformation basicInformation = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", hisRelationship.getBasicInformation());
Map<String, Object> map = evidenceSaveService.verifyFactor(basicInformation.getEvidenceSn());
if ((int) map.get("status") != 1) {
result.put("status", map.get("status"));
result.put("message", map.get("message"));
return result;
}
}
// 通过流水号得到证据附件信息
EvidenceEnclosureExample enclosurExample = new EvidenceEnclosureExample();
EvidenceEnclosureExample.Criteria ec = enclosurExample.createCriteria();
ec.andSerialnumberEqualTo(orderNumber);
ec.andPdfTypeEqualTo("4");
List<EvidenceEnclosure> enclosurs = sqlSession.selectList("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", enclosurExample);
// 判断证据是否已出
if ("0".equals(hisCertificate.getHisState()) && enclosurs != null) {
EvidenceEnclosure enclosure = enclosurs.get(0);
try {
// 获取密码服务
RealNameAuthentication realNameAuthentication = CacheCustomer.getAUTH_CONFIG_MAP().get(2);
if (realNameAuthentication == null) {
realNameAuthentication = realNameAuthenticationSerivce.getRealNameAuthenticationByTwo();
}
if (realNameAuthentication == null) {
result.put("status", -6);
result.put("message", "缺少服务配置,请联系管理员");
return result;
}
// 下载出证报告base64
String str = decryptedAndDownload(sqlSession, enclosure.getBuid(), realNameAuthentication.getRealNameddress());
} catch (Exception e) {
result.put("status", -5);
result.put("message", "服务器出错,请联系管理员");
String oper = "查询出证接口-异常";
String info = "服务流水号: " + orderNumber + ",错误原因:" + e.toString();
LogUtil.evidencelog(sqlSession, null, oper, info);
}
} else {
// 生成出证报告
Map<String, Object> mapRet = null;
// 判断是否为自动出证
if (hisCertificate.getHisway().equals("1")) {
// 生成出证报告
try {
mapRet = reportTemplate.certificationReport(hisCertificate.getSerialnumber());
} catch (Exception e) {
result.put("status", 0);
result.put("message", "出证失败");
return result;
}
} else {
result.put("status", 0);
result.put("message", "无法自动出证");
return result;
}
// 判断出证报告是否生成成功
if (mapRet != null && (int) mapRet.get("status") == 0) {
result.put("status", 1);
result.put("message", "出证成功");
result.put("orderNumber", hisCertificate.getSerialnumber());
result.put("pdfBase64", mapRet.get("pdfBase64"));
hisCertificate.setHisState("0");
} else {
result.put("status", 0);
result.put("message", "出证失败");
hisCertificate.setHisCauseFailure(mapRet.get("message").toString());
// 判断为自动出证失败后 转人工出证
if (hisCertificate.getHisway().equals("1")) {
hisCertificate.setHisway("3");
result.put("message", "出证失败,已自动转人工出证");
}
}
sqlSession.update("com.itrus.portal.db.EvidenceHisCertificateMapper.updateByPrimaryKey", hisCertificate);
}
return result;
}
use of com.itrus.portal.db.RealNameAuthentication in project portal by ixinportal.
the class HisCertificateController method savepdf.
@RequestMapping(params = "uploadPDF", method = RequestMethod.POST, produces = "text/html")
public String savepdf(MultipartFile excelFile, int id, int type, HttpServletRequest request, Model uiModel) throws Exception {
JSONObject ret_data = null;
BufferedInputStream bin = null;
ByteArrayOutputStream baos = null;
BufferedOutputStream bout = null;
String fileName = excelFile.getOriginalFilename();
// 文件类型
String fileType = FilenameUtils.getExtension(fileName);
if ((!fileType.toLowerCase().equals("pdf"))) {
error = "上传失败,上传的文件不是以‘.pdf’文件名结尾";
return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
}
// 得到出征信息
EvidenceHisCertificateExample hiscer = new EvidenceHisCertificateExample();
EvidenceHisCertificateExample.Criteria tificate = hiscer.createCriteria();
tificate.andSerialnumberEqualTo(contractNumber);
EvidenceHisCertificate hisCertificate = sqlSession.selectOne("com.itrus.portal.db.EvidenceHisCertificateMapper.selectByExample", hiscer);
// 得到出证关系表
EvidenceHisRelationshipExample hisrelation = new EvidenceHisRelationshipExample();
EvidenceHisRelationshipExample.Criteria shipEx = hisrelation.createCriteria();
shipEx.andHisCertificateEqualTo(hisCertificate.getId());
List<EvidenceHisRelationship> hisrelationship = sqlSession.selectList("com.itrus.portal.db.EvidenceHisRelationshipMapper.selectByExample", hisrelation);
try {
// 建立读取文件的文件输出流
// fin = new FileInputStream(excelFile.getName());
// 在文件输出流上安装节点流(更大效率读取)
// 读取文件流
bin = new BufferedInputStream(excelFile.getInputStream());
// 创建一个新的 byte 数组输出流,它具有指定大小的缓冲区容量
baos = new ByteArrayOutputStream();
// 创建一个新的缓冲输出流,以将数据写入指定的底层输出流
bout = new BufferedOutputStream(baos);
byte[] buffer = new byte[1024];
int len = bin.read(buffer);
while (len != -1) {
bout.write(buffer, 0, len);
len = bin.read(buffer);
}
// 刷新此输出流并强制写出所有缓冲的输出字节,必须这行代码,否则有可能有问题
bout.flush();
byte[] bytes = baos.toByteArray();
// sun公司的API
// return encoder.encodeBuffer(bytes).trim();
// apache公司的API
String base64 = Base64.encodeBase64String(bytes);
RealNameAuthentication realNameAuthentication = CacheCustomer.getAUTH_CONFIG_MAP().get(2);
if (realNameAuthentication == null) {
realNameAuthentication = realNameAuthenticationSerivce.getRealNameAuthenticationByTwo();
}
if (realNameAuthentication == null) {
error = "无服务路径";
return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
}
// 得到服务编码
AppService appservice = appService.selectById(hisCertificate.getHisAppService());
// 得到出证服务配置
EvidenceOutServiceConfigExample saveService = new EvidenceOutServiceConfigExample();
EvidenceOutServiceConfigExample.Criteria saveServiceEx = saveService.createCriteria();
saveServiceEx.andAppServiceEqualTo(appservice.getId());
EvidenceOutServiceConfig outService = sqlSession.selectOne("com.itrus.portal.db.EvidenceOutServiceConfigMapper.selectByExample", saveService);
// 得到出证名称
if (outService == null) {
error = "无服务配置";
return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
}
// 得到证书信息
EvidenceCertificate certificate = sqlSession.selectOne("com.itrus.portal.db.EvidenceCertificateMapper.selectByPrimaryKey", outService.getEvidenceCertificate());
if (certificate == null) {
error = "无证书信息";
return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
}
// 得到密钥信息
EvidenceSecretKey secrerkey = sqlSession.selectOne("com.itrus.portal.db.EvidenceSecretKeyMapper.selectByPrimaryKey", certificate.getEvidenceSecretKey());
EvidenceEnclosure enclosure = new EvidenceEnclosure();
// 得到签章位置配置信息
EvidenceSignetPlaceConfigExample signet = new EvidenceSignetPlaceConfigExample();
EvidenceSignetPlaceConfigExample.Criteria palace = signet.createCriteria();
palace.andEvidenceOutServiceConfigEqualTo(outService.getId());
List<EvidenceSignetPlaceConfig> configlist = sqlSession.selectList("com.itrus.portal.db.EvidenceSignetPlaceConfigMapper.selectByExample", signet);
// 得到接口路径
String urlAgent = realNameAuthentication.getRealNameddress() + PDF_SIGN;
Map<String, Object> paramsAgent = new HashMap<String, Object>();
// 参数信息
paramsAgent.put("alias", secrerkey.getAlias());
paramsAgent.put("pdfContent", base64);
for (EvidenceSignetPlaceConfig config : configlist) {
// 获取签章信息
List<Map> list = new ArrayList<Map>();
Map<String, String> map = new HashMap<String, String>();
if (config != null) {
if (config.getType() == 2) {
// 参数信息
map.put("y", config.getDistanceToDown());
// 参数信息
map.put("width", config.getWidthOfImage());
// 参数信息
map.put("height", config.getHeightOfImage());
list.add(map);
paramsAgent.put("pagingSeal", JSON.toJSONString(list));
} else if (config.getType() == 3) {
// 参数信息
map.put("page", config.getPage());
// 参数信息
map.put("x", config.getDistanceToLeft());
// 参数信息
map.put("y", config.getDistanceToDown());
// 参数信息
map.put("width", config.getWidthOfImage());
// 参数信息
map.put("height", config.getHeightOfImage());
list.add(map);
paramsAgent.put("multiPagesSeal", JSON.toJSONString(list));
} else if (config.getType() == 1) {
// 参数信息
map.put("keyWord", config.getKeyword());
// 参数信息
map.put("page", config.getPage());
// 参数信息
map.put("width", config.getWidthOfImage());
// 参数信息
map.put("height", config.getHeightOfImage());
list.add(map);
paramsAgent.put("keyWordSeal", JSON.toJSONString(list));
}
}
}
boolean isbool = true;
String signedPdf = null;
if (outService.getIsAddTimestamp() == 2) {
isbool = false;
}
// 参数信息
paramsAgent.put("timeStamp", isbool);
// paramsAgent.put("resultType",2L);//参数信息
// 调用签章接口返回数据
String repAgent = HttpClientUtil.postForm(urlAgent, AuthService.getHeader(), paramsAgent);
// 把数据转换为json格式
ret_data = JSONObject.parseObject(repAgent);
if (ret_data.getIntValue("code") != 0) {
// 判断是否成功
String oper = "出证报告失败-pdf签章失败";
String info = "错误原因:" + ret_data.getString("message");
LogUtil.evidencelog(sqlSession, null, oper, info);
error = ret_data.getString("message");
// 修改证据中的出证状态
for (EvidenceHisRelationship h : hisrelationship) {
// 得到基本信息表
EvidenceBasicInformation basic = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", h.getBasicInformation());
basic.setStatus(4);
sqlSession.update("com.itrus.portal.db.EvidenceBasicInformationMapper.updateByPrimaryKey", basic);
}
return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
} else {
// 证书base编码
signedPdf = ret_data.getString("signedPdf");
// 正式系统将hood替换为/**/重的值
String retpdf = EvidenceSaveServiceApi.storageSave("ST_O", "hood", /*realNameAuthentication.getKeyCode()*/
hisCertificate.getSerialnumber() + ".pdf", "CT_MESSAGE", signedPdf, null, null, null, null, null, false, null, realNameAuthentication.getRealNameddress());
// 把数据转换为json格式
ret_data = JSONObject.parseObject(retpdf);
if (ret_data.getInteger("code") == 0) {
// 获取证据附件表
EvidenceEnclosureExample envlosureE = new EvidenceEnclosureExample();
EvidenceEnclosureExample.Criteria envlosureEx = envlosureE.createCriteria();
envlosureEx.andSerialnumberEqualTo(hisCertificate.getSerialnumber());
envlosureEx.andPdfTypeEqualTo("4");
EvidenceEnclosure envlosure = sqlSession.selectOne("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", envlosureE);
if (envlosure != null && envlosure.getPdfType() != null) {
envlosure.setPdfType("4");
envlosure.setEvidenceSn(null);
envlosure.setSerialnumber(hisCertificate.getSerialnumber());
envlosure.setType("ST_E");
envlosure.setContentType("CT_BASE64_DATA");
envlosure.setBucketName(realNameAuthentication.getKeyCode());
envlosure.setObjectName(fileName);
envlosure.setAlias(secrerkey.getAlias());
envlosure.setFilesize(null);
envlosure.setApplicationTime(new Date());
envlosure.setFixationTime(new Date());
envlosure.setSaveFactor(null);
envlosure.setBuid(ret_data.getString("buid").toString());
// ret_data.remove("saveFactor");
sqlSession.update("com.itrus.portal.db.EvidenceEnclosureMapper.updateByPrimaryKey", envlosure);
} else {
enclosure.setPdfType("4");
enclosure.setEvidenceSn(null);
enclosure.setSerialnumber(hisCertificate.getSerialnumber());
enclosure.setType("ST_E");
enclosure.setContentType("CT_BASE64_DATA");
enclosure.setBucketName(realNameAuthentication.getKeyCode());
enclosure.setObjectName(fileName);
enclosure.setAlias(secrerkey.getAlias());
enclosure.setFilesize(null);
enclosure.setApplicationTime(new Date());
enclosure.setFixationTime(new Date());
enclosure.setSaveFactor(null);
enclosure.setBuid(ret_data.getString("buid").toString());
// ret_data.remove("saveFactor");
sqlSession.insert("com.itrus.portal.db.EvidenceEnclosureMapper.insert", enclosure);
}
hisCertificate.setHisTime(new Date());
hisCertificate.setHisway("2");
hisCertificate.setHisState("0");
hisCertificate.setOutState(0);
sqlSession.update("com.itrus.portal.db.EvidenceHisCertificateMapper.updateByPrimaryKey", hisCertificate);
// 修改证据中的出证状态
for (EvidenceHisRelationship h : hisrelationship) {
// 得到基本信息表
EvidenceBasicInformation basic = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", h.getBasicInformation());
basic.setStatus(2);
sqlSession.update("com.itrus.portal.db.EvidenceBasicInformationMapper.updateByPrimaryKey", basic);
}
error = "上传pdf成功";
String oper = "pdf上传成功";
String info = "存储编号:" + ret_data.getString("buid").toString() + "pdf名称:" + hisCertificate.getSerialnumber();
LogUtil.evidencelog(sqlSession, null, oper, info);
}
}
} catch (FileNotFoundException e) {
// 修改证据中的出证状态
for (EvidenceHisRelationship h : hisrelationship) {
// 得到基本信息表
EvidenceBasicInformation basic = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", h.getBasicInformation());
basic.setStatus(4);
sqlSession.update("com.itrus.portal.db.EvidenceBasicInformationMapper.updateByPrimaryKey", basic);
}
e.printStackTrace();
String oper = "pdf上传失败";
String info = "失败原因:" + e.getMessage();
LogUtil.evidencelog(sqlSession, null, oper, info);
error = e.getMessage();
return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
} catch (IOException e) {
// 修改证据中的出证状态
for (EvidenceHisRelationship h : hisrelationship) {
// 得到基本信息表
EvidenceBasicInformation basic = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", h.getBasicInformation());
basic.setStatus(4);
sqlSession.update("com.itrus.portal.db.EvidenceBasicInformationMapper.updateByPrimaryKey", basic);
}
e.printStackTrace();
String oper = "pdf上传失败";
String info = "失败原因:" + e.getMessage();
LogUtil.evidencelog(sqlSession, null, oper, info);
error = e.getMessage();
return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
} finally {
try {
bin.close();
// 关闭 ByteArrayOutputStream 无效。此类中的方法在关闭此流后仍可被调用,而不会产生任何
// IOException
// 暂时关闭掉
baos.close();
bout.close();
} catch (IOException e) {
e.printStackTrace();
error = e.getMessage();
return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
}
}
return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
}
use of com.itrus.portal.db.RealNameAuthentication in project portal by ixinportal.
the class BasicInformationController method show1.
/**
* 查看详细内容(事件详细)
*
* @param id
* @param type
* @param uiModel
* @return
*/
@RequestMapping(value = "show1/{id}/{mid}/{type}", produces = "text/html")
public String show1(@PathVariable("id") Long id, @PathVariable("mid") Long mid, @PathVariable("type") int type, Model uiModel) {
/*
* if (type == 1) {// 身份意愿鉴别信息 EvidenceDesireIdentify desire =
* sqlSession .selectOne(
* "com.itrus.portal.db.EvidenceDesireIdentifyMapper.selectByPrimaryKey",
* id); EvidenceMainInformation mainInfo = sqlSession.selectOne(
* "com.itrus.portal.db.EvidenceMainInformationMapper.selectByPrimaryKey",
* desire.getMainInformation()); uiModel.addAttribute("desire", desire);
* uiModel.addAttribute("mainInfo", mainInfo); return
* "basicinformation/desireIdentify"; } else if (type == 2) {// 获取实名认证信息
* EvidenceCompaniesSubmit companiesSubmit = sqlSession .selectOne(
* "com.itrus.portal.db.EvidenceCompaniesSubmitMapper.selectByPrimaryKey",
* id); String cid = companiesSubmit.getId().toString(); int evid =
* Integer.parseInt(cid); EvidenceRealNameExample realnameE = new
* EvidenceRealNameExample(); EvidenceRealNameExample.Criteria
* realnameEx = realnameE.createCriteria();
* realnameEx.andCompaniesSubmitEqualTo(evid); EvidenceRealName
* erealname = sqlSession .selectOne(
* "com.itrus.portal.db.EvidenceRealNameMapper.selectByExample",
* realnameE); EvidenceMainInformation mainInfo = sqlSession.selectOne(
* "com.itrus.portal.db.EvidenceMainInformationMapper.selectByPrimaryKey",
* erealname.getMainInformation()); if
* (companiesSubmit.getRepresentative() != null) {// 法定代表人
* EvidenceRepresentative representative = sqlSession.selectOne(
* "com.itrus.portal.db.EvidenceRepresentativeMapper.selectByPrimaryKey",
* companiesSubmit.getRepresentative());
* uiModel.addAttribute("representative", representative); } if
* (companiesSubmit.getTheAgent() != null) {// 代理人 EvidenceTheAgent
* theagent = sqlSession.selectOne(
* "com.itrus.portal.db.EvidenceTheAgentMapper.selectByPrimaryKey",
* companiesSubmit.getTheAgent()); uiModel.addAttribute("theagent",
* theagent); } uiModel.addAttribute("erealname", erealname);
* uiModel.addAttribute("companiesSubmit", companiesSubmit);
* uiModel.addAttribute("mainInfo", mainInfo); return
* "basicinformation/companiesSubmit";
*
* } else
*/
if (type == 3) {
// 可信身份标识
// EvidenceTrustedIdentity trusted = sqlSession
// .selectOne("com.itrus.portal.db.EvidenceTrustedIdentityMapper.selectByPrimaryKey", id);
// EvidenceMainInformation mainInfo = sqlSession.selectOne(
// "com.itrus.portal.db.EvidenceMainInformationMapper.selectByPrimaryKey",
// trusted.getMainInformation());
// uiModel.addAttribute("trusted", trusted);
// uiModel.addAttribute("mainInfo", mainInfo);
EvidenceTrustedIdentity trusted = sqlSession.selectOne("com.itrus.portal.db.EvidenceTrustedIdentityMapper.selectByPrimaryKey", id);
String idCode = trusted.getMainInformation().split(";")[1];
String idName = trusted.getMainInformation().split(";")[0];
EvidenceMainInformationExample maininfor = new EvidenceMainInformationExample();
EvidenceMainInformationExample.Criteria mation = maininfor.createCriteria();
mation.andIdentificationEqualTo(idCode);
mation.andSubjectNameEqualTo(idName);
List<EvidenceMainInformation> mainInfo = sqlSession.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", maininfor);
uiModel.addAttribute("trusted", trusted);
/*EvidenceCertExample basicEx = new EvidenceCertExample();
EvidenceCertExample.Criteria information = basicEx.createCriteria();
information.andCertSerialnumberEqualTo(trusted.getCertSerialnumber().trim());
EvidenceCert cert = sqlSession.selectOne("com.itrus.portal.db.EvidenceCertMapper.selectByExample", basicEx);
uiModel.addAttribute("cert", cert);
if(cert!=null && cert.getIssuerdn()!=null){
uiModel.addAttribute("Issuerdn", EvidenceSaveServiceApi.getCertCn(cert.getIssuerdn()));
}*/
uiModel.addAttribute("mainInfo", mainInfo.get(0));
return "basicinformation/trustedIdentity";
} else if (type == 4) {
// 事件内容
EvidenceEventContent mevencontent = sqlSession.selectOne("com.itrus.portal.db.EvidenceEventContentMapper.selectByPrimaryKey", id);
// 得到基本信息
/*EvidenceBasicInformation basicinfor = sqlSession
.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", mevencontent.getBasicInformation());*/
EvidenceBasicInformationExample basicEx = new EvidenceBasicInformationExample();
EvidenceBasicInformationExample.Criteria information = basicEx.createCriteria();
information.andEvidenceSnEqualTo(mevencontent.getEvidenceSn());
EvidenceBasicInformation basicinfor = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByExample", basicEx);
// 得到服务表信息
AppService appservice = appService.selectById(basicinfor.getAppService());
EvidenceSaveServiceExample save = new EvidenceSaveServiceExample();
EvidenceSaveServiceExample.Criteria saveEx = save.createCriteria();
saveEx.andAppServiceEqualTo(appservice.getId());
EvidenceSaveService evidenceSave = sqlSession.selectOne("com.itrus.portal.db.EvidenceSaveServiceMapper.selectByExample", save);
// String js = evidenceSave.getFactorBusinessInfo();
String evidenceType = null;
try {
JSONArray jsonArray = new JSONArray(evidenceSave.getFactorBusinessInfo());
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsob = JSONObject.parseObject(jsonArray.get(i).toString());
if ("业务类型".equals(jsob.getString("b_factor"))) {
evidenceType = jsob.getString("b_category");
}
}
if ("电子合同PDF".equals(evidenceType)) {
// 判断图片是否存在
if (mevencontent.getIsimg() == null) {
// EvidenceBasicInformation basic = sqlSession.selectOne(
// "com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey",
// mevencontent.getEvidenceSn());
// 得到证据附件表,用于获取信息
EvidenceEnclosureExample envlosureE = new EvidenceEnclosureExample();
EvidenceEnclosureExample.Criteria envlosureEx = envlosureE.createCriteria();
envlosureEx.andEvidenceSnEqualTo(basicinfor.getEvidenceSn());
envlosureEx.andPdfTypeEqualTo("1");
EvidenceEnclosure envlosure = sqlSession.selectOne("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", envlosureE);
RealNameAuthentication realNameAuthentication = CacheCustomer.getAUTH_CONFIG_MAP().get(2);
if (realNameAuthentication == null) {
try {
realNameAuthentication = realNameAuthenticationSerivce.getRealNameAuthenticationByTwo();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
String pdfbase64 = null;
String urlAgent = realNameAuthentication.getRealNameddress();
if (envlosure != null && envlosure.getBuid() != null) {
log.error("Buid======" + envlosure.getBuid());
pdfbase64 = EvidenceSaveServiceApi.decryptedAndDownload(sqlSession, envlosure.getBuid(), urlAgent);
}
if (pdfbase64 != null) {
log.error("*******pdfbase64不为空*********");
// 得到证据包的json
JSONObject jsonEvidenceContent = JSONObject.parseObject(pdfbase64);
String authEvent = jsonEvidenceContent.getString("authEvent");
JSONObject authEvent1 = JSONObject.parseObject(authEvent);
String jsonpdf = authEvent1.getString("eventContent");
JSONObject jsonpdf1 = JSONObject.parseObject(jsonpdf);
// 得到pdf的base64编码
String jsonbase64 = jsonpdf1.getString("contCode");
BufferedInputStream bin = null;
FileOutputStream fout = null;
BufferedOutputStream bout = null;
try {
BASE64Decoder decoder = new sun.misc.BASE64Decoder();
// 将base64编码的字符串解码成字节数组
byte[] bytes = decoder.decodeBuffer(jsonbase64);
// apache公司的API
// byte[] bytes = Base64.decodeBase64(base64sString);
// 创建一个将bytes作为其缓冲区的ByteArrayInputStream对象
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
// 创建从底层输入流中读取数据的缓冲输入流对象
bin = new BufferedInputStream(bais);
// 指定输出的文件
log.error("路径地址=" + systemConfigService.getpdfurl() + File.separator + envlosure.getBucketName() + File.separator + envlosure.getEvidenceSn() + ".pdf");
File file = new File(systemConfigService.getpdfurl() + File.separator + envlosure.getBucketName() + File.separator + envlosure.getEvidenceSn() + ".pdf");
// 创建到指定文件的输出流
fout = new FileOutputStream(file);
// 为文件输出流对接缓冲输出流对象
bout = new BufferedOutputStream(fout);
byte[] buffers = new byte[1024];
int len = bin.read(buffers);
while (len != -1) {
bout.write(buffers, 0, len);
len = bin.read(buffers);
}
// 刷新此输出流并强制写出所有缓冲的输出字节,必须这行代码,否则有可能有问题
bout.flush();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (bin != null) {
bin.close();
}
if (fout != null) {
fout.close();
}
if (bout != null) {
bout.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
// 判断是否为用户上传pdf
if (envlosure != null) {
String urlFile = systemConfigService.getpdfurl() + File.separator + envlosure.getBucketName();
File filePathStr = new File(urlFile, envlosure.getEvidenceSn() + ".pdf");
log.error("***********filePathStr=" + filePathStr.getPath());
int pdfToPng = 0;
if (filePathStr != null && filePathStr.getPath() != null) {
try {
pdfToPng = Pdf.pdf2png(filePathStr.getPath());
} catch (Exception e) {
e.printStackTrace();
}
}
log.error("是否生成,数量****pdfToPng=" + pdfToPng);
// 判断生成图片是否成功
if (pdfToPng > 0) {
// 修改内容表信息,表示生成图片
mevencontent.setIsimg(1);
mevencontent.setImgCount(pdfToPng);
sqlSession.update("com.itrus.portal.db.EvidenceEventContentMapper.updateByPrimaryKey", mevencontent);
String oper = "原文图片生成成功";
String info = "图片地址:" + urlFile;
LogUtil.evidencelog(sqlSession, null, oper, info);
} else {
String oper = "原文图片生成失败";
String info = "失败原因:" + systemConfigService.getpdfurl() + File.separator + envlosure.getBucketName();
LogUtil.evidencelog(sqlSession, null, oper, info);
}
}
}
}
uiModel.addAttribute("selectType", 1);
} else if ("合同摘要数据".equals(evidenceType)) {
uiModel.addAttribute("selectType", 2);
} else if ("图片摘要数据".equals(evidenceType)) {
uiModel.addAttribute("selectType", 3);
} else if ("信息摘要数据".equals(evidenceType)) {
uiModel.addAttribute("selectType", 4);
}
} catch (JSONException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
uiModel.addAttribute("mevencontent", mevencontent);
return "basicinformation/evenconrent";
} else if (type == 5) {
// 事件详细
EvidenceEventContent mevencontent = sqlSession.selectOne("com.itrus.portal.db.EvidenceEventContentMapper.selectByPrimaryKey", id);
// EvidenceBasicInformation basicInformation = basicInformationimpl.selectById(mevencontent.getEvidenceSn());
EvidenceBasicInformationExample basicEx = new EvidenceBasicInformationExample();
EvidenceBasicInformationExample.Criteria information = basicEx.createCriteria();
information.andEvidenceSnEqualTo(mevencontent.getEvidenceSn());
EvidenceBasicInformation basicInformation = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByExample", basicEx);
EvidenceMainInformation mainInfo = new EvidenceMainInformation();
// 事件对象
EvidenceTrustedIdentityExample trustenid = new EvidenceTrustedIdentityExample();
EvidenceTrustedIdentityExample.Criteria identitye = trustenid.createCriteria();
// identitye.andBasicInformationEqualTo(mevencontent.getEvidenceSn());// 获取事件对象
identitye.andEventContentEqualTo(mevencontent.getIdCode());
// identitye.andMainInformationEqualTo(mid);
EvidenceTrustedIdentity trusted = sqlSession.selectOne("com.itrus.portal.db.EvidenceTrustedIdentityMapper.selectByExample", trustenid);
if (trusted != null) {
String mainName = trusted.getMainInformation().split(";")[0];
String mainIdentity = trusted.getMainInformation().split(";")[1];
// 证据主体信息
EvidenceMainInformationExample infomationE = new EvidenceMainInformationExample();
EvidenceMainInformationExample.Criteria tionE = infomationE.createCriteria();
tionE.andIdentificationEqualTo(mainIdentity);
if (mainName != null) {
tionE.andSubjectNameEqualTo(mainName);
}
List<EvidenceMainInformation> ainInfo = sqlSession.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", infomationE);
mainInfo = ainInfo.get(0);
/*mainInfo = sqlSession.selectOne("com.itrus.portal.db.EvidenceMainInformationMapper.selectByPrimaryKey",
trusted.getMainInformation());*/
}
// 事件行为
EvidenceEventBehaviorExample eventbehaciorEx = new EvidenceEventBehaviorExample();
EvidenceEventBehaviorExample.Criteria eventbe = eventbehaciorEx.createCriteria();
eventbe.andEventContentEqualTo(mevencontent.getIdCode());
// eventbe.andMainInformationEqualTo(mid);
List<EvidenceEventBehavior> elist = sqlSession.selectList("com.itrus.portal.db.EvidenceEventBehaviorMapper.selectByExample", eventbehaciorEx);
// 事件时间
EvidenceEventTimeExample eventime = new EvidenceEventTimeExample();
EvidenceEventTimeExample.Criteria eventimeEx = eventime.createCriteria();
eventimeEx.andEventContentEqualTo(mevencontent.getIdCode());
// eventimeEx.andMainInformationEqualTo(mid);
List<EvidenceEventTime> meventime = sqlSession.selectList("com.itrus.portal.db.EvidenceEventTimeMapper.selectByExample", eventime);
// 事件意愿
EvidenceEventDesireExample desireEx = new EvidenceEventDesireExample();
EvidenceEventDesireExample.Criteria eventdesire = desireEx.createCriteria();
eventdesire.andEventContenteEqualTo(mevencontent.getIdCode());
// eventdesire.andMainInformationEqualTo(mid);
EvidenceEventDesire meventdesire = sqlSession.selectOne("com.itrus.portal.db.EvidenceEventDesireMapper.selectByExample", desireEx);
// 事件网络地址
EvidenceEventNetworkAddressExample network = new EvidenceEventNetworkAddressExample();
EvidenceEventNetworkAddressExample.Criteria address = network.createCriteria();
address.andEventContentEqualTo(mevencontent.getIdCode());
// address.andMainInformationEqualTo(mid);
EvidenceEventNetworkAddress networkaddress = sqlSession.selectOne("com.itrus.portal.db.EvidenceEventNetworkAddressMapper.selectByExample", network);
uiModel.addAttribute("mevencontent", mevencontent);
uiModel.addAttribute("meventdesire", meventdesire);
uiModel.addAttribute("networkaddress", networkaddress);
uiModel.addAttribute("basicInformation", basicInformation);
uiModel.addAttribute("trusted", trusted);
uiModel.addAttribute("mainInfo", mainInfo);
uiModel.addAttribute("elist", elist);
uiModel.addAttribute("meventime", meventime);
return "basicinformation/certificationdetails";
} else if (type == 6) {
// 服务委托人签名信息
EvidenceClientSignature cliensig = sqlSession.selectOne("com.itrus.portal.db.EvidenceClientSignatureMapper.selectByPrimaryKey", id);
EvidenceEnclosureExample enclo = new EvidenceEnclosureExample();
EvidenceEnclosureExample.Criteria enclosureEx = enclo.createCriteria();
enclosureEx.andEvidenceSnEqualTo(cliensig.getEvidenceSn());
enclosureEx.andPdfTypeEqualTo("1");
EvidenceEnclosure enclosure = sqlSession.selectOne("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", enclo);
// 天威签名信息
EvidenceClientSignatureExample cilentsign = new EvidenceClientSignatureExample();
EvidenceClientSignatureExample.Criteria signature = cilentsign.createCriteria();
signature.andEvidenceSnEqualTo(enclosure.getEvidenceSn());
signature.andNameEqualTo("1");
EvidenceClientSignature cilentsignature = sqlSession.selectOne("com.itrus.portal.db.EvidenceClientSignatureMapper.selectByExample", cilentsign);
EvidenceCert oneCert = new EvidenceCert();
EvidenceCheck oneCheck = new EvidenceCheck();
if (cilentsignature != null) {
// 天威证书信息
/*EvidenceCertExample certE = new EvidenceCertExample();
EvidenceCertExample.Criteria evidenceCertE = certE.createCriteria();
evidenceCertE.andClientSignatureEqualTo(cilentsignature.getId());
oneCert = sqlSession.selectOne("com.itrus.portal.db.EvidenceCertMapper.selectByExample",certE);*/
oneCert = sqlSession.selectOne("com.itrus.portal.db.EvidenceCertMapper.selectByPrimaryKey", cilentsignature.getCertId());
// 天威核验信息
EvidenceCheckExample checkE = new EvidenceCheckExample();
EvidenceCheckExample.Criteria evidenceCheckE = checkE.createCriteria();
evidenceCheckE.andClientSignatureEqualTo(cilentsignature.getId());
oneCheck = sqlSession.selectOne("com.itrus.portal.db.EvidenceCheckMapper.selectByExample", checkE);
}
// 服务委托人时间戳信息
EvidenceClientTimeStampExample clientTime = new EvidenceClientTimeStampExample();
EvidenceClientTimeStampExample.Criteria stamp = clientTime.createCriteria();
stamp.andEvidenceSnEqualTo(enclosure.getEvidenceSn());
stamp.andNameEqualTo("0");
EvidenceClientTimeStamp clientTimestamp = sqlSession.selectOne("com.itrus.portal.db.EvidenceClientTimeStampMapper.selectByExample", clientTime);
// 天威时间戳信息
EvidenceClientTimeStampExample tclientTime = new EvidenceClientTimeStampExample();
EvidenceClientTimeStampExample.Criteria tstamp = tclientTime.createCriteria();
tstamp.andEvidenceSnEqualTo(enclosure.getEvidenceSn());
tstamp.andNameEqualTo("1");
EvidenceClientTimeStamp tclientTimestamp = sqlSession.selectOne("com.itrus.portal.db.EvidenceClientTimeStampMapper.selectByExample", tclientTime);
// 服务委托人证书信息
/*EvidenceCertExample certEx = new EvidenceCertExample();
EvidenceCertExample.Criteria evidenceCert = certEx.createCriteria();
evidenceCert.andClientSignatureEqualTo(cliensig.getId());
List<EvidenceCert> listCert = sqlSession
.selectList("com.itrus.portal.db.EvidenceCertMapper.selectByExample", certEx);*/
List<EvidenceCert> listCert = sqlSession.selectList("com.itrus.portal.db.EvidenceCertMapper.selectByPrimaryKey", cliensig.getCertId());
// 服务委托人核验信息
EvidenceCheckExample checkEx = new EvidenceCheckExample();
EvidenceCheckExample.Criteria evidenceCheck = checkEx.createCriteria();
evidenceCheck.andClientSignatureEqualTo(cliensig.getId());
EvidenceCheck listCheck = sqlSession.selectOne("com.itrus.portal.db.EvidenceCheckMapper.selectByExample", checkEx);
Map<Long, EvidenceCheck> mapCheck = new HashMap<Long, EvidenceCheck>();
// 服务委托人证书核验信息
for (EvidenceCert c : listCert) {
EvidenceCheckExample certcheckEx = new EvidenceCheckExample();
EvidenceCheckExample.Criteria certCheck = certcheckEx.createCriteria();
certCheck.andEvidenceCertEqualTo(c.getId());
EvidenceCheck listCertCheck = sqlSession.selectOne("com.itrus.portal.db.EvidenceCheckMapper.selectByExample", certcheckEx);
mapCheck.put(c.getId(), listCertCheck);
}
// 服务委托人证书信息
uiModel.addAttribute("listCert", listCert);
// 服务委托人核验信息
uiModel.addAttribute("listCheck", listCheck);
// 天威证书信息
uiModel.addAttribute("oneCert", oneCert);
// 天威核验信息
uiModel.addAttribute("oneCheck", oneCheck);
// 服务委托人证书核验信息
uiModel.addAttribute("mapCheck", mapCheck);
// 服务委托人签名信息
uiModel.addAttribute("cliensig", cliensig);
// 天威签名信息
uiModel.addAttribute("cilentsignature", cilentsignature);
// 服务委托人时间戳信息
uiModel.addAttribute("clientTimestamp", clientTimestamp);
// 天威时间戳信息
uiModel.addAttribute("tclientTimestamp", tclientTimestamp);
return "basicinformation/evidenceexists";
}
/*
* else if (type == 7) { EvidenceIndividual indiv = sqlSession
* .selectOne(
* "com.itrus.portal.db.EvidenceIndividualMapper.selectByPrimaryKey",
* id); String cid = indiv.getId().toString(); int evid =
* Integer.parseInt(cid); EvidenceRealNameExample realnameE = new
* EvidenceRealNameExample(); EvidenceRealNameExample.Criteria
* realnameEx = realnameE.createCriteria();
* realnameEx.andIndividualEqualTo(evid); EvidenceRealName erealname
* = sqlSession .selectOne(
* "com.itrus.portal.db.EvidenceRealNameMapper.selectByExample",
* realnameE); EvidenceMainInformation mainInfo =
* sqlSession.selectOne(
* "com.itrus.portal.db.EvidenceMainInformationMapper.selectByPrimaryKey",
* erealname.getMainInformation()); uiModel.addAttribute("indiv",
* indiv); uiModel.addAttribute("mainInfo", mainInfo); return
* "basicinformation/ineividual"; }
*/
return null;
}
Aggregations