Search in sources :

Example 1 with EvidenceOutTemplate

use of com.itrus.portal.db.EvidenceOutTemplate 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 EvidenceOutTemplate

use of com.itrus.portal.db.EvidenceOutTemplate 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 EvidenceOutTemplate

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

the class OutServiceConfigController method create.

// 新建处理
@RequestMapping(method = RequestMethod.POST, produces = "text/html")
public String create(@ModelAttribute("evidenceOutServiceConfig") EvidenceOutServiceConfig outServiceConfig, @ModelAttribute("appService") AppService appService, @RequestParam(required = false, value = "type1") Integer type1, @RequestParam(required = false, value = "keyword1") String keyword1, @RequestParam(required = false, value = "page1") String page1, @RequestParam(required = false, value = "distanceToLeft1") String distanceToLeft1, @RequestParam(required = false, value = "distanceToDown1") String distanceToDown1, @RequestParam(required = false, value = "heightOfImage1") String heightOfImage1, @RequestParam(required = false, value = "widthOfImage1") String widthOfImage1, @RequestParam(required = false, value = "type2") Integer type2, @RequestParam(required = false, value = "keyword2") String keyword2, @RequestParam(required = false, value = "page2") String page2, @RequestParam(required = false, value = "distanceToLeft2") String distanceToLeft2, @RequestParam(required = false, value = "distanceToDown2") String distanceToDown2, @RequestParam(required = false, value = "heightOfImage2") String heightOfImage2, @RequestParam(required = false, value = "widthOfImage2") String widthOfImage2, @RequestParam(required = false, value = "type3") Integer type3, @RequestParam(required = false, value = "keyword3") String keyword3, @RequestParam(required = false, value = "page3") String page3, @RequestParam(required = false, value = "distanceToLeft3") String distanceToLeft3, @RequestParam(required = false, value = "distanceToDown3") String distanceToDown3, @RequestParam(required = false, value = "heightOfImage3") String heightOfImage3, @RequestParam(required = false, value = "widthOfImage3") String widthOfImage3, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
    if (bindingResult.hasErrors()) {
        List<EvidenceOutTemplate> outTemplateList = outServiceConfigService.selectOutTemplateByList();
        uiModel.addAttribute("outTemplateList", outTemplateList);
        List<EvidenceCertificate> certificateList = certificateService.getSignatureList();
        uiModel.addAttribute("certificateList", certificateList);
        return "outserviceconfig/create";
    }
    if (outServiceConfig.getOutWay() == 0) {
        outServiceConfig.setOutWay(null);
    }
    if (outServiceConfig.getOutReportTemplate() == 0) {
        outServiceConfig.setOutReportTemplate(null);
    }
    if (outServiceConfig.getSaveRetTemplate() == 0) {
        outServiceConfig.setSaveRetTemplate(null);
    }
    if (outServiceConfig.getEvidenceCertificate() == 0) {
        outServiceConfig.setEvidenceCertificate(null);
    }
    EvidenceSignetPlaceConfig signetPlaceConfigOne = new EvidenceSignetPlaceConfig();
    EvidenceSignetPlaceConfig signetPlaceConfigTwo = new EvidenceSignetPlaceConfig();
    EvidenceSignetPlaceConfig signetPlaceConfigThree = new EvidenceSignetPlaceConfig();
    if (type1 != null && type1 != 0) {
        signetPlaceConfigOne.setType(type1);
        signetPlaceConfigOne.setKeyword(keyword1);
        signetPlaceConfigOne.setPage(page1);
        signetPlaceConfigOne.setDistanceToLeft(distanceToLeft1);
        signetPlaceConfigOne.setDistanceToDown(distanceToDown1);
        signetPlaceConfigOne.setHeightOfImage(heightOfImage1);
        signetPlaceConfigOne.setWidthOfImage(widthOfImage1);
    }
    if (type2 != null && type2 != 0) {
        signetPlaceConfigTwo.setType(type2);
        signetPlaceConfigTwo.setKeyword(keyword2);
        signetPlaceConfigTwo.setPage(page2);
        signetPlaceConfigTwo.setDistanceToLeft(distanceToLeft2);
        signetPlaceConfigTwo.setDistanceToDown(distanceToDown2);
        signetPlaceConfigTwo.setHeightOfImage(heightOfImage2);
        signetPlaceConfigTwo.setWidthOfImage(widthOfImage2);
    }
    if (type3 != null && type3 != 0) {
        signetPlaceConfigThree.setType(type3);
        signetPlaceConfigThree.setKeyword(keyword3);
        signetPlaceConfigThree.setPage(page3);
        signetPlaceConfigThree.setDistanceToLeft(distanceToLeft3);
        signetPlaceConfigThree.setDistanceToDown(distanceToDown3);
        signetPlaceConfigThree.setHeightOfImage(heightOfImage3);
        signetPlaceConfigThree.setWidthOfImage(widthOfImage3);
    }
    outServiceConfigService.saveEvidenceOutServiceConfig(outServiceConfig, appService, signetPlaceConfigOne, signetPlaceConfigTwo, signetPlaceConfigThree, getAdmin().getId());
    String oper = "添加出证服务配置";
    String info = "出证服务配置名称: " + appService.getAppServiceName();
    LogUtil.evidencelog(sqlSession, null, oper, info);
    return "redirect:outserviceconfig/" + outServiceConfig.getId();
}
Also used : EvidenceSignetPlaceConfig(com.itrus.portal.db.EvidenceSignetPlaceConfig) EvidenceCertificate(com.itrus.portal.db.EvidenceCertificate) EvidenceOutTemplate(com.itrus.portal.db.EvidenceOutTemplate) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with EvidenceOutTemplate

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

the class OutServiceConfigController method list.

// 列表显示
@RequestMapping(produces = "text/html")
public String list(@RequestParam(required = false, value = "appServiceName") String appServiceName, @RequestParam(required = false, value = "appServiceId") String appServiceId, @RequestParam(required = false, value = "outWay") Integer outWay, @RequestParam(required = false, value = "outReportTemplate") Integer outReportTemplate, @RequestParam(required = false, value = "certificateName") String certificateName, @RequestParam(required = false, value = "isServiceStatus") Integer isServiceStatus, @RequestParam(required = false, value = "queryDate1") Date queryDate1, @RequestParam(required = false, value = "queryDate2") Date queryDate2, @RequestParam(required = false, value = "message") Integer message, @RequestParam(required = false, value = "page") Integer page, @RequestParam(required = false, value = "size") Integer size, HttpServletRequest request, Model uiModel) {
    // 补全日期
    if (queryDate1 == null && queryDate2 == null) {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DATE, 1);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        calendar.add(Calendar.MILLISECOND, -1);
        queryDate2 = calendar.getTime();
        calendar.add(Calendar.MILLISECOND, 1);
        calendar.add(Calendar.MONTH, -1);
        queryDate1 = calendar.getTime();
    }
    Map<String, Object> param = new HashMap<String, Object>();
    // page,size
    if (page == null || page < 1)
        page = 1;
    if (size == null || size < 1)
        size = 10;
    Integer offset = size * (page - 1);
    param.put("offset", offset);
    param.put("limit", size);
    param.put("queryDate1", queryDate1);
    param.put("queryDate2", queryDate2);
    param.put("isServiceStatus", isServiceStatus);
    param.put("outWay", outWay);
    param.put("outReportTemplate", outReportTemplate);
    if (StringUtils.isNotEmpty(appServiceName)) {
        param.put("appServiceName", "%" + appServiceName + "%");
    }
    if (StringUtils.isNotEmpty(appServiceId)) {
        param.put("appServiceId", "%" + appServiceId + "%");
    }
    if (StringUtils.isNotEmpty(certificateName)) {
        param.put("certificateName", "%" + certificateName + "%");
    }
    // 查询列表对应展示数据
    List<Map<String, Object>> outServiceConfigList = outServiceConfigService.selectOutServiceConfigByList(param);
    int count = outServiceConfigService.selectOutServiceConfigByCount(param);
    // page, size
    if (page > 1 && size * (page - 1) >= count) {
        page = (count + size - 1) / size;
    }
    // 得到 全部出证报告模板
    List<EvidenceOutTemplate> outTemplateList = outServiceConfigService.selectOutTemplateByList();
    uiModel.addAttribute("outTemplateList", outTemplateList);
    uiModel.addAttribute("outServiceConfigList", outServiceConfigList);
    uiModel.addAttribute("count", count);
    uiModel.addAttribute("pages", (count + size - 1) / size);
    uiModel.addAttribute("page", page);
    uiModel.addAttribute("size", size);
    uiModel.addAttribute("appServiceName", appServiceName);
    uiModel.addAttribute("appServiceId", appServiceId);
    uiModel.addAttribute("out_way", outWay);
    uiModel.addAttribute("outReportTemplate", outReportTemplate);
    uiModel.addAttribute("isServiceStatus", isServiceStatus);
    uiModel.addAttribute("certificateName", certificateName);
    uiModel.addAttribute("queryDate1", queryDate1);
    uiModel.addAttribute("queryDate2", queryDate2);
    return "outserviceconfig/list";
}
Also used : HashMap(java.util.HashMap) Calendar(java.util.Calendar) EvidenceOutTemplate(com.itrus.portal.db.EvidenceOutTemplate) HashMap(java.util.HashMap) Map(java.util.Map) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 5 with EvidenceOutTemplate

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

the class StatisticsIssuingController method list.

@RequestMapping(produces = "text/html")
public String list(@RequestParam(value = "serviceRequestPlatform", required = false) String serviceRequestPlatform, @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 = "hisApplicant", required = false) String hisApplicant, @RequestParam(value = "type", required = false) String type, @RequestParam(value = "outReportTemplate", required = false) String outReportTemplate, @RequestParam(value = "hisway", required = false) String hisway, 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(serviceRequestPlatform) && !"0".equals(serviceRequestPlatform)) {
                    param.put("serviceRequestPlatform", serviceRequestPlatform);
                }
                if (StringUtils.isNotEmpty(hisApplicant)) {
                    param.put("hisApplicant", "%" + hisApplicant + "%");
                }
                if (type != null && !"0".equals(type)) {
                    param.put("type", type);
                }
                if (outReportTemplate != null && !"0".equals(outReportTemplate)) {
                    param.put("outReportTemplate", outReportTemplate);
                }
                if (hisway != null && !"0".equals(hisway)) {
                    param.put("hisway", hisway);
                }
                month = year1 + "-" + monthList[j];
                param.put("queryDate1", dt1);
                param.put("queryDate2", dt2);
                int count = hiscertificate.selectcount(param);
                Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                map.put(1, year1);
                map.put(2, count);
                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(serviceRequestPlatform) && !"0".equals(serviceRequestPlatform)) {
                    param.put("serviceRequestPlatform", serviceRequestPlatform);
                }
                if (StringUtils.isNotEmpty(hisApplicant)) {
                    param.put("hisApplicant", "%" + hisApplicant + "%");
                }
                if (type != null && !"0".equals(type)) {
                    param.put("type", type);
                }
                if (outReportTemplate != null && !"0".equals(outReportTemplate)) {
                    param.put("outReportTemplate", outReportTemplate);
                }
                if (hisway != null && !"0".equals(hisway)) {
                    param.put("hisway", hisway);
                }
                month = year1 + "-" + monthList[j];
                param.put("queryDate1", dt1);
                param.put("queryDate2", dt2);
                int count = hiscertificate.selectcount(param);
                Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                map.put(1, year1);
                map.put(2, count);
                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(serviceRequestPlatform) && !"0".equals(serviceRequestPlatform)) {
                param.put("serviceRequestPlatform", serviceRequestPlatform);
            }
            if (StringUtils.isNotEmpty(hisApplicant)) {
                param.put("hisApplicant", "%" + hisApplicant + "%");
            }
            if (type != null && !"0".equals(type)) {
                param.put("type", type);
            }
            if (outReportTemplate != null && !"0".equals(outReportTemplate)) {
                param.put("outReportTemplate", outReportTemplate);
            }
            if (hisway != null && !"0".equals(hisway)) {
                param.put("hisway", hisway);
            }
            year = year + "Y";
            param.put("queryDate1", dt1);
            param.put("queryDate2", dt2);
            int count = hiscertificate.selectcount(param);
            Map<Integer, Integer> map = new HashMap<Integer, Integer>();
            map.put(1, year1);
            map.put(2, count);
            list.add(map);
            year1++;
        }
    }
    List appservice = applicationInfoService.selectByExample(new ApplicationInfoExample());
    uiModel.addAttribute("appservice", appservice);
    if (null == serviceRequestPlatform || "0".equals(serviceRequestPlatform)) {
        serviceRequestPlatform = "所有应用";
    }
    List<EvidenceBasicInformation> basicinfo = basicInformationimpl.selectList();
    uiModel.addAttribute("basicinfo", basicinfo);
    List<EvidenceOutTemplate> outRemplate = outServiceConfigService.selectOutTemplateByList();
    uiModel.addAttribute("outRemplate", outRemplate);
    if (null == serviceRequestPlatform || "0".equals(serviceRequestPlatform)) {
        serviceRequestPlatform = "所有应用";
    }
    uiModel.addAttribute("list", list);
    // System.out.println(list);
    uiModel.addAttribute("year1", year3);
    uiModel.addAttribute("serviceRequestPlatform", serviceRequestPlatform);
    uiModel.addAttribute("year2", year2);
    uiModel.addAttribute("Statistics", Statistics);
    uiModel.addAttribute("hisApplicant", hisApplicant);
    uiModel.addAttribute("type", type);
    uiModel.addAttribute("outReportTemplate", outReportTemplate);
    uiModel.addAttribute("hisway", hisway);
    return "sratisticsissuing/list";
}
Also used : ApplicationInfoExample(com.itrus.portal.db.ApplicationInfoExample) HashMap(java.util.HashMap) EvidenceBasicInformation(com.itrus.portal.db.EvidenceBasicInformation) Date(java.util.Date) Calendar(java.util.Calendar) ArrayList(java.util.ArrayList) Date(java.util.Date) ArrayList(java.util.ArrayList) List(java.util.List) EvidenceOutTemplate(com.itrus.portal.db.EvidenceOutTemplate) HashMap(java.util.HashMap) Map(java.util.Map) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

EvidenceOutTemplate (com.itrus.portal.db.EvidenceOutTemplate)11 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)10 HashMap (java.util.HashMap)7 EvidenceBasicInformation (com.itrus.portal.db.EvidenceBasicInformation)6 EvidenceHisCertificate (com.itrus.portal.db.EvidenceHisCertificate)5 ArrayList (java.util.ArrayList)5 AppService (com.itrus.portal.db.AppService)4 EvidenceEnclosure (com.itrus.portal.db.EvidenceEnclosure)4 EvidenceEnclosureExample (com.itrus.portal.db.EvidenceEnclosureExample)4 EvidenceHisRelationship (com.itrus.portal.db.EvidenceHisRelationship)4 EvidenceMainInformation (com.itrus.portal.db.EvidenceMainInformation)4 EvidenceOutServiceConfig (com.itrus.portal.db.EvidenceOutServiceConfig)4 EvidenceOutServiceConfigExample (com.itrus.portal.db.EvidenceOutServiceConfigExample)4 List (java.util.List)4 Map (java.util.Map)4 EvidenceHisRelationshipExample (com.itrus.portal.db.EvidenceHisRelationshipExample)3 EvidenceSubjectIdentity (com.itrus.portal.db.EvidenceSubjectIdentity)3 EvidenceSubjectIdentityExample (com.itrus.portal.db.EvidenceSubjectIdentityExample)3 Calendar (java.util.Calendar)3 Date (java.util.Date)3