| | |
| | | if (CollUtil.isNotEmpty(slipList)){ |
| | | detailVo.setPaymentSlip(slipList); |
| | | } |
| | | BusinessCustomer customer = businessCustomerMapper.selectById(contract.getPartyAId()); |
| | | if (ObjUtil.isNotNull(customer)){ |
| | | detailVo.setInvoiceType(customer.getInvoiceType()); |
| | | } |
| | | return detailVo; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | } |
| | | if (StrUtil.equals(contract.getPartyBId()+"",smj)&&StrUtil.isNotEmpty(smjErp)){ |
| | | log.info("石煤机合同推送erp入参:{}",request.toJSONString()); |
| | | String result = HttpUtil.post(smjErp,request.toJSONString()); |
| | | log.info("石煤机合同推送erp回参:{}",result); |
| | | //保存请求记录 |
| | | saveErpRequestRecord("smj",request.toJSONString(),result); |
| | | //更新合同erp推送标识 |
| | | contract.setErpPushFlag("1"); |
| | | baseMapper.updateById(contract); |
| | | if ((StrUtil.equals(contract.getPartyBId()+"",smj)||StrUtil.equals(contract.getPartyBId()+"",smjsc)|| |
| | | StrUtil.equals(contract.getPartyBId()+"",smjzt))&&StrUtil.isNotEmpty(smjErp)){ |
| | | request.put("customerCode",customer.getErpCompanyCode()); |
| | | request.put("currencyId","RMB"); |
| | | request.put("signDate",DateUtil.format(contract.getSignDate(),DatePattern.NORM_DATETIME_PATTERN)); |
| | | request.put("dateDeliver",DateUtil.format(contract.getExpirationDate(),DatePattern.NORM_DATETIME_PATTERN)); |
| | | request.put("moneySum",contract.getAmount()); |
| | | request.put("signManner","面签"); |
| | | request.put("salesman",""); |
| | | if (ArrayUtil.isNotEmpty(subjectMatterList)){ |
| | | JSONArray subjectMatter = new JSONArray(); |
| | | subjectMatterList.stream().forEach(contractSubjectMatter -> { |
| | | JSONObject subjectMatterItem = new JSONObject(); |
| | | subjectMatterItem.put("itemNo",contractSubjectMatter.getMaterialCode()); |
| | | subjectMatterItem.put("salePrice",contractSubjectMatter.getUnitPrice()); |
| | | subjectMatterItem.put("qtyRequired",contractSubjectMatter.getQuantity()); |
| | | subjectMatterItem.put("money",contractSubjectMatter.getQuantity().multiply(contractSubjectMatter.getUnitPrice())); |
| | | Product product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getCompId,contract.getCompId()) |
| | | .eq(Product::getErpCode,contractSubjectMatter.getMaterialCode())); |
| | | if (ObjUtil.isNotNull(product)){ |
| | | subjectMatterItem.put("taxRate",new BigDecimal(product.getTaxRate()).divide(new BigDecimal("100"))); |
| | | } |
| | | subjectMatterItem.put("dateDeliver",ObjUtil.isNotNull(contractSubjectMatter.getPlannedDeliveryDate())? |
| | | DateUtil.format(contractSubjectMatter.getPlannedDeliveryDate(),DatePattern.NORM_DATETIME_PATTERN): |
| | | DateUtil.format(contract.getExpirationDate(),DatePattern.NORM_DATETIME_PATTERN)); |
| | | subjectMatter.add(subjectMatterItem); |
| | | }); |
| | | request.put("details",subjectMatter); |
| | | } |
| | | |
| | | JSONObject loginJson = new JSONObject(); |
| | | loginJson.put("username","admin"); |
| | | loginJson.put("password","Zimafold@2026"); |
| | | log.info("石煤机合同推送获取token入参:{}",loginJson.toJSONString()); |
| | | String loginResp = HttpUtil.post(smjErp+"/api/account/v1/login",loginJson.toJSONString()); |
| | | log.info("石煤机合同推送获取token回参:{}",loginResp); |
| | | JSONObject respJson = JSONObject.parseObject(loginResp); |
| | | if (respJson.getInteger("code")==0){ |
| | | JSONObject dataJson = JSONObject.parseObject(respJson.getString("data")); |
| | | log.info("石煤机合同推送erp入参:{}",request.toJSONString()); |
| | | HttpResponse response = HttpRequest.post(smjErp+"/api/contract/v1/createWithDetails") |
| | | .header("token", dataJson.getString("token")) // 添加认证头 |
| | | .header("Content-Type", "application/json") // 设置内容类型 |
| | | .body(request.toJSONString()) // 设置请求体 |
| | | .execute(); // 执行请求.post(ymjErp,request.toJSONString()); |
| | | log.info("石煤机合同推送erp回参:{}",response.body()); |
| | | //保存请求记录 |
| | | saveErpRequestRecord("smj",request.toJSONString(),response.body()); |
| | | //更新合同erp推送标识 |
| | | contract.setErpPushFlag("1"); |
| | | baseMapper.updateById(contract); |
| | | } |
| | | } |
| | | |
| | | if (StrUtil.equals(contract.getPartyBId()+"",jxc)&&StrUtil.isNotEmpty(jxcErp)){ |
| | |
| | | } |
| | | contractExecDate.setGenFlag("1"); |
| | | contractExecDateMapper.updateById(contractExecDate); |
| | | contract.setBillingStatus("2"); |
| | | baseMapper.updateById(contract); |
| | | }); |
| | | } |
| | | return R.ok(); |
| | |
| | | baseMapper.insert(contract); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| | | public R pushCenter(Long id) { |
| | | Contract contract = baseMapper.selectById(id); |
| | | List<ContractSubjectMatter> subjectMatterList=contractSubjectMatterMapper.selectList(Wrappers.<ContractSubjectMatter>lambdaQuery() |
| | | .eq(ContractSubjectMatter::getContractId,id)); |
| | | JSONObject requestApply = new JSONObject(); |
| | | requestApply.put("fd_selectionmethod", "公开招标"); |
| | | requestApply.put("fd_isrelated", "是"); |
| | | requestApply.put("fd_bizId", contract.getId()); |
| | | requestApply.put("fd_remark", contract.getRemark()); |
| | | requestApply.put("fd_MainContent", ""); |
| | | requestApply.put("fd_settlementType", "00"); |
| | | requestApply.put("fd_applyType", "外销"); |
| | | requestApply.put("fd_contractsubject ", subjectMatterList.stream().map(item -> item.getMaterialName()).collect(Collectors.joining(","))); |
| | | requestApply.put("fd_docNumber", contract.getContractNo()); |
| | | requestApply.put("fd_templateId", "19e39bb6c1edadbdb162c434274a8a18"); |
| | | requestApply.put("fd_name", contract.getContractName()); |
| | | requestApply.put("fd_signDate", DateUtil.formatDate(contract.getSignDate())); |
| | | requestApply.put("fd_endDate", DateUtil.formatDate(contract.getExpirationDate())); |
| | | requestApply.put("fd_contractCreater", contract.getNickName()); |
| | | requestApply.put("fd_currency", "人民币"); |
| | | requestApply.put("fd_ContractAmount", contract.getAmount()); |
| | | requestApply.put("fd_finAmount", contract.getAmount().divide(new BigDecimal("113"), 2, RoundingMode.HALF_UP) |
| | | .multiply(new BigDecimal("87"))); |
| | | requestApply.put("fd_docStatus", "20"); |
| | | requestApply.put("fd_taxRates", 13); |
| | | requestApply.put("fd_customerName", contract.getPartyA()); |
| | | requestApply.put("fd_systemSource", "非煤销售系统"); |
| | | requestApply.put("fd_type", "00"); |
| | | log.info("合同中心合同起草接口入参:{}", requestApply.toJSONString()); |
| | | String respApply = HttpUtil.post("https://oatest.res.jzeg.cn/ekp/api/km-agreement/kmAgreementWebService/addSupplyContractApply", requestApply.toJSONString()); |
| | | log.info("合同中心合同起草接口回参:{}", respApply); |
| | | JSONObject applyResp = JSONObject.parseObject(respApply); |
| | | if (applyResp.getString("code").equals("00")) { |
| | | JSONObject request = new JSONObject(); |
| | | request.put("fd_docNumber", contract.getContractNo()); |
| | | request.put("fd_singer", contract.getNickName()); |
| | | request.put("fd_signTime", DateUtil.formatDate(contract.getSignDate())); |
| | | request.put("fd_linkPerson", ""); |
| | | request.put("fd_linkPhone", ""); |
| | | request.put("fd_address", contract.getSignPlace()); |
| | | request.put("fd_receivedTime", DateUtil.format(contract.getCreateTime(), DatePattern.NORM_DATETIME_PATTERN)); |
| | | request.put("fd_receivedNum", 1); |
| | | request.put("fd_effedate", DateUtil.formatDate(contract.getSignDate())); |
| | | request.put("fd_enddate", DateUtil.formatDate(contract.getExpirationDate())); |
| | | request.put("fd_reviewerNo", contract.getNickName()); |
| | | request.put("fd_docStatus", "20"); |
| | | request.put("fd_templateId", "19e39bb6c1edadbdb162c434274a8a18"); |
| | | request.put("fd_attName", contract.getAttachmentName()); |
| | | request.put("fd_attcontent", NetworkFileToBase64.convertNetworkFileToBase64("https://zbjt.res.jzeg.cn/api" + contract.getAttachmentUrl())); |
| | | log.info("合同中心同步合同接口入参:{}", request.toJSONString()); |
| | | String resp = HttpUtil.post("https://oatest.res.jzeg.cn/ekp/api/km-agreement/kmAgreementWebService/addContractReview", request.toJSONString()); |
| | | log.info("合同中心同步合同接口回参:{}", resp); |
| | | JSONObject respJson = JSONObject.parseObject(resp); |
| | | if (respJson.getString("code").equals("00")) { |
| | | contract.setCenterPushFlag("1"); |
| | | baseMapper.updateById(contract); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | } |