use of com.itrus.portal.db.ApplicationInfo in project portal by ixinportal.
the class QueueService method run.
@Override
public void run() {
boolean isException = false;
while (true) {
log.debug("execute run,the queue size is [" + OBJECT_QUEUE.size() + "]");
if (OBJECT_QUEUE.isEmpty()) {
try {
// 若队列中没有信息则等待十秒
sleep(10 * 1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
continue;
}
log.debug("execute run,the queue size is [" + OBJECT_QUEUE.size() + "]");
Map<String, RealNameRecord> realMap = new HashMap<String, RealNameRecord>();
Map<String, PersonalName> perMap = new HashMap<String, PersonalName>();
// for (int i = 0; !OBJECT_QUEUE.isEmpty() && i < 500; i++) {
Object obj = OBJECT_QUEUE.poll();
if (obj instanceof Map) {
if ((RealNameRecord) ((Map) obj).get("realNameRecord") != null) {
realMap.put("realNameRecord", (RealNameRecord) ((Map) obj).get("realNameRecord"));
}
if ((PersonalName) ((Map) obj).get("personalName") != null) {
perMap.put("personalName", (PersonalName) ((Map) obj).get("personalName"));
}
}
// 存储企业路径
if (!realMap.isEmpty()) {
try {
RealNameRecord realNameRecord = (RealNameRecord) ((Map) obj).get("realNameRecord");
log.error("【认证信息入库】 企业名称 :" + realNameRecord.getCompanyname() + ",入库时间 :" + new Date());
sqlSession.insert("com.itrus.portal.db.RealNameRecordMapper.insert", realNameRecord);
Agentinformation agentinformation = (Agentinformation) ((Map) obj).get("agentinformation");
if (agentinformation != null) {
agentinformation.setRealNameRecord(realNameRecord.getId());
sqlSession.insert("com.itrus.portal.db.AgentinformationMapper.insert", agentinformation);
realNameRecord.setAgentinformation(agentinformation.getId());
}
ApplicationInfo applicationInfo = (ApplicationInfo) ((Map) obj).get("applicationInfo");
AppService appService = (AppService) ((Map) obj).get("appService");
// 计费 appId serviceCode 服务类别,二选一(企业为1,个人为2) 调用前还是调用后
Map<String, Object> cert = certificationChargingService.charging(applicationInfo.getAppId(), appService.getAppServiceId(), appService.getServiceConfigName(), appService.getServiceConfigId(), applicationInfo, appService, realNameRecord.getId(), "RealNameRecord");
if ((int) cert.get("retCode") != 1) {
// 错误
realNameRecord.setServicestate(1L);
}
realNameRecord.setReturntime(new Date());
sqlSession.update("com.itrus.portal.db.RealNameRecordMapper.updateByPrimaryKeySelective", realNameRecord);
} catch (Exception e) {
isException = true;
// 将错误信息显示,不进行操作
log.error(e);
}
}
// 存储个人记录
if (!perMap.isEmpty()) {
try {
PersonalName personalName = (PersonalName) ((Map) obj).get("personalName");
log.error("【认证信息入库】 名称 :" + personalName.getName() + ",入库时间 :" + new Date());
sqlSession.insert("com.itrus.portal.db.PersonalNameMapper.insert", personalName);
ApplicationInfo applicationInfo = (ApplicationInfo) ((Map) obj).get("applicationInfo");
AppService appService = (AppService) ((Map) obj).get("appService");
// 计费 appId code 服务类别,二选一(企业为1,个人为2) 调用前还是调用后
Map<String, Object> cert = certificationChargingService.charging(applicationInfo.getAppId(), appService.getAppServiceId(), appService.getServiceConfigName(), appService.getServiceConfigId(), applicationInfo, appService, personalName.getId(), "PersonalName");
if ((int) cert.get("retCode") != 1) {
// 错误
personalName.setServicestate(1);
}
personalName.setReturntime(new Date());
sqlSession.update("com.itrus.portal.db.PersonalNameMapper.updateByPrimaryKeySelective", personalName);
} catch (Exception e) {
isException = true;
// 将错误信息显示,不进行操作
log.error(e);
}
}
log.debug("the exception is [" + isException + "]");
// 若出现异常则暂停10秒钟
if (isException) {
try {
// 若队列中没有信息则等待十秒
sleep(10 * 1000);
} catch (InterruptedException e) {
log.error(e);
} finally {
isException = false;
}
}
}
}
use of com.itrus.portal.db.ApplicationInfo in project portal by ixinportal.
the class RealNameCordController method show.
// 显示详情
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) {
RealNameRecord realName = realnameservice.selectById(id);
uiModel.addAttribute("realName", realName);
AppServiceAuthentication appServiceauthentication = appServiceAuthenticationService.selectById(realName.getAppServiceAuthentication());
uiModel.addAttribute("appServiceauthentication", appServiceauthentication);
AppService appService = appServiceImpl.selectById(appServiceauthentication.getAppService());
uiModel.addAttribute("appService", appService);
/*
* LicenseinformationExample licensecriteria = new
* LicenseinformationExample(); LicenseinformationExample.Criteria
* licenseinformation=licensecriteria.or();
* licenseinformation.andRealNameRecordEqualTo(id);
* List<Licenseinformation> sysRess= sqlSession.selectList(
* "com.itrus.portal.db.LicenseinformationMapper.selectByExample",
* licensecriteria);
*/
Licenseinformation licen = sqlSession.selectOne("com.itrus.portal.db.LicenseinformationMapper.selectByPrimaryKey", realName.getLicenseinformation());
String ss = appServiceauthentication.getServiceAuthenticationItem();
/*
* OrganizationExample organition = new OrganizationExample();
* OrganizationExample.Criteria organitonex=organition.or();
* organitonex.andRealNameRecordEqualTo(id); List<Organization> organ=
* sqlSession.selectList(
* "com.itrus.portal.db.OrganizationMapper.selectByExample",
* organition);
*/
Organization orgen = sqlSession.selectOne("com.itrus.portal.db.OrganizationMapper.selectByPrimaryKey", realName.getOrganization());
/*
* CorporateinformationExample corporatein = new
* CorporateinformationExample(); CorporateinformationExample.Criteria
* corporateinform=corporatein.or();
* corporateinform.andRealNameRecordEqualTo(id);
* List<Corporateinformation> cor= sqlSession.selectList(
* "com.itrus.portal.db.CorporateinformationMapper.selectByExample",
* corporatein);
*/
Corporateinformation core = sqlSession.selectOne("com.itrus.portal.db.CorporateinformationMapper.selectByPrimaryKey", realName.getCorporateinformation());
/*
* AgentinformationExample agentinformation = new
* AgentinformationExample(); AgentinformationExample.Criteria
* agentincrite=agentinformation.or();
* agentincrite.andRealNameRecordEqualTo(id); List<Agentinformation> age
* = null; age= sqlSession.selectList(
* "com.itrus.portal.db.AgentinformationMapper.selectByExample",
* agentinformation);
*/
Agentinformation agee = sqlSession.selectOne("com.itrus.portal.db.AgentinformationMapper.selectByPrimaryKey", realName.getAgentinformation());
/*
* EnterprisebankExample enterise = new EnterprisebankExample();
* EnterprisebankExample.Criteria enterpr=enterise.or();
* enterpr.andRealNameRecordEqualTo(id); List<Enterprisebank> ent=
* sqlSession.selectList(
* "com.itrus.portal.db.EnterprisebankMapper.selectByExample",
* enterise);
*/
Enterprisebank entt = sqlSession.selectOne("com.itrus.portal.db.EnterprisebankMapper.selectByPrimaryKey1", realName.getEnterprisebank());
if (null != ss && "" != ss) {
if (ss.indexOf("1") != -1) {
uiModel.addAttribute("licenseinformation", licen);
} else {
uiModel.addAttribute("licenseinformation", 1);
}
if (ss.indexOf("2") != -1) {
uiModel.addAttribute("organition", orgen);
} else {
uiModel.addAttribute("organition", 1);
}
if (ss.indexOf("3") != -1) {
uiModel.addAttribute("corporateinformation", core);
} else {
uiModel.addAttribute("corporateinformation", 1);
}
if (ss.indexOf("4") != -1) {
uiModel.addAttribute("corporateinformatio", core);
} else {
uiModel.addAttribute("corporateinformatio", 1);
}
if (ss.indexOf("5") != -1) {
uiModel.addAttribute("agentinformation", agee);
} else {
uiModel.addAttribute("agentinformation", 1);
}
if (ss.indexOf("6") != -1) {
uiModel.addAttribute("agentinformatio", agee);
} else {
uiModel.addAttribute("agentinformatio", 1);
}
if (ss.indexOf("7") != -1) {
uiModel.addAttribute("enterprise", entt);
} else if (ss.indexOf("8") != -1) {
uiModel.addAttribute("enterprise", entt);
} else {
uiModel.addAttribute("enterprise", 1);
}
}
ApplicationInfo applicationInfo = applicationInfoService.selectById(realName.getApplicationInfo());
uiModel.addAttribute("applicationInfo", applicationInfo);
return "realnamerecord/show";
}
use of com.itrus.portal.db.ApplicationInfo in project portal by ixinportal.
the class CertificationChargingController method createForm.
// 新建处理页面
@RequestMapping(params = "form", produces = "text/html")
public String createForm(Model uiModel) {
// 系统配置的应用集合
List<ApplicationInfo> applicationInfos = new ArrayList<ApplicationInfo>();
applicationInfos = sqlSession.selectList("com.itrus.portal.db.ApplicationInfoMapper.selectByExample", null);
// 移除已经存在了的应用集合
Iterator<ApplicationInfo> iterator = applicationInfos.iterator();
while (iterator.hasNext()) {
ApplicationInfo applicationInfo = iterator.next();
List<CertificationCharging> certificationChargings = certificationChargingService.selectListByAppId(applicationInfo.getId(), null);
if (null != certificationChargings && certificationChargings.size() > 0) {
iterator.remove();
}
}
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("applicationInfos", applicationInfos);
uiModel.addAttribute("appServices_e", appServices_e);
uiModel.addAttribute("appServices_p", appServices_p);
return "certificationcharging/create";
}
use of com.itrus.portal.db.ApplicationInfo 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";
}
use of com.itrus.portal.db.ApplicationInfo 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;
}
Aggregations