Search in sources :

Example 6 with MakeSealServer

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

the class MakeSealServerServiceImpl method delete.

/**
 * 删除签章服务
 *
 * @param id
 * @param needAdminLog
 *            是否添加管理员日志
 * @throws java.lang.Exception
 */
public void delete(Long id, boolean needAdminLog) throws Exception {
    // 判断是否有和产品关联
    MakeSealServer makeSealServer = selectMakeSealServer(id);
    if (null == makeSealServer) {
        throw new Exception("该签章服务不存在");
    }
    if (null != getProduct(id) && !getProduct(id).isEmpty()) {
        throw new Exception("删除的签章服务存在关联,无法删除");
    }
    // 删除
    sqlSession.delete("com.itrus.portal.db.MakeSealServerMapper.deleteByPrimaryKey", id);
    if (needAdminLog) {
        String oper = "删除签章服务";
        String info = "签章服务名称: " + makeSealServer.getName();
        LogUtil.adminlog(sqlSession, oper, info);
    }
}
Also used : MakeSealServer(com.itrus.portal.db.MakeSealServer)

Example 7 with MakeSealServer

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

the class MakeCertController method makeSeal.

/**
 * 获取签章模版
 *
 * @param billId
 * @return
 * @throws Exception
 * @throws EncDecException
 */
@RequestMapping(value = "/makeSeal", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> makeSeal(@RequestParam(value = "billId", required = true) Long billId, @RequestParam(value = "productId", required = false) Long productId, HttpServletRequest request, HttpServletResponse response) throws EncDecException, Exception {
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("retCode", 0);
    // 获取签章模版
    Bill bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", billId);
    // 查询项目产品
    Product product = null;
    // 如为组合产品productId不为空
    if (null == productId) {
        product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.getProduct());
    } else {
        product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", productId);
    }
    if (null == product.getMakeSealServer() || product.getMakeSealServer() <= 0) {
        map.put("retMsg", "该产品未配置签章服务");
        return map;
    }
    MakeSealServer makeSealServer = sqlSession.selectOne("com.itrus.portal.db.MakeSealServerMapper.selectByPrimaryKey", product.getMakeSealServer());
    // 签章服务配置
    List<MakeSealConfig> makeSealConfigs = sqlSession.selectList("com.itrus.portal.db.MakeSealConfigMapper.selectByExample");
    if (makeSealConfigs.isEmpty()) {
        map.put("retMsg", "没有找到签章服务配置");
        return map;
    }
    /**
     * 增加百润和以前的点聚
     */
    if (makeSealServer.getFirm().contains("点聚")) {
        // 新加if
        if (makeSealConfigs.get(0).getName().equals(makeSealServer.getFirm())) {
            MakeSealConfig makeSealConfig = makeSealConfigs.get(0);
            makeSealConfig.setAddressKey(AESencrp.decrypt(makeSealConfig.getAddressKey(), dbEncKey));
            map.put("retCode", 1);
            map.put("makeSealConfig", makeSealConfig);
            // 替换-印章名称
            if (StringUtils.isNotBlank(makeSealServer.getSealName())) {
                UIDInfoUtils uidutils = new UIDInfoUtils();
                uidutils.initService(businessService, orgCodeService, taxCertService, identityCardService, userInfoService, enterpriseService);
                makeSealServer.setSealName(uidutils.getUidInfo(billId, makeSealServer.getSealName()));
            }
        } else {
            MakeSealConfig makeSealConfig = makeSealConfigs.get(1);
            makeSealConfig.setAddressKey(AESencrp.decrypt(makeSealConfig.getAddressKey(), dbEncKey));
            map.put("retCode", 1);
            map.put("makeSealConfig", makeSealConfig);
            // 替换-印章名称
            if (StringUtils.isNotBlank(makeSealServer.getSealName())) {
                UIDInfoUtils uidutils = new UIDInfoUtils();
                uidutils.initService(businessService, orgCodeService, taxCertService, identityCardService, userInfoService, enterpriseService);
                makeSealServer.setSealName(uidutils.getUidInfo(billId, makeSealServer.getSealName()));
            }
        }
    }
    // 新加百润
    if (makeSealServer.getFirm().contains("百润")) {
        // 第一条是点聚,第二条是百润
        if (makeSealConfigs.get(0).getName().equals(makeSealServer.getFirm())) {
            MakeSealConfig makeSealConfig = makeSealConfigs.get(0);
            makeSealConfig.setAddressKey(AESencrp.decrypt(makeSealConfig.getAddressKey(), dbEncKey));
            map.put("retCode", 1);
            map.put("makeSealConfig", makeSealConfig);
            // 替换-印章名称
            if (StringUtils.isNotBlank(makeSealServer.getSealName())) {
                UIDInfoUtils uidutils = new UIDInfoUtils();
                uidutils.initService(businessService, orgCodeService, taxCertService, identityCardService, userInfoService, enterpriseService);
                makeSealServer.setSealName(uidutils.getUidInfo(billId, makeSealServer.getSealName()));
            }
        } else {
            MakeSealConfig makeSealConfig = makeSealConfigs.get(1);
            makeSealConfig.setAddressKey(AESencrp.decrypt(makeSealConfig.getAddressKey(), dbEncKey));
            map.put("retCode", 1);
            map.put("makeSealConfig", makeSealConfig);
            // 替换-印章名称
            if (StringUtils.isNotBlank(makeSealServer.getSealName())) {
                UIDInfoUtils uidutils = new UIDInfoUtils();
                uidutils.initService(businessService, orgCodeService, taxCertService, identityCardService, userInfoService, enterpriseService);
                makeSealServer.setSealName(uidutils.getUidInfo(billId, makeSealServer.getSealName()));
            }
        }
    }
    map.put("makeSealServer", makeSealServer);
    return map;
}
Also used : UIDInfoUtils(com.itrus.portal.utils.UIDInfoUtils) MakeSealServer(com.itrus.portal.db.MakeSealServer) MakeSealConfig(com.itrus.portal.db.MakeSealConfig) HashMap(java.util.HashMap) Bill(com.itrus.portal.db.Bill) Product(com.itrus.portal.db.Product) JSONObject(com.alibaba.fastjson.JSONObject) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 8 with MakeSealServer

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

the class MakeSealServerController method updateForm.

// 修改页面
@RequestMapping(value = "/{id}", params = "form", produces = "text/html")
public String updateForm(@PathVariable("id") Long id, Model uiModel) {
    MakeSealServer makeSealServer = makeSealServerService.selectMakeSealServer(id);
    uiModel.addAttribute("makeSealServer", makeSealServer);
    List<MakeSealConfig> makeSealConfigs = new ArrayList<MakeSealConfig>();
    makeSealConfigs = sqlSession.selectList("com.itrus.portal.db.MakeSealConfigMapper.selectByExample", null);
    uiModel.addAttribute("makeSealConfigs", makeSealConfigs);
    // if(makeSealServer.getFirm().contains("点聚")){
    return "makesealserver/update";
/*}else{
			return "makesealserver/update2";
		}*/
}
Also used : MakeSealServer(com.itrus.portal.db.MakeSealServer) MakeSealConfig(com.itrus.portal.db.MakeSealConfig) ArrayList(java.util.ArrayList) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

MakeSealServer (com.itrus.portal.db.MakeSealServer)8 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)6 MakeSealConfig (com.itrus.portal.db.MakeSealConfig)5 Product (com.itrus.portal.db.Product)4 UIDInfoUtils (com.itrus.portal.utils.UIDInfoUtils)4 JSONObject (com.alibaba.fastjson.JSONObject)3 Bill (com.itrus.portal.db.Bill)3 HashMap (java.util.HashMap)3 RaServiceUnavailable_Exception (cn.topca.tca.ra.service.RaServiceUnavailable_Exception)2 EncDecException (com.itrus.portal.exception.EncDecException)2 IOException (java.io.IOException)2 JSONArray (com.alibaba.fastjson.JSONArray)1 CertBuf (com.itrus.portal.db.CertBuf)1 CertBufExample (com.itrus.portal.db.CertBufExample)1 DigitalCert (com.itrus.portal.db.DigitalCert)1 EditBill (com.itrus.portal.db.EditBill)1 MakeSealServerExample (com.itrus.portal.db.MakeSealServerExample)1 ProductSpec (com.itrus.portal.db.ProductSpec)1 UserCert (com.itrus.portal.db.UserCert)1 UserCertExample (com.itrus.portal.db.UserCertExample)1