Search in sources :

Example 46 with ExtraProduct

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

the class ExtraBillReviewController method sendSmsBySHJJ.

/**
 * 手动发送审核拒绝短信通知
 *
 * @param billId
 * @return
 */
@RequestMapping("/sendSmsBySHJJ")
@ResponseBody
public synchronized Map<String, Object> sendSmsBySHJJ(@RequestParam(value = "billId", required = true) Long billId) {
    Map<String, Object> retMap = new HashMap<String, Object>();
    retMap.put("retCode", 0);
    // 修改订单
    ExtraBill bill = extraBillService.selectByPrimaryKey(billId);
    if (null == bill) {
        retMap.put("retMsg", "订单不存在");
        return retMap;
    }
    // 查询短信模版
    // 查找对应项目的消息模版:SHJJ
    MessageTemplate messageTemplate = messageTemplateService.getMsgTemp(bill.getProject(), "SHJJ");
    if (null == messageTemplate) {
        retMap.put("retMsg", "审核拒绝短信模版不存在,请联系系统管理员配置");
        return retMap;
    }
    Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bill.getEnterprise());
    ExtraProduct product = extraProductService.selectByPrimaryKey(bill.getExtraProduct());
    Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", bill.getProject());
    UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bill.getUniqueId());
    String content = messageTemplate.getMessageContent();
    // 替换特定内容:企业名称:enterpriseName,产品名称:productName,项目名称:projectName,拒绝原因:reason
    if (content.contains("enterpriseName")) {
        content = content.replaceAll("enterpriseName", enterprise.getEnterpriseName());
    }
    if (content.contains("productName")) {
        content = content.replaceAll("productName", product.getAppName());
    }
    if (content.contains("projectName")) {
        content = content.replaceAll("projectName", project.getName());
    }
    if (content.contains("reason")) {
        content = content.replaceAll("reason", bill.getRefuseReason());
    }
    // 发送短信
    try {
        smsSendService.sendRefuseReview(userInfo.getmPhone(), content, "SHJJ", project.getId(), userInfo.getUniqueId(), bill.getBillId());
    } catch (Exception e) {
        e.printStackTrace();
    }
    bill.setIsRefuseSms(true);
    bill.setSendTime(new Date());
    try {
        extraBillService.updateByPrimaryKey(bill);
        retMap.put("retCode", 1);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return retMap;
}
Also used : MessageTemplate(com.itrus.portal.db.MessageTemplate) ExtraProduct(com.itrus.portal.db.ExtraProduct) Project(com.itrus.portal.db.Project) HashMap(java.util.HashMap) ExtraBill(com.itrus.portal.db.ExtraBill) Enterprise(com.itrus.portal.db.Enterprise) UserInfo(com.itrus.portal.db.UserInfo) Date(java.util.Date) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 47 with ExtraProduct

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

the class ExtraBillReviewController method audit.

// TODO 单个订单推送到第三方支付平台进行审核.
@RequestMapping("/audit")
@ResponseBody
public synchronized Map<String, Object> audit(@RequestParam(value = "billId", required = true) Long id) {
    Map<String, Object> retMap = new HashMap<>();
    retMap.put("retCode", 0);
    ExtraBill bill = extraBillService.selectByPrimaryKey(id);
    if (null == bill || !bill.getBillStatus().equals(ComNames.EXTRA_BILL_STATUS_3)) {
        retMap.put("retMsg", "订单不存在,或者订单状态不是待审核");
        return retMap;
    }
    ExtraProduct product = extraProductService.selectByPrimaryKey(bill.getExtraProduct());
    // 根据产品所属的服务商,调用不同的服务商推送接口
    Long serviceInterfaceName = product.getServiceInterfaceName();
    if (null == serviceInterfaceName) {
        retMap.put("retMsg", "产品没有配置服务接口");
        return retMap;
    }
    if (bill.getBillStatus().equals(ComNames.EXTRA_BILL_STATUS_4)) {
        retMap.put("retMsg", "该订单服务商已经在审核中");
        return retMap;
    }
    boolean flag = false;
    if (serviceInterfaceName.equals(ComNames.SERVICE_INTERFACE_NAME_BWFPTPT)) {
        flag = baiWangService.submitOrder(bill);
    } else if (serviceInterfaceName.equals(ComNames.SERVICE_INTERFACE_NAME_SZYQQYDB)) {
        flag = SZYQService.submitBill(bill);
    } else {
        retMap.put("retMsg", "产品配置的服务接口类型错误,无法送审");
        return retMap;
    }
    if (flag) {
        retMap.put("retCode", 1);
        retMap.put("retMsg", "订单送审成功");
        return retMap;
    } else {
        retMap.put("retMsg", "推送订单失败,详情请查看管理员日志");
    }
    return retMap;
}
Also used : 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 48 with ExtraProduct

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

the class ExtraBillReviewController method queryAudit.

// TODO 单个订单查询送审结果
@RequestMapping("/queryAudit")
@ResponseBody
public synchronized Map<String, Object> queryAudit(@RequestParam(value = "billId", required = true) Long id) {
    Map<String, Object> retMap = new HashMap<>();
    retMap.put("retCode", 0);
    ExtraBill bill = extraBillService.selectByPrimaryKey(id);
    if (null == bill || !bill.getBillStatus().equals(ComNames.EXTRA_BILL_STATUS_4)) {
        retMap.put("retMsg", "订单不存在,或者订单状态不是审核中");
        return retMap;
    }
    ExtraProduct product = extraProductService.selectByPrimaryKey(bill.getExtraProduct());
    // 根据产品所属的服务商,调用不同的服务商查询
    Long serviceInterfaceName = product.getServiceInterfaceName();
    if (null == serviceInterfaceName) {
        retMap.put("retMsg", "产品没有配置服务接口");
        return retMap;
    }
    if (serviceInterfaceName.equals(ComNames.SERVICE_INTERFACE_NAME_BWFPTPT)) {
        bill = baiWangService.query(bill);
    } else if (serviceInterfaceName.equals(ComNames.SERVICE_INTERFACE_NAME_SZYQQYDB)) {
        bill = SZYQService.queryBills(bill);
    }
    if (bill.getBillStatus().equals(ComNames.EXTRA_BILL_STATUS_4)) {
        retMap.put("retMsg", "服务商审核中");
    } else if (bill.getBillStatus().equals(ComNames.EXTRA_BILL_STATUS_5)) {
        retMap.put("retMsg", "服务商审核拒绝");
    } else if (bill.getBillStatus().equals(ComNames.EXTRA_BILL_STATUS_6) || bill.getBillStatus().equals(ComNames.EXTRA_BILL_STATUS_7)) {
        retMap.put("retMsg", "服务商审核通过");
    }
    retMap.put("retCode", 1);
    return retMap;
}
Also used : 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 49 with ExtraProduct

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

the class ExtraProductController method loadInstrustionsPdf.

/**
 * 根据产品id,返回产品操作指南的pdf文件
 *
 * @param id
 * @param session
 * @param request
 * @param response
 * @return
 * @throws Exception
 */
@RequestMapping("/loadInstrustionsPdf/{id}")
public String loadInstrustionsPdf(@PathVariable("id") Long id, HttpSession session, HttpServletRequest request, HttpServletResponse response) throws Exception {
    // UserInfo webuserInfo = (UserInfo)
    // session.getAttribute("webuserInfo");
    // if (null == webuserInfo) {
    // // 登录状态失效
    // return null;
    // }
    ExtraProduct extraProduct = extraProductService.selectByPrimaryKey(id);
    if (null == extraProduct) {
        return "status403";
    }
    String pdf = extraProduct.getInstructions();
    if (null == pdf) {
        return "status403";
    }
    File filePath = extraProductService.getFilePathById(id);
    if (!filePath.exists()) {
        filePath.mkdir();
    }
    File file = new File(filePath, pdf);
    InputStream proxyIn = null;
    // 重置response对象中的缓冲区,该方法可以不写,但是你要保证response缓冲区没有其他数据,否则导出可能会出现问题,建议加上
    try {
        proxyIn = new FileInputStream(file);
        response.reset();
        String filename = "操作指南.pdf";
        filename = encodeFilename(filename, request);
        // 设置输出文件为
        response.setHeader("Content-disposition", "filename=" + filename);
        response.setCharacterEncoding("utf-8");
        // 由于导出格式是excel的文件,设置导出文件的响应头部信息
        response.setContentType("application/pdf");
        // 用response对象获取输出流
        OutputStream os = response.getOutputStream();
        byte[] bos = new byte[proxyIn.available()];
        proxyIn.read(bos);
        os.write(bos);
        os.flush();
        // 关闭os
        if (os != null) {
            os.close();
        }
        if (null != proxyIn) {
            proxyIn.close();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
Also used : ExtraProduct(com.itrus.portal.db.ExtraProduct) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) OutputStream(java.io.OutputStream) File(java.io.File) MultipartFile(org.springframework.web.multipart.MultipartFile) FileInputStream(java.io.FileInputStream) IOException(java.io.IOException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 50 with ExtraProduct

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

the class ExtraProductController method updateMorePage.

// 返回修改产品对应的服务信息页面:服务办理接口信息,服务应用方式,服务配置
@RequestMapping(value = "/updateMore/{id}", produces = "text/html")
public String updateMorePage(@PathVariable("id") Long id, Model uiModel) throws Exception {
    ExtraProduct extraProduct = extraProductService.selectByPrimaryKey(id);
    uiModel.addAttribute("extraProduct", extraProduct);
    List<ExtraProductSpec> extraProductSpecs = extraProductSpecService.getSpecByProductId(id);
    uiModel.addAttribute("extraProductSpecs", extraProductSpecs);
    // 服务提供商组成的map
    Map<Long, ServiceProvider> serviceProviderMap = serviceProviderService.selectMapByExample(null);
    uiModel.addAttribute("serviceProviderMap", serviceProviderMap);
    // 在线支付的map:微信和支付宝
    List<OnlinePay> onlinepays = sqlSession.selectList("com.itrus.portal.db.OnlinePayMapper.selectByExample", null);
    uiModel.addAttribute("onlinepays", onlinepays);
    // 银行付款的List
    List<Transfer> bankPays = sqlSession.selectList("com.itrus.portal.db.TransferMapper.selectByExample", null);
    uiModel.addAttribute("bankPays", bankPays);
    // 电子发票的list
    List<Ereceipt> einvoices = sqlSession.selectList("com.itrus.portal.db.EreceiptMapper.selectByExample", null);
    uiModel.addAttribute("einvoices", einvoices);
    // 附加项的list
    List<ExtraMessage> extraMessages = extraMessageService.selectByExample(null);
    uiModel.addAttribute("extraMessages", extraMessages);
    return "extraproduct/update2";
}
Also used : Ereceipt(com.itrus.portal.db.Ereceipt) ExtraProductSpec(com.itrus.portal.db.ExtraProductSpec) ExtraProduct(com.itrus.portal.db.ExtraProduct) ServiceProvider(com.itrus.portal.db.ServiceProvider) Transfer(com.itrus.portal.db.Transfer) ExtraMessage(com.itrus.portal.db.ExtraMessage) OnlinePay(com.itrus.portal.db.OnlinePay) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

ExtraProduct (com.itrus.portal.db.ExtraProduct)62 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)44 HashMap (java.util.HashMap)28 ExtraBill (com.itrus.portal.db.ExtraBill)25 Enterprise (com.itrus.portal.db.Enterprise)24 UserInfo (com.itrus.portal.db.UserInfo)24 IOException (java.io.IOException)20 Project (com.itrus.portal.db.Project)17 ArrayList (java.util.ArrayList)16 ExtraProductSpec (com.itrus.portal.db.ExtraProductSpec)14 HttpSession (javax.servlet.http.HttpSession)14 File (java.io.File)13 BusinessLicense (com.itrus.portal.db.BusinessLicense)12 OpenBankInfo (com.itrus.portal.db.OpenBankInfo)12 TaxRegisterCert (com.itrus.portal.db.TaxRegisterCert)12 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)12 IdentityCard (com.itrus.portal.db.IdentityCard)11 ServiceProvider (com.itrus.portal.db.ServiceProvider)11 OrgCode (com.itrus.portal.db.OrgCode)10 UserinfoEnterprise (com.itrus.portal.db.UserinfoEnterprise)10