Search in sources :

Example 31 with ExtraBill

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

the class ExtraQueryBillController method cancleBill.

// 后台管理员撤销订单
@RequestMapping("/cancleBill/{id}")
@ResponseBody
public Map<String, Object> cancleBill(@PathVariable("id") Long id, @RequestParam(value = "reason", required = false) String reason) {
    Map<String, Object> retMap = new HashMap<String, Object>();
    retMap.put("retCode", 0);
    // 管理员项目权限
    Long[] projectsOfAdmin = getProjectLongIdsOfAdmin();
    List<Long> projectsOfAdminList = Arrays.asList(projectsOfAdmin);
    ExtraBillExample billExample = new ExtraBillExample();
    ExtraBillExample.Criteria criteria = billExample.or();
    criteria.andIdEqualTo(id);
    criteria.andProjectIn(projectsOfAdminList);
    ExtraBill bill = sqlSession.selectOne("com.itrus.portal.db.ExtraBillMapper.selectByExample", billExample);
    if (null == bill) {
        retMap.put("retMsg", "订单不存在,或者无权操作改订单");
        return retMap;
    }
    bill.setCancelReason(reason);
    // 如果是百旺的订单,后台管理员点击撤销订单的时候,则直接撤销
    ExtraProduct product = extraProductService.selectByPrimaryKey(bill.getExtraProduct());
    if (null != product.getServiceInterfaceName() && product.getServiceInterfaceName().equals(ComNames.SERVICE_INTERFACE_NAME_BWFPTPT)) {
        bill.setBillStatus(ComNames.EXTRA_BILL_STATUS_9);
    } else {
        bill.setBillStatus(ComNames.EXTRA_BILL_STATUS_8);
    }
    // }
    try {
        extraBillService.updateByPrimaryKeySelective(bill);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        retMap.put("retMsg", "出现异常,异常信息:" + e.getMessage());
        return retMap;
    }
    retMap.put("retCode", 1);
    return retMap;
}
Also used : ExtraBillExample(com.itrus.portal.db.ExtraBillExample) ExtraProduct(com.itrus.portal.db.ExtraProduct) HashMap(java.util.HashMap) ExtraBill(com.itrus.portal.db.ExtraBill) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 32 with ExtraBill

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

the class ExtraQueryBillController method updateExtraBillStatus.

/**
 * 执行修改订单状态的方法
 * @param id
 * @param bill_status
 * @param uiModel
 * @return
 */
@RequestMapping(value = "/update_extrabill_status", produces = "text/html")
public String updateExtraBillStatus(@RequestParam(value = "id", required = true) Long id, @RequestParam(value = "bill_status", required = true) Integer bill_status, Model uiModel) {
    ExtraBill bill = extraBillService.selectByPrimaryKey(id);
    if (null == bill) {
        return "status403";
    }
    Integer oldStatus = bill.getBillStatus();
    bill.setBillStatus(bill_status);
    try {
        extraBillService.updateByPrimaryKey(bill);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    uiModel.addAttribute("bill", bill);
    Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bill.getEnterprise());
    uiModel.addAttribute("enterprise", enterprise);
    // 记录管理员修改日志
    LogUtil.adminlog(sqlSession, "修改订单状态", enterprise.getEnterpriseName() + "[" + bill.getBillId() + "],订单状态由" + oldStatus + "改为了" + bill.getBillStatus());
    return "redirect:/extraquerybill/update_extrabill_status_page/" + bill.getId();
}
Also used : ExtraBill(com.itrus.portal.db.ExtraBill) Enterprise(com.itrus.portal.db.Enterprise) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 33 with ExtraBill

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

the class ExtraBillPayController method sendsms.

/**
 * 增值订单,未支付短信通知发送
 * @param id,订单id
 * @param phone,手机号
 * @param type,短信类型,WZF
 * @return
 */
@RequestMapping(value = "/sendsms/{id}/{phone}/{type}", produces = "text/html")
@ResponseBody
public String sendsms(@PathVariable("id") Long id, @PathVariable("phone") String phone, @PathVariable("type") String type) {
    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.ExtraBillMapper.selectByCondition", param);
    ExtraBill b = extraBillService.selectByPrimaryKey(id);
    MessageTemplate messageTemplate = messageTemplateService.getMsgTemp(b.getProject(), type);
    if (null == messageTemplate) {
        return "发送短信失败,未找到对应的消息模版";
    }
    String content = messageTemplate.getMessageContent();
    if (StringUtils.isBlank(content) || content.indexOf("content") == -1) {
        return "发送短信失败,消息模版配置错误";
    }
    content = content.replaceAll("content", bill.get("epname").toString());
    smsSendService.sendSms(bill.get("m_phone").toString(), content, type.equals("WZF") ? "支付通知" : "支付异常通知", b.getProject(), null, b.getBillId());
    b.setIsNotPaySms(true);
    b.setNpSmsTime(new Date());
    try {
        extraBillService.updateByPrimaryKeySelective(b);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return null;
}
Also used : MessageTemplate(com.itrus.portal.db.MessageTemplate) HashMap(java.util.HashMap) ExtraBill(com.itrus.portal.db.ExtraBill) HashMap(java.util.HashMap) Map(java.util.Map) Date(java.util.Date) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 34 with ExtraBill

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

the class ExtraBillServiceImpl method selectByExample.

public List<ExtraBill> selectByExample(ExtraBillExample example) throws Exception {
    ExtraBillMapper mapper = sqlSession.getMapper(ExtraBillMapper.class);
    List<ExtraBill> list = mapper.selectByExample(example);
    return list;
}
Also used : ExtraBillMapper(com.itrus.portal.db.ExtraBillMapper) ExtraBill(com.itrus.portal.db.ExtraBill)

Example 35 with ExtraBill

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

the class ExtraBillServiceImpl method saveExtraBill.

/**
 * 保存订单
 *
 * @param project
 * @param uniqueId
 * @param enterprise
 * @param extraProduct
 * @param extraProductSpec
 * @param einvoice
 * @param productNum
 * @param billSum
 * @param billStatus
 * @return
 * @throws Exception
 */
public ExtraBill saveExtraBill(Long project, Long uniqueId, Long enterprise, Long extraProduct, Long extraProductSpec, Long einvoice, Integer productNum, double billSum, Integer billStatus) throws Exception {
    ExtraBill extraBill = new ExtraBill();
    // 订单唯一编号
    extraBill.setBillId(UniqueIDUtils.genExtraBilUID(sqlSession));
    // 订单总价
    extraBill.setBillSum(billSum);
    // 创建时间
    extraBill.setCreateTime(new Date());
    // 订单对应的电子发票
    extraBill.seteInvoice(einvoice);
    // 企业
    extraBill.setEnterprise(enterprise);
    // 增值产品
    extraBill.setExtraProduct(extraProduct);
    // 规格
    extraBill.setExtraProductSpec(extraProductSpec);
    // 没删除
    extraBill.setIsDelete(false);
    // 项目
    extraBill.setProject(project);
    // 买够数量
    extraBill.setProductNum(productNum);
    // 订单对应的用户
    extraBill.setUniqueId(uniqueId);
    // 订单状态
    extraBill.setBillStatus(billStatus);
    extraBill = insert(extraBill);
    return extraBill;
}
Also used : ExtraBill(com.itrus.portal.db.ExtraBill) Date(java.util.Date)

Aggregations

ExtraBill (com.itrus.portal.db.ExtraBill)41 ExtraProduct (com.itrus.portal.db.ExtraProduct)25 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)24 HashMap (java.util.HashMap)22 Enterprise (com.itrus.portal.db.Enterprise)21 UserInfo (com.itrus.portal.db.UserInfo)20 HttpSession (javax.servlet.http.HttpSession)12 ExtraProductSpec (com.itrus.portal.db.ExtraProductSpec)11 OpenBankInfo (com.itrus.portal.db.OpenBankInfo)11 Date (java.util.Date)11 Map (java.util.Map)11 TransactionStatus (org.springframework.transaction.TransactionStatus)11 DefaultTransactionDefinition (org.springframework.transaction.support.DefaultTransactionDefinition)11 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)11 BusinessLicense (com.itrus.portal.db.BusinessLicense)10 TaxRegisterCert (com.itrus.portal.db.TaxRegisterCert)10 ExtraBillExample (com.itrus.portal.db.ExtraBillExample)9 IdentityCard (com.itrus.portal.db.IdentityCard)9 OnPayInfo (com.itrus.portal.db.OnPayInfo)9 ArrayList (java.util.ArrayList)9