Search in sources :

Example 1 with EvidenceSignetPlaceConfig

use of com.itrus.portal.db.EvidenceSignetPlaceConfig 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 2 with EvidenceSignetPlaceConfig

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

the class OutServiceConfigServiceImpl method deleteOutServiceConfig.

/**
 * 删除出证服务
 * @param serviceId
 * @param outServiceConfigId
 */
public void deleteOutServiceConfig(Long serviceId, Long outServiceConfigId) {
    DefaultTransactionDefinition def = new DefaultTransactionDefinition();
    def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    TransactionStatus status = transactionManager.getTransaction(def);
    try {
        List<EvidenceSignetPlaceConfig> signetPlaceConfigs = signetPlaceConfigService.selectSignetPlaceConfigByList(outServiceConfigId);
        for (EvidenceSignetPlaceConfig signetPlaceConfig : signetPlaceConfigs) {
            signetPlaceConfigService.deleteSignetPlaceConfigById(signetPlaceConfig.getId());
        }
        sqlSession.flushStatements();
        deleteOutServiceConfigById(outServiceConfigId);
        appServiceImpl.deleteAppServiceById(serviceId);
        transactionManager.commit(status);
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        if (!status.isCompleted())
            transactionManager.rollback(status);
    }
}
Also used : DefaultTransactionDefinition(org.springframework.transaction.support.DefaultTransactionDefinition) EvidenceSignetPlaceConfig(com.itrus.portal.db.EvidenceSignetPlaceConfig) TransactionStatus(org.springframework.transaction.TransactionStatus)

Example 3 with EvidenceSignetPlaceConfig

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

the class HisCertificateController method savepdf.

@RequestMapping(params = "uploadPDF", method = RequestMethod.POST, produces = "text/html")
public String savepdf(MultipartFile excelFile, int id, int type, HttpServletRequest request, Model uiModel) throws Exception {
    JSONObject ret_data = null;
    BufferedInputStream bin = null;
    ByteArrayOutputStream baos = null;
    BufferedOutputStream bout = null;
    String fileName = excelFile.getOriginalFilename();
    // 文件类型
    String fileType = FilenameUtils.getExtension(fileName);
    if ((!fileType.toLowerCase().equals("pdf"))) {
        error = "上传失败,上传的文件不是以‘.pdf’文件名结尾";
        return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
    }
    // 得到出征信息
    EvidenceHisCertificateExample hiscer = new EvidenceHisCertificateExample();
    EvidenceHisCertificateExample.Criteria tificate = hiscer.createCriteria();
    tificate.andSerialnumberEqualTo(contractNumber);
    EvidenceHisCertificate hisCertificate = sqlSession.selectOne("com.itrus.portal.db.EvidenceHisCertificateMapper.selectByExample", hiscer);
    // 得到出证关系表
    EvidenceHisRelationshipExample hisrelation = new EvidenceHisRelationshipExample();
    EvidenceHisRelationshipExample.Criteria shipEx = hisrelation.createCriteria();
    shipEx.andHisCertificateEqualTo(hisCertificate.getId());
    List<EvidenceHisRelationship> hisrelationship = sqlSession.selectList("com.itrus.portal.db.EvidenceHisRelationshipMapper.selectByExample", hisrelation);
    try {
        // 建立读取文件的文件输出流
        // fin = new FileInputStream(excelFile.getName());
        // 在文件输出流上安装节点流(更大效率读取)
        // 读取文件流
        bin = new BufferedInputStream(excelFile.getInputStream());
        // 创建一个新的 byte 数组输出流,它具有指定大小的缓冲区容量
        baos = new ByteArrayOutputStream();
        // 创建一个新的缓冲输出流,以将数据写入指定的底层输出流
        bout = new BufferedOutputStream(baos);
        byte[] buffer = new byte[1024];
        int len = bin.read(buffer);
        while (len != -1) {
            bout.write(buffer, 0, len);
            len = bin.read(buffer);
        }
        // 刷新此输出流并强制写出所有缓冲的输出字节,必须这行代码,否则有可能有问题
        bout.flush();
        byte[] bytes = baos.toByteArray();
        // sun公司的API
        // return encoder.encodeBuffer(bytes).trim();
        // apache公司的API
        String base64 = Base64.encodeBase64String(bytes);
        RealNameAuthentication realNameAuthentication = CacheCustomer.getAUTH_CONFIG_MAP().get(2);
        if (realNameAuthentication == null) {
            realNameAuthentication = realNameAuthenticationSerivce.getRealNameAuthenticationByTwo();
        }
        if (realNameAuthentication == null) {
            error = "无服务路径";
            return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
        }
        // 得到服务编码
        AppService appservice = appService.selectById(hisCertificate.getHisAppService());
        // 得到出证服务配置
        EvidenceOutServiceConfigExample saveService = new EvidenceOutServiceConfigExample();
        EvidenceOutServiceConfigExample.Criteria saveServiceEx = saveService.createCriteria();
        saveServiceEx.andAppServiceEqualTo(appservice.getId());
        EvidenceOutServiceConfig outService = sqlSession.selectOne("com.itrus.portal.db.EvidenceOutServiceConfigMapper.selectByExample", saveService);
        // 得到出证名称
        if (outService == null) {
            error = "无服务配置";
            return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
        }
        // 得到证书信息
        EvidenceCertificate certificate = sqlSession.selectOne("com.itrus.portal.db.EvidenceCertificateMapper.selectByPrimaryKey", outService.getEvidenceCertificate());
        if (certificate == null) {
            error = "无证书信息";
            return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
        }
        // 得到密钥信息
        EvidenceSecretKey secrerkey = sqlSession.selectOne("com.itrus.portal.db.EvidenceSecretKeyMapper.selectByPrimaryKey", certificate.getEvidenceSecretKey());
        EvidenceEnclosure enclosure = new EvidenceEnclosure();
        // 得到签章位置配置信息
        EvidenceSignetPlaceConfigExample signet = new EvidenceSignetPlaceConfigExample();
        EvidenceSignetPlaceConfigExample.Criteria palace = signet.createCriteria();
        palace.andEvidenceOutServiceConfigEqualTo(outService.getId());
        List<EvidenceSignetPlaceConfig> configlist = sqlSession.selectList("com.itrus.portal.db.EvidenceSignetPlaceConfigMapper.selectByExample", signet);
        // 得到接口路径
        String urlAgent = realNameAuthentication.getRealNameddress() + PDF_SIGN;
        Map<String, Object> paramsAgent = new HashMap<String, Object>();
        // 参数信息
        paramsAgent.put("alias", secrerkey.getAlias());
        paramsAgent.put("pdfContent", base64);
        for (EvidenceSignetPlaceConfig config : configlist) {
            // 获取签章信息
            List<Map> list = new ArrayList<Map>();
            Map<String, String> map = new HashMap<String, String>();
            if (config != null) {
                if (config.getType() == 2) {
                    // 参数信息
                    map.put("y", config.getDistanceToDown());
                    // 参数信息
                    map.put("width", config.getWidthOfImage());
                    // 参数信息
                    map.put("height", config.getHeightOfImage());
                    list.add(map);
                    paramsAgent.put("pagingSeal", JSON.toJSONString(list));
                } else if (config.getType() == 3) {
                    // 参数信息
                    map.put("page", config.getPage());
                    // 参数信息
                    map.put("x", config.getDistanceToLeft());
                    // 参数信息
                    map.put("y", config.getDistanceToDown());
                    // 参数信息
                    map.put("width", config.getWidthOfImage());
                    // 参数信息
                    map.put("height", config.getHeightOfImage());
                    list.add(map);
                    paramsAgent.put("multiPagesSeal", JSON.toJSONString(list));
                } else if (config.getType() == 1) {
                    // 参数信息
                    map.put("keyWord", config.getKeyword());
                    // 参数信息
                    map.put("page", config.getPage());
                    // 参数信息
                    map.put("width", config.getWidthOfImage());
                    // 参数信息
                    map.put("height", config.getHeightOfImage());
                    list.add(map);
                    paramsAgent.put("keyWordSeal", JSON.toJSONString(list));
                }
            }
        }
        boolean isbool = true;
        String signedPdf = null;
        if (outService.getIsAddTimestamp() == 2) {
            isbool = false;
        }
        // 参数信息
        paramsAgent.put("timeStamp", isbool);
        // paramsAgent.put("resultType",2L);//参数信息
        // 调用签章接口返回数据
        String repAgent = HttpClientUtil.postForm(urlAgent, AuthService.getHeader(), paramsAgent);
        // 把数据转换为json格式
        ret_data = JSONObject.parseObject(repAgent);
        if (ret_data.getIntValue("code") != 0) {
            // 判断是否成功
            String oper = "出证报告失败-pdf签章失败";
            String info = "错误原因:" + ret_data.getString("message");
            LogUtil.evidencelog(sqlSession, null, oper, info);
            error = ret_data.getString("message");
            // 修改证据中的出证状态
            for (EvidenceHisRelationship h : hisrelationship) {
                // 得到基本信息表
                EvidenceBasicInformation basic = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", h.getBasicInformation());
                basic.setStatus(4);
                sqlSession.update("com.itrus.portal.db.EvidenceBasicInformationMapper.updateByPrimaryKey", basic);
            }
            return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
        } else {
            // 证书base编码
            signedPdf = ret_data.getString("signedPdf");
            // 正式系统将hood替换为/**/重的值
            String retpdf = EvidenceSaveServiceApi.storageSave("ST_O", "hood", /*realNameAuthentication.getKeyCode()*/
            hisCertificate.getSerialnumber() + ".pdf", "CT_MESSAGE", signedPdf, null, null, null, null, null, false, null, realNameAuthentication.getRealNameddress());
            // 把数据转换为json格式
            ret_data = JSONObject.parseObject(retpdf);
            if (ret_data.getInteger("code") == 0) {
                // 获取证据附件表
                EvidenceEnclosureExample envlosureE = new EvidenceEnclosureExample();
                EvidenceEnclosureExample.Criteria envlosureEx = envlosureE.createCriteria();
                envlosureEx.andSerialnumberEqualTo(hisCertificate.getSerialnumber());
                envlosureEx.andPdfTypeEqualTo("4");
                EvidenceEnclosure envlosure = sqlSession.selectOne("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", envlosureE);
                if (envlosure != null && envlosure.getPdfType() != null) {
                    envlosure.setPdfType("4");
                    envlosure.setEvidenceSn(null);
                    envlosure.setSerialnumber(hisCertificate.getSerialnumber());
                    envlosure.setType("ST_E");
                    envlosure.setContentType("CT_BASE64_DATA");
                    envlosure.setBucketName(realNameAuthentication.getKeyCode());
                    envlosure.setObjectName(fileName);
                    envlosure.setAlias(secrerkey.getAlias());
                    envlosure.setFilesize(null);
                    envlosure.setApplicationTime(new Date());
                    envlosure.setFixationTime(new Date());
                    envlosure.setSaveFactor(null);
                    envlosure.setBuid(ret_data.getString("buid").toString());
                    // ret_data.remove("saveFactor");
                    sqlSession.update("com.itrus.portal.db.EvidenceEnclosureMapper.updateByPrimaryKey", envlosure);
                } else {
                    enclosure.setPdfType("4");
                    enclosure.setEvidenceSn(null);
                    enclosure.setSerialnumber(hisCertificate.getSerialnumber());
                    enclosure.setType("ST_E");
                    enclosure.setContentType("CT_BASE64_DATA");
                    enclosure.setBucketName(realNameAuthentication.getKeyCode());
                    enclosure.setObjectName(fileName);
                    enclosure.setAlias(secrerkey.getAlias());
                    enclosure.setFilesize(null);
                    enclosure.setApplicationTime(new Date());
                    enclosure.setFixationTime(new Date());
                    enclosure.setSaveFactor(null);
                    enclosure.setBuid(ret_data.getString("buid").toString());
                    // ret_data.remove("saveFactor");
                    sqlSession.insert("com.itrus.portal.db.EvidenceEnclosureMapper.insert", enclosure);
                }
                hisCertificate.setHisTime(new Date());
                hisCertificate.setHisway("2");
                hisCertificate.setHisState("0");
                hisCertificate.setOutState(0);
                sqlSession.update("com.itrus.portal.db.EvidenceHisCertificateMapper.updateByPrimaryKey", hisCertificate);
                // 修改证据中的出证状态
                for (EvidenceHisRelationship h : hisrelationship) {
                    // 得到基本信息表
                    EvidenceBasicInformation basic = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", h.getBasicInformation());
                    basic.setStatus(2);
                    sqlSession.update("com.itrus.portal.db.EvidenceBasicInformationMapper.updateByPrimaryKey", basic);
                }
                error = "上传pdf成功";
                String oper = "pdf上传成功";
                String info = "存储编号:" + ret_data.getString("buid").toString() + "pdf名称:" + hisCertificate.getSerialnumber();
                LogUtil.evidencelog(sqlSession, null, oper, info);
            }
        }
    } catch (FileNotFoundException e) {
        // 修改证据中的出证状态
        for (EvidenceHisRelationship h : hisrelationship) {
            // 得到基本信息表
            EvidenceBasicInformation basic = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", h.getBasicInformation());
            basic.setStatus(4);
            sqlSession.update("com.itrus.portal.db.EvidenceBasicInformationMapper.updateByPrimaryKey", basic);
        }
        e.printStackTrace();
        String oper = "pdf上传失败";
        String info = "失败原因:" + e.getMessage();
        LogUtil.evidencelog(sqlSession, null, oper, info);
        error = e.getMessage();
        return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
    } catch (IOException e) {
        // 修改证据中的出证状态
        for (EvidenceHisRelationship h : hisrelationship) {
            // 得到基本信息表
            EvidenceBasicInformation basic = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", h.getBasicInformation());
            basic.setStatus(4);
            sqlSession.update("com.itrus.portal.db.EvidenceBasicInformationMapper.updateByPrimaryKey", basic);
        }
        e.printStackTrace();
        String oper = "pdf上传失败";
        String info = "失败原因:" + e.getMessage();
        LogUtil.evidencelog(sqlSession, null, oper, info);
        error = e.getMessage();
        return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
    } finally {
        try {
            bin.close();
            // 关闭 ByteArrayOutputStream 无效。此类中的方法在关闭此流后仍可被调用,而不会产生任何
            // IOException
            // 暂时关闭掉
            baos.close();
            bout.close();
        } catch (IOException e) {
            e.printStackTrace();
            error = e.getMessage();
            return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
        }
    }
    return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
}
Also used : HashMap(java.util.HashMap) EvidenceBasicInformation(com.itrus.portal.db.EvidenceBasicInformation) ArrayList(java.util.ArrayList) FileNotFoundException(java.io.FileNotFoundException) EvidenceHisCertificate(com.itrus.portal.db.EvidenceHisCertificate) EvidenceEnclosure(com.itrus.portal.db.EvidenceEnclosure) RealNameAuthentication(com.itrus.portal.db.RealNameAuthentication) EvidenceOutServiceConfig(com.itrus.portal.db.EvidenceOutServiceConfig) EvidenceSignetPlaceConfigExample(com.itrus.portal.db.EvidenceSignetPlaceConfigExample) BufferedInputStream(java.io.BufferedInputStream) EvidenceCertificate(com.itrus.portal.db.EvidenceCertificate) BufferedOutputStream(java.io.BufferedOutputStream) AppService(com.itrus.portal.db.AppService) EvidenceOutServiceConfigExample(com.itrus.portal.db.EvidenceOutServiceConfigExample) EvidenceSignetPlaceConfig(com.itrus.portal.db.EvidenceSignetPlaceConfig) EvidenceHisRelationship(com.itrus.portal.db.EvidenceHisRelationship) EvidenceEnclosureExample(com.itrus.portal.db.EvidenceEnclosureExample) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException) EvidenceSecretKey(com.itrus.portal.db.EvidenceSecretKey) EvidenceHisRelationshipExample(com.itrus.portal.db.EvidenceHisRelationshipExample) Date(java.util.Date) JSONObject(com.alibaba.fastjson.JSONObject) EvidenceHisCertificateExample(com.itrus.portal.db.EvidenceHisCertificateExample) JSONObject(com.alibaba.fastjson.JSONObject) Map(java.util.Map) HashMap(java.util.HashMap) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with EvidenceSignetPlaceConfig

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

the class OutServiceConfigController method update.

// 修改处理
@RequestMapping(method = RequestMethod.PUT, produces = "text/html")
public String update(@ModelAttribute("evidenceOutServiceConfig") EvidenceOutServiceConfig evidenceOutServiceConfig, @ModelAttribute("appService") AppService appService, @RequestParam(required = false, value = "id1") Long id1, @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 = "id2") Long id2, @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 = "id3") Long id3, @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()) {
        Map<String, Object> param = new HashMap<String, Object>();
        param.put("id", evidenceOutServiceConfig.getId());
        List<Map<String, Object>> outServiceConfig = outServiceConfigService.selectOutServiceConfigByList(param);
        uiModel.addAttribute("outServiceConfig", outServiceConfig.get(0));
        // 得到对应的签章位置配置信息
        List<EvidenceSignetPlaceConfig> signetPlaceConfigList = signetPlaceConfigService.selectSignetPlaceConfigByList(evidenceOutServiceConfig.getId());
        for (int i = 0; i < signetPlaceConfigList.size(); i++) {
            uiModel.addAttribute("signetPlaceConfig_" + (i + 1), signetPlaceConfigList.get(i));
        }
        List<EvidenceOutTemplate> outTemplateList = outServiceConfigService.selectOutTemplateByList();
        uiModel.addAttribute("outTemplateList", outTemplateList);
        List<EvidenceCertificate> certificateList = certificateService.getSignatureList();
        uiModel.addAttribute("certificateList", certificateList);
        return "outserviceconfig/update";
    }
    if (evidenceOutServiceConfig.getOutWay() == 0) {
        evidenceOutServiceConfig.setOutWay(null);
    }
    if (evidenceOutServiceConfig.getOutReportTemplate() == 0) {
        evidenceOutServiceConfig.setOutReportTemplate(null);
    }
    if (evidenceOutServiceConfig.getSaveRetTemplate() == 0) {
        evidenceOutServiceConfig.setSaveRetTemplate(null);
    }
    if (evidenceOutServiceConfig.getEvidenceCertificate() == 0) {
        evidenceOutServiceConfig.setEvidenceCertificate(null);
    }
    EvidenceSignetPlaceConfig signetPlaceConfigOne = null;
    EvidenceSignetPlaceConfig signetPlaceConfigTwo = null;
    EvidenceSignetPlaceConfig signetPlaceConfigThree = null;
    if (type1 != null && type1 != 0) {
        if (id1 != null) {
            signetPlaceConfigOne = signetPlaceConfigService.selectById(id1);
        } else {
            signetPlaceConfigOne = new EvidenceSignetPlaceConfig();
        }
        signetPlaceConfigOne.setType(type1);
        signetPlaceConfigOne.setKeyword(keyword1);
        signetPlaceConfigOne.setPage(page1);
        signetPlaceConfigOne.setDistanceToLeft(distanceToLeft1);
        signetPlaceConfigOne.setDistanceToDown(distanceToDown1);
        signetPlaceConfigOne.setHeightOfImage(heightOfImage1);
        signetPlaceConfigOne.setWidthOfImage(widthOfImage1);
    } else {
        if (id1 != null) {
            sqlSession.delete("com.itrus.portal.db.EvidenceSignetPlaceConfigMapper.deleteByPrimaryKey", id1);
        }
    }
    if (type2 != null && type2 != 0) {
        if (id2 != null) {
            signetPlaceConfigTwo = signetPlaceConfigService.selectById(id2);
        } else {
            signetPlaceConfigTwo = new EvidenceSignetPlaceConfig();
        }
        signetPlaceConfigTwo.setType(type2);
        signetPlaceConfigTwo.setKeyword(keyword2);
        signetPlaceConfigTwo.setPage(page2);
        signetPlaceConfigTwo.setDistanceToLeft(distanceToLeft2);
        signetPlaceConfigTwo.setDistanceToDown(distanceToDown2);
        signetPlaceConfigTwo.setHeightOfImage(heightOfImage2);
        signetPlaceConfigTwo.setWidthOfImage(widthOfImage2);
    } else {
        if (id2 != null) {
            sqlSession.delete("com.itrus.portal.db.EvidenceSignetPlaceConfigMapper.deleteByPrimaryKey", id2);
        }
    }
    if (type3 != null && type3 != 0) {
        if (id3 != null) {
            signetPlaceConfigThree = signetPlaceConfigService.selectById(id3);
        } else {
            signetPlaceConfigThree = new EvidenceSignetPlaceConfig();
        }
        signetPlaceConfigThree.setType(type3);
        signetPlaceConfigThree.setKeyword(keyword3);
        signetPlaceConfigThree.setPage(page3);
        signetPlaceConfigThree.setDistanceToLeft(distanceToLeft3);
        signetPlaceConfigThree.setDistanceToDown(distanceToDown3);
        signetPlaceConfigThree.setHeightOfImage(heightOfImage3);
        signetPlaceConfigThree.setWidthOfImage(widthOfImage3);
    } else {
        if (id3 != null) {
            sqlSession.delete("com.itrus.portal.db.EvidenceSignetPlaceConfigMapper.deleteByPrimaryKey", id3);
        }
    }
    outServiceConfigService.updateOutServiceConfigeService(evidenceOutServiceConfig, appService, signetPlaceConfigOne, signetPlaceConfigTwo, signetPlaceConfigThree, getAdmin().getId());
    String oper = "修改出证服务";
    String info = "出证服务名称: " + appService.getAppServiceName();
    LogUtil.evidencelog(sqlSession, null, oper, info);
    return "redirect:outserviceconfig/" + evidenceOutServiceConfig.getId();
}
Also used : EvidenceSignetPlaceConfig(com.itrus.portal.db.EvidenceSignetPlaceConfig) HashMap(java.util.HashMap) EvidenceCertificate(com.itrus.portal.db.EvidenceCertificate) EvidenceOutTemplate(com.itrus.portal.db.EvidenceOutTemplate) HashMap(java.util.HashMap) Map(java.util.Map) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 5 with EvidenceSignetPlaceConfig

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

the class SignetPlaceConfigServiceImpl method selectSignetPlaceConfigByList.

/**
 * 通过出证服务配置id得到对应的所以签章位置配置
 * @param outServiceConfigId
 * @return
 */
public List<EvidenceSignetPlaceConfig> selectSignetPlaceConfigByList(Long outServiceConfigId) {
    EvidenceSignetPlaceConfigExample signetPlaceConfigExample = new EvidenceSignetPlaceConfigExample();
    EvidenceSignetPlaceConfigExample.Criteria signetCriteria = signetPlaceConfigExample.createCriteria();
    signetCriteria.andEvidenceOutServiceConfigEqualTo(outServiceConfigId);
    List<EvidenceSignetPlaceConfig> signetPlaceConfigList = sqlSession.selectList("com.itrus.portal.db.EvidenceSignetPlaceConfigMapper.selectByExample", signetPlaceConfigExample);
    return signetPlaceConfigList;
}
Also used : EvidenceSignetPlaceConfig(com.itrus.portal.db.EvidenceSignetPlaceConfig) EvidenceSignetPlaceConfigExample(com.itrus.portal.db.EvidenceSignetPlaceConfigExample)

Aggregations

EvidenceSignetPlaceConfig (com.itrus.portal.db.EvidenceSignetPlaceConfig)5 EvidenceCertificate (com.itrus.portal.db.EvidenceCertificate)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 EvidenceOutTemplate (com.itrus.portal.db.EvidenceOutTemplate)2 EvidenceSignetPlaceConfigExample (com.itrus.portal.db.EvidenceSignetPlaceConfigExample)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 JSONObject (com.alibaba.fastjson.JSONObject)1 AppService (com.itrus.portal.db.AppService)1 EvidenceBasicInformation (com.itrus.portal.db.EvidenceBasicInformation)1 EvidenceEnclosure (com.itrus.portal.db.EvidenceEnclosure)1 EvidenceEnclosureExample (com.itrus.portal.db.EvidenceEnclosureExample)1 EvidenceHisCertificate (com.itrus.portal.db.EvidenceHisCertificate)1 EvidenceHisCertificateExample (com.itrus.portal.db.EvidenceHisCertificateExample)1 EvidenceHisRelationship (com.itrus.portal.db.EvidenceHisRelationship)1 EvidenceHisRelationshipExample (com.itrus.portal.db.EvidenceHisRelationshipExample)1 EvidenceOutServiceConfig (com.itrus.portal.db.EvidenceOutServiceConfig)1 EvidenceOutServiceConfigExample (com.itrus.portal.db.EvidenceOutServiceConfigExample)1 EvidenceSecretKey (com.itrus.portal.db.EvidenceSecretKey)1 RealNameAuthentication (com.itrus.portal.db.RealNameAuthentication)1