| | |
| | | import com.by4cloud.platformx.business.dto.BankStatementUpdateDTO; |
| | | import com.by4cloud.platformx.business.dto.BipQueryDTO; |
| | | import com.by4cloud.platformx.business.dto.PaymentConfirmAddDTO; |
| | | import com.by4cloud.platformx.business.dto.SyncPaymentRecepitDTO; |
| | | import com.by4cloud.platformx.business.entity.*; |
| | | import com.by4cloud.platformx.business.mapper.*; |
| | | import com.by4cloud.platformx.business.service.BankStatementService; |
| | | import com.by4cloud.platformx.business.service.PaymentConfirmService; |
| | | import com.by4cloud.platformx.business.vo.CustInfoVo; |
| | | import com.by4cloud.platformx.business.vo.ReceiveBipVo; |
| | | import com.by4cloud.platformx.business.vo.ReceiveItemVo; |
| | | import com.by4cloud.platformx.business.vo.StatementContractVo; |
| | |
| | | @Value("${erp.sgb}") |
| | | private String sgbErp; |
| | | |
| | | @Value("${dept.smj}") |
| | | private String smj; |
| | | |
| | | @Value("${dept.smjsc}") |
| | | private String smjsc; |
| | | |
| | | @Value("${dept.smjzt}") |
| | | private String smjzt; |
| | | |
| | | @Value("${dept.smjhw}") |
| | | private String smjhw; |
| | | |
| | | @Value("${dept.jxc}") |
| | | private String jxc; |
| | | |
| | | @Value("${dept.tfgs}") |
| | | private String tfgs; |
| | | |
| | | @Value("${dept.ymj}") |
| | | private String ymj; |
| | | |
| | | @Override |
| | | public R edit(BankStatementUpdateDTO updateDTO) { |
| | | BankStatement statement = baseMapper.selectById(updateDTO.getId()); |
| | |
| | | addDTO.setBusGuestId(statement.getBusGuestId() + ""); |
| | | addDTO.setConfirmTime(statement.getTranDate()); |
| | | addDTO.setContractNo(contract.getContractNo()); |
| | | addDTO.setInOrOut(statement.getDcFlag()); |
| | | addDTO.setInOrOut("1"); |
| | | addDTO.setTransationAmount(statementContractDTO.getToPaidAmount()); |
| | | addDTO.setBankSeqNo(statement.getBankSeqNo()); |
| | | paymentConfirmService.add(addDTO); |
| | |
| | | pushCollectionSgb(statement, updateDTO.getContractCollectionList()); |
| | | } |
| | | |
| | | // //判断是否内部单位 |
| | | // CustInfoVo custInfoVo = bipViewMapper.selectBaseInfoByCustName(statement.getPayBankAccName()); |
| | | // if (ObjUtil.isNull(custInfoVo)){ |
| | | // return R.ok(); |
| | | // } |
| | | // //bip推送 |
| | | // if (bipFlag&&custInfoVo.getCustCode().equals("01")) { |
| | | // return pushSaveCollection(statement, updateDTO.getContractCollectionList()); |
| | | // } |
| | | // log.info("内部往来收款单,客户名称:{},客户类型:{},不用保存收款单",custInfoVo.getCustName(),custInfoVo.getCustclass()); |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | |
| | | // HttpResponse resp = HttpUtil.createPost(sgbErp + "/apilink/arclose/create?corpsecret=12345678&appserver=appserver1&accountid=888&tradeid=" |
| | | // + IdUtil.fastUUID()) |
| | | // .header("Content-Type","application/x-www-form-urlencoded") |
| | | // .body(URLEncodeUtil.encode(request.toJSONString(), StandardCharsets.UTF_8)) |
| | | // .form("",request.toJSONString()) |
| | | // .timeout(30000) |
| | | // // 指定编码格式 |
| | | // .charset(StandardCharsets.UTF_8) |
| | | // .execute(); |
| | | |
| | | log.info("工业泵收款入参:{}", "=" +request.toJSONString()); |
| | | OkHttpClient client = new OkHttpClient().newBuilder() |
| | | .build(); |
| | | MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded"); |
| | | RequestBody body = RequestBody.create(mediaType, "=" + request.toJSONString()); |
| | | Request req = new Request.Builder() |
| | | .url(sgbErp + "/apilink/arclose/create?corpsecret=12345678&appserver=appserver1&accountid=888&tradeid=" + IdUtil.fastUUID()) |
| | | .method("POST", body) |
| | | .addHeader("Content-Type", "application/x-www-form-urlencoded") |
| | | .build(); |
| | | String result = ""; |
| | | try (Response response = client.newCall(req).execute()){ |
| | | if (response.isSuccessful()) { |
| | | // 仅调用一次string(),结果存入变量复用,后续所有逻辑直接读取该变量 |
| | | result = response.body().string(); |
| | | // 业务逻辑直接使用result,禁止再次调用response.body().string() |
| | | } |
| | | log.info("工业泵收款入参:{}", "=" + request.toJSONString()); |
| | | OkHttpClient client = new OkHttpClient().newBuilder() |
| | | .build(); |
| | | MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded"); |
| | | RequestBody body = RequestBody.create(mediaType, "=" + request.toJSONString()); |
| | | Request req = new Request.Builder() |
| | | .url(sgbErp + "/apilink/arclose/create?corpsecret=12345678&appserver=appserver1&accountid=888&tradeid=" + IdUtil.fastUUID()) |
| | | .method("POST", body) |
| | | .addHeader("Content-Type", "application/x-www-form-urlencoded") |
| | | .build(); |
| | | String result = ""; |
| | | try (Response response = client.newCall(req).execute()) { |
| | | if (response.isSuccessful()) { |
| | | // 仅调用一次string(),结果存入变量复用,后续所有逻辑直接读取该变量 |
| | | result = response.body().string(); |
| | | // 业务逻辑直接使用result,禁止再次调用response.body().string() |
| | | } |
| | | log.info("工业泵收款回参:{}", result); |
| | | saveErpRequestRecord("sgb", "/apilink/arclose/create", request.toJSONString(), result); |
| | | JSONObject respJson = JSONObject.parseObject(result); |
| | |
| | | djt.put("cBankAccount", statement.getReceiveBankAccAcc());//本方银行账号 |
| | | djt.put("cBank", statement.getPayBankAccName());//本方银行账号 |
| | | djt.put("cContractType", "161"); |
| | | if (CollUtil.size(contractCollectionList)==1) { |
| | | if (CollUtil.size(contractCollectionList) == 1) { |
| | | Contract contractHeader = contractMapper.selectById(contractCollectionList.get(0).getId()); |
| | | djt.put("cContractID", contractHeader.getErpContractNo()); |
| | | } |
| | |
| | | djti.put("cPersonCode", "00164");//业务员编码 |
| | | djti.put("cConID", contract.getErpContractNo());//合同编码 |
| | | djti.put("款项类型", "应收款"); |
| | | djti.put("cConType","镇江市"); |
| | | djti.put("cConType", "镇江市"); |
| | | array.add(djti); |
| | | }); |
| | | |
| | |
| | | data.put("exchangeRate", "1");//汇率 |
| | | data.put("exchangeRateDate", DateUtil.now());//汇率时间 |
| | | data.put("objectType", "1"); |
| | | data.put("customerCode", customer.getBipCode());//客户编码 |
| | | data.put("customerCode", bipVo.getKh());//客户编码 |
| | | data.put("financeOrgCode", dept.getBipCode());//开票组织编码 |
| | | data.put("orgCode", dept.getBipCode());//业务组织编码 |
| | | data.put("bustypeCode", "ar_colsale");// TODO 交易类型编码 暂估默认ZGYSFP,装备默认ZBYXGLXT暂时不能用 |
| | | data.put("bustypeCode", bipVo.getJylx());// TODO 交易类型编码 YS-YSKD//预收款单 ZJSKD 直接收款单 收款单 ar_coloth 其他收款 收款单 ar_colsale 其他收款 收款单 |
| | | data.put("oriCurrencyCode", "CNY");//币种 |
| | | data.put("settleModeCode",bipVo.getJsfs());//结算方式 |
| | | data.put("staffCode",bipVo.getYwy());//业务员 |
| | | data.put("srcBillType", "38"); |
| | | data.put("srcBillNo", statement.getBankSeqNo()); |
| | | data.put("_status", "Insert"); |
| | |
| | | item.put("expenseItemCode", bipVo.getItemList().get(0).getJjsx());//经济事项 |
| | | item.put("remarks", bipVo.getItemList().get(0).getZy());//摘要 |
| | | JSONObject freeChId = new JSONObject(); |
| | | |
| | | freeChId.put("YSYF14", bipVo.getItemList().get(0).getKxlx());//款项类型 1 预收款 2 应收款 |
| | | freeChId.put("YSYF33", bipVo.getItemList().get(0).getFphm());//发票号码 |
| | | freeChId.put("GX08", bipVo.getItemList().get(0).getHsdy());//核算单元 |
| | | freeChId.put("YSYF14", "1");//款项类型 1 预收款 2 应收款 |
| | | freeChId.put("JT04", bipVo.getItemList().get(0).getHsjylx());//核算交易类型 0101 集团外部 01020301 三级分子公司间 01020302 三级分公司与子子公司之间 |
| | | freeChId.put("JT06", bipVo.getItemList().get(0).getKxmx());//款项明细 |
| | | freeChId.put("JT12", bipVo.getItemList().get(0).getCpwlfl());//产品物料分类 |
| | | freeChId.put("JT32", bipVo.getItemList().get(0).getZyys());//作业要素 |
| | | freeChId.put("zzbkfl", bipVo.getItemList().get(0).getBkfl());//板块分类 |
| | | freeChId.put("YSZJX01A",bipVo.getItemList().get(0).getXzjysxma());//新资金预算项目A |
| | | freeChId.put("YSZJX11","是");//是否资金预算控制 |
| | | |
| | | item.put("freeChId", freeChId); |
| | | |
| | |
| | | data.put("bodyItem", bodyItem); |
| | | JSONObject datafreeChId = new JSONObject(); |
| | | datafreeChId.put("YSYF_SFZY", bipVo.getSfzy());//是否主营 |
| | | datafreeChId.put("fk_035", bipVo.getSffz());//是否入负债科目 |
| | | datafreeChId.put("fk_038", bipVo.getPzzdr());//凭证制单人 |
| | | datafreeChId.put("YSYF_08", bipVo.getSfnbwl());//是否内部往来 |
| | | datafreeChId.put("YSYF24", bipVo.getSfjyjs());//是否简易计税 |
| | |
| | | } |
| | | bipVo.setYwy(SecurityUtils.getUser().getNickname()); |
| | | bipVo.setPzzdr(SecurityUtils.getUser().getNickname()); |
| | | bipVo.setJylx("ZBYXGLXT"); |
| | | bipVo.setJylx("YS-YSKD"); |
| | | bipVo.setWldxlx("1"); |
| | | bipVo.setKh(customer.getCreditCode()); |
| | | bipVo.setBz("CNY"); |
| | |
| | | bipVo.setDjfx("1"); |
| | | List<ReceiveItemVo> list = new ArrayList<>(); |
| | | ReceiveItemVo itemVo = new ReceiveItemVo(); |
| | | itemVo.setKxlx("1"); |
| | | itemVo.setConfirmAmount(bankStatementItem.getConfirmAmount()); |
| | | list.add(itemVo); |
| | | bipVo.setItemList(list); |
| | |
| | | item.setBipParam(updateDTO.getBipParam()); |
| | | bankStatementItemMapper.updateById(item); |
| | | BankStatement statement = baseMapper.selectById(item.getStatetId()); |
| | | |
| | | //判断是否内部单位 |
| | | CustInfoVo custInfoVo = bipViewMapper.selectBaseInfoByCustName(statement.getPayBankAccName()); |
| | | if (ObjUtil.isNotNull(custInfoVo) && custInfoVo.getCustCode().equals("01")) { |
| | | log.info("内部往来收款单,客户名称:{},客户类型:{},不用保存收款单", custInfoVo.getCustName(), custInfoVo.getCustclass()); |
| | | return R.failed("内部往来收款单,不用推送BIP"); |
| | | } |
| | | |
| | | return pushSaveCollection(statement, item); |
| | | } |
| | | |
| | | @Override |
| | | public R pullBankData(SyncPaymentRecepitDTO queryDTO) { |
| | | if (StrUtil.isBlank(queryDTO.getStartDate())||StrUtil.isBlank(queryDTO.getEndDate())){ |
| | | return R.failed("请选择交易时间范围"); |
| | | } |
| | | if (StrUtil.equals(SecurityUtils.getUser().getCompId() + "", smj) || |
| | | StrUtil.equals(SecurityUtils.getUser().getCompId() + "", smjhw)) { |
| | | queryDTO.setBipCode("10860"); |
| | | } |
| | | if ( StrUtil.equals(SecurityUtils.getUser().getCompId() + "", smjsc) ) { |
| | | queryDTO.setBipCode("1086005"); |
| | | } |
| | | if (StrUtil.equals(SecurityUtils.getUser().getCompId() + "", smjzt)) { |
| | | queryDTO.setBipCode("10860"); |
| | | } |
| | | if (StrUtil.equals(SecurityUtils.getUser().getCompId() + "", sgb)) { |
| | | queryDTO.setBipCode("10802 "); |
| | | } |
| | | if (StrUtil.equals(SecurityUtils.getUser().getCompId() + "", ymj)) { |
| | | queryDTO.setBipCode("10668"); |
| | | } |
| | | if (StrUtil.equals(SecurityUtils.getUser().getCompId() + "", tfgs)) { |
| | | queryDTO.setBipCode("10861"); |
| | | } |
| | | if (StrUtil.equals(SecurityUtils.getUser().getCompId() + "", jxc)) { |
| | | queryDTO.setBipCode("10801"); |
| | | } |
| | | return paymentConfirmService.syncPaymentRecepit(queryDTO); |
| | | } |
| | | |
| | | @Override |
| | | public R updById(Long id) { |
| | | BankStatement statement = baseMapper.selectById(id); |
| | | if (ObjUtil.isNull(statement)){ |
| | | return R.failed("流水数据异常"); |
| | | } |
| | | |
| | | |
| | | |
| | | if (StrUtil.equals(SecurityUtils.getUser().getCompId() + "", smj) || StrUtil.equals(SecurityUtils.getUser().getCompId() + "", smjhw)) { |
| | | List<String> smjList = new ArrayList<>(); |
| | | smjList.add(smj); |
| | | smjList.add(smjhw); |
| | | BusinessCustomer customer = businessCustomerMapper.selectOne(Wrappers.<BusinessCustomer>lambdaQuery() |
| | | .eq(BusinessCustomer::getCompanyName,statement.getPayBankAccName()) |
| | | .in(BusinessCustomer::getCompId,smjList) |
| | | .last("limit 1")); |
| | | if (ObjUtil.isNull(customer)){ |
| | | return R.failed("客户信息查询失败"); |
| | | } |
| | | statement.setBusGuestId(customer.getId()); |
| | | baseMapper.updateById(statement); |
| | | return R.ok(); |
| | | } |
| | | BusinessCustomer customer = businessCustomerMapper.selectOne(Wrappers.<BusinessCustomer>lambdaQuery() |
| | | .eq(BusinessCustomer::getCompanyName,statement.getPayBankAccName()) |
| | | .eq(BusinessCustomer::getCompId,SecurityUtils.getUser().getCompId()) |
| | | .last("limit 1")); |
| | | if (ObjUtil.isNull(customer)){ |
| | | return R.failed("客户信息查询失败"); |
| | | } |
| | | statement.setBusGuestId(customer.getId()); |
| | | baseMapper.updateById(statement); |
| | | return R.ok(); |
| | | } |
| | | } |