use of com.itrus.portal.db.EvidenceBasicInformation in project portal by ixinportal.
the class BasicInformationServiceImpl method getInformationBySn.
/**
* 通过证据编号得到对应证据数据
* @param sn
* @return
*/
public EvidenceBasicInformation getInformationBySn(String sn, Integer type) {
EvidenceBasicInformationExample informationExample = new EvidenceBasicInformationExample();
EvidenceBasicInformationExample.Criteria ebc = informationExample.createCriteria();
ebc.andEvidenceSnEqualTo(sn);
if (type != null)
ebc.andEvidenceTypeEqualTo(type);
EvidenceBasicInformation basicInformation = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByExample", informationExample);
return basicInformation;
}
use of com.itrus.portal.db.EvidenceBasicInformation in project portal by ixinportal.
the class BasicInformationServiceImpl method getInformationByBusinessSn.
/**
* 通过业务单号得到对应证据数据
* @param businessSn
* @return
*/
public List<EvidenceBasicInformation> getInformationByBusinessSn(String businessSn, Integer type) {
EvidenceBasicInformationExample informationExample = new EvidenceBasicInformationExample();
EvidenceBasicInformationExample.Criteria ec = informationExample.createCriteria();
ec.andServiceNumberEqualTo(businessSn);
if (type != null)
ec.andEvidenceTypeEqualTo(type);
List<EvidenceBasicInformation> basicInformations = sqlSession.selectList("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByExample", informationExample);
if (basicInformations == null || basicInformations.isEmpty()) {
return null;
}
return basicInformations;
}
use of com.itrus.portal.db.EvidenceBasicInformation in project portal by ixinportal.
the class StatisticsdepositaryController method list.
@RequestMapping(produces = "text/html")
public String list(@RequestParam(value = "servicePlatformName", required = false) String servicePlatformName, @RequestParam(value = "Statistics", required = false) Integer Statistics, @RequestParam(value = "year1", required = false) Integer year1, @RequestParam(value = "year2", required = false) Integer year2, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, @RequestParam(value = "serviceName", required = false) String serviceName, @RequestParam(value = "type", required = false) String type, @RequestParam(value = "serviceClientName", required = false) String serviceClientName, Model uiModel) throws Exception {
Map param = new HashMap();
Integer year3 = null;
if (year1 != null) {
year3 = year1;
}
List<Map<Integer, Integer>> list = new ArrayList<Map<Integer, Integer>>();
java.util.Date nowdate = new java.util.Date();
String[] monthList = { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" };
String[] seasonList = { "S1", "S2", "S3", "S4" };
String month = null;
String season = null;
String year = null;
Calendar calendar = Calendar.getInstance();
Calendar calendar2 = Calendar.getInstance();
if (null != Statistics && Statistics == 12) {
while (year1 <= year2) {
for (int j = 0; j <= 11; j++) {
calendar.set(Calendar.YEAR, year1);
calendar.set(Calendar.MONTH, j);
calendar.set(Calendar.DAY_OF_MONTH, 1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
Date dt1 = calendar.getTime();
calendar2.set(Calendar.YEAR, year1);
calendar2.set(Calendar.MONTH, j + 1);
calendar2.set(Calendar.DAY_OF_MONTH, 1);
calendar2.set(Calendar.HOUR_OF_DAY, 0);
calendar2.set(Calendar.MINUTE, 0);
calendar2.set(Calendar.SECOND, 0);
calendar2.set(Calendar.MILLISECOND, 0);
Date dt2 = calendar2.getTime();
if (StringUtils.isNotEmpty(servicePlatformName) && !"0".equals(servicePlatformName)) {
param.put("servicePlatformName", servicePlatformName);
}
if (StringUtils.isNotEmpty(serviceName)) {
param.put("serviceName", "%" + serviceName + "%");
}
if (type != null && !"0".equals(type)) {
param.put("type", type);
}
if (serviceClientName != null && !"0".equals(serviceClientName)) {
param.put("serviceClientName", serviceClientName);
}
month = year1 + "-" + monthList[j];
param.put("queryDate1", dt1);
param.put("queryDate2", dt2);
Integer count = basicInformationimpl.selectcount(param);
int sum = 0;
// System.out.println("count="+count);
if (count != 0) {
sum = basicInformationimpl.selectsize(param);
}
// System.out.println("sum="+sum);
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
map.put(1, year1);
map.put(2, count);
map.put(3, sum);
list.add(map);
}
year1++;
}
}
if (null != Statistics && Statistics == 4) {
while (year1 <= year2) {
for (int j = 0; j <= 9; j = j + 3) {
calendar.set(Calendar.YEAR, year1);
calendar.set(Calendar.MONTH, j);
calendar.set(Calendar.DAY_OF_MONTH, 1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
Date dt1 = calendar.getTime();
calendar2.set(Calendar.YEAR, year1);
calendar2.set(Calendar.MONTH, j + 3);
calendar2.set(Calendar.DAY_OF_MONTH, 1);
calendar2.set(Calendar.HOUR_OF_DAY, 0);
calendar2.set(Calendar.MINUTE, 0);
calendar2.set(Calendar.SECOND, 0);
calendar2.set(Calendar.MILLISECOND, 0);
Date dt2 = calendar2.getTime();
if (StringUtils.isNotEmpty(servicePlatformName) && !"0".equals(servicePlatformName)) {
param.put("serviceRequestPlatform", servicePlatformName);
}
if (serviceName != null && !"0".equals(serviceName)) {
param.put("serviceName", "%" + serviceName + "%");
}
if (type != null && !"0".equals(type)) {
param.put("type", type);
}
if (serviceClientName != null && !"0".equals(serviceClientName)) {
param.put("serviceClientName", serviceClientName);
}
param.put("queryDate1", dt1);
param.put("queryDate2", dt2);
Integer count = basicInformationimpl.selectcount(param);
int sum = 0;
System.out.println("count=" + count);
if (count != 0) {
sum = basicInformationimpl.selectsize(param);
}
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
map.put(1, year1);
map.put(2, count);
map.put(3, sum);
list.add(map);
}
year1++;
}
}
if (null != Statistics && Statistics == 1) {
while (year1 <= year2) {
calendar.set(Calendar.YEAR, year1);
calendar.set(Calendar.MONTH, 0);
calendar.set(Calendar.DAY_OF_MONTH, 1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
Date dt1 = calendar.getTime();
calendar2.set(Calendar.YEAR, year1 + 1);
calendar2.set(Calendar.MONTH, 0);
calendar2.set(Calendar.DAY_OF_MONTH, 1);
calendar2.set(Calendar.HOUR_OF_DAY, 0);
calendar2.set(Calendar.MINUTE, 0);
calendar2.set(Calendar.SECOND, 0);
calendar2.set(Calendar.MILLISECOND, 0);
Date dt2 = calendar2.getTime();
if (StringUtils.isNotEmpty(servicePlatformName) && !"0".equals(servicePlatformName)) {
param.put("serviceRequestPlatform", servicePlatformName);
}
if (StringUtils.isNotEmpty(serviceName) && !"0".equals(serviceName)) {
param.put("serviceName", "%" + serviceName + "%");
}
if (type != null && !"0".equals(type)) {
param.put("type", type);
}
if (serviceClientName != null && !"0".equals(serviceClientName)) {
param.put("serviceClientName", serviceClientName);
}
year = year + "Y";
param.put("queryDate1", dt1);
param.put("queryDate2", dt2);
Integer count = basicInformationimpl.selectcount(param);
int sum = 0;
System.out.println("count=" + count);
if (count != 0) {
sum = basicInformationimpl.selectsize(param);
}
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
map.put(1, year1);
map.put(2, count);
map.put(3, sum);
list.add(map);
year1++;
}
}
List appservice = applicationInfoService.selectByExample(new ApplicationInfoExample());
uiModel.addAttribute("appservice", appservice);
List<EvidenceBasicInformation> basicinfo = basicInformationimpl.selectList();
uiModel.addAttribute("basicinfo", basicinfo);
if (null == servicePlatformName || "0".equals(servicePlatformName)) {
servicePlatformName = "所有应用";
}
uiModel.addAttribute("list", list);
// System.out.println(list);
uiModel.addAttribute("year1", year3);
uiModel.addAttribute("servicePlatformName", servicePlatformName);
uiModel.addAttribute("year2", year2);
uiModel.addAttribute("Statistics", Statistics);
uiModel.addAttribute("serviceName", serviceName);
uiModel.addAttribute("type", type);
uiModel.addAttribute("serviceClientName", serviceClientName);
return "sratisticsdepositary/list";
}
use of com.itrus.portal.db.EvidenceBasicInformation in project portal by ixinportal.
the class EvidenceOutTask method outBody1.
/**
* 人工出证
* @param hisCertificate
* @param orderNumber
*/
private void outBody1(String orderNumber, EvidenceOutServiceConfig outServiceConfig, ApplicationInfo applicationInfo, AppService appService, String evidenceSns, String businessSn, Date date, String code, Integer count) {
try {
// 定义错误原因字段
String hisCauseFailure = null;
// 整合出证信息表
EvidenceHisCertificate hisCertificate = new EvidenceHisCertificate();
hisCertificate.setServiceRequestPlatform(applicationInfo.getName());
hisCertificate.setApplicationInfo(applicationInfo.getId());
hisCertificate.setSisServiceName(appService.getAppServiceName());
hisCertificate.setSerialnumber(orderNumber);
hisCertificate.setHisAppService(appService.getId());
hisCertificate.setApplicationTime(date);
hisCertificate.setHisApplicant(code);
if (outServiceConfig.getOutWay() == null) {
hisCertificate.setHisway("2");
} else {
hisCertificate.setHisway(outServiceConfig.getOutWay().toString());
}
hisCertificate.setHisState("1");
hisCertificate.setOutState(0);
hisCertificate.setOutTemplate(outServiceConfig.getOutReportTemplate());
hisCertificate.setHisway(outServiceConfig.getOutWay().toString());
sqlSession.insert("com.itrus.portal.db.EvidenceHisCertificateMapper.insert", hisCertificate);
sqlSession.flushStatements();
// int count = 0;
if (StringUtils.isNotEmpty(evidenceSns)) {
String[] evidenceSnArr = evidenceSns.split(",");
for (String evidenceSn : evidenceSnArr) {
// 获得对应证据编号的信息
EvidenceBasicInformation basicInformation = basicInformationService.getInformationBySn(evidenceSn, 2);
if (basicInformation == null) {
if (StringUtils.isEmpty(hisCauseFailure))
hisCauseFailure = "提交的" + evidenceSn + "证据编号为无效的证据编码";
else
hisCauseFailure = hisCauseFailure + "," + "提交的" + evidenceSn + "证据编号为无效的证据编码";
continue;
}
// count++;
if (basicInformation.getEvidenceStatus() == 0 || StringUtils.isNotEmpty(basicInformation.getLackMainContent())) {
if (StringUtils.isEmpty(hisCauseFailure))
hisCauseFailure = "证据编号:" + evidenceSn + "核验未通过,不满足出证要求";
else
hisCauseFailure = hisCauseFailure + "," + "证据编号:" + evidenceSn + "核验未通过,不满足出证要求";
}
// 得到证据附件信息
/*EvidenceEnclosureExample enclosureExample = new EvidenceEnclosureExample();
EvidenceEnclosureExample.Criteria eec = enclosureExample.createCriteria();
eec.andEvidenceSnEqualTo(evidenceSn);
eec.andPdfTypeEqualTo("1");
List<EvidenceEnclosure> enclosures = sqlSession
.selectList("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample",
enclosureExample);*/
// 存储出证与证据关系
EvidenceHisRelationship hisRelationship = new EvidenceHisRelationship();
hisRelationship.setBasicInformation(basicInformation.getId());
hisRelationship.setHisCertificate(hisCertificate.getId());
sqlSession.insert("com.itrus.portal.db.EvidenceHisRelationshipMapper.insert", hisRelationship);
}
} else {
List<EvidenceBasicInformation> basicInformations = basicInformationService.getInformationByBusinessSn(businessSn, 2);
if (basicInformations == null || basicInformations.isEmpty()) {
if (StringUtils.isEmpty(hisCauseFailure))
hisCauseFailure = "提交的业务单号有误";
else
hisCauseFailure = hisCauseFailure + "," + "提交的业务单号有误";
}
for (EvidenceBasicInformation basicInformation : basicInformations) {
// 存储出证与证据关系
EvidenceHisRelationship hisRelationship = new EvidenceHisRelationship();
hisRelationship.setBasicInformation(basicInformation.getId());
hisRelationship.setHisCertificate(hisCertificate.getId());
sqlSession.insert("com.itrus.portal.db.EvidenceHisRelationshipMapper.insert", hisRelationship);
}
}
// 判断出证模式
if (count == 1)
hisCertificate.setHis("0");
else
hisCertificate.setHis("1");
// 判断出证是否有错
if (StringUtils.isNotEmpty(hisCauseFailure)) {
// hisCertificate.setHisway("3");
hisCertificate.setOutState(1);
hisCertificate.setHisCauseFailure(hisCauseFailure);
}
sqlSession.update("com.itrus.portal.db.EvidenceHisCertificateMapper.updateByPrimaryKey", hisCertificate);
sqlSession.flushStatements();
// 出证计费加流水
takeChargingService.takeCharing(appService.getServiceConfigName(), appService.getServiceConfigId(), applicationInfo, appService, hisCertificate.getId(), "EvidenceHisCertificate", count, applicationInfo.getName(), hisCertificate.getHisApplicant());
if (hisCertificate.getOutState() == 0) {
String oper1 = "出证接口";
String info1 = "人工出证申请成功,流水号:" + orderNumber;
LogUtil.evidencelog(sqlSession, null, oper1, info1);
} else {
String oper = "出证接口";
String info = "人工出证失败,流水号:" + orderNumber;
// 判断为自动出证失败后 转人工出证
LogUtil.evidencelog(sqlSession, null, oper, info);
}
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
StackTraceElement stackTraceElement = e.getStackTrace()[e.getStackTrace().length - 3];
String info = "出证失败,错误详情:" + stackTraceElement.getClassName() + stackTraceElement.getLineNumber() + e.toString();
String oper = "出证接口";
LogUtil.evidencelog(sqlSession, null, oper, info);
}
}
use of com.itrus.portal.db.EvidenceBasicInformation in project portal by ixinportal.
the class EvidenceOutTask method outBody.
/**
* 自动出证
* @param hisCertificate
* @param orderNumber
*/
private void outBody(String orderNumber, EvidenceOutServiceConfig outServiceConfig, ApplicationInfo applicationInfo, AppService appService, String evidenceSns, String businessSn, Date date, String code, Integer count) {
try {
// 定义错误原因字段
String hisCauseFailure = null;
// 得到出证模板信息
EvidenceOutTemplateExample outTemplateExample = new EvidenceOutTemplateExample();
EvidenceOutTemplateExample.Criteria tec = outTemplateExample.createCriteria();
tec.andIdEqualTo(outServiceConfig.getOutReportTemplate());
EvidenceOutTemplate outTemplate = sqlSession.selectOne("com.itrus.portal.db.EvidenceOutTemplateMapper.selectByExample", outTemplateExample);
// 整合证书需要的要素
String[] factorArr = outTemplate.getFactor().split(",");
// 整合出证信息表
EvidenceHisCertificate hisCertificate = new EvidenceHisCertificate();
hisCertificate.setServiceRequestPlatform(applicationInfo.getName());
hisCertificate.setApplicationInfo(applicationInfo.getId());
hisCertificate.setSisServiceName(appService.getAppServiceName());
hisCertificate.setSerialnumber(orderNumber);
hisCertificate.setHisAppService(appService.getId());
hisCertificate.setApplicationTime(date);
hisCertificate.setHisApplicant(code);
hisCertificate.setHisState("1");
hisCertificate.setOutState(0);
hisCertificate.setOutTemplate(outServiceConfig.getOutReportTemplate());
hisCertificate.setHisway(outServiceConfig.getOutWay().toString());
sqlSession.insert("com.itrus.portal.db.EvidenceHisCertificateMapper.insert", hisCertificate);
sqlSession.flushStatements();
// int count = 0;
if (StringUtils.isNotEmpty(evidenceSns)) {
String[] evidenceSnArr = evidenceSns.split(",");
for (String evidenceSn : evidenceSnArr) {
// 获得对应证据编号的信息
EvidenceBasicInformation basicInformation = basicInformationService.getInformationBySn(evidenceSn, 2);
if (basicInformation == null) {
if (StringUtils.isEmpty(hisCauseFailure))
hisCauseFailure = "提交的" + evidenceSn + "证据编号为无效的证据编码";
else
hisCauseFailure = hisCauseFailure + "," + "提交的" + evidenceSn + "证据编号为无效的证据编码";
continue;
}
// count++;
if (basicInformation.getEvidenceStatus() == 0 || StringUtils.isNotEmpty(basicInformation.getLackMainContent())) {
if (StringUtils.isEmpty(hisCauseFailure))
hisCauseFailure = "证据编号:" + evidenceSn + "核验未通过,不满足出证要求";
else
hisCauseFailure = hisCauseFailure + "," + "证据编号:" + evidenceSn + "核验未通过,不满足出证要求";
}
// 得到证据附件信息
EvidenceEnclosureExample enclosureExample = new EvidenceEnclosureExample();
EvidenceEnclosureExample.Criteria eec = enclosureExample.createCriteria();
eec.andEvidenceSnEqualTo(evidenceSn);
eec.andPdfTypeEqualTo("1");
List<EvidenceEnclosure> enclosures = sqlSession.selectList("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", enclosureExample);
// 核验事件证据提交的要素
String subFactor = null;
String lackFactor = null;
for (EvidenceEnclosure enclosure : enclosures) {
if (StringUtils.isEmpty(subFactor))
subFactor = enclosure.getSaveFactor();
else
subFactor = subFactor + "," + enclosure.getSaveFactor();
}
for (String factor : factorArr) {
if (!subFactor.contains(factor) && !(factor.contains("主体身份") || factor.contains("身份实名认证") || factor.contains("身份意愿鉴别"))) {
if (StringUtils.isEmpty(lackFactor))
lackFactor = factor;
else
lackFactor = lackFactor + "," + factor;
}
}
if (StringUtils.isNotEmpty(lackFactor)) {
if (StringUtils.isEmpty(hisCauseFailure))
hisCauseFailure = "证据编号:" + evidenceSn + ",缺少必要要素信息:" + lackFactor;
else
hisCauseFailure = hisCauseFailure + "," + "证据编号:" + evidenceSn + ",缺少必要要素信息:" + lackFactor;
}
// 核验身份提交的要素
String idFactor = null;
for (String factor : factorArr) {
if (factor.contains("主体身份") || factor.contains("身份实名认证") || factor.contains("身份意愿鉴别")) {
if (StringUtils.isEmpty(idFactor))
idFactor = factor;
else
idFactor = idFactor + "," + factor;
}
}
log.debug("idFactor__ : " + idFactor);
if (StringUtils.isNotEmpty(idFactor)) {
EvidenceTrustedIdentityExample trustedIdentityExample = new EvidenceTrustedIdentityExample();
EvidenceTrustedIdentityExample.Criteria ttc = trustedIdentityExample.createCriteria();
ttc.andBasicInformationEqualTo(basicInformation.getId().toString());
ttc.andEventContentIsNull();
List<EvidenceTrustedIdentity> trustedIdentities = sqlSession.selectList("com.itrus.portal.db.EvidenceTrustedIdentityMapper.selectByExample", trustedIdentityExample);
if (trustedIdentities == null || trustedIdentities.isEmpty()) {
if (StringUtils.isEmpty(hisCauseFailure))
hisCauseFailure = "证据编号:" + evidenceSn + ",缺少必要要素信息:可信身份标识";
else
hisCauseFailure = hisCauseFailure + "," + "证据编号:" + evidenceSn + ",缺少必要要素信息:可信身份标识";
} else {
for (EvidenceTrustedIdentity trustedIdentity : trustedIdentities) {
// 得到主体身份信息
EvidenceMainInformationExample informationExample = new EvidenceMainInformationExample();
EvidenceMainInformationExample.Criteria iec = informationExample.createCriteria();
// iec.andIdEqualTo(trustedIdentity.getMainInformation());
EvidenceMainInformation mainInformation = sqlSession.selectOne("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", informationExample);
// 整合没关联主体身份证据的信息
if (StringUtils.isEmpty(trustedIdentity.getEvidenceSn())) {
if (StringUtils.isEmpty(hisCauseFailure))
hisCauseFailure = "证据主体:" + mainInformation.getSubjectName() + ",编号:" + evidenceSn + ",缺少必要要素信息:" + idFactor;
else
hisCauseFailure = hisCauseFailure + "," + "证据主体:" + mainInformation.getSubjectName() + ",编号:" + evidenceSn + ",缺少必要要素信息:" + idFactor;
} else {
// 得到证据附件信息
EvidenceEnclosureExample enclosureExample1 = new EvidenceEnclosureExample();
EvidenceEnclosureExample.Criteria eec1 = enclosureExample1.createCriteria();
eec1.andEvidenceSnEqualTo(trustedIdentity.getEvidenceSn());
eec1.andPdfTypeEqualTo("1");
List<EvidenceEnclosure> enclosures1 = sqlSession.selectList("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", enclosureExample1);
String subFactorId = null;
String lackFactorId = null;
for (EvidenceEnclosure enclosure : enclosures1) {
if (StringUtils.isEmpty(subFactorId))
subFactorId = enclosure.getSaveFactor();
else
subFactorId = subFactorId + "," + enclosure.getSaveFactor();
}
log.debug("subFactorId__ : " + subFactorId);
String[] factorIdArr = idFactor.split(",");
for (String factor : factorIdArr) {
if (!subFactorId.contains(factor)) {
if (StringUtils.isEmpty(lackFactorId))
lackFactorId = factor;
else
lackFactorId = lackFactorId + "," + factor;
}
}
log.debug("lackFactorId__ : " + lackFactorId);
if (StringUtils.isNotEmpty(lackFactorId)) {
if (StringUtils.isEmpty(hisCauseFailure))
hisCauseFailure = "证据主体:" + mainInformation.getSubjectName() + ",编号:" + evidenceSn + ",缺少必要要素信息:" + lackFactorId;
else
hisCauseFailure = hisCauseFailure + "," + "证据主体:" + mainInformation.getSubjectName() + ",编号:" + evidenceSn + ",缺少必要要素信息:" + lackFactorId;
}
}
}
}
}
// 存储出证与证据关系
EvidenceHisRelationship hisRelationship = new EvidenceHisRelationship();
hisRelationship.setBasicInformation(basicInformation.getId());
hisRelationship.setHisCertificate(hisCertificate.getId());
sqlSession.insert("com.itrus.portal.db.EvidenceHisRelationshipMapper.insert", hisRelationship);
}
} else {
List<EvidenceBasicInformation> basicInformations = basicInformationService.getInformationByBusinessSn(businessSn, 2);
if (basicInformations == null || basicInformations.isEmpty()) {
if (StringUtils.isEmpty(hisCauseFailure))
hisCauseFailure = "提交的业务单号有误";
else
hisCauseFailure = hisCauseFailure + "," + "提交的业务单号有误";
}
for (EvidenceBasicInformation basicInformation : basicInformations) {
// 得到证据附件信息
EvidenceEnclosureExample enclosureExample = new EvidenceEnclosureExample();
EvidenceEnclosureExample.Criteria eec = enclosureExample.createCriteria();
eec.andBasicInformationEqualTo(basicInformation.getId());
eec.andPdfTypeEqualTo("1");
List<EvidenceEnclosure> enclosures = sqlSession.selectList("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", enclosureExample);
// 得到提交的要素
String subFactor = null;
String lackFactor = null;
for (EvidenceEnclosure enclosure : enclosures) {
if (StringUtils.isEmpty(subFactor))
subFactor = enclosure.getSaveFactor();
else
subFactor = subFactor + "," + enclosure.getSaveFactor();
}
for (String factor : factorArr) {
if (!subFactor.contains(factor)) {
if (StringUtils.isEmpty(lackFactor))
lackFactor = factor;
else
lackFactor = lackFactor + "," + factor;
}
}
if (StringUtils.isNotEmpty(lackFactor)) {
if (StringUtils.isEmpty(hisCauseFailure))
hisCauseFailure = "证据编号:" + basicInformation.getEvidenceSn() + ",缺少必要要素信息:" + lackFactor;
else
hisCauseFailure = hisCauseFailure + "," + "证据编号:" + basicInformation.getEvidenceSn() + ",缺少必要要素信息:" + lackFactor;
}
// count++;
if (basicInformation.getEvidenceStatus() == 0 || StringUtils.isNotEmpty(basicInformation.getLackMainContent())) {
if (StringUtils.isEmpty(hisCauseFailure))
hisCauseFailure = "证据编号:" + basicInformation.getEvidenceSn() + ",不满足出证要求";
else
hisCauseFailure = hisCauseFailure + "," + "证据编号:" + basicInformation.getEvidenceSn() + ",不满足出证要求";
}
// 存储出证与证据关系
EvidenceHisRelationship hisRelationship = new EvidenceHisRelationship();
hisRelationship.setBasicInformation(basicInformation.getId());
hisRelationship.setHisCertificate(hisCertificate.getId());
sqlSession.insert("com.itrus.portal.db.EvidenceHisRelationshipMapper.insert", hisRelationship);
}
}
// 判断出证模式
if (count == 1)
hisCertificate.setHis("0");
else
hisCertificate.setHis("1");
// 判断出证是否有错
if (StringUtils.isNotEmpty(hisCauseFailure)) {
// hisCertificate.setHisway("3");
hisCertificate.setOutState(1);
hisCertificate.setHisCauseFailure(hisCauseFailure);
}
sqlSession.update("com.itrus.portal.db.EvidenceHisCertificateMapper.updateByPrimaryKey", hisCertificate);
sqlSession.flushStatements();
// 判断是否为自动出证
if ("1".equals(hisCertificate.getHisway()) && hisCertificate.getOutState() == 0) {
String oper1 = "出证接口";
String info1 = "出证申请成功,流水号:" + orderNumber;
LogUtil.evidencelog(sqlSession, null, oper1, info1);
Map<String, Object> mapRet = null;
// 生成出证报告
try {
mapRet = reportTemplate.certificationReport(hisCertificate.getSerialnumber());
} catch (Exception e) {
StackTraceElement stackTraceElement = e.getStackTrace()[e.getStackTrace().length - 3];
String infoErr = stackTraceElement.getClassName() + stackTraceElement.getLineNumber() + e.toString();
String oper = "出证接口";
String info = "生成出证报告失败,流水号:" + orderNumber + ",失败原因:" + infoErr;
LogUtil.evidencelog(sqlSession, null, oper, info);
e.printStackTrace();
}
// 判断出证报告是否生成成功
if (mapRet != null) {
if ((int) mapRet.get("status") == 0) {
// hisCertificate.setOutState(0);
String oper = "出证接口";
String info = "生成出证报告成功,流水号:" + orderNumber;
LogUtil.evidencelog(sqlSession, null, oper, info);
hisCertificate.setHisState("0");
} else {
// hisCertificate.setOutState(1);
String oper = "出证接口";
String info = null;
if (mapRet.get("message") != null) {
info = "生成出证报告失败,流水号:" + orderNumber + ",失败原因:" + mapRet.get("message").toString();
// hisCertificate.setHisCauseFailure(mapRet.get("message").toString());
} else {
info = "生成出证报告失败,流水号:" + orderNumber;
// hisCertificate.setHisCauseFailure("出证失败");
}
LogUtil.evidencelog(sqlSession, null, oper, info);
}
}
} else {
String oper = "出证接口";
String info = "出证失败,流水号:" + orderNumber;
// 判断为自动出证失败后 转人工出证
if (hisCertificate.getHisway().equals("1")) {
hisCertificate.setHisway("3");
info = info + ",已自动转人工出证";
}
LogUtil.evidencelog(sqlSession, null, oper, info);
}
sqlSession.update("com.itrus.portal.db.EvidenceHisCertificateMapper.updateByPrimaryKeySelective", hisCertificate);
// 出证计费加流水
takeChargingService.takeCharing(appService.getServiceConfigName(), appService.getServiceConfigId(), applicationInfo, appService, hisCertificate.getId(), "EvidenceHisCertificate", count, applicationInfo.getName(), hisCertificate.getHisApplicant());
} catch (Exception e) {
e.printStackTrace();
StackTraceElement stackTraceElement = e.getStackTrace()[e.getStackTrace().length - 3];
String info = "出证失败,错误详情:" + stackTraceElement.getClassName() + stackTraceElement.getLineNumber() + e.toString();
String oper = "出证接口";
LogUtil.evidencelog(sqlSession, null, oper, info);
}
}
Aggregations