| | |
| | | */ |
| | | @Override |
| | | public List<CoalPayRepDto> selectCoalPayList(CoalPayReq coalPay) { |
| | | List<CoalPayRepDto> coalPayRepDtos = new ArrayList<>(); |
| | | List<CoalPay> coalPays = coalPayMapper.selectCoalPayList(coalPay); |
| | | for (CoalPay pay : coalPays) { |
| | | CoalPayRepDto coalPayRepDto = new CoalPayRepDto(); |
| | | BeanUtils.copyProperties(pay, coalPayRepDto); |
| | | // List<CoalPayRepDto> coalPayRepDtos = new ArrayList<>(); |
| | | List<CoalPayRepDto> coalPays = coalPayMapper.selectCoalPayList(coalPay); |
| | | for (CoalPayRepDto pay : coalPays) { |
| | | // CoalPayRepDto coalPayRepDto = new CoalPayRepDto(); |
| | | // BeanUtils.copyProperties(pay, coalPayRepDto); |
| | | //部门数据 |
| | | SysDept sysDept = sysDeptMapper.selectDeptById(pay.getDeptId()); |
| | | coalPayRepDto.setDeptName(sysDept.getDeptName()); |
| | | pay.setDeptName(sysDept.getDeptName()); |
| | | //工种数据 |
| | | List<CoalCategory> coalCategories = coalCategoryMapper.selectByCoalPayId(pay.getId()); |
| | | coalPayRepDto.setCoalCategoryList(coalCategories); |
| | | pay.setCoalCategoryList(coalCategories); |
| | | //学员数据 |
| | | List<CoalPayStudent> coalPayStudents = coalPayStudentService.selectByCoalPayId(pay.getId()); |
| | | List<CoalPayStudent> havePay = coalPayStudents.stream() |
| | | .filter(stu -> stu.getPayStatus() != null && stu.getPayStatus() == 1) |
| | | .collect(Collectors.toList()); |
| | | coalPayRepDto.setTotalNum(coalPayStudents.size()); |
| | | coalPayRepDto.setHavePayNum(havePay.size()); |
| | | coalPayRepDtos.add(coalPayRepDto); |
| | | // List<CoalPayStudent> coalPayStudents = coalPayStudentService.selectByCoalPayId(pay.getId()); |
| | | // List<CoalPayStudent> havePay = coalPayStudents.stream() |
| | | // .filter(stu -> stu.getPayStatus() != null && stu.getPayStatus() == 1) |
| | | // .collect(Collectors.toList()); |
| | | // pay.setTotalNum(coalPayStudents.size()); |
| | | // pay.setHavePayNum(havePay.size()); |
| | | // coalPayRepDtos.add(coalPayRepDto); |
| | | } |
| | | return coalPayRepDtos; |
| | | return coalPays; |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public AjaxResult deleteCoalPayByIds(Long[] ids) { |
| | | for (Long id : ids) { |
| | | List<CoalPayStudent> coalPayStudents = coalPayStudentService.selectByCoalPayIdAndPayStatus(id, 1); |
| | | List<CoalPayStudent> coalPayStudents = coalPayStudentService.selectByCoalPayIdAndPayStatus(id,1); |
| | | if (!CollectionUtils.isEmpty(coalPayStudents)) { |
| | | throw new BusinessException(this.getClass(), ResultConstants.BUSINESS_ERROR, "已有学员完成缴费,请勿删除"); |
| | | } |
| | |
| | | CoalPayStudent coalPayStudent = new CoalPayStudent(); |
| | | coalPayStudent.setCoalPayId(coalPayTypeReq.getCoalPayId()); |
| | | coalPayStudent.setPayType(2); |
| | | coalPayStudent.setGovPayStatus(0); |
| | | coalPayStudentService.updateByCoalPayId(coalPayStudent); |
| | | } |
| | | return i; |
| | |
| | | if (student.getPayStatus() == 1) { |
| | | throw new BusinessException(this.getClass(), ResultConstants.BUSINESS_ERROR, "请勿重新缴费"); |
| | | } |
| | | if (student.getGovPayStatus() == 2){ |
| | | return student.getOrderId(); |
| | | } |
| | | |
| | | PayReqData payReqData = fillData(coalPayStudent, coalPay, coalCategories, coalTicket, 1, null); |
| | | |
| | | ResultVo resultVo = payUtils.sendApiPost(payReqData); |
| | | ResultVo resultVo = payUtils.faqiV2(payReqData); |
| | | if (resultVo.getRespcode().equals("BUS0000")) { |
| | | //进行票据签名并校验 |
| | | // ResultVo resultVo1 = payUtils.uploadXml(resultVo.getRespdata().getOrderNo(), resultVo.getRespdata().getFileData()); |
| | |
| | | // throw new BusinessException(this.getClass(), ResultConstants.BUSINESS_ERROR, "签名验证错误"); |
| | | // } |
| | | payStudent.setId(studentId); |
| | | payStudent.setOrderId(resultVo.getRespdata().getOrderNo()); |
| | | payStudent.setGovPayStatus(1); |
| | | payStudent.setOrderNo(resultVo.getRespdata().getOrderNo()); |
| | | payStudent.setOrderId(resultVo.getRespdata().getOrderId()); |
| | | payStudent.setGovPayStatus(2); |
| | | payStudent.setPayCode(resultVo.getRespdata().getBillNo()); |
| | | coalPayStudentService.updateByCoalPayStudent(payStudent); |
| | | coalPayStudentService.updateByIdAndPayType(payStudent); |
| | | return resultVo.getRespdata().getOrderId(); |
| | | } else { |
| | | throw new BusinessException(this.getClass(), ResultConstants.BUSINESS_ERROR, resultVo.getRespmsg()); |
| | | } |
| | | } catch (BusinessException e) { |
| | | throw new RuntimeException(e); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } finally { |
| | | if (lock.isLocked()) { |
| | |
| | | if (coalPay == null) { |
| | | throw new BusinessException(this.getClass(), ResultConstants.BUSINESS_ERROR, "未找到相关缴费信息"); |
| | | } |
| | | if (coalPayStudents.get(0).getGovPayStatus() == 2){ |
| | | return coalPayStudents.get(0).getOrderId(); |
| | | } |
| | | |
| | | CoalPayStudent payStudent = new CoalPayStudent(); |
| | | PayReqData payReqData = fillData(coalPayStudents, coalPay, coalCategories, coalTicket, 2, coalTeamPayReq); |
| | | ResultVo resultVo = payUtils.sendApiPost(payReqData); |
| | | ResultVo resultVo = payUtils.faqiV2(payReqData); |
| | | if (resultVo.getRespcode().equals("BUS0000")) { |
| | | payStudent.setCoalPayId(coalPay.getId()); |
| | | payStudent.setOrderId(resultVo.getRespdata().getOrderNo()); |
| | | payStudent.setGovPayStatus(1); |
| | | payStudent.setOrderId(resultVo.getRespdata().getOrderId()); |
| | | payStudent.setOrderNo(resultVo.getRespdata().getOrderNo()); |
| | | payStudent.setGovPayStatus(2); |
| | | payStudent.setPayCode(resultVo.getRespdata().getBillNo()); |
| | | coalPayStudentService.updateByCoalPayIdAndStatus(payStudent); |
| | | CoalPay coalPay1 = new CoalPay(); |
| | | coalPay1.setPayCompanyCard(coalTeamPayReq.getPayCompanyCard()); |
| | | coalPay1.setPayCompanyName(coalTeamPayReq.getPayCompanyName()); |
| | | coalPay1.setId(coalTeamPayReq.getCoalPayId()); |
| | | coalPay1.setPayPersonType(2); |
| | | coalPayMapper.updateCoalPayById(coalPay1); |
| | | return resultVo.getRespdata().getOrderId(); |
| | | } else { |
| | | throw new BusinessException(this.getClass(), ResultConstants.BUSINESS_ERROR, "发起支付失败,请稍后重试"); |
| | |
| | | //订单编号 |
| | | payReqData.setOrderNo(RandomUtil.generateOrderNumber(1L, "NC")); |
| | | //订单总金额 |
| | | payReqData.setMoney(BigDecimal.valueOf(56)); |
| | | payReqData.setMoney(BigDecimal.valueOf(203)); |
| | | //子订单数目 |
| | | payReqData.setAmount(1); |
| | | //缴费人姓名(单位填单位名称)阿克苏地区博安煤矿安全技术服务中心 |
| | | payReqData.setPayerName("李州"); |
| | | payReqData.setPayerName("杨治国"); |
| | | //缴费人证件号(单位填同一信用代码)52652900789893140A |
| | | payReqData.setCertNo("612324197909106056"); |
| | | payReqData.setCertNo("610481199801166233"); |
| | | //缴款人类型(1个人 2单位) |
| | | payReqData.setPayerType(1); |
| | | //开票单位社会信用代码12650000MB1A9612XD |
| | | payReqData.setInvoiceSocialCode("11652100MB19019356"); |
| | | payReqData.setInvoiceSocialCode("11650100745216623A"); |
| | | //开票人 |
| | | payReqData.setHandlingPerson("孙乾"); |
| | | payReqData.setHandlingPerson("朱晓明"); |
| | | //复核人 |
| | | payReqData.setChecker("哲霞"); |
| | | payReqData.setChecker("董莹"); |
| | | //单位编码547185129 |
| | | payReqData.setEnterCode("204704695"); |
| | | payReqData.setEnterCode("482911639"); |
| | | //订单描述(非必填) |
| | | payReqData.setDesc("非煤安全作业考试费_理论-012381"); |
| | | payReqData.setDesc("非煤安全作业实操考试_焊接与热切割作业-012413"); |
| | | //订单明细 |
| | | List<PayReqData.Feedata> feedatas1 = new ArrayList<>(); |
| | | //数量 |
| | | feedatas.setAmount(1); |
| | | //业务代码 |
| | | feedatas.setBusCode("DZ012381"); |
| | | feedatas.setBusCode("DZ012413"); |
| | | //单价 |
| | | feedatas.setPrice(BigDecimal.valueOf(56)); |
| | | feedatas.setPrice(BigDecimal.valueOf(203)); |
| | | PayReqData.Feedata feedata = new PayReqData.Feedata(); |
| | | // feedata.setBusCode("DZ011574"); |
| | | // feedata.setAmount(1); |
| | |
| | | |
| | | PayUtils payUtils = new PayUtils(); |
| | | ResultVo resultVo = payUtils.faqiV2(payReqData); |
| | | if (!resultVo.getRespcode().equals("BUS0000")) { |
| | | throw new BusinessException(this.getClass(), ResultConstants.BUSINESS_ERROR, "签名验证错误"); |
| | | } else { |
| | | //todo 业务处理 |
| | | } |
| | | log.info("请求结果:" + JSONObject.toJSONString(resultVo)); |
| | | // String fileData = resultVo.getRespdata().getFileData(); |
| | | // //票据原文转为byte字节文件 |