Search in sources :

Example 56 with UserInfo

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

the class ClientPayWebController method pay.

/**
 * 测试的接口
 * String notifyStr = request.getContextPath()+"/web/pay/notifyUrl";//回调url
 *	   String returnStr = request.getContextPath()+"/web/pay/returnUrl";//跳转url
 * @param request
 * @param response
 */
@RequestMapping(produces = "text/html")
public String pay(HttpServletRequest request, HttpServletResponse response, String url, String payid, String pay_type, String appid, String appSecretKey, String orderNo, String money, String body) {
    try {
        HttpSession session = request.getSession();
        UserInfo userInfo = (UserInfo) session.getAttribute("webuserInfo");
        SortedMap<String, String> map = new TreeMap();
        map.put("payType", (Integer.parseInt(pay_type) == 1 ? "0" : "3"));
        map.put("userId", userInfo.getId().toString());
        map.put("appId", appid);
        map.put("orderId", orderNo);
        map.put("totalFee", money);
        map.put("description", body);
        map.put("attach", body);
        String mySign = SignUtil.createSign(map, appSecretKey);
        // body = URLEncoder.encode(body,"utf-8");
        /*url = url.endsWith("?")?url:url+"?";
			url += "payType="+(Integer.parseInt(pay_type)==1?"0":"3");
			url += "&userId="+userInfo.getId();
			url += "&appid="+appid;
			url += "&orderId="+orderNo;
			url += "&totalFee="+money;
			url += "&description="+body;
			url += "&attach="+body;
			url += "&sign="+mySign;*/
        /*String param = "";
			param += "payType="+(Integer.parseInt(pay_type)==1?"0":"3");
			param += "&userId="+userInfo.getId();
			param += "&appId="+appid;
			param += "&orderId="+orderNo;
			param += "&totalFee="+money;
			param += "&description="+body;
			param += "&attach="+body;
			param += "&sign="+mySign;
			System.out.println(param);*/
        request.setAttribute("payType", (Integer.parseInt(pay_type) == 1 ? "0" : "3"));
        request.setAttribute("userId", userInfo.getId());
        request.setAttribute("appId", appid);
        request.setAttribute("orderId", orderNo);
        request.setAttribute("totalFee", money);
        request.setAttribute("description", body);
        request.setAttribute("attach", body);
        request.setAttribute("sign", mySign);
        request.setAttribute("requestUrl", url);
        generatePayInfo(userInfo.getId(), orderNo, payid, money);
    // response.setContentType("text/html;charset=utf-8");
    // response.getOutputStream().write(result.getBytes("UTF-8"));
    } catch (Exception e) {
        LogUtil.syslog(sqlSession, "在线支付", orderNo + "在线支付错误:" + url + e.toString());
        e.printStackTrace();
    }
    // TODO 客户端支付页面
    return "clientFW/payResult";
}
Also used : HttpSession(javax.servlet.http.HttpSession) UserInfo(com.itrus.portal.db.UserInfo) TreeMap(java.util.TreeMap) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 57 with UserInfo

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

the class ClientWebController method checkInvoceByPDF.

/**
 * retCode:0为失败,1为成功
 * PDF发票校验接口
 * @param invoicePDF:PDF发票文件
 */
@RequestMapping("/fpjyByPDF")
@ResponseBody
public Map<String, Object> checkInvoceByPDF(@RequestParam(value = "invoicePDF", required = true) MultipartFile invoicePDF, @RequestParam(value = "productId", required = true) Long productId, HttpServletRequest request) {
    HttpSession session = request.getSession();
    Map<String, Object> retMap = new HashMap<>();
    retMap.put("retCode", 0);
    UserInfo webuserInfo = (UserInfo) session.getAttribute("webuserInfo");
    Enterprise webenterprise = (Enterprise) session.getAttribute("webenterprise");
    if (null == webuserInfo || null == webenterprise) {
        retMap.put("retMsg", "用户登录信息已失效,请重新登录");
        return retMap;
    }
    // 
    Project project = (Project) session.getAttribute("webproject");
    if (null == project) {
        retMap.put("retMsg", "项目信息不存在");
        return retMap;
    }
    // 获取发票校验的应用
    ExtraProduct product = extraProductService.selectByPrimaryKey(productId);
    if (null == product) {
        retMap.put("retMsg", "产品信息不存在");
        return retMap;
    }
    if (invoicePDF.getContentType().equals("pdf")) {
        retMap.put("retMsg", "请上传PDF类型的文件");
        return retMap;
    }
    try {
        File file = baiWangService.getInvoiceImageFilePath();
        String imageFileName = getImageFileName();
        // 将pdf转为图片,存储到制定路径
        PDFToImageUtils.pdf2Pic(invoicePDF.getInputStream(), file, imageFileName);
        File PDFImageFile = new File(file, imageFileName);
        // 0位发票代码,1为发票号码,2为发票校验码
        String[] invoiceInfo = parseQRCodeTool.parseQRCode(PDFImageFile);
        if (null == invoiceInfo || invoiceInfo.length != 3) {
            retMap.put("retMsg", "无法识别发票中的信息,请重新上传或者用其他方式校验发票");
            return retMap;
        }
        // 删除临时文件
        PDFImageFile.deleteOnExit();
        Map<String, String> invoiceMap = baiWangService.verifyInvoice(invoiceInfo[0], invoiceInfo[1], invoiceInfo[2]);
        retMap.putAll(invoiceMap);
        if (null != retMap.get("REPLYCODE") && retMap.get("REPLYCODE").equals("0000")) {
            retMap.put("retCode", 1);
            String info = invoiceMap.toString().replaceAll(" ", "");
            checkInvoiceLogService.insertCheckInvoiceLog(product.getAppName(), webenterprise.getEnterpriseName(), info, project.getId(), webuserInfo.getRealName());
            return retMap;
        } else {
            String REPLYMSG = (String) retMap.get("REPLYMSG");
            retMap.put("retMsg", REPLYMSG);
            return retMap;
        }
    } catch (Exception e) {
        UserLog userlog = new UserLog();
        userlog.setProject(webuserInfo.getProject());
        userlog.setType("校验发票");
        userlog.setInfo("url:fpjyByPDF,详细错误:" + e.getMessage());
        userlog.setHostId("未知");
        userlog.setSn(null == webuserInfo.getUniqueId() ? null : webuserInfo.getUniqueId());
        LogUtil.userlog(sqlSession, userlog);
        retMap.put("retMsg", "PDF发票校验出错,请确认您上传的PDF电子发票是否正确或者更换其他查验方式,您还可以请联系管理员,错误代码:fpjyByPDF001");
    }
    return retMap;
}
Also used : HashMap(java.util.HashMap) HttpSession(javax.servlet.http.HttpSession) UserInfo(com.itrus.portal.db.UserInfo) UserLog(com.itrus.portal.db.UserLog) IOException(java.io.IOException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) Project(com.itrus.portal.db.Project) ExtraProduct(com.itrus.portal.db.ExtraProduct) Enterprise(com.itrus.portal.db.Enterprise) UserinfoEnterprise(com.itrus.portal.db.UserinfoEnterprise) File(java.io.File) MultipartFile(org.springframework.web.multipart.MultipartFile) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 58 with UserInfo

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

the class ClientWebController method faPiaoChaYanPage.

// 跳转发票校验的页面
@RequestMapping("/faPiaoChaYan")
public String faPiaoChaYanPage(@RequestParam(value = "productId", required = true) Long productId, HttpServletRequest request, Model uiModel) {
    HttpSession session = request.getSession();
    UserInfo webuserInfo = (UserInfo) session.getAttribute("webuserInfo");
    Enterprise webenterprise = (Enterprise) session.getAttribute("webenterprise");
    if (null == webuserInfo || null == webenterprise) {
        uiModel.addAttribute("errorMsg", "登录超时,请重新登录");
        return "client/errorpage";
    }
    uiModel.addAttribute("currentTimeMillis", System.currentTimeMillis());
    uiModel.addAttribute("productId", productId);
    return "client/fapiaochayan";
}
Also used : HttpSession(javax.servlet.http.HttpSession) Enterprise(com.itrus.portal.db.Enterprise) UserinfoEnterprise(com.itrus.portal.db.UserinfoEnterprise) UserInfo(com.itrus.portal.db.UserInfo) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 59 with UserInfo

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

the class ClientWebController method checkInvoceByPhone.

/**
 * retCode:0为失败,1为成功
 * 手机发票校验接口
 */
@RequestMapping("/fpjyByPhone")
@ResponseBody
public Map<String, Object> checkInvoceByPhone(@RequestParam(value = "invoiceQRImage", required = true) MultipartFile invoiceQRImage, @RequestParam(value = "projectId", required = true) Long projectId, @RequestParam(value = "productId", required = true) Long productId, @RequestParam(value = "userInfoId", required = true) Long userInfoId, @RequestParam(value = "enterpriseId", required = true) Long enterpriseId, @RequestParam(value = "currentTimeMillis", required = true) Long currentTimeMillis, HttpServletRequest request) {
    HttpSession session = request.getSession();
    Map<String, Object> retMap = new HashMap<>();
    retMap.put("retCode", 0);
    UserInfo webuserInfo = userInfoService.getUserInfoById(userInfoId);
    Enterprise webenterprise = enterpriseService.getEnterpriseById(enterpriseId);
    // 时间戳校验
    long time = System.currentTimeMillis();
    if ((time - currentTimeMillis) > (60 * 60 * 1000)) {
        retMap.put("retMsg", "二维码已经失效,请重新扫描");
        return retMap;
    }
    if (null == webuserInfo || null == webenterprise) {
        retMap.put("retMsg", "用户登录信息已失效,请重新登录");
        return retMap;
    }
    // 获取发票校验的应用
    ExtraProduct product = extraProductService.selectByPrimaryKey(productId);
    if (null == product) {
        retMap.put("retMsg", "产品信息不存在");
        return retMap;
    }
    // 
    Project project = projectService.selectByPrimaryKey(projectId);
    if (null == project) {
        retMap.put("retMsg", "项目信息不存在");
        return retMap;
    }
    // 校验文件信息
    if (invoiceQRImage.isEmpty()) {
        retMap.put("retMsg", "上传的图片信息不能为空");
        return retMap;
    }
    try {
        // 0位发票代码,1为发票号码,2为发票校验码
        String[] invoiceInfo = parseQRCodeTool.parseQRCode(invoiceQRImage.getInputStream());
        if (null == invoiceInfo || invoiceInfo.length != 3) {
            retMap.put("retMsg", "无法识别发票中的信息,请重新上传或者用其他方式校验发票");
            return retMap;
        }
        Map<String, String> invoiceMap = baiWangService.verifyInvoice(invoiceInfo[0], invoiceInfo[1], invoiceInfo[2]);
        retMap.putAll(invoiceMap);
        if (null != retMap.get("REPLYCODE") && retMap.get("REPLYCODE").equals("0000")) {
            retMap.put("retCode", 1);
            String info = invoiceMap.toString().replaceAll(" ", "");
            checkInvoiceLogService.insertCheckInvoiceLog(product.getAppName(), webenterprise.getEnterpriseName(), info, project.getId(), webuserInfo.getRealName());
            return retMap;
        } else {
            String REPLYMSG = (String) retMap.get("REPLYMSG");
            retMap.put("retMsg", REPLYMSG);
            return retMap;
        }
    } catch (Exception e) {
        UserLog userlog = new UserLog();
        userlog.setProject(webuserInfo.getProject());
        userlog.setType("校验发票");
        userlog.setInfo("url:fpjyByPhone,详细错误:" + e.getMessage());
        userlog.setHostId("未知");
        userlog.setSn(null == webuserInfo.getUniqueId() ? null : webuserInfo.getUniqueId());
        LogUtil.userlog(sqlSession, userlog);
        retMap.put("retMsg", "手机端发票校验出错,请联系管理员,错误信息:" + e.getMessage());
    }
    return retMap;
}
Also used : HashMap(java.util.HashMap) HttpSession(javax.servlet.http.HttpSession) UserInfo(com.itrus.portal.db.UserInfo) UserLog(com.itrus.portal.db.UserLog) IOException(java.io.IOException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) ExtraProduct(com.itrus.portal.db.ExtraProduct) Project(com.itrus.portal.db.Project) Enterprise(com.itrus.portal.db.Enterprise) UserinfoEnterprise(com.itrus.portal.db.UserinfoEnterprise) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 60 with UserInfo

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

the class ClientWebController method registerUser.

// TODO 用户注册
// 可以考虑先检测用户是否注册过了,
// 如果注册过了,则直接进入,没注册过,则让用户输入一个密码,就直接注册了.(或者直接取ukey平台的用户姓名,直接注册)
@RequestMapping("/registerUser")
public Map<String, Object> registerUser(@RequestParam(value = "email", required = false) String email, @RequestParam(value = "mPhone", required = true) String mPhone, @RequestParam(value = "projectId", required = true) Long projectId, HttpServletRequest request) {
    // 注册用户
    Map<String, Object> retMap = new HashMap<String, Object>();
    // 0标识处理失败,1标识成功
    retMap.put("retCode", 0);
    UserInfo userInfo = null;
    HttpSession session = request.getSession();
    // 判断用户是否已经注册过了
    userInfo = userInfoService.getUserInfoByMphone(mPhone);
    if (null != userInfo) {
        retMap.put("retCode", 1);
        // 验证码验证通过
        session.setAttribute("webverifyCodeStatus", true);
        session.setAttribute("webmPhone", mPhone);
        session.setAttribute("webuserInfo", userInfo);
        // session.setAttribute("webproductId", productId);
        session.setAttribute("webprojectId", projectId);
        return retMap;
    } else {
        try {
            userInfo = userInfoService.registerUserInfo(mPhone, DEFAULT_USER_PASSWORD, projectId);
            // 记录系统日志
            String info = mPhone + "注册成功";
            LogUtil.syslog(sqlSession, "注册用户", info);
            // 验证码验证通过
            session.setAttribute("webverifyCodeStatus", true);
            session.setAttribute("webmPhone", mPhone);
            session.setAttribute("webuserInfo", userInfo);
            // session.setAttribute("webproductId", productId);
            session.setAttribute("webprojectId", projectId);
            retMap.put("retCode", 1);
        } catch (Exception e) {
            retMap.put("retMsg", "出现未知异常,请联系管理员处理");
            String info = mPhone + "注册失败,原因:" + e.getMessage();
            LogUtil.syslog(sqlSession, "注册用户", info);
            return retMap;
        }
    }
    return retMap;
}
Also used : HashMap(java.util.HashMap) HttpSession(javax.servlet.http.HttpSession) UserInfo(com.itrus.portal.db.UserInfo) IOException(java.io.IOException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

UserInfo (com.itrus.portal.db.UserInfo)99 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)79 Enterprise (com.itrus.portal.db.Enterprise)68 HashMap (java.util.HashMap)52 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)40 IOException (java.io.IOException)39 HttpSession (javax.servlet.http.HttpSession)37 Bill (com.itrus.portal.db.Bill)31 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)31 Product (com.itrus.portal.db.Product)26 ExtraProduct (com.itrus.portal.db.ExtraProduct)24 Project (com.itrus.portal.db.Project)24 UserCert (com.itrus.portal.db.UserCert)24 BusinessLicense (com.itrus.portal.db.BusinessLicense)21 ExtraBill (com.itrus.portal.db.ExtraBill)20 TaxRegisterCert (com.itrus.portal.db.TaxRegisterCert)20 UserLog (com.itrus.portal.db.UserLog)20 IdentityCard (com.itrus.portal.db.IdentityCard)19 OrgCode (com.itrus.portal.db.OrgCode)19 UserinfoEnterprise (com.itrus.portal.db.UserinfoEnterprise)19