Search in sources :

Example 16 with Product

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

the class PayController method update.

// 修改处理
@RequestMapping(value = "/update/{billid}/{id}", produces = "text/html")
public String update(@PathVariable("billid") Long billid, @PathVariable("id") Long id, @RequestParam(value = "status", required = false) Integer status, @Valid PayInfo payInfo, BindingResult bindingResult, Model uiModel) throws UnsupportedEncodingException {
    // DefaultTransactionDefinition def = new
    // DefaultTransactionDefinition();
    // def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    // TransactionStatus s = transactionManager.getTransaction(def);
    Bill bill = null;
    try {
        bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", billid);
        bill.setBillStatus(status);
        bill.setBillSum(payInfo.getPay());
        sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKeySelective", bill);
        PayInfo p = sqlSession.selectOne("com.itrus.portal.db.PayInfoMapper.selectByPrimaryKey", id);
        if (p != null) {
            p.setPay(payInfo.getPay());
            p.setName(payInfo.getName());
            p.setPayTime(payInfo.getPayTime());
            p.setComment(payInfo.getComment());
            if (status == 3) {
                p.setPayConfirmTime(new Date());
            }
            sqlSession.update("com.itrus.portal.db.PayInfoMapper.updateByPrimaryKeySelective", p);
        }
        if (status == 3) {
            LogUtil.adminlog(sqlSession, "订单确认到款", "订单号" + bill.getBillId());
        } else {
            sendsms(billid, null, "ZFYC");
            LogUtil.adminlog(sqlSession, "订单支付异常", "订单号" + bill.getBillId());
        }
        // transactionManager.commit(s);
        // 产品
        Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.getProduct());
        // pfx流程判断begin
        DigitalCert digitalCert = null;
        if (null != product.getCert()) {
            digitalCert = digitalCertService.getDigitalCert(product.getCert());
            if (null != digitalCert && null != digitalCert.getCertType() && digitalCert.getCertType().equals(ComNames.DIGITALCERT_CERTTYPE_PFX)) {
                // 这个用户,这个企业,这个项目,有通过了实名认证的订单,则直接进入待下载,
                List<Bill> bills = billService.hasAuthticationLevel(bill.getUniqueId(), bill.getEnterprise(), product.getProject());
                if (null != bills && bills.size() > 0 && digitalCert.getInitBuy().equals(ComNames.DIGITALCERT_INITBUYS_2)) {
                    bill.setBillStatus(ComNames.BILL_STATUS_13);
                    // 新增审核通过的记录
                    reviewService.agreeBillReview(bill);
                    sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKeySelective", bill);
                }
            }
        }
        // 解锁订单流程判断begin
        if (null != product.getKeyUnlockType()) {
            if (null != status && status.equals(ComNames.BILL_STATUS_3)) {
                bill = unLockKeyBillService.updateBillStatusWhileHasPay(bill, product);
            }
        }
    // 解锁订单流程判断end
    } catch (Exception e) {
        if (status == 3) {
            LogUtil.adminlog(sqlSession, "订单确认到款-异常", e.toString() + ",订单号" + bill.getBillId());
        } else {
            LogUtil.adminlog(sqlSession, "订单支付异常-异常", e.toString() + ",订单号" + bill.getBillId());
        }
    }
    // }
    return "redirect:/pay";
}
Also used : DigitalCert(com.itrus.portal.db.DigitalCert) OnPayInfo(com.itrus.portal.db.OnPayInfo) PayInfo(com.itrus.portal.db.PayInfo) Bill(com.itrus.portal.db.Bill) Product(com.itrus.portal.db.Product) Date(java.util.Date) UnsupportedEncodingException(java.io.UnsupportedEncodingException) IOException(java.io.IOException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 17 with Product

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

the class PayController method show.

// 显示详情
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) {
    Map param = new HashMap();
    param.put("id", id);
    // 管理员项目权限
    Long[] projectsOfAdmin = getProjectLongIdsOfAdmin();
    param.put("hasProjects", Arrays.asList(projectsOfAdmin));
    Map bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByCondition", param);
    if (null == bill || bill.isEmpty()) {
        uiModel.addAttribute("errorMsg", "未找到该订单");
        return "status403";
    }
    uiModel.addAttribute("bill", bill);
    Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.get("product"));
    DigitalCert cert = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", product.getCert());
    uiModel.addAttribute("cert", cert);
    ProductSpec productSpec = null;
    // 判断是否属于组合产品
    if (product.getIsCombined() != null && product.getIsCombined().equals(1)) {
        Product productSub = null;
        // 得到三条组合产品的产品信息
        for (int i = 1; i < 4; i++) {
            if (bill.get("product" + i) == null) {
                continue;
            }
            productSub = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.get("product" + i));
            uiModel.addAttribute("product" + i, productSub);
            cert = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", productSub.getCert());
            uiModel.addAttribute("cert" + i, cert);
            // 获取产品规格
            if (bill.containsKey("product_spec" + i) && !"0".equals(bill.get("product_spec" + i))) {
                productSpec = productSpecService.getProductSpec((Long) bill.get("product_spec" + i));
            }
            uiModel.addAttribute("productSpec" + i, productSpec);
        }
        if (bill.get("bill_status").toString().equals("11")) {
            PayInfo pi = sqlSession.selectOne("com.itrus.portal.db.PayInfoMapper.selectByPrimaryKey", bill.get("pay_info"));
            uiModel.addAttribute("pi", pi);
        }
        return "pay/show";
    }
    // 获取产品规格
    if (bill.containsKey("product_spec") && !"0".equals(bill.get("product_spec"))) {
        productSpec = productSpecService.getProductSpec((Long) bill.get("product_spec"));
    }
    uiModel.addAttribute("productSpec", productSpec);
    if (bill.get("bill_status").toString().equals("11")) {
        PayInfo pi = sqlSession.selectOne("com.itrus.portal.db.PayInfoMapper.selectByPrimaryKey", bill.get("pay_info"));
        uiModel.addAttribute("pi", pi);
    }
    return "pay/show";
}
Also used : DigitalCert(com.itrus.portal.db.DigitalCert) OnPayInfo(com.itrus.portal.db.OnPayInfo) PayInfo(com.itrus.portal.db.PayInfo) HashMap(java.util.HashMap) Product(com.itrus.portal.db.Product) ProductSpec(com.itrus.portal.db.ProductSpec) Map(java.util.Map) HashMap(java.util.HashMap) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 18 with Product

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

the class PayController method confirm.

// 显示详情
@RequestMapping(value = "/confirm/{id}", produces = "text/html")
public String confirm(@PathVariable("id") Long id, Model uiModel) {
    Map param = new HashMap();
    param.put("id", id);
    // 管理员项目权限
    Long[] projectsOfAdmin = getProjectLongIdsOfAdmin();
    param.put("hasProjects", Arrays.asList(projectsOfAdmin));
    Map bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByCondition", param);
    if (null == bill || bill.isEmpty()) {
        uiModel.addAttribute("errorMsg", "未找到该订单");
        return "status403";
    }
    uiModel.addAttribute("bill", bill);
    // 得到纳税人识别号
    if (bill.get("id") != null) {
        String taxesCode = getTaxesCode(Long.valueOf(bill.get("id").toString()));
        uiModel.addAttribute("taxesCode", taxesCode);
    }
    if (bill.get("on_pay_info") != null) {
        OnPayInfo onpayinfo = sqlSession.selectOne("com.itrus.portal.db.OnPayInfoMapper.selectByPrimaryKey", bill.get("on_pay_info"));
        uiModel.addAttribute("onpayinfo", onpayinfo);
        OnlinePay onlinepay = sqlSession.selectOne("com.itrus.portal.db.OnlinePayMapper.selectByPrimaryKey", bill.get("online_pay"));
        uiModel.addAttribute("onlinepay", onlinepay);
    }
    if (bill.get("price") != null && bill.get("product_num") != null) {
        uiModel.addAttribute("sum", Double.parseDouble(bill.get("price").toString()) * Integer.parseInt(bill.get("product_num").toString()));
    } else {
        uiModel.addAttribute("sum", 0);
    }
    ProductSpec productSpec = null;
    Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.get("product"));
    DigitalCert cert = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", product.getCert());
    uiModel.addAttribute("cert", cert);
    // 判断是否属于组合产品
    if (product.getIsCombined() != null && product.getIsCombined().equals(1)) {
        Product productSub = null;
        PreferentialRecord pr = null;
        // 得到三条组合产品的产品信息
        for (int i = 1; i < 4; i++) {
            if (bill.get("product" + i) == null) {
                continue;
            }
            productSub = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.get("product" + i));
            uiModel.addAttribute("product" + i, productSub);
            cert = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", productSub.getCert());
            uiModel.addAttribute("cert" + i, cert);
            // 获取产品规格
            if (bill.containsKey("product_spec" + i) && !"0".equals(bill.get("product_spec" + i))) {
                productSpec = productSpecService.getProductSpec((Long) bill.get("product_spec" + i));
            }
            uiModel.addAttribute("productSpec" + i, productSpec);
            // 该订单是否有价格优惠记录
            pr = preferentialRecordService.selectPreferentialRecordSByBillIdAndProductId(id, (Long) (bill.get("product" + i)));
            if (null != pr) {
                uiModel.addAttribute("preferentialrecord" + i, pr);
            }
        }
        PayInfo pi = sqlSession.selectOne("com.itrus.portal.db.PayInfoMapper.selectByPrimaryKey", bill.get("pay_info"));
        uiModel.addAttribute("pi", pi);
        return "pay/update";
    }
    // 获取产品规格
    if (bill.containsKey("product_spec") && !"0".equals(bill.get("product_spec"))) {
        productSpec = productSpecService.getProductSpec((Long) bill.get("product_spec"));
    }
    uiModel.addAttribute("productSpec", productSpec);
    PayInfo pi = sqlSession.selectOne("com.itrus.portal.db.PayInfoMapper.selectByPrimaryKey", bill.get("pay_info"));
    uiModel.addAttribute("pi", pi);
    // 该订单是否有价格优惠记录
    PreferentialRecord pr = preferentialRecordService.selectPreferentialRecordSByBillId(id);
    if (null != pr) {
        uiModel.addAttribute("preferentialrecord", pr);
    }
    return "pay/update";
}
Also used : HashMap(java.util.HashMap) Product(com.itrus.portal.db.Product) ProductSpec(com.itrus.portal.db.ProductSpec) PreferentialRecord(com.itrus.portal.db.PreferentialRecord) DigitalCert(com.itrus.portal.db.DigitalCert) OnPayInfo(com.itrus.portal.db.OnPayInfo) PayInfo(com.itrus.portal.db.PayInfo) OnPayInfo(com.itrus.portal.db.OnPayInfo) Map(java.util.Map) HashMap(java.util.HashMap) OnlinePay(com.itrus.portal.db.OnlinePay) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 19 with Product

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

the class PsCourierController method confirm.

// 确认配送
@RequestMapping(value = "confirm/{id}", produces = "text/html")
public String confirm(@PathVariable("id") Long id, Model uiModel, @Valid Delivery delivery, @Valid CourierInfo courierInfo, @RequestParam(value = "dvid", required = false) Integer dvid, @RequestParam(value = "itnum", required = false) Integer itnum, @RequestParam(value = "billid", required = false) Integer billid, @RequestParam(value = "ivc", required = false) Integer ivc, @RequestParam(value = "items1", required = false) String items1, @RequestParam(value = "items2", required = false) String items2) {
    // 得到配送内容
    int itemsnum = 0;
    if (items1 != null && items2 != null) {
        itemsnum = 3;
    } else if (items2 != null) {
        itemsnum = Integer.parseInt(items2);
    } else {
        itemsnum = Integer.parseInt(items1);
    }
    // 添加配送信息
    courierInfo.setCourierItems(itemsnum);
    courierInfo.setCourierTime(new Date());
    courierInfo.setCourierStatus(1);
    courierInfo.setMessageSms(0);
    sqlSession.insert("com.itrus.portal.db.CourierInfoMapper.insertSelective", courierInfo);
    Bill bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", billid);
    Product pdt = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.getProduct());
    Product product1 = null;
    Product product2 = null;
    Product product3 = null;
    Integer hasKey = 0;
    /*if (null != pdt.getIsCombined() && pdt.getIsCombined() ==1){
				String[] comb = pdt.getCombinedId().split(",");
				product1 = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", Long.parseLong(comb[0]));
				product2 = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", Long.parseLong(comb[1]));
				if (null != product1.getUsbKey() || null != product2.getUsbKey()){
					hasKey = 1;
				}
				if(comb.length==3){
					product3 = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", Long.parseLong(comb[2]));
					if (null != product3.getUsbKey()){
						hasKey = 1;
					}
				}
			}*/
    if (null != bill.getProduct1()) {
        product1 = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.getProduct1());
        if (null != product1.getUsbKey()) {
            hasKey = 1;
        }
    }
    if (null != bill.getProduct2()) {
        product2 = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.getProduct2());
        if (null != product2.getUsbKey()) {
            hasKey = 1;
        }
    }
    if (null != bill.getProduct3()) {
        product3 = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.getProduct3());
        if (null != product3.getUsbKey()) {
            hasKey = 1;
        }
    }
    // itnum=0 为第一次配送
    if (itnum == 0) {
        // 修改配送地址,并保存
        Delivery delivery1 = sqlSession.selectOne("com.itrus.portal.db.DeliveryMapper.selectByPrimaryKey", dvid);
        delivery1.setReceiver(delivery.getReceiver());
        delivery1.setRvPhone(delivery.getRvPhone());
        delivery1.setDetailAdds(delivery.getDetailAdds());
        delivery1.setRegionCodes(delivery.getRegionCodes());
        sqlSession.update("com.itrus.portal.db.DeliveryMapper.updateByPrimaryKeySelective", delivery1);
    }
    // itnum=1 为第二次配送,
    if (itnum == 1 || itemsnum == 3 || (itemsnum == 1 && ivc == 0) || (ivc == 1 && itemsnum == 2 && (pdt.getUsbKey() == null && hasKey == 0))) {
        // 修改bill表里的配送时间,和设置订单状态为完成
        bill.setBillStatus(8);
        bill.setDeliveryTime(new Date());
        sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKeySelective", bill);
    }
    List<Map> l1 = sqlSession.selectList("com.itrus.portal.db.CourierInfoMapper.selectCourierInfoMaxId");
    // 自动发短信
    sendMoreSmsFhtz((long) l1.get(0).get("id"));
    String oper = "确认快递配送";
    String info = "快递订单: " + courierInfo.getCourierId();
    LogUtil.adminlog(sqlSession, oper, info);
    return "redirect:/pscourier";
}
Also used : Bill(com.itrus.portal.db.Bill) Product(com.itrus.portal.db.Product) Delivery(com.itrus.portal.db.Delivery) Map(java.util.Map) HashMap(java.util.HashMap) Date(java.util.Date) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 20 with Product

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

the class MakeCertController method userCertMakeSealStatus.

/**
 * 证书签章授权成功
 *
 * @param type
 *            make表示证书签章,authori表示证书授权
 * @param sealImage
 *            签章时候需传图片base64
 * @param enterpriseId
 * @param userCertId
 * @return
 */
@RequestMapping("/userCertMakeSealStatus")
@ResponseBody
public Map<String, Object> userCertMakeSealStatus(@RequestParam(value = "type", required = true) String type, @RequestParam(value = "sealImage", required = false) String sealImage, @RequestParam(value = "billId", required = true) Long billId, @RequestParam(value = "enterpriseId", required = false) Long enterpriseId, @RequestParam(value = "userCertId", required = true) Long userCertId) {
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("retCode", 0);
    UserCert userCert = sqlSession.selectOne("com.itrus.portal.db.UserCertMapper.selectByPrimaryKey", userCertId);
    if ("make".equals(type)) {
        // 制章
        // if (StringUtils.isBlank(sealImage)) {
        // map.put("retMsg", "获取签章图片失败,请重试");
        // return map;
        // }
        // 0未制章,1已制章
        userCert.setMakeSealmstatus(1);
    // Enterprise enterprise = sqlSession.selectOne(
    // "com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey",
    // enterpriseId);
    // 保存图片
    // try {
    // File imgDir = filePathUtils.getEnterpriseFile(enterprise
    // .getEnterpriseSn());
    // String filename = System.currentTimeMillis() + "seal"
    // + Math.round(Math.random() * 89 + 10) + ".gif";
    // // 创建磁盘文件
    // File imgFile = new File(imgDir, filename);
    // imageByBase64.saveImage(sealImage, imgFile);
    // if (null != imgFile && imgFile.isFile()) {
    // enterprise.setSealImage(imgFile.getName());
    // sqlSession
    // .update("com.itrus.portal.db.EnterpriseMapper.updateByPrimaryKey",
    // enterprise);
    // }
    // } catch (Exception e) {
    // map.put("retMsg", e.getMessage());
    // return map;
    // }
    } else if ("authori".equals(type)) {
        // 授权
        // 0未授权,1已授权
        userCert.setMakeSealastatus(1);
    } else if ("amake".equals(type)) {
        // 0未制章,1已制章
        userCert.setMakeSealmstatus(1);
        // 0未授权,1已授权
        userCert.setMakeSealastatus(1);
    }
    sqlSession.update("com.itrus.portal.db.UserCertMapper.updateByPrimaryKey", userCert);
    // 更新订单状态
    Bill bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", billId);
    // 查询项目产品
    Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.getProduct());
    updateBillStatus(bill, product);
    map.put("retCode", 1);
    return map;
}
Also used : HashMap(java.util.HashMap) Bill(com.itrus.portal.db.Bill) Product(com.itrus.portal.db.Product) 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)

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