| | |
| | | import com.by4cloud.platformx.admin.api.entity.SysDept; |
| | | import com.by4cloud.platformx.admin.api.feign.RemoteDeptService; |
| | | import com.by4cloud.platformx.business.entity.*; |
| | | import com.by4cloud.platformx.business.entity.invoice.vo.BipResVo; |
| | | import com.by4cloud.platformx.business.entity.invoice.vo.InvoicingVo; |
| | | import com.by4cloud.platformx.business.invoice.service.BIPYsService; |
| | | import com.by4cloud.platformx.business.service.*; |
| | | import com.by4cloud.platformx.business.vo.ContractOutBoundVo; |
| | | import com.by4cloud.platformx.common.core.util.R; |
| | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 销售挂账 |
| | |
| | | private final ContractSubjectMatterService contractSubjectMatterService; |
| | | private final RemoteDeptService remoteDeptService; |
| | | |
| | | |
| | | private final InvoiceService invoiceService; |
| | | private final BIPYsService bipYsService; |
| | | |
| | | |
| | | /** |
| | |
| | | contractOutBoundService.updateById(outBound); |
| | | } |
| | | saleCredit.setOutBoundIds(outBoundIds); |
| | | saleCreditService.save(saleCredit); |
| | | saleCredit.setEntrustCode("JsNo"+System.currentTimeMillis()); |
| | | saleCreditService.updateById(saleCredit); |
| | | |
| | | return R.ok("销售挂账生成!"); |
| | | //生成vo |
| | | InvoicingVo invoicingVo = invoiceService.toGetByCompareByVo(saleCredit,contractOutBoundList); |
| | | try { |
| | | Map<String, Object> objectMap = invoiceService.toKaipiao(invoicingVo); |
| | | Boolean success = (Boolean) objectMap.get("success"); |
| | | String message = (String) objectMap.get("message"); |
| | | //System.out.println(saleCredit.getEntrustCode() + "的railwayEntrust蓝字开票结果为:" + success + "------" + message); |
| | | if(success){ |
| | | saleCredit.setBlueResultStatus(1); |
| | | saleCreditService.updateById(saleCredit); |
| | | //StringBuffer errMsg = new StringBuffer(); |
| | | BipResVo bipResVo = bipYsService.sendBIPYs(saleCredit); |
| | | if (!bipResVo.getCode().equals("200")) { |
| | | /*if (StrUtil.isNotEmpty(errMsg)) { |
| | | errMsg.append(","); |
| | | } |
| | | errMsg.append(saleCredit.getCreditCodeB()+ "应收发票推送失败:" + bipResVo.getMessage());*/ |
| | | return R.failed("开票成功,推送bip失败,err:" + bipResVo.getMessage()); |
| | | }else{ |
| | | return R.ok("开票成功,推送big成功!"); |
| | | } |
| | | |
| | | }else{ |
| | | saleCredit.setStatus(2); |
| | | saleCreditService.updateById(saleCredit); |
| | | return R.failed("开票失败!原因:" + message); |
| | | } |
| | | |
| | | }catch (Exception e){ |
| | | saleCredit.setStatus(3); |
| | | saleCreditService.updateById(saleCredit); |
| | | return R.failed("开票失败!"); |
| | | } |
| | | //return R.ok("销售挂账生成!"); |
| | | } |
| | | |
| | | |
| | |
| | | @SysLog("拼接销售挂账" ) |
| | | @GetMapping("/generatorInvoice") |
| | | @PreAuthorize("@pms.hasPermission('business_saleCredit_view')" ) |
| | | @Inner(value = false) |
| | | public R generatorInvoice(@ParameterObject SaleCredit saleCredit) { |
| | | if(saleCredit.getContractId()==null){ |
| | | return R.failed("合同id不能为空"); |