|
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import cn.hutool.http.HttpUtil; |
|
|
|
|
import cn.hutool.json.JSONObject; |
|
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
|
import com.logpm.factorydata.base.feign.IFactoryDataBaseClient; |
|
|
|
@ -12,6 +13,7 @@ import com.logpm.factorydata.enums.BrandEnums;
|
|
|
|
|
import com.logpm.factorydata.feign.IFactoryDataClient; |
|
|
|
|
import com.logpm.factorydata.linsy.entity.DeliveryNoteEntity; |
|
|
|
|
import com.logpm.factorydata.linsy.mapper.DeliveryNoteMapper; |
|
|
|
|
import com.logpm.factorydata.linsy.pros.LinsyProperties; |
|
|
|
|
import com.logpm.factorydata.linsy.service.DeliveryNoteService; |
|
|
|
|
import com.logpm.factorydata.linsy.vo.CancelOrderVO; |
|
|
|
|
import com.logpm.factorydata.linsy.vo.DeliveryNoteVO; |
|
|
|
@ -33,6 +35,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -49,6 +52,7 @@ public class DeliveryNoteServiceImpl extends BaseServiceImpl<DeliveryNoteMapper,
|
|
|
|
|
private final IFactoryDataBaseClient baseClient; |
|
|
|
|
private final IFactoryDataClient factoryDataClient; |
|
|
|
|
private final ITrunklineAdvanceClient advanceClient; |
|
|
|
|
private final LinsyProperties linsyProperties; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@LogpmAsync("asyncExecutor") |
|
|
|
@ -123,9 +127,9 @@ public class DeliveryNoteServiceImpl extends BaseServiceImpl<DeliveryNoteMapper,
|
|
|
|
|
advanceDetailEntity.setBrand(BrandEnums.LINSY.getValue()); |
|
|
|
|
advanceDetailEntity.setSystemType("线上"); |
|
|
|
|
advanceDetailEntity.setFirstPackName(orderPackageDTO.getMaterialName()); |
|
|
|
|
//二级品类名称
|
|
|
|
|
// 二级品类名称
|
|
|
|
|
advanceDetailEntity.setSecondPackName(orderPackageDTO.getMaterialName()); |
|
|
|
|
//三级品类名称
|
|
|
|
|
// 三级品类名称
|
|
|
|
|
advanceDetailEntity.setThirdPackName(orderPackageDTO.getMaterialName()); |
|
|
|
|
advanceDetailEntity.setMaterialName(orderPackageDTO.getMaterialName()); |
|
|
|
|
advanceDetailEntity.setMaterialCode(orderPackageDTO.getMaterialCode()); |
|
|
|
@ -171,8 +175,133 @@ public class DeliveryNoteServiceImpl extends BaseServiceImpl<DeliveryNoteMapper,
|
|
|
|
|
log.info("工厂发起取消订单:{}", JSONUtil.toJsonStr(vo)); |
|
|
|
|
CancelOrderParamVO param = new CancelOrderParamVO(); |
|
|
|
|
param.setOrderCode(vo.getSourceCode()); |
|
|
|
|
Boolean result = advanceClient.cancelOrder(param); |
|
|
|
|
return result; |
|
|
|
|
if(linsyProperties.getNewAdvance()){ |
|
|
|
|
Boolean result = advanceClient.cancelOrder(param); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
if(linsyProperties.getOldAdvance()){ |
|
|
|
|
String post = HttpUtil.post(linsyProperties.getOldSystemHost() + linsyProperties.getOldSystemCancelAdvanceUrl(), JSONUtil.toJsonStr(param)); |
|
|
|
|
|
|
|
|
|
// return result;
|
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@LogpmAsync("asyncExecutor") |
|
|
|
|
public void buildOldAdvance(DeliveryNoteVO vo) { |
|
|
|
|
log.info("林氏老系统生成暂存单:{}", JSONUtil.toJsonStr(vo)); |
|
|
|
|
Long startWarehouseId = null; |
|
|
|
|
String startWarehouseName = null; |
|
|
|
|
// 获取工厂基地绑定的始发仓信息
|
|
|
|
|
R<FactoryWarehouseBindVO> warehouseByBrandAndSiteName = baseClient.getWarehouseByBrandAndSiteName(BrandEnums.LINSY.getValue(), vo.getSupplierName()); |
|
|
|
|
if (ObjectUtil.equal(HttpConstants.HTTP.HTTP_RESOURCE_CODE.SUCCESS_CODE, warehouseByBrandAndSiteName.getCode())) { |
|
|
|
|
FactoryWarehouseBindVO data = warehouseByBrandAndSiteName.getData(); |
|
|
|
|
if (ObjectUtil.isNotNull(data)) { |
|
|
|
|
startWarehouseId = data.getOldWarehouseId(); |
|
|
|
|
startWarehouseName = data.getOldWarehouseName(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
JSONObject advance = new JSONObject(); |
|
|
|
|
List<PackageInfoVO> packages = vo.getPackages(); |
|
|
|
|
// 组装暂存单数据
|
|
|
|
|
advance.set("siteName", vo.getSupplierName()); |
|
|
|
|
advance.set("area", ""); |
|
|
|
|
advance.set("orderTypeName", ""); |
|
|
|
|
advance.set("orderClassName", ""); |
|
|
|
|
advance.set("type", BrandEnums.LINSY.getValue()); |
|
|
|
|
advance.set("total", CollUtil.isNotEmpty(packages) ? packages.size() : 0); |
|
|
|
|
advance.set("mtdsNo", ""); |
|
|
|
|
advance.set("warehouse_id", startWarehouseId); |
|
|
|
|
advance.set("mctsTruck", StrUtil.replace(DateUtil.today(), "-", "")); |
|
|
|
|
advance.set("orderSelfNum", vo.getBillCode()); |
|
|
|
|
advance.set("dealerName", vo.getShopName()); |
|
|
|
|
advance.set("dealerCode", ""); |
|
|
|
|
advance.set("storeName", vo.getShopName()); |
|
|
|
|
advance.set("storeNo", ""); |
|
|
|
|
advance.set("old_id", ""); |
|
|
|
|
advance.set("serialKey", ""); |
|
|
|
|
advance.set("dueDate", ""); |
|
|
|
|
advance.set("delete_reason", ""); |
|
|
|
|
advance.set("delete_administrators_id", ""); |
|
|
|
|
advance.set("matingCode", ""); |
|
|
|
|
advance.set("leaveBehind", "N"); |
|
|
|
|
advance.set("contractNum", ""); |
|
|
|
|
advance.set("orderNum", ""); |
|
|
|
|
advance.set("waybill_no", ""); |
|
|
|
|
advance.set("waybill_status", 1); |
|
|
|
|
advance.set("freeze", 1); |
|
|
|
|
advance.set("cars_num", ""); |
|
|
|
|
advance.set("administrators_id", 1126); |
|
|
|
|
advance.set("carrierName", "汇通"); |
|
|
|
|
advance.set("systemType", "线上"); |
|
|
|
|
advance.set("is_opai", 0); |
|
|
|
|
advance.set("serviceNum", vo.getCustomizedBillCode()); |
|
|
|
|
advance.set("customerName", vo.getReceiverName()); |
|
|
|
|
advance.set("customerPhone", vo.getReceiverTelephone()); |
|
|
|
|
advance.set("customerRoad", vo.getReceiverDetailAddress()); |
|
|
|
|
advance.set("senderName", vo.getSenderName()); |
|
|
|
|
advance.set("senderMobile", vo.getSenderTelephone()); |
|
|
|
|
advance.set("senderAddress", vo.getSenderDetailAddress()); |
|
|
|
|
|
|
|
|
|
List<JSONObject> packageList = new ArrayList<>(); |
|
|
|
|
for (PackageInfoVO orderPackageDTO : packages) { |
|
|
|
|
advance.set("firstPackName", orderPackageDTO.getMaterialName()); |
|
|
|
|
advance.set("firstPackCode", orderPackageDTO.getMaterialCode()); |
|
|
|
|
// 封装包件
|
|
|
|
|
JSONObject advanceDetailEntity = new JSONObject(); |
|
|
|
|
advanceDetailEntity.set("orderSelfNum", vo.getBillCode()); |
|
|
|
|
advanceDetailEntity.set("serviceNum", vo.getCustomizedBillCode()); |
|
|
|
|
advanceDetailEntity.set("type", BrandEnums.LINSY.getValue()); |
|
|
|
|
advanceDetailEntity.set("systemType", "线上"); |
|
|
|
|
advanceDetailEntity.set("firstPackName", orderPackageDTO.getMaterialName()); |
|
|
|
|
// 二级品类名称
|
|
|
|
|
advanceDetailEntity.set("secondPackName", orderPackageDTO.getMaterialName()); |
|
|
|
|
// 三级品类名称
|
|
|
|
|
advanceDetailEntity.set("thirdPackName", orderPackageDTO.getMaterialName()); |
|
|
|
|
advanceDetailEntity.set("firstPackCode", orderPackageDTO.getMaterialCode()); |
|
|
|
|
advanceDetailEntity.set("secondPackCode", orderPackageDTO.getMaterialCode()); |
|
|
|
|
advanceDetailEntity.set("thirdPackCode", orderPackageDTO.getMaterialCode()); |
|
|
|
|
advanceDetailEntity.set("siteName", vo.getSupplierName()); |
|
|
|
|
advanceDetailEntity.set("unitNo", orderPackageDTO.getBarcode()); |
|
|
|
|
advanceDetailEntity.set("mctsTruck", StrUtil.replace(DateUtil.today(), "-", "")); |
|
|
|
|
advanceDetailEntity.set("volume", StrUtil.isNotBlank(orderPackageDTO.getVolume()) ? new BigDecimal(orderPackageDTO.getVolume()) : BigDecimal.ZERO); |
|
|
|
|
advanceDetailEntity.set("is_pay", 0); |
|
|
|
|
advanceDetailEntity.set("mtdsNum", 0); |
|
|
|
|
advanceDetailEntity.set("lineID", ""); |
|
|
|
|
advanceDetailEntity.set("mctsTruckNo", ""); |
|
|
|
|
advanceDetailEntity.set("serialKey", ""); |
|
|
|
|
advanceDetailEntity.set("mscsNum", "1"); |
|
|
|
|
advanceDetailEntity.set("isAddin", "N"); |
|
|
|
|
advanceDetailEntity.set("isThirdAddin", "N"); |
|
|
|
|
advanceDetailEntity.set("isSuppin", "N"); |
|
|
|
|
advanceDetailEntity.set("productCode", ""); |
|
|
|
|
advanceDetailEntity.set("goodName", ""); |
|
|
|
|
advanceDetailEntity.set("admin", ""); |
|
|
|
|
advanceDetailEntity.set("siteCode", ""); |
|
|
|
|
advanceDetailEntity.set("area", ""); |
|
|
|
|
advanceDetailEntity.set("date2", ""); |
|
|
|
|
advanceDetailEntity.set("date3", ""); |
|
|
|
|
advanceDetailEntity.set("date4", ""); |
|
|
|
|
advanceDetailEntity.set("date5", ""); |
|
|
|
|
advanceDetailEntity.set("date6", ""); |
|
|
|
|
advanceDetailEntity.set("orderNum", ""); |
|
|
|
|
advanceDetailEntity.set("mtdsNo", ""); |
|
|
|
|
advanceDetailEntity.set("old_id", 0); |
|
|
|
|
advanceDetailEntity.set("remark", ""); |
|
|
|
|
advanceDetailEntity.set("dueDate", ""); |
|
|
|
|
advanceDetailEntity.set("is_opai", 0); |
|
|
|
|
advanceDetailEntity.set("administrators_id", 1126); |
|
|
|
|
advanceDetailEntity.set("date100", new Date()); |
|
|
|
|
JSONObject entries = JSONUtil.parseObj(advanceDetailEntity); |
|
|
|
|
packageList.add(entries); |
|
|
|
|
} |
|
|
|
|
advance.set("details", JSONUtil.toJsonStr(packageList)); |
|
|
|
|
if (ObjectUtil.isAllNotEmpty(linsyProperties.getOldSystemHost(), linsyProperties.getOldSystemAdvanceUrl())) { |
|
|
|
|
log.info("推送老系统暂存单:{}", JSONUtil.toJsonStr(advance)); |
|
|
|
|
String post = HttpUtil.post(linsyProperties.getOldSystemHost() + linsyProperties.getOldSystemAdvanceUrl(), JSONUtil.toJsonStr(advance)); |
|
|
|
|
log.info("推送老系统暂存单结果:{}", post); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|