Search in sources :

Example 1 with AppService

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

the class HisCertificateController method showpdf.

/**
 * 查看详情 导入PDF跳转详情方法
 *
 * @param id
 * @param type
 * @param uiModel
 * @return
 */
@RequestMapping(value = "/showpdf/{id}/{type}", produces = "text/html")
public String showpdf(@PathVariable("id") Long id, @PathVariable("type") int type, Model uiModel) {
    EvidenceHisCertificate hisCertificate = hiscertificate.selectById(id);
    // 得到服务编码
    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);
    // 得到出证模板信息
    EvidenceOutTemplate outtemp = sqlSession.selectOne("com.itrus.portal.db.EvidenceOutTemplateMapper.selectByPrimaryKey", outService.getSaveRetTemplate());
    uiModel.addAttribute("hisCertificate", hisCertificate);
    uiModel.addAttribute("outtemp", outtemp);
    Map<Long, List<EvidenceMainInformation>> minfo = new HashMap<Long, List<EvidenceMainInformation>>();
    List<EvidenceBasicInformation> blists = new ArrayList<EvidenceBasicInformation>();
    // 得到出证关联表信息
    EvidenceHisRelationshipExample relation = new EvidenceHisRelationshipExample();
    EvidenceHisRelationshipExample.Criteria hisreation = relation.createCriteria();
    hisreation.andHisCertificateEqualTo(hisCertificate.getId());
    List<EvidenceHisRelationship> hisRelation = sqlSession.selectList("com.itrus.portal.db.EvidenceHisRelationshipMapper.selectByExample", relation);
    // 获取证据附件表
    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);
    uiModel.addAttribute("envlosure", envlosure);
    for (int j = 0; j < hisRelation.size(); j++) {
        List<EvidenceMainInformation> mlist = new ArrayList<EvidenceMainInformation>();
        // 得到证据基本信息
        EvidenceBasicInformation basic = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", hisRelation.get(j).getBasicInformation());
        blists.add(basic);
        // 得到证据身份主题关联信息
        EvidenceSubjectIdentityExample subjectExample = new EvidenceSubjectIdentityExample();
        EvidenceSubjectIdentityExample.Criteria identity = subjectExample.createCriteria();
        identity.andBasicInformationEqualTo(basic.getEvidenceSn());
        List<EvidenceSubjectIdentity> subjectIdentity = sqlSession.selectList("com.itrus.portal.db.EvidenceSubjectIdentityMapper.selectByExample", subjectExample);
        for (int g = 0; g < subjectIdentity.size(); g++) {
            // 得到主题身份信息
            EvidenceMainInformation mainInfo = sqlSession.selectOne("com.itrus.portal.db.EvidenceMainInformationMapper.selectByPrimaryKey", subjectIdentity.get(g).getMainInformation());
            mlist.add(mainInfo);
        }
        minfo.put(basic.getId(), mlist);
    }
    uiModel.addAttribute("mainInfo", minfo);
    uiModel.addAttribute("blists", blists);
    if (type == 1) {
        uiModel.addAttribute("error", error);
        return "hiscertificate/show";
    } else if (type == 2) {
        return "hiscertificate/show1";
    }
    return null;
}
Also used : EvidenceSubjectIdentityExample(com.itrus.portal.db.EvidenceSubjectIdentityExample) HashMap(java.util.HashMap) EvidenceBasicInformation(com.itrus.portal.db.EvidenceBasicInformation) ArrayList(java.util.ArrayList) EvidenceHisCertificate(com.itrus.portal.db.EvidenceHisCertificate) EvidenceEnclosure(com.itrus.portal.db.EvidenceEnclosure) EvidenceMainInformation(com.itrus.portal.db.EvidenceMainInformation) EvidenceOutServiceConfig(com.itrus.portal.db.EvidenceOutServiceConfig) EvidenceOutTemplate(com.itrus.portal.db.EvidenceOutTemplate) ArrayList(java.util.ArrayList) List(java.util.List) AppService(com.itrus.portal.db.AppService) EvidenceOutServiceConfigExample(com.itrus.portal.db.EvidenceOutServiceConfigExample) EvidenceHisRelationship(com.itrus.portal.db.EvidenceHisRelationship) EvidenceEnclosureExample(com.itrus.portal.db.EvidenceEnclosureExample) EvidenceSubjectIdentity(com.itrus.portal.db.EvidenceSubjectIdentity) EvidenceHisRelationshipExample(com.itrus.portal.db.EvidenceHisRelationshipExample) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with AppService

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

the class HisCertificateController method outpdf.

/**
 * 出证盖章
 *
 * @param serialnumber
 * @param request
 * @param uiModel
 * @return
 * @throws Exception
 */
/*@RequestMapping(value = "/{serialnumber}", method = RequestMethod.POST, produces = "text/html")
	@ResponseBody
	public String seal(@PathVariable("serialnumber") String serialnumber, HttpServletRequest request,
			Model uiModel) throws Exception {
		// EvidenceHisCertificate hisCertificate = new EvidenceHisCertificate();
		Map<String, Object> result = new HashMap<String, Object>();
		// 根据流水号得到出证信息表
		EvidenceHisCertificateExample hiscer = new EvidenceHisCertificateExample();
		EvidenceHisCertificateExample.Criteria tificate = hiscer.createCriteria();
		tificate.andSerialnumberEqualTo(serialnumber);
		EvidenceHisCertificate hisCertificate = sqlSession
				.selectOne("com.itrus.portal.db.EvidenceHisCertificateMapper.selectByExample", hiscer);
		//得到模板信息
		EvidenceOutTemplate outTemplate = sqlSession.selectOne(
				"com.itrus.portal.db.EvidenceOutTemplateMapper.selectByPrimaryKey", hisCertificate.getOutTemplate());
		// 整合证书需要的要素
		String[] factorArr = outTemplate.getFactor().split(",");
		//得到出证关系表
		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);
		// 要素核验
		for (EvidenceHisRelationship h : hisrelationship) {
			// 得到基本信息表
			EvidenceBasicInformation basic = sqlSession.selectOne(
					"com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", h.getBasicInformation());
			result = saveSericece.verifyFactor(basic.getEvidenceSn());
			if (!"1".equals(result.get("status").toString())) {
				result.put("message", result.get("message").toString());
				hisCertificate.setOutState(1);
				hisCertificate.setHisCauseFailure(result.get("message").toString());
				sqlSession.update("com.itrus.portal.db.EvidenceHisCertificateMapper.updateByPrimaryKey",
						hisCertificate);
				return result.get("message").toString();
			}
			// 得到证据附件信息
			EvidenceEnclosureExample enclosureExample = new EvidenceEnclosureExample();
			EvidenceEnclosureExample.Criteria eec = enclosureExample.createCriteria();
			eec.andEvidenceSnEqualTo(basic.getEvidenceSn());
			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)) {
				hisCertificate.setOutState(1);
				hisCertificate.setHisCauseFailure("证据编号:" + basic.getEvidenceSn() + ",缺少必要要素信息:" + lackFactor);
				sqlSession.update("com.itrus.portal.db.EvidenceHisCertificateMapper.updateByPrimaryKey",
						hisCertificate);
				return "证据编号:" + basic.getEvidenceSn() + ",缺少必要要素信息:" + lackFactor;
			}
		}
		result = rtlService.certificationReport(serialnumber);
		if ("0".equals(result.get("status").toString())) {
			
			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);
			}
			
			
			hisCertificate.setHisway("2");
			hisCertificate.setHisState("0");
			hisCertificate.setOutState(0);
			sqlSession.update("com.itrus.portal.db.EvidenceHisCertificateMapper.updateByPrimaryKey", hisCertificate);
		} else {
			// hisCertificate.setHisway("2");
			hisCertificate.setOutState(1);
			hisCertificate.setHisCauseFailure(result.get("message").toString());
			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(4);
				sqlSession.update("com.itrus.portal.db.EvidenceBasicInformationMapper.updateByPrimaryKey", basic);
			}

		}

		return "核验成功";
	}*/
/**
 * 下载pdf
 *
 * @param serialnumber
 * @param request
 * @param response
 * @return
 * @throws IOException
 */
@RequestMapping(value = "/outpdf/{serialnumber}")
public String outpdf(@PathVariable("serialnumber") String serialnumber, HttpServletRequest request, HttpServletResponse response) throws IOException {
    try {
        EvidenceHisCertificateExample hiscer = new EvidenceHisCertificateExample();
        EvidenceHisCertificateExample.Criteria tificate = hiscer.createCriteria();
        tificate.andSerialnumberEqualTo(serialnumber);
        EvidenceHisCertificate hisCertificate = sqlSession.selectOne("com.itrus.portal.db.EvidenceHisCertificateMapper.selectByExample", hiscer);
        // 得到服务编码
        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);
        String footer = getClass().getClassLoader().getResource("").getPath() + File.separator + "footer.html";
        String header = getClass().getClassLoader().getResource("").getPath() + File.separator + "header.html";
        // 得到出证模板信息
        EvidenceOutTemplate outTmplate = sqlSession.selectOne("com.itrus.portal.db.EvidenceOutTemplateMapper.selectByPrimaryKey", outService.getOutReportTemplate());
        // 拼接url路径
        String url = systemConfigService.getTsAddress() + "/" + outTmplate.getFile() + "/" + serialnumber;
        log.error("123url321=" + url);
        /*
			 * String base64 = Pdf.html2pdf(outTmplate.getFile(),
			 * systemConfigService.getpdfurl() + "/" + serialnumber + ".pdf",
			 * header, footer);// 下载未签章证书
			 */
        String base64 = Pdf.html2pdf(url, systemConfigService.getpdfurl() + "/" + serialnumber + ".pdf", header, // 下载未签章证书
        footer);
        String fileName = "" + Calendar.getInstance().getTimeInMillis();
        fileName = reportTemplate.chineseUtf(fileName, request);
        // String filename = "存证服务统计信息" + new
        // SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".pdf";
        response.addHeader("Content-Disposition", "attachment;filename=" + new String((fileName + ".pdf").getBytes("utf-8"), "iso-8859-1"));
        // response.setHeader("Content-disposition", "attachment;filename="
        // +
        // fileName);
        response.setCharacterEncoding("utf-8");
        response.setContentType("application/pdf");
        if (base64 == null)
            return null;
        BASE64Decoder decoder = new BASE64Decoder();
        // Base64解码
        byte[] bytes = decoder.decodeBuffer(base64);
        for (int i = 0; i < bytes.length; ++i) {
            if (bytes[i] < 0) {
                // 调整异常数据
                bytes[i] += 256;
            }
        }
        // 生成文件的路径
        OutputStream out = response.getOutputStream();
        out.write(bytes);
        out.flush();
        out.close();
        return null;
    } catch (Exception e) {
        return null;
    }
}
Also used : AppService(com.itrus.portal.db.AppService) EvidenceOutServiceConfigExample(com.itrus.portal.db.EvidenceOutServiceConfigExample) ByteArrayOutputStream(java.io.ByteArrayOutputStream) BufferedOutputStream(java.io.BufferedOutputStream) FileOutputStream(java.io.FileOutputStream) ServletOutputStream(javax.servlet.ServletOutputStream) OutputStream(java.io.OutputStream) EvidenceHisCertificate(com.itrus.portal.db.EvidenceHisCertificate) EvidenceOutServiceConfig(com.itrus.portal.db.EvidenceOutServiceConfig) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) EvidenceHisCertificateExample(com.itrus.portal.db.EvidenceHisCertificateExample) EvidenceOutTemplate(com.itrus.portal.db.EvidenceOutTemplate) BASE64Decoder(sun.misc.BASE64Decoder) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with AppService

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

the class ReceiptContoller method preview.

/**
 * 预览证书
 *
 * @param evidenceSn
 * @param uiModel
 * @return
 */
@RequestMapping(value = "/preview/{evidenceSn}", produces = "text/html")
public String preview(@PathVariable("evidenceSn") String evidenceSn, Model uiModel) {
    // 得到证书基本信息
    EvidenceBasicInformationExample basicEx = new EvidenceBasicInformationExample();
    EvidenceBasicInformationExample.Criteria information = basicEx.createCriteria();
    information.andEvidenceSnEqualTo(evidenceSn);
    EvidenceBasicInformation basic = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByExample", basicEx);
    // 得到时间内容信息
    EvidenceEventContentExample evencontent = new EvidenceEventContentExample();
    EvidenceEventContentExample.Criteria countent = evencontent.createCriteria();
    // countent.andBasicInformationEqualTo(basic.getId());
    countent.andEvidenceSnEqualTo(basic.getEvidenceSn());
    List<EvidenceEventContent> mevencontent = sqlSession.selectList("com.itrus.portal.db.EvidenceEventContentMapper.selectByExample", evencontent);
    /*
		 * EvidenceEnclosureExample closure = new EvidenceEnclosureExample();
		 * EvidenceEnclosureExample.Criteria enclsureEx =
		 * closure.createCriteria();
		 * enclsureEx.andEvidenceSnEqualTo(evidenceSn);
		 */
    Map param = new HashMap();
    param.put("evidenceSn", evidenceSn);
    int sun = basicInformationimpl.selectsize(param);
    // int sun = basic.getEvidenceSize();
    // 得到证书附件信息
    List<EvidenceEnclosure> enclosure = sqlSession.selectList("com.itrus.portal.db.EvidenceEnclosureMapper.selectEvidenceEnclosureList", param);
    // int count = 0;
    // for (int i = 0; i < enclosure.size(); i++) {
    // count++;
    // }
    // 得到服务表信息
    /*AppService appservice = appService.selectById(basic.getOutAppService());
		if (null != appservice) {
			// 得到出证服务配置
			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) {
				// 得到证书信息
				EvidenceCertificate certificate = sqlSession.selectOne(
						"com.itrus.portal.db.EvidenceCertificateMapper.selectByPrimaryKey",
						outService.getEvidenceCertificate());
				
				uiModel.addAttribute("certificate", certificate);
			}*/
    // 得到服务表信息
    // 得到服务编码
    Map<Long, AppService> mAppService = CacheCustomer.APP_SERVICE_MAP_BY_ID();
    AppService appservices = null;
    if (mAppService != null && mAppService.get(basic.getAppService()) != null) {
        appservices = mAppService.get(basic.getAppService());
    }
    if (null == appservices) {
        appservices = appService.selectById(basic.getAppService());
    }
    // AppService appservices = appService.selectById(basic.getAppService());
    Map<Long, EvidenceSaveService> evidenceSaveService = CacheCustomer.getappSAVE_SERVICE_MAP();
    EvidenceSaveService evidenceSave = null;
    if (evidenceSaveService != null && evidenceSaveService.get(appservices.getId()) != null) {
        evidenceSave = evidenceSaveService.get(appservices.getId());
    } else {
        EvidenceSaveServiceExample save = new EvidenceSaveServiceExample();
        EvidenceSaveServiceExample.Criteria saveEx = save.createCriteria();
        saveEx.andAppServiceEqualTo(appservices.getId());
        evidenceSave = sqlSession.selectOne("com.itrus.portal.db.EvidenceSaveServiceMapper.selectByExample", save);
    }
    uiModel.addAttribute("evidenceSave", evidenceSave);
    // }
    uiModel.addAttribute("datetime", new Date());
    uiModel.addAttribute("sun", sun);
    uiModel.addAttribute("enclosure", enclosure);
    if (enclosure.size() != 0) {
        // uiModel.addAttribute("fixationTime", enclosure.get(0).getFixationTime());// 最新一次更新时间
        // 第一次更新时间
        uiModel.addAttribute("dataTime", enclosure.get(enclosure.size() - 1).getFixationTime());
    }
    uiModel.addAttribute("mevencontent", mevencontent.get(0));
    uiModel.addAttribute("basic", basic);
    // }
    return "reporttemplate/receiptTemplate1";
}
Also used : AppService(com.itrus.portal.db.AppService) EvidenceBasicInformation(com.itrus.portal.db.EvidenceBasicInformation) HashMap(java.util.HashMap) EvidenceSaveService(com.itrus.portal.db.EvidenceSaveService) EvidenceEnclosure(com.itrus.portal.db.EvidenceEnclosure) EvidenceEventContentExample(com.itrus.portal.db.EvidenceEventContentExample) Date(java.util.Date) EvidenceBasicInformationExample(com.itrus.portal.db.EvidenceBasicInformationExample) EvidenceSaveServiceExample(com.itrus.portal.db.EvidenceSaveServiceExample) Map(java.util.Map) HashMap(java.util.HashMap) EvidenceEventContent(com.itrus.portal.db.EvidenceEventContent) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with AppService

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

the class SaveServiceController method create.

// 返回新建页面
@RequestMapping(params = "form", produces = "text/html")
public String create(Model uiModel) {
    AppServiceExample ase = new AppServiceExample();
    AppServiceExample.Criteria asec = ase.createCriteria();
    asec.andTypeEqualTo(3L);
    asec.andServiceConfigNameEqualTo("EvidenceOutServiceConfig");
    List<AppService> appServiceList = sqlSession.selectList("com.itrus.portal.db.AppServiceMapper.selectByExample", ase);
    uiModel.addAttribute("appServiceList", appServiceList);
    return "saveservice/create";
}
Also used : AppService(com.itrus.portal.db.AppService) AppServiceExample(com.itrus.portal.db.AppServiceExample) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 5 with AppService

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

the class SaveServiceController method show.

// 显示详情
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) {
    EvidenceSaveService saveService = saveServiceImpl.selectServiceById(id);
    uiModel.addAttribute("saveService", saveService);
    AppService appService = appServiceImpl.selectById(saveService.getAppService());
    uiModel.addAttribute("appService", appService);
    AppServiceExample ase = new AppServiceExample();
    AppServiceExample.Criteria asec = ase.createCriteria();
    asec.andTypeEqualTo(3L);
    asec.andServiceConfigNameEqualTo("EvidenceOutServiceConfig");
    List<AppService> appServiceList = sqlSession.selectList("com.itrus.portal.db.AppServiceMapper.selectByExample", ase);
    uiModel.addAttribute("appServiceList", appServiceList);
    return "saveservice/show";
}
Also used : AppService(com.itrus.portal.db.AppService) EvidenceSaveService(com.itrus.portal.db.EvidenceSaveService) AppServiceExample(com.itrus.portal.db.AppServiceExample) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

AppService (com.itrus.portal.db.AppService)53 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)34 HashMap (java.util.HashMap)25 ApplicationInfo (com.itrus.portal.db.ApplicationInfo)19 Date (java.util.Date)16 EvidenceBasicInformation (com.itrus.portal.db.EvidenceBasicInformation)13 ArrayList (java.util.ArrayList)12 AppServiceExample (com.itrus.portal.db.AppServiceExample)10 EvidenceOutServiceConfig (com.itrus.portal.db.EvidenceOutServiceConfig)9 EvidenceSaveService (com.itrus.portal.db.EvidenceSaveService)9 EvidenceEnclosure (com.itrus.portal.db.EvidenceEnclosure)8 IOException (java.io.IOException)8 List (java.util.List)8 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)8 JSONObject (com.alibaba.fastjson.JSONObject)7 AppServiceAuthentication (com.itrus.portal.db.AppServiceAuthentication)7 EvidenceEnclosureExample (com.itrus.portal.db.EvidenceEnclosureExample)6 EvidenceHisCertificate (com.itrus.portal.db.EvidenceHisCertificate)6 Map (java.util.Map)6 EvidenceHisRelationship (com.itrus.portal.db.EvidenceHisRelationship)5