Search in sources :

Example 6 with EvidenceOutServiceConfig

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

the class HisCertificateController method show.

/**
 * 查看详情
 *
 * @param id
 * @param type
 * @param uiModel
 * @return
 */
@RequestMapping(value = "/{id}/{type}", produces = "text/html")
public String show(@PathVariable("id") Long id, @PathVariable("type") int type, Model uiModel) {
    EvidenceHisCertificate hisCertificate = hiscertificate.selectById(id);
    // 出征流水号
    contractNumber = hisCertificate.getSerialnumber();
    // 得到服务编码
    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);
    // 获取证据附件表
    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);
    Map<Long, List<EvidenceMainInformation>> minfo = new HashMap<Long, List<EvidenceMainInformation>>();
    // Map<Long, List<EvidenceBasicInformation>> mbasi = new HashMap<Long,
    // List<EvidenceBasicInformation>>();
    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);
    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) {
        // 待出证
        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 7 with EvidenceOutServiceConfig

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

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

the class OutServiceConfigController method delete.

// 删除处理
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = "text/html")
@ResponseBody
public String delete(@PathVariable("id") Long id, HttpServletRequest request, Model uiModel) {
    EvidenceOutServiceConfig outServiceConfig = outServiceConfigService.selectById(id);
    if (outServiceConfig == null) {
        // uiModel.addAttribute("message", "未找到要删除的实名认证服务");
        return "未找到要删除的存证服务";
    }
    AppService appService = appServiceImpl.selectById(outServiceConfig.getAppService());
    int count = appServiceImpl.selectAppInfoConuntById(appService.getId());
    if (count > 0) {
        // uiModel.addAttribute("message", "此条服务与计费配置存在关联,不能删除");
        return "此条服务与计费配置存在关联,不能删除";
    }
    try {
        outServiceConfigService.deleteOutServiceConfig(appService.getId(), outServiceConfig.getId());
        String oper = "删除出证服务";
        String info = "出证服务名称: " + appService.getAppServiceName();
        LogUtil.evidencelog(sqlSession, null, oper, info);
        return null;
    } catch (Exception e) {
        // + "】存在关联,无法删除");
        return "要删除应用【" + appService.getAppServiceName() + "】存在关联,无法删除";
    }
}
Also used : AppService(com.itrus.portal.db.AppService) EvidenceOutServiceConfig(com.itrus.portal.db.EvidenceOutServiceConfig) IOException(java.io.IOException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 9 with EvidenceOutServiceConfig

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

the class OutServiceConfigServiceImpl method updateOutServiceConfigeService.

/**
 * 修改出证服务
 * @param evidenceSaveService
 * @param appService
 * @param id
 */
public void updateOutServiceConfigeService(EvidenceOutServiceConfig outServiceConfig, AppService appService, EvidenceSignetPlaceConfig signetPlaceConfigOne, EvidenceSignetPlaceConfig signetPlaceConfigTwo, EvidenceSignetPlaceConfig signetPlaceConfigThree, Long adminId) {
    DefaultTransactionDefinition def = new DefaultTransactionDefinition();
    def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    TransactionStatus status = transactionManager.getTransaction(def);
    try {
        // 修改出证服务配置表
        EvidenceOutServiceConfig outServiceConfig0 = selectById(outServiceConfig.getId());
        outServiceConfig.setAppService(outServiceConfig0.getAppService());
        sqlSession.update("com.itrus.portal.db.EvidenceOutServiceConfigMapper.updateByPrimaryKey", outServiceConfig);
        // 修改签章位置配置
        if (signetPlaceConfigOne != null && signetPlaceConfigOne.getType() != null) {
            if (signetPlaceConfigOne.getId() == null) {
                signetPlaceConfigOne.setEvidenceOutServiceConfig(outServiceConfig.getId());
                sqlSession.insert("com.itrus.portal.db.EvidenceSignetPlaceConfigMapper.insert", signetPlaceConfigOne);
                sqlSession.flushStatements();
            } else {
                sqlSession.update("com.itrus.portal.db.EvidenceSignetPlaceConfigMapper.updateByPrimaryKey", signetPlaceConfigOne);
            }
        }
        if (signetPlaceConfigTwo != null && signetPlaceConfigTwo.getType() != null) {
            if (signetPlaceConfigTwo.getId() == null) {
                signetPlaceConfigTwo.setEvidenceOutServiceConfig(outServiceConfig.getId());
                sqlSession.insert("com.itrus.portal.db.EvidenceSignetPlaceConfigMapper.insert", signetPlaceConfigTwo);
                sqlSession.flushStatements();
            } else {
                sqlSession.update("com.itrus.portal.db.EvidenceSignetPlaceConfigMapper.updateByPrimaryKey", signetPlaceConfigTwo);
            }
        }
        if (signetPlaceConfigThree != null && signetPlaceConfigThree.getType() != null) {
            if (signetPlaceConfigThree.getId() == null) {
                signetPlaceConfigThree.setEvidenceOutServiceConfig(outServiceConfig.getId());
                sqlSession.insert("com.itrus.portal.db.EvidenceSignetPlaceConfigMapper.insert", signetPlaceConfigThree);
                sqlSession.flushStatements();
            } else {
                sqlSession.update("com.itrus.portal.db.EvidenceSignetPlaceConfigMapper.updateByPrimaryKey", signetPlaceConfigThree);
            }
        }
        // 修改应用服务表
        AppService appService0 = appServiceImpl.selectById(appService.getId());
        appService.setCreator(appService0.getCreator());
        appService.setCreateTime(appService0.getCreateTime());
        appService.setType(appService0.getType());
        appService.setServiceConfigName(appService0.getServiceConfigName());
        appService.setServiceConfigId(appService0.getServiceConfigId());
        appService.setModifyTime(new Date());
        appService.setModifier(adminId);
        appService.setIsDelete(appService0.getIsDelete());
        sqlSession.update("com.itrus.portal.db.AppServiceMapper.updateByPrimaryKey", appService);
        sqlSession.flushStatements();
        transactionManager.commit(status);
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        if (!status.isCompleted())
            transactionManager.rollback(status);
    }
}
Also used : AppService(com.itrus.portal.db.AppService) DefaultTransactionDefinition(org.springframework.transaction.support.DefaultTransactionDefinition) TransactionStatus(org.springframework.transaction.TransactionStatus) EvidenceOutServiceConfig(com.itrus.portal.db.EvidenceOutServiceConfig) Date(java.util.Date)

Aggregations

AppService (com.itrus.portal.db.AppService)9 EvidenceOutServiceConfig (com.itrus.portal.db.EvidenceOutServiceConfig)9 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)7 EvidenceBasicInformation (com.itrus.portal.db.EvidenceBasicInformation)6 EvidenceHisCertificate (com.itrus.portal.db.EvidenceHisCertificate)6 HashMap (java.util.HashMap)6 EvidenceHisRelationship (com.itrus.portal.db.EvidenceHisRelationship)5 EvidenceOutServiceConfigExample (com.itrus.portal.db.EvidenceOutServiceConfigExample)5 IOException (java.io.IOException)5 Date (java.util.Date)5 EvidenceEnclosure (com.itrus.portal.db.EvidenceEnclosure)4 EvidenceEnclosureExample (com.itrus.portal.db.EvidenceEnclosureExample)4 EvidenceHisRelationshipExample (com.itrus.portal.db.EvidenceHisRelationshipExample)4 EvidenceOutTemplate (com.itrus.portal.db.EvidenceOutTemplate)4 ArrayList (java.util.ArrayList)4 JSONObject (com.alibaba.fastjson.JSONObject)3 EvidenceMainInformation (com.itrus.portal.db.EvidenceMainInformation)3 EvidenceSubjectIdentity (com.itrus.portal.db.EvidenceSubjectIdentity)3 EvidenceSubjectIdentityExample (com.itrus.portal.db.EvidenceSubjectIdentityExample)3 List (java.util.List)3