Search in sources :

Example 56 with Product

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

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

the class MakeCertController method sendReNewInfo.

/**
 * 发送待更新短信通知
 *
 * @param id
 *            订单id
 * @return
 */
@RequestMapping("/sendReNewInfo")
@ResponseBody
public Map<String, Object> sendReNewInfo(@RequestParam(value = "billId") Long id) {
    Map<String, Object> retMap = new HashMap<String, Object>();
    // 0标识发送验证码失败,1标识成功
    retMap.put("retCode", 0);
    Bill bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", id);
    if (null != bill.getRenewSms() && bill.getRenewSms() == true) {
        retMap.put("message", "该用户已经发送过短信通知了,不能重复发送");
        return retMap;
    }
    // 获取订单对应的产品信息
    Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.getProduct());
    String productName = product.getName();
    // 发送短信所需要的信息
    UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bill.getUniqueId());
    UserCertExample userCertExample = new UserCertExample();
    UserCertExample.Criteria criteria = userCertExample.or();
    criteria.andIdEqualTo(bill.getOldUserCert());
    UserCert userCert = sqlSession.selectOne("com.itrus.portal.db.UserCertMapper.selectByExample", userCertExample);
    Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bill.getEnterprise());
    Long projectId = bill.getProject();
    String mPhone = userInfo.getmPhone();
    String keySn = userCert.getKeySn();
    if (null == keySn) {
        keySn = "该证书未绑定key";
    }
    String enterpriseName = enterprise.getEnterpriseName();
    Date endTime = userCert.getCertEndTime();
    // 执行发送
    try {
        makeCerServiceImpl.sendReNewInfo(bill, mPhone, projectId, "ZSGX", keySn, enterpriseName, endTime, productName);
        retMap.put("retCode", 1);
        retMap.put("message", "发送更新通知短信成功");
    } catch (Exception e) {
        // TODO: handle exception
        e.printStackTrace();
        retMap.put("message", "发送短信失败,请联系管理员");
        String type = "发送更新证书通知失败";
        String info = "用户电话:" + mPhone + "错误信息:" + e.getMessage();
        LogUtil.syslog(sqlSession, type, info);
    }
    return retMap;
}
Also used : HashMap(java.util.HashMap) UserCertExample(com.itrus.portal.db.UserCertExample) Product(com.itrus.portal.db.Product) UserInfo(com.itrus.portal.db.UserInfo) Date(java.util.Date) EncDecException(com.itrus.portal.exception.EncDecException) IOException(java.io.IOException) RaServiceUnavailable_Exception(cn.topca.tca.ra.service.RaServiceUnavailable_Exception) Bill(com.itrus.portal.db.Bill) Enterprise(com.itrus.portal.db.Enterprise) JSONObject(com.alibaba.fastjson.JSONObject) UserCert(com.itrus.portal.db.UserCert) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 58 with Product

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

the class MakeCertController method makecert.

// 制作证书
@RequestMapping(value = "/make/{id}", produces = "text/html")
@ResponseBody
public Map<String, Object> makecert(@RequestParam(value = "uidIdx", required = true) Integer uidIdx, @RequestParam(value = "csr", required = true) String csr, @RequestParam(value = "pid", required = true) Long pid, @RequestParam(value = "index", required = false) Integer index, @RequestParam(value = "keySn", required = false) String keySn, @PathVariable("id") Long id) {
    Map<String, Object> ret = new HashMap<String, Object>();
    // 查询订单
    Bill bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", id);
    // 查询项目产品
    Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", pid);
    // 解析项目产品中,certinfo配置信息
    JSONArray certinfo = JSONArray.parseArray(product.getCertinfo());
    // 解析订单中uid信息{"ADDTIONAL_FIELD1_1":"","ADDTIONAL_FIELD3_1":"","ADDTIONAL_FIELD4_1":"G2016071301","inputName":"inputValue"}
    JSONObject uid = JSONObject.parseObject(bill.getUid());
    if (null != index) {
        if (index == 1) {
            uid = JSONObject.parseObject(bill.getUid1());
        }
        if (index == 2) {
            uid = JSONObject.parseObject(bill.getUid2());
        }
        if (index == 3) {
            uid = JSONObject.parseObject(bill.getUid3());
        }
    }
    // 获取产品、RA配置
    RaAccount ra = sqlSession.selectOne("com.itrus.portal.db.RaAccountMapper.selectByPrimaryKey", product.getRa());
    com.itrus.portal.utils.CertUtlis certutil = new com.itrus.portal.utils.CertUtlis();
    // 证书配置
    DigitalCert digitalcert = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", product.getCert());
    // 组织RA参数
    cn.topca.tca.ra.service.UserInfo rauserinfo = new cn.topca.tca.ra.service.UserInfo();
    UIDInfoUtils uidutils = new UIDInfoUtils();
    uidutils.initService(businessService, orgCodeService, taxCertService, identityCardService, userInfoService, enterpriseService);
    String autoidType = "";
    Integer autoidValue = 0;
    for (int i = 0; i < certinfo.size(); i++) {
        JSONObject obj = certinfo.getJSONObject(i);
        String raParaName = obj.getString("raParaName");
        if (raParaName == null)
            continue;
        // "autoid":"yes",
        String autoid = obj.getString("autoid");
        // "raParaName": "userName",
        String constValue = obj.getString("constValue");
        // "constValue": "test@itrus.com.cn"
        String refName = obj.getString("refName");
        String val = null;
        if (constValue != null) {
            val = constValue;
        } else if (refName != null) {
            if (refName.indexOf("?") == -1)
                val = uidutils.getUidInfo(bill.getId(), refName);
            else {
                val = "";
                String[] arr = refName.split("\\?", 2);
                if (arr.length == 2) {
                    String condition = arr[0].trim();
                    String[] refarr = arr[1].split(":", 2);
                    if (refarr.length == 2) {
                        boolean bret = uidutils.checkCondition(bill.getId(), condition);
                        if (bret)
                            val = uidutils.getUidInfo(bill.getId(), refarr[0].trim());
                        else
                            val = uidutils.getUidInfo(bill.getId(), refarr[1].trim());
                    }
                }
            }
        } else if (autoid != null) {
            // "autoidPrev":"G",
            String autoidPrev = obj.getString("autoidPrev");
            // "autoidType":"mytestautoid",
            autoidType = obj.getString("autoidType");
            // "inputName": "ADDTIONAL_FIELD4",存在多个值
            String uidval = uid.getString(obj.getString("inputName") + "_" + uidIdx.toString());
            val = uidval;
            if (StringUtils.isNotBlank(uidval) && uidval.indexOf(autoidPrev) == 0) {
                // "autoidPrevDate":"yyyyMMdd",
                String autoidPrevDate = obj.getString("autoidPrevDate");
                try {
                    if (autoidPrevDate == null || autoidPrevDate.length() == 0)
                        autoidValue = Integer.parseInt(uidval.substring(autoidPrev.length()));
                    else
                        autoidValue = Integer.parseInt(uidval.substring(autoidPrev.length() + autoidPrevDate.length()));
                } catch (Exception e) {
                    e.printStackTrace();
                    autoidValue = 0;
                }
            }
        } else {
            val = uid.getString(obj.getString("inputName") + "_" + uidIdx.toString());
        }
        certutil.setUserInfoVal(rauserinfo, raParaName, val);
    }
    // 证书有效期
    // {"0":"1年","1":"2年","2":"3年","3":"5年","4":"10年"})
    Integer certValidity = 5;
    boolean hasProductSpec = false;
    // 判断订单中是否配了产品规格且有期限
    ProductSpec productSpec = null;
    if (null != bill.getProductSpec() && 0 != bill.getProductSpec()) {
        productSpec = productSpecService.getProductSpec(bill.getProductSpec());
        if (StringUtils.isNotBlank(productSpec.getProductValid())) {
            hasProductSpec = true;
        }
    }
    if (null != index) {
        if (index == 1)
            if (null != bill.getProductSpec1() && 0 != bill.getProductSpec1()) {
                productSpec = productSpecService.getProductSpec(bill.getProductSpec1());
                if (StringUtils.isNotBlank(productSpec.getProductValid())) {
                    hasProductSpec = true;
                }
            }
        if (index == 2)
            if (null != bill.getProductSpec2() && 0 != bill.getProductSpec2()) {
                productSpec = productSpecService.getProductSpec(bill.getProductSpec2());
                if (StringUtils.isNotBlank(productSpec.getProductValid())) {
                    hasProductSpec = true;
                }
            }
        if (index == 3)
            if (null != bill.getProductSpec3() && 0 != bill.getProductSpec3()) {
                productSpec = productSpecService.getProductSpec(bill.getProductSpec3());
                if (StringUtils.isNotBlank(productSpec.getProductValid())) {
                    hasProductSpec = true;
                }
            }
    }
    if (hasProductSpec) {
        Integer day = Integer.parseInt(productSpec.getProductValid());
        if (day == 100) {
            // TODO 测试时候,配置年限为100年,则有效期为10天
            certValidity = 1;
        } else {
            certValidity = 365 * day + 1 + (day / 4);
        }
    } else {
        if ("0".compareTo(digitalcert.getCertDeadline()) == 0) {
            certValidity = 365 * 1 + 1;
        } else if ("1".compareTo(digitalcert.getCertDeadline()) == 0) {
            certValidity = 365 * 2 + 1;
        } else if ("2".compareTo(digitalcert.getCertDeadline()) == 0) {
            certValidity = 365 * 3 + 1;
        } else if ("3".compareTo(digitalcert.getCertDeadline()) == 0) {
            certValidity = 365 * 5 + 2;
        } else if ("4".compareTo(digitalcert.getCertDeadline()) == 0) {
            certValidity = 365 * 10 + 2;
        } else if ("-1".compareTo(digitalcert.getCertDeadline()) == 0) {
            // 数字证书没有配置年限(-1),默认10天有效期
            certValidity = 10;
        }
    }
    log.error("证书期限*********" + certValidity);
    // 调用RA
    CertInfo racertinfo = null;
    try {
        if (ra.getAaPassword() != null)
            ra.setAaPassword(AESencrp.decrypt(ra.getAaPassword(), dbEncKey));
        racertinfo = certutil.enrollCertByWS(csr, ra, rauserinfo, certValidity);
    } catch (RaServiceUnavailable_Exception e) {
        e.printStackTrace();
        ret.put("status", 1001);
        ret.put("message", e.getMessage());
        // 记录日志
        String oper = "制作证书失败";
        String info = "企业名称: " + uidutils.getUidInfo(bill.getId(), "enterprise.enterpriseName") + ",参数:" + ToStringBuilder.reflectionToString(rauserinfo) + ",异常信息: " + e.toString();
        LogUtil.adminlog(sqlSession, oper, info);
        return ret;
    } catch (Exception e) {
        e.printStackTrace();
        ret.put("status", 1002);
        ret.put("message", e.getMessage());
        // 记录日志
        String oper = "制作证书失败";
        String info = "企业名称: " + uidutils.getUidInfo(bill.getId(), "enterprise.enterpriseName") + "参数:" + ToStringBuilder.reflectionToString(rauserinfo) + ",异常信息: " + e.toString();
        LogUtil.adminlog(sqlSession, oper, info);
        return ret;
    }
    // 解析数字证书信息
    // 存储数字证书信息
    CertBuf certbuf = new CertBuf();
    certbuf.setCreateTime(new Date());
    certbuf.setCertBuf(racertinfo.getCertSignBuf());
    certbuf.setCertKmcRep1(racertinfo.getCertKmcRep1());
    certbuf.setCertKmcRep2(racertinfo.getCertKmcRep2());
    certbuf.setCertsignBuf(racertinfo.getCertSignBuf());
    certbuf.setEncUserCert(racertinfo.getCertSignBufKmc());
    sqlSession.insert("com.itrus.portal.db.CertBufMapper.insert", certbuf);
    UserCert usercert = new UserCert();
    usercert.setBill(bill.getId());
    usercert.setRaAccount(ra.getId());
    usercert.setCertBuf(certbuf.getId());
    usercert.setUidIdx(uidIdx);
    usercert.setCertDn(racertinfo.getCertSubjectDn());
    usercert.setCertSn(racertinfo.getCertSerialNumber());
    usercert.setIssuerDn(racertinfo.getCertIssuerDn());
    usercert.setCertStatus("1");
    usercert.setCertUid("certUid");
    usercert.setProduct(pid);
    if (StringUtils.isNotBlank(keySn))
        // 设置证书keySn
        usercert.setKeySn(keySn);
    try {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmmss");
        usercert.setCertStartTime(sdf.parse(racertinfo.getCertNotBefore()));
        usercert.setCertEndTime(sdf.parse(racertinfo.getCertNotAfter()));
    } catch (java.text.ParseException e) {
        e.printStackTrace();
    }
    usercert.setSha1Fingerprint("setSha1Fingerprint");
    // autoid 数据
    if (!autoidType.equals("")) {
        usercert.setAutoidType(autoidType);
        usercert.setAutoidValue(autoidValue);
    }
    usercert.setEnterprise(bill.getEnterprise());
    try {
        sqlSession.insert("com.itrus.portal.db.UserCertMapper.insert", usercert);
    } catch (Exception e) {
        e.printStackTrace();
    }
    // 查询userCert中,该bill的记录数目,如果数据 大于等于 bill 里面的购买数量,则修改该bill为制证完成
    updateBillStatus(bill, product);
    // 记录日志
    String oper = "制作证书";
    String info = "数字证书: " + racertinfo.getCertSerialNumber() + ", " + racertinfo.getCertSubjectDn();
    LogUtil.adminlog(sqlSession, oper, info);
    // 返回数字证书
    ret.put("certChain", racertinfo.getCertSignBufP7());
    ret.put("certsignBuf", racertinfo.getCertSignBuf());
    ret.put("certKmcRep1", racertinfo.getCertKmcRep1());
    ret.put("certKmcRep2", racertinfo.getCertKmcRep2());
    // 加密证书
    ret.put("encUserCert", racertinfo.getCertSignBufKmc());
    ret.put("status", 0);
    return ret;
}
Also used : CertInfo(cn.topca.tca.ra.service.CertInfo) RaServiceUnavailable_Exception(cn.topca.tca.ra.service.RaServiceUnavailable_Exception) HashMap(java.util.HashMap) Product(com.itrus.portal.db.Product) UserInfo(com.itrus.portal.db.UserInfo) UIDInfoUtils(com.itrus.portal.utils.UIDInfoUtils) DigitalCert(com.itrus.portal.db.DigitalCert) RaAccount(com.itrus.portal.db.RaAccount) CertBuf(com.itrus.portal.db.CertBuf) UserCert(com.itrus.portal.db.UserCert) JSONArray(com.alibaba.fastjson.JSONArray) ProductSpec(com.itrus.portal.db.ProductSpec) EncDecException(com.itrus.portal.exception.EncDecException) IOException(java.io.IOException) RaServiceUnavailable_Exception(cn.topca.tca.ra.service.RaServiceUnavailable_Exception) Date(java.util.Date) BigInteger(java.math.BigInteger) JSONObject(com.alibaba.fastjson.JSONObject) Bill(com.itrus.portal.db.Bill) JSONObject(com.alibaba.fastjson.JSONObject) SimpleDateFormat(java.text.SimpleDateFormat) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 59 with Product

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

the class MakeCertController method updateBillStatus.

/**
 * 修改订单状态:1、订单关联的证书数量大于或等于订单购买的产品数量;2、假如该产品配了签章服务,则判断该订单关联的所有证书,是否都已经签章并且授权,
 * 假如都已经签章授权,则改变订单状态。
 *
 * @param bill
 * @param product
 */
private void updateBillStatus(Bill bill, Product product) {
    // 查询userCert中,该bill的记录数目,如果数据 大于等于 bill 里面的购买数量,则修改该bill为制证完成
    UserCertExample example = new UserCertExample();
    UserCertExample.Criteria criteria = example.or();
    criteria.andCertStatusNotEqualTo("0");
    criteria.andBillEqualTo(bill.getId());
    List<UserCert> usercertall = sqlSession.selectList("com.itrus.portal.db.UserCertMapper.selectByExample", example);
    Product p = productService.getProductById(bill.getProduct());
    Integer num1 = 0;
    Integer num2 = 0;
    Integer num3 = 0;
    if (null != bill.getProductNum1()) {
        num1 = bill.getProductNum1();
    }
    if (null != bill.getProductNum2()) {
        num2 = bill.getProductNum2();
    }
    if (null != bill.getProductNum3()) {
        num3 = bill.getProductNum3();
    }
    Integer pSum = num1 + num2 + num3;
    // 新添:组合产品判断
    if ((usercertall.size() >= bill.getProductNum() && null == p.getIsCombined()) || (usercertall.size() >= bill.getProductNum() && null != p.getIsCombined() && p.getIsCombined() != 1) || (usercertall.size() >= pSum && null != p.getIsCombined() && p.getIsCombined() == 1)) {
        // 判断产品是否配置了签章服务
        if (null != product.getMakeSealServer() && product.getMakeSealServer() > 0) {
            // 查看证书是否都已经完成了签章,授权
            for (UserCert userCert : usercertall) {
                if (null == userCert.getMakeSealmstatus() || "0".equals(userCert.getMakeSealmstatus().toString()) || null == userCert.getMakeSealastatus() || "0".equals(userCert.getMakeSealastatus().toString())) {
                    // 未签章或者未授权,则直接返回,不修改订单状态
                    return;
                }
            }
        }
        if (bill.getIsenterprisecert() != null && bill.getIsenterprisecert()) {
            // 判断友互通是否自动制证
            if (bill.getIscertinfo() != null && bill.getIscertinfo() == 1) {
                // 判断友互通自动制证是否已制证
                bill.setBillStatus(ComNames.BILL_STATUS_6);
                if (null == bill.getDelivery()) {
                    bill.setBillStatus(ComNames.BILL_STATUS_8);
                } else if (null != bill.getIsInvoiced() && bill.getIsInvoiced().equals(1)) {
                    bill.setBillStatus(ComNames.BILL_STATUS_7);
                }
                // 当订单价格是0的时候,又不需要开票,设置为已开票代配送
                if (0 == bill.getBillSum() && null == bill.getInvoice() && null == bill.geteInvoice()) {
                    bill.setBillStatus(ComNames.BILL_STATUS_7);
                    if (null == bill.getDelivery()) {
                        bill.setBillStatus(ComNames.BILL_STATUS_8);
                    }
                }
            } else {
                // 友互通管理员制证已制证
                bill.setIscertinfo(3);
            }
        } else {
            bill.setIscertinfo(4);
            bill.setBillStatus(ComNames.BILL_STATUS_6);
            if (null == bill.getDelivery()) {
                bill.setBillStatus(ComNames.BILL_STATUS_8);
            } else if (null != bill.getIsInvoiced() && bill.getIsInvoiced().equals(1)) {
                bill.setBillStatus(ComNames.BILL_STATUS_7);
            }
            // 当订单价格是0的时候,又不需要开票,设置为已开票代配送
            if (0 == bill.getBillSum() && null == bill.getInvoice() && null == bill.geteInvoice()) {
                bill.setBillStatus(ComNames.BILL_STATUS_7);
                if (null == bill.getDelivery()) {
                    bill.setBillStatus(ComNames.BILL_STATUS_8);
                }
            }
        }
        sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKey", bill);
    }
}
Also used : BigInteger(java.math.BigInteger) UserCertExample(com.itrus.portal.db.UserCertExample) Product(com.itrus.portal.db.Product) UserCert(com.itrus.portal.db.UserCert)

Example 60 with Product

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

the class HomeController method register.

// @RequestMapping(value = "/s/{name}")
public String register(@PathVariable("name") String name, @RequestParam(value = "login", required = false) String login, HttpSession session, Model uiModel) {
    ProductExample productExample = new ProductExample();
    ProductExample.Criteria pe = productExample.createCriteria();
    pe.andProNameEqualTo(name);
    Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByExample", productExample);
    // return
    // "forward:/userInfoWeb/zhuce.html?projectId="+product.getProject()+"&productId="+product.getId();
    uiModel.addAttribute("projectId", product.getProject());
    uiModel.addAttribute("productId", product.getId());
    if (StringUtils.isNotBlank(login) && login.equals("1")) {
        List<String> allIssUerDn = new ArrayList<String>();
        allIssUerDn = sqlSession.selectList("com.itrus.portal.db.CrlContextMapper.selectAllIssUerDn");
        try {
            uiModel.addAttribute("allIssUerDn", jsonTool.writeValueAsString(allIssUerDn));
            // 返回随机数
            String random = UniqueIDUtils.genUUID();
            uiModel.addAttribute("random", random);
            session.setAttribute("webrandom", random);
        } catch (JsonGenerationException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (JsonMappingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return "ixinweb/denglu2";
    }
    if (null != product.getIsBan() && product.getIsBan() == true) {
        EnterpriseQqExample enterprise = new EnterpriseQqExample();
        EnterpriseQqExample.Criteria qqEx = enterprise.createCriteria();
        qqEx.andProjectIdEqualTo(product.getProject());
        EnterpriseQq enterpriseqq = sqlSession.selectOne("com.itrus.portal.db.EnterpriseQqMapper.selectByExample", enterprise);
        uiModel.addAttribute("enterpriseqq", enterpriseqq.getEnterpriseQqLinks());
        // 产品已经下架
        return "ixinweb/chanpinxiajia";
    }
    return "ixinweb/zhuce";
}
Also used : EnterpriseQq(com.itrus.portal.db.EnterpriseQq) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) ProductExample(com.itrus.portal.db.ProductExample) Product(com.itrus.portal.db.Product) EnterpriseQqExample(com.itrus.portal.db.EnterpriseQqExample) IOException(java.io.IOException) JsonGenerationException(org.codehaus.jackson.JsonGenerationException)

Aggregations

Product (com.itrus.portal.db.Product)77 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)43 HashMap (java.util.HashMap)42 Bill (com.itrus.portal.db.Bill)39 Enterprise (com.itrus.portal.db.Enterprise)27 UserInfo (com.itrus.portal.db.UserInfo)27 DigitalCert (com.itrus.portal.db.DigitalCert)24 JSONObject (com.alibaba.fastjson.JSONObject)19 UserCert (com.itrus.portal.db.UserCert)19 ArrayList (java.util.ArrayList)19 IOException (java.io.IOException)18 Map (java.util.Map)17 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)17 ProductExample (com.itrus.portal.db.ProductExample)15 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)15 Date (java.util.Date)15 List (java.util.List)14 HttpSession (javax.servlet.http.HttpSession)14 BillExample (com.itrus.portal.db.BillExample)10 Project (com.itrus.portal.db.Project)10