|
|
|
@ -57,6 +57,8 @@ public class YunguanInterfaceController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private ContractLCommodityService contractLCommodityService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ContractLPaymentService contractLPaymentService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private DictionaryyunguandataService dictionaryyunguandataService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ProvinceService provinceService;
|
|
|
|
@ -311,52 +313,59 @@ public class YunguanInterfaceController {
|
|
|
|
|
System.out.println(str);
|
|
|
|
|
JSONObject jsonObject = JSON.parseObject(str);
|
|
|
|
|
ContractLEntity contractLEntity = new ContractLEntity();
|
|
|
|
|
contractLEntity.setCurrency("1");//币种
|
|
|
|
|
contractLEntity.setContractType(jsonObject.get("CONTR_TY").toString());
|
|
|
|
|
if(ObjectUtil.equal("01", jsonObject.get("CONTR_TY").toString())){
|
|
|
|
|
contractLEntity.setContractType("1");
|
|
|
|
|
}else if(ObjectUtil.equal("02", jsonObject.get("CONTR_TY").toString())){
|
|
|
|
|
contractLEntity.setContractType("2");
|
|
|
|
|
//合同号
|
|
|
|
|
if(ObjectUtil.isNotEmpty(jsonObject.get("CONTR_CD"))){
|
|
|
|
|
QueryWrapper<ContractLEntity> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
queryWrapper.lambda().eq(ContractLEntity::getContractNumber, jsonObject.get("CONTR_CD").toString());
|
|
|
|
|
List<ContractLEntity> contractLEntityList = contractLService.list(queryWrapper);
|
|
|
|
|
if(contractLEntityList != null && contractLEntityList.size() > 0){
|
|
|
|
|
contractLEntity = contractLEntityList.get(0);
|
|
|
|
|
}
|
|
|
|
|
contractLEntity.setContractNumber(jsonObject.get("CONTR_CD").toString());
|
|
|
|
|
contractLEntity.setContractNo(jsonObject.get("CONTR_NO").toString());
|
|
|
|
|
contractLEntity.setSupplierSiteId(jsonObject.get("SUPPLIER_SITE_ID").toString());
|
|
|
|
|
contractLEntity.setSupplierSiteName(jsonObject.get("RESERVE17").toString());
|
|
|
|
|
contractLEntity.setRemark(jsonObject.get("REMARK").toString());
|
|
|
|
|
contractLEntity.setContrForm(jsonObject.get("CONTR_FORM").toString());
|
|
|
|
|
Date parse = dateFormat.parse(jsonObject.get("DELV_DATE").toString());
|
|
|
|
|
contractLEntity.setDeliveryTime(parse);
|
|
|
|
|
contractLEntity.setReserve4(jsonObject.get("RESERVE4").toString());
|
|
|
|
|
contractLEntity.setReserve5(jsonObject.get("RESERVE5").toString());
|
|
|
|
|
contractLEntity.setReserve9(jsonObject.get("RESERVE9").toString());
|
|
|
|
|
contractLEntity.setContractName(jsonObject.get("CONTR_NM").toString());
|
|
|
|
|
contractLEntity.setReserve2(jsonObject.get("RESERVE2").toString());
|
|
|
|
|
contractLEntity.setReserve3(jsonObject.get("RESERVE3").toString());
|
|
|
|
|
contractLEntity.setStockType(jsonObject.get("STOCK_TYPE").toString());
|
|
|
|
|
contractLEntity.setTotalAmount(new BigDecimal(jsonObject.get("CONTR_PRICE").toString()));
|
|
|
|
|
if(ObjectUtil.equal("否", jsonObject.get("RESERVE15").toString())){
|
|
|
|
|
contractLEntity.setIsLongAgreement("2");
|
|
|
|
|
}else {
|
|
|
|
|
contractLEntity.setIsLongAgreement("1");
|
|
|
|
|
}
|
|
|
|
|
if(ObjectUtil.equal("B", jsonObject.get("TRADE_TYPE").toString())){
|
|
|
|
|
contractLEntity.setProcurementModel("2");
|
|
|
|
|
}else {
|
|
|
|
|
contractLEntity.setProcurementModel("1");
|
|
|
|
|
}
|
|
|
|
|
contractLEntity.setKucunOrgCode(jsonObject.get("ORG_CD").toString());//库存组织编码
|
|
|
|
|
//库存组织编码,库存组织名称
|
|
|
|
|
if(ObjectUtil.isNotEmpty(jsonObject.get("ORG_CD"))){
|
|
|
|
|
contractLEntity.setKucunOrgCode(jsonObject.get("ORG_CD").toString());
|
|
|
|
|
DictionaryyunguandataEntity dictionaryyunguandataEntity = dictionaryyunguandataService.getDateValueInfo("564773000885326917",contractLEntity.getKucunOrgCode());
|
|
|
|
|
if (ObjectUtil.isNotEmpty(dictionaryyunguandataEntity)) {
|
|
|
|
|
contractLEntity.setKucunOrgName(dictionaryyunguandataEntity.getZhihuiValue());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//组织,公司,部门,签约主体
|
|
|
|
|
if(ObjectUtil.isNotEmpty(jsonObject.get("DEPT_CD"))){
|
|
|
|
|
QueryWrapper<OrganizeEntity> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
queryWrapper.lambda().eq(OrganizeEntity::getEnCode, jsonObject.get("DEPT_CD").toString());
|
|
|
|
|
List<OrganizeEntity> orgList = organizeService.list(queryWrapper);
|
|
|
|
|
if(orgList != null && orgList.size() > 0){
|
|
|
|
|
List<String> conpanyIdList = Arrays.asList(orgList.get(0).getCompanyIdTree().split(","));
|
|
|
|
|
String organizeId = JSON.toJSONString(conpanyIdList);
|
|
|
|
|
contractLEntity.setOrganizeJsonId(organizeId);//分支机构编码
|
|
|
|
|
contractLEntity.setDepartmentId(orgList.get(0).getId());
|
|
|
|
|
contractLEntity.setCompanyId(orgList.get(0).getParentId());
|
|
|
|
|
contractLEntity.setDeptId(contractLEntity.getCompanyId());
|
|
|
|
|
contractLEntity.setOrganizeJsonId(organizeId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//合同名称
|
|
|
|
|
if(ObjectUtil.isNotEmpty(jsonObject.get("CONTR_NM"))){
|
|
|
|
|
contractLEntity.setContractName(jsonObject.get("CONTR_NM").toString());
|
|
|
|
|
}
|
|
|
|
|
//合同类型
|
|
|
|
|
if(ObjectUtil.isNotEmpty(jsonObject.get("CONTR_TY"))){
|
|
|
|
|
if(ObjectUtil.equal("01", jsonObject.get("CONTR_TY").toString())){
|
|
|
|
|
contractLEntity.setContractType("1");
|
|
|
|
|
}else if(ObjectUtil.equal("02", jsonObject.get("CONTR_TY").toString())){
|
|
|
|
|
contractLEntity.setContractType("2");
|
|
|
|
|
}else{
|
|
|
|
|
contractLEntity.setContractType("3");//租赁合同
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//对方合同号
|
|
|
|
|
if(ObjectUtil.isNotEmpty(jsonObject.get("CONTR_NO"))){
|
|
|
|
|
contractLEntity.setContractNo(jsonObject.get("CONTR_NO").toString());
|
|
|
|
|
}
|
|
|
|
|
contractLEntity.setContractStatus("0");
|
|
|
|
|
//供应商
|
|
|
|
|
if(ObjectUtil.isNotEmpty(jsonObject.get("SUPPLIER_CD"))){
|
|
|
|
|
QueryWrapper<SubjectbasicEntity> subjectbasicQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
subjectbasicQueryWrapper.lambda().eq(SubjectbasicEntity::getCode, jsonObject.get("SUPPLIER_CD").toString());
|
|
|
|
|
subjectbasicQueryWrapper.lambda().isNull(SubjectbasicEntity::getDeleteMark);
|
|
|
|
@ -364,7 +373,122 @@ public class YunguanInterfaceController {
|
|
|
|
|
if(subjectbasicList != null && subjectbasicList.size() > 0){
|
|
|
|
|
contractLEntity.setSubject(subjectbasicList.get(0).getId());
|
|
|
|
|
}
|
|
|
|
|
contractLService.save(contractLEntity);
|
|
|
|
|
}
|
|
|
|
|
//供应商地点编码,供应商地点名称
|
|
|
|
|
contractLEntity.setSupplierSiteId(ObjectUtil.isNotEmpty(jsonObject.get("SUPPLIER_SITE_ID")) ? jsonObject.get("SUPPLIER_SITE_ID").toString() : "");
|
|
|
|
|
contractLEntity.setSupplierSiteName(ObjectUtil.isNotEmpty(jsonObject.get("RESERVE17")) ? jsonObject.get("RESERVE17").toString() : "");
|
|
|
|
|
//结算方式 A:一票结算、 B:两票结算
|
|
|
|
|
if(ObjectUtil.isNotEmpty(jsonObject.get("INV_MTH"))){
|
|
|
|
|
if(ObjectUtil.equal("A", jsonObject.get("INV_MTH").toString())){
|
|
|
|
|
contractLEntity.setSettlementType("1");
|
|
|
|
|
}else if(ObjectUtil.equal("B", jsonObject.get("INV_MTH").toString())){
|
|
|
|
|
contractLEntity.setSettlementType("2");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//签订日期
|
|
|
|
|
if(ObjectUtil.isNotEmpty(jsonObject.get("CONTR_DT"))){
|
|
|
|
|
contractLEntity.setContractSignedTime(dateFormat.parse(jsonObject.get("CONTR_DT").toString()));
|
|
|
|
|
}
|
|
|
|
|
contractLEntity.setCurrency("1");//币种
|
|
|
|
|
//交货方式A 自提、 B 送货上门、D快递
|
|
|
|
|
if(ObjectUtil.isNotEmpty(jsonObject.get("DELV_MTH"))){
|
|
|
|
|
if(ObjectUtil.equal("A", jsonObject.get("DELV_MTH").toString())){
|
|
|
|
|
contractLEntity.setDeliveryModel("3");
|
|
|
|
|
}else if(ObjectUtil.equal("B", jsonObject.get("DELV_MTH").toString())){
|
|
|
|
|
contractLEntity.setDeliveryModel("2");
|
|
|
|
|
}else{
|
|
|
|
|
contractLEntity.setDeliveryModel("1");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//合同数量
|
|
|
|
|
contractLEntity.setContractNum(ObjectUtil.isNotEmpty(jsonObject.get("RESERVE2")) ? new BigDecimal(jsonObject.get("RESERVE2").toString()) : BigDecimal.ZERO);
|
|
|
|
|
//合计金额
|
|
|
|
|
contractLEntity.setTotalAmount(ObjectUtil.isNotEmpty(jsonObject.get("CONTR_PRICE")) ? new BigDecimal(jsonObject.get("CONTR_PRICE").toString()) : BigDecimal.ZERO);
|
|
|
|
|
//运输方式
|
|
|
|
|
if(ObjectUtil.isNotEmpty(jsonObject.get("TRS_MTH"))){
|
|
|
|
|
if(ObjectUtil.equal("A", jsonObject.get("TRS_MTH").toString())){
|
|
|
|
|
contractLEntity.setModeTransport("1");
|
|
|
|
|
}else if(ObjectUtil.equal("B", jsonObject.get("TRS_MTH").toString())){
|
|
|
|
|
contractLEntity.setModeTransport("2");
|
|
|
|
|
}else{
|
|
|
|
|
contractLEntity.setModeTransport("3");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//定价模式
|
|
|
|
|
if(ObjectUtil.isNotEmpty(jsonObject.get("PRICE_DCN_MTH"))){
|
|
|
|
|
if(ObjectUtil.equal("A", jsonObject.get("PRICE_DCN_MTH").toString())){
|
|
|
|
|
contractLEntity.setPricingModel("1");
|
|
|
|
|
}else{
|
|
|
|
|
contractLEntity.setPricingModel("2");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//采购模式/销售模式
|
|
|
|
|
if(ObjectUtil.isNotEmpty(jsonObject.get("TRADE_TYPE"))){
|
|
|
|
|
if(ObjectUtil.equal("A", jsonObject.get("TRADE_TYPE").toString())){
|
|
|
|
|
contractLEntity.setProcurementModel("1");
|
|
|
|
|
}else{
|
|
|
|
|
contractLEntity.setProcurementModel("2");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//关联合同
|
|
|
|
|
if(ObjectUtil.isNotEmpty(jsonObject.get("CONTR_CD_CRSP"))){
|
|
|
|
|
QueryWrapper<ContractLEntity> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
queryWrapper.lambda().eq(ContractLEntity::getContractNumber, jsonObject.get("CONTR_CD_CRSP").toString());
|
|
|
|
|
List<ContractLEntity> contractLEntityList = contractLService.list(queryWrapper);
|
|
|
|
|
if(contractLEntityList != null && contractLEntityList.size() > 0){
|
|
|
|
|
contractLEntity.setRelatedContractId(contractLEntityList.get(0).getId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//配送方式(1.仓配2.直送)
|
|
|
|
|
if(ObjectUtil.isNotEmpty(jsonObject.get("STOCK_TYPE"))){
|
|
|
|
|
if(ObjectUtil.equal("A", jsonObject.get("STOCK_TYPE").toString())){
|
|
|
|
|
contractLEntity.setDeliveryMethod("1");
|
|
|
|
|
}else{
|
|
|
|
|
contractLEntity.setDeliveryMethod("2");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//预计交货时间
|
|
|
|
|
if(ObjectUtil.isNotEmpty(jsonObject.get("DELV_DATE"))){
|
|
|
|
|
contractLEntity.setDeliveryTime(dateFormat.parse(jsonObject.get("DELV_DATE").toString()));
|
|
|
|
|
contractLEntity.setDeliveryTimeEnd(dateFormat.parse(jsonObject.get("DELV_DATE").toString()));
|
|
|
|
|
}
|
|
|
|
|
//合同发货天数
|
|
|
|
|
contractLEntity.setDelvDays(ObjectUtil.isNotEmpty(jsonObject.get("DELV_DAYS")) ? Integer.parseInt(jsonObject.get("DELV_DAYS").toString()) : 0);
|
|
|
|
|
//是否长协
|
|
|
|
|
if(ObjectUtil.equal("否", jsonObject.get("RESERVE15").toString())){
|
|
|
|
|
contractLEntity.setIsLongAgreement("1");
|
|
|
|
|
}else {
|
|
|
|
|
contractLEntity.setIsLongAgreement("2");
|
|
|
|
|
}
|
|
|
|
|
//合同汇率
|
|
|
|
|
contractLEntity.setContrExRate(ObjectUtil.isNotEmpty(jsonObject.get("CONTR_EX_RATE")) ? jsonObject.get("CONTR_EX_RATE").toString() : "");
|
|
|
|
|
//是否安全协议
|
|
|
|
|
if(ObjectUtil.equal("否", jsonObject.get("RESERVE5").toString())){
|
|
|
|
|
contractLEntity.setSecurityProtocol("1");
|
|
|
|
|
}else {
|
|
|
|
|
contractLEntity.setSecurityProtocol("2");
|
|
|
|
|
}
|
|
|
|
|
//是否招投标
|
|
|
|
|
if(ObjectUtil.equal("否", jsonObject.get("RESERVE3").toString())){
|
|
|
|
|
contractLEntity.setBidding("1");
|
|
|
|
|
}else {
|
|
|
|
|
contractLEntity.setBidding("2");
|
|
|
|
|
}
|
|
|
|
|
//保证金
|
|
|
|
|
contractLEntity.setMargin(ObjectUtil.isNotEmpty(jsonObject.get("RESERVE11")) ? new BigDecimal(jsonObject.get("RESERVE11").toString()) : BigDecimal.ZERO);
|
|
|
|
|
//合同要求
|
|
|
|
|
contractLEntity.setContractRequirement(ObjectUtil.isNotEmpty(jsonObject.get("CONTR_REQ")) ? jsonObject.get("CONTR_REQ").toString() : "");
|
|
|
|
|
//备注
|
|
|
|
|
contractLEntity.setRemark(ObjectUtil.isNotEmpty(jsonObject.get("REMARK")) ? jsonObject.get("REMARK").toString() : "");
|
|
|
|
|
//风险提示
|
|
|
|
|
contractLEntity.setRiskInfo(ObjectUtil.isNotEmpty(jsonObject.get("RISK_INFO")) ? jsonObject.get("RISK_INFO").toString() : "");
|
|
|
|
|
//销售类型
|
|
|
|
|
if(ObjectUtil.equal("自产", jsonObject.get("SAL_INV_TYPE").toString())){
|
|
|
|
|
contractLEntity.setSalInvType("1");
|
|
|
|
|
}else {
|
|
|
|
|
contractLEntity.setSalInvType("2");
|
|
|
|
|
}
|
|
|
|
|
contractLService.saveOrUpdate(contractLEntity);
|
|
|
|
|
return ActionResult.success("运管推送合同信息到智慧成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -388,28 +512,152 @@ public class YunguanInterfaceController {
|
|
|
|
|
queryWrapper.lambda().eq(ContractLEntity::getContractNumber, jsonObject.get("CONTR_CD").toString());
|
|
|
|
|
List<ContractLEntity> contractLEntityList = contractLService.list(queryWrapper);
|
|
|
|
|
if(contractLEntityList != null && contractLEntityList.size() > 0){
|
|
|
|
|
QueryWrapper<ContractLCommodityEntity> contractLCommodityEntityQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
contractLCommodityEntityQueryWrapper.lambda().eq(ContractLCommodityEntity::getContractId, contractLEntityList.get(0).getId());
|
|
|
|
|
contractLCommodityEntityQueryWrapper.lambda().eq(ObjectUtil.isNotEmpty(jsonObject.get("CONTR_LINE_ID")), ContractLCommodityEntity::getContrLineId, jsonObject.get("CONTR_LINE_ID").toString());
|
|
|
|
|
List<ContractLCommodityEntity> contractLCommodityList = contractLCommodityService.list(contractLCommodityEntityQueryWrapper);
|
|
|
|
|
if(contractLCommodityList != null && contractLCommodityList.size() > 0){
|
|
|
|
|
contractLCommodityEntity = contractLCommodityList.get(0);
|
|
|
|
|
}
|
|
|
|
|
//组织,部门,公司,合同ID
|
|
|
|
|
contractLCommodityEntity.setContractId(contractLEntityList.get(0).getId());
|
|
|
|
|
contractLCommodityEntity.setDepartmentId(contractLEntityList.get(0).getDepartmentId());
|
|
|
|
|
contractLCommodityEntity.setCompanyId(contractLEntityList.get(0).getCompanyId());
|
|
|
|
|
contractLCommodityEntity.setOrganizeJsonId(contractLEntityList.get(0).getOrganizeJsonId());
|
|
|
|
|
}
|
|
|
|
|
//行号
|
|
|
|
|
contractLCommodityEntity.setContrLineId(ObjectUtil.isNotEmpty(jsonObject.get("CONTR_LINE_ID")) ? jsonObject.get("CONTR_LINE_ID").toString() : "");
|
|
|
|
|
//商品id,编码,名称,图片,规格,单位
|
|
|
|
|
if(ObjectUtil.isNotEmpty(jsonObject.get("ITEM_CD"))){
|
|
|
|
|
QueryWrapper<ProductWarehouseEntity> productWarehouseEntityWrapper = new QueryWrapper<>();
|
|
|
|
|
productWarehouseEntityWrapper.lambda().eq(ProductWarehouseEntity::getCode, jsonObject.get("ITEM_CD").toString());
|
|
|
|
|
List<ProductWarehouseEntity> productWarehouseEntityList = productWarehouseService.list(productWarehouseEntityWrapper);
|
|
|
|
|
if(productWarehouseEntityList != null && productWarehouseEntityList.size() > 0){
|
|
|
|
|
contractLCommodityEntity.setProductId(productWarehouseEntityList.get(0).getId());
|
|
|
|
|
contractLCommodityEntity.setCommodityCode(jsonObject.get("ITEM_CD").toString());
|
|
|
|
|
contractLCommodityEntity.setCommodityName(jsonObject.get("ITEM_NM").toString());
|
|
|
|
|
contractLCommodityEntity.setCommodityCode(productWarehouseEntityList.get(0).getCode());
|
|
|
|
|
contractLCommodityEntity.setCommodityName(productWarehouseEntityList.get(0).getName());
|
|
|
|
|
contractLCommodityEntity.setCommodityPhone(productWarehouseEntityList.get(0).getPhoto());
|
|
|
|
|
contractLCommodityEntity.setSpecifications(productWarehouseEntityList.get(0).getSpec());
|
|
|
|
|
contractLCommodityEntity.setInventoryUnitId(productWarehouseEntityList.get(0).getInventoryUnitId());
|
|
|
|
|
contractLCommodityEntity.setProcureUnit(contractLCommodityEntity.getInventoryUnitId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//数量
|
|
|
|
|
contractLCommodityEntity.setNumber(ObjectUtil.isNotEmpty(jsonObject.get("WEIGHT")) ? new BigDecimal(jsonObject.get("WEIGHT").toString()) : BigDecimal.ZERO);
|
|
|
|
|
//不含税单价
|
|
|
|
|
contractLCommodityEntity.setPriceRateNo(ObjectUtil.isNotEmpty(jsonObject.get("PRICE")) ? new BigDecimal(jsonObject.get("PRICE").toString()) : BigDecimal.ZERO);
|
|
|
|
|
//含税单价
|
|
|
|
|
contractLCommodityEntity.setPriceRate(ObjectUtil.isNotEmpty(jsonObject.get("TAX_PRICE")) ? new BigDecimal(jsonObject.get("TAX_PRICE").toString()) : BigDecimal.ZERO);
|
|
|
|
|
//ERP税码
|
|
|
|
|
contractLCommodityEntity.setTaxRateCode(ObjectUtil.isNotEmpty(jsonObject.get("TAX_RATE_CODE")) ? jsonObject.get("TAX_RATE_CODE").toString() : "");
|
|
|
|
|
//税率
|
|
|
|
|
contractLCommodityEntity.setTaxRate(ObjectUtil.isNotEmpty(jsonObject.get("TAX_RATE")) ? new BigDecimal(jsonObject.get("TAX_RATE").toString()) : BigDecimal.ZERO);
|
|
|
|
|
//不含税总金额
|
|
|
|
|
contractLCommodityEntity.setAmount(ObjectUtil.isNotEmpty(jsonObject.get("AMOUNT")) ? new BigDecimal(jsonObject.get("AMOUNT").toString()) : BigDecimal.ZERO);
|
|
|
|
|
//含税总金额
|
|
|
|
|
contractLCommodityEntity.setTotalRate(ObjectUtil.isNotEmpty(jsonObject.get("TOTAL_AMOUNT")) ? new BigDecimal(jsonObject.get("TOTAL_AMOUNT").toString()) : BigDecimal.ZERO);
|
|
|
|
|
//计算方式
|
|
|
|
|
if(ObjectUtil.equal("正算", jsonObject.get("RESERVE1").toString())){
|
|
|
|
|
contractLCommodityEntity.setCalculationMethod("1");
|
|
|
|
|
}else {
|
|
|
|
|
contractLCommodityEntity.setCalculationMethod("2");
|
|
|
|
|
}
|
|
|
|
|
//备注
|
|
|
|
|
contractLCommodityEntity.setRemark(ObjectUtil.isNotEmpty(jsonObject.get("REMARK")) ? jsonObject.get("REMARK").toString() : "");
|
|
|
|
|
//上下允差
|
|
|
|
|
contractLCommodityEntity.setDelvTolMax(ObjectUtil.isNotEmpty(jsonObject.get("DELV_TOL_MAX")) ? new BigDecimal(jsonObject.get("DELV_TOL_MAX").toString()) : BigDecimal.ZERO);
|
|
|
|
|
contractLCommodityEntity.setDelvTolMin(ObjectUtil.isNotEmpty(jsonObject.get("DELV_TOL_MIN")) ? new BigDecimal(jsonObject.get("DELV_TOL_MIN").toString()) : BigDecimal.ZERO);
|
|
|
|
|
contractLCommodityService.saveOrUpdate(contractLCommodityEntity);
|
|
|
|
|
}else{
|
|
|
|
|
return ActionResult.fail("运管推送合同信息到智慧失败,未查到合同头信息");
|
|
|
|
|
}
|
|
|
|
|
contractLCommodityEntity.setNumber(new BigDecimal(jsonObject.get("WEIGHT").toString()));
|
|
|
|
|
contractLCommodityEntity.setTaxRate(new BigDecimal(jsonObject.get("TAX_RATE").toString()));
|
|
|
|
|
contractLCommodityEntity.setPriceRate(new BigDecimal(jsonObject.get("TAX_PRICE").toString()));
|
|
|
|
|
contractLCommodityEntity.setTotalRate(new BigDecimal(jsonObject.get("TOTAL_AMOUNT").toString()));
|
|
|
|
|
contractLCommodityService.save(contractLCommodityEntity);
|
|
|
|
|
return ActionResult.success("运管推送合同信息到智慧成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 运管推送合同收付款节点信息到智慧
|
|
|
|
|
*
|
|
|
|
|
* @param
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Operation(summary = "运管推送合同收付款节点信息到智慧")
|
|
|
|
|
@PostMapping("/syncContractPayment")
|
|
|
|
|
public ActionResult syncContractPayment(HttpServletRequest httpRequest) throws IOException {
|
|
|
|
|
ServletInputStream inputStream = httpRequest.getInputStream();
|
|
|
|
|
byte[] bytes = new byte[httpRequest.getContentLength()];
|
|
|
|
|
inputStream.read(bytes);
|
|
|
|
|
String str = new String(bytes, StandardCharsets.UTF_8);
|
|
|
|
|
System.out.println(str);
|
|
|
|
|
JSONObject jsonObject = JSON.parseObject(str);
|
|
|
|
|
ContractLPaymentEntity contractLPaymentEntity = new ContractLPaymentEntity();
|
|
|
|
|
QueryWrapper<ContractLEntity> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
queryWrapper.lambda().eq(ContractLEntity::getContractNumber, jsonObject.get("CONTR_CD").toString());
|
|
|
|
|
List<ContractLEntity> contractLEntityList = contractLService.list(queryWrapper);
|
|
|
|
|
if(contractLEntityList != null && contractLEntityList.size() > 0){
|
|
|
|
|
QueryWrapper<ContractLPaymentEntity> contractLPaymentEntityQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
contractLPaymentEntityQueryWrapper.lambda().eq(ContractLPaymentEntity::getContractId, contractLEntityList.get(0).getId());
|
|
|
|
|
contractLPaymentEntityQueryWrapper.lambda().eq(ObjectUtil.isNotEmpty(jsonObject.get("INDEXS")), ContractLPaymentEntity::getIndexs, jsonObject.get("INDEXS").toString());
|
|
|
|
|
List<ContractLPaymentEntity> contractLPaymentEntityList = contractLPaymentService.list(contractLPaymentEntityQueryWrapper);
|
|
|
|
|
if(contractLPaymentEntityList != null && contractLPaymentEntityList.size() > 0){
|
|
|
|
|
contractLPaymentEntity = contractLPaymentEntityList.get(0);
|
|
|
|
|
}
|
|
|
|
|
//组织,部门,公司,合同ID
|
|
|
|
|
contractLPaymentEntity.setContractId(contractLEntityList.get(0).getId());
|
|
|
|
|
contractLPaymentEntity.setDepartmentId(contractLEntityList.get(0).getDepartmentId());
|
|
|
|
|
contractLPaymentEntity.setCompanyId(contractLEntityList.get(0).getCompanyId());
|
|
|
|
|
contractLPaymentEntity.setOrganizeJsonId(contractLEntityList.get(0).getOrganizeJsonId());
|
|
|
|
|
//行号
|
|
|
|
|
contractLPaymentEntity.setIndexs(ObjectUtil.isNotEmpty(jsonObject.get("INDEXS")) ? jsonObject.get("INDEXS").toString() : "");
|
|
|
|
|
//收付款节点
|
|
|
|
|
if(ObjectUtil.isNotEmpty(jsonObject.get("PAY_FLAG"))){
|
|
|
|
|
if(ObjectUtil.equal("预付款", jsonObject.get("PAY_FLAG").toString())){
|
|
|
|
|
contractLPaymentEntity.setPaymentNode("1");
|
|
|
|
|
}else if(ObjectUtil.equal("进度款", jsonObject.get("PAY_FLAG").toString())){
|
|
|
|
|
contractLPaymentEntity.setPaymentNode("2");
|
|
|
|
|
}else if(ObjectUtil.equal("发货后支付", jsonObject.get("PAY_FLAG").toString())){
|
|
|
|
|
contractLPaymentEntity.setPaymentNode("3");
|
|
|
|
|
}else if(ObjectUtil.equal("开票后支付", jsonObject.get("PAY_FLAG").toString())){
|
|
|
|
|
contractLPaymentEntity.setPaymentNode("4");
|
|
|
|
|
}else if(ObjectUtil.equal("质保金", jsonObject.get("PAY_FLAG").toString())){
|
|
|
|
|
contractLPaymentEntity.setPaymentNode("5");
|
|
|
|
|
}else if(ObjectUtil.equal("保证金", jsonObject.get("PAY_FLAG").toString())){
|
|
|
|
|
contractLPaymentEntity.setPaymentNode("6");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//付款方式
|
|
|
|
|
if(ObjectUtil.isNotEmpty(jsonObject.get("PAY_MTH"))){
|
|
|
|
|
if(ObjectUtil.equal("电汇", jsonObject.get("PAY_MTH").toString())){
|
|
|
|
|
contractLPaymentEntity.setPaymentMethod("1");
|
|
|
|
|
}else if(ObjectUtil.equal("承兑", jsonObject.get("PAY_MTH").toString())){
|
|
|
|
|
contractLPaymentEntity.setPaymentMethod("2");
|
|
|
|
|
}else if(ObjectUtil.equal("信用证", jsonObject.get("PAY_MTH").toString())){
|
|
|
|
|
contractLPaymentEntity.setPaymentMethod("3");
|
|
|
|
|
}else if(ObjectUtil.equal("现金", jsonObject.get("PAY_MTH").toString())){
|
|
|
|
|
contractLPaymentEntity.setPaymentMethod("4");
|
|
|
|
|
}else if(ObjectUtil.equal("支票", jsonObject.get("PAY_MTH").toString())){
|
|
|
|
|
contractLPaymentEntity.setPaymentMethod("5");
|
|
|
|
|
}else if(ObjectUtil.equal("银行承兑", jsonObject.get("PAY_MTH").toString())){
|
|
|
|
|
contractLPaymentEntity.setPaymentMethod("6");
|
|
|
|
|
}else if(ObjectUtil.equal("商业承兑", jsonObject.get("PAY_MTH").toString())){
|
|
|
|
|
contractLPaymentEntity.setPaymentMethod("7");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//账期
|
|
|
|
|
contractLPaymentEntity.setAccountingPeriod(ObjectUtil.isNotEmpty(jsonObject.get("ACCOUNT_PERIOD")) ? jsonObject.get("ACCOUNT_PERIOD").toString() : "");
|
|
|
|
|
//收款后付款
|
|
|
|
|
contractLPaymentEntity.setPayAfter(ObjectUtil.isNotEmpty(jsonObject.get("PAY_AFTER")) ? jsonObject.get("PAY_AFTER").toString() : "");
|
|
|
|
|
//备注
|
|
|
|
|
contractLPaymentEntity.setRemark(ObjectUtil.isNotEmpty(jsonObject.get("REMARK")) ? jsonObject.get("REMARK").toString() : "");
|
|
|
|
|
//付款比例
|
|
|
|
|
contractLPaymentEntity.setPaymentRatio(ObjectUtil.isNotEmpty(jsonObject.get("SCALES")) ? jsonObject.get("SCALES").toString() : "");
|
|
|
|
|
//金额
|
|
|
|
|
contractLPaymentEntity.setPrice(ObjectUtil.isNotEmpty(jsonObject.get("AMOUNT")) ? new BigDecimal(jsonObject.get("AMOUNT").toString()) : BigDecimal.ZERO);
|
|
|
|
|
contractLPaymentService.saveOrUpdate(contractLPaymentEntity);
|
|
|
|
|
}else{
|
|
|
|
|
return ActionResult.fail("运管推送合同收付款节点信息到智慧,未查到合同头信息");
|
|
|
|
|
}
|
|
|
|
|
return ActionResult.success("运管推送合同收付款节点信息到智慧成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 运管推送效益测算到智慧
|
|
|
|
|
*
|
|
|
|
|