| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.cwgl.domain.*; |
| | | import com.ruoyi.cwgl.domain.dto.CallbackReceiptDto; |
| | | import com.ruoyi.cwgl.service.IInvoiceBillDetailService; |
| | | import com.ruoyi.cwgl.service.IInvoiceBusinessService; |
| | | import com.ruoyi.system.service.ISystemDataNoService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private InvoiceBillDetailMapper invoiceBillDetailMapper; |
| | | |
| | | @Resource |
| | | private IInvoiceBillDetailService invoiceBillDetailService; |
| | | |
| | | @Resource |
| | | private IInvoiceManageLogService invoiceManageLogService; |
| | | |
| | | @Autowired |
| | |
| | | private String invoicingAddress; |
| | | @Value("${custom.gdpaasApi.returnAddress}") |
| | | private String returnAddress; |
| | | |
| | | @Autowired |
| | | private IInvoiceBusinessService invoiceBusinessService; |
| | | /** |
| | | * 查询发票管理 |
| | | * |
| | |
| | | @Override |
| | | public int updateInvoiceManage(InvoiceManage invoiceManage) { |
| | | invoiceManage.setUpdateTime(DateUtils.getNowDate()); |
| | | // 删除原有的发票明细 |
| | | invoiceManageMapper.deleteInvoiceDetailByInvoiceManageId(invoiceManage.getId()); |
| | | // 删除原有的发票业务商品明细 |
| | | invoiceBillDetailService.deleteInvoiceBillDetailByInvoiceManageId(invoiceManage.getId()); |
| | | // 插入新的明细记录 |
| | | insertInvoiceDetail(invoiceManage); |
| | | int rows = invoiceManageMapper.updateInvoiceManage(invoiceManage); |
| | | |
| | |
| | | for (InvoiceBillDetail billingDetail : invoiceBillDetails) { |
| | | InvoiceDetailApi invoiceDetail = new InvoiceDetailApi(); |
| | | |
| | | |
| | | invoiceDetail.setGoodsName(invoiceDetail.getGoodsName()); |
| | | invoiceDetail.setGoodsCode(billingDetail.getGoodsCode()); |
| | | invoiceDetail.setGoodsName(billingDetail.getGoodsName()); |
| | | |
| | | invoiceDetail.setWithTaxFlag(billingDetail.getWithTaxFlag().toString()); |
| | | invoiceDetail.setTaxRate("0.06"); |
| | |
| | | order.setInvoiceDetail(invoiceDetailList); |
| | | invoicingVo.setOrder(order); |
| | | String body = JSONObject.toJSONString(invoicingVo); |
| | | String json = HttpUtil.post(invoicingAddress + "?businessType=" + businessType + "&returnUrl=" + returnAddress, body); |
| | | String urlString = invoicingAddress + "?businessType=" + businessType + "&returnUrl=" + returnAddress; |
| | | logger.info("请求body{}",body); |
| | | logger.info("请求地址{}",urlString); |
| | | String json = HttpUtil.post(urlString, body); |
| | | |
| | | if (json == null) { |
| | | logger.info("开票失败"); |
| | |
| | | } |
| | | JSONObject jsonObject = JSONObject.parseObject(json); |
| | | String code = jsonObject.getString("code"); |
| | | |
| | | logger.info("开票返回{}",jsonObject); |
| | | String invoiceSerialNum = null; |
| | | InvoiceBusiness record = new InvoiceBusiness(); |
| | | record.setReqData(JSONObject.toJSONString(invoicingVo)); |
| | |
| | | logger.info("开票成功发票序列号为{}", invoiceSerialNum); |
| | | record.setInvoiceSerialNum(invoiceSerialNum); |
| | | record.setInvoiceManageId(invoiceManage.getId()); |
| | | invoiceBusinessService.insertInvoiceBusiness(record); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | return AjaxResult.error("开票失败"); |
| | | } |
| | | |